I set up a FreeRADIUS server with a SQL backend running on a remote MariaDB instance. Authentication and traffic encryption should be handled by Kerberos using k5start
to maintain the tickets. The system runs on a Debian 11 instance.
I created an override for /etc/systemd/system/freeradius.service
:
[Service]
Environment="KRB5CCNAME=/run/freeradius/sql.tkt"
ExecStartPre=/usr/bin/k5start -u radius_user -f /etc/freeradius/3.0/freeradius.keytab -o freerad -g freerad -m 600 -H 60 -b -K 30 -L -k /run/freeradius/sql.tkt
This basically works. However, since this is a background service it may well happen that k5start
on one evil day crashes and then after the ticket expired RADIUS will be down.
Another issue of lesser concern is that k5start
in this case is run as the RADIUS user i.e., the keytab must be readable by the RADIUS user. I like it better to have it as root:root 0600
.
Of course I could run k5start
as a service of its own, which has the minor beauty issue that /run/freeradius
does not necessarily exist, when k5start
is launched i.e., I have to use yet another directory for the tickets and given PrivateTmp=true
its probably not in /tmp
.
So, for my ideal solution the freeradius.service
would create the /run/freeradius
directory, then launch something like a ticket.service
and then resume to start RADIUS. Looks similar to BindsTo=
, but still somehow different.
Is there a nicer solution to have systemd
monitor k5start
and restart it in case it is gone?