Add support for systemd service and watchdogs Fixes #2499.

Stefano Mason Stefano.Mason at eng.it
Wed Feb 27 10:43:14 CET 2019


Dear all,
   "systemctl start radiusd.service" it doesn't exit but remain in a
stuck state, it's necessary to do a CTRL-C, after that I check the
status e the process list: all it's okay.

- systemctl start radiusd.service (stuck in)
- systemctl status radiusd.service (okay)
- systemctl stop radiusd.service (okay) 

Environment Centos 7

# cat /etc/redhat-release
CentOS Linux release 7.6.1810 (Core)

cd freeradius-server
git pull
git checkout v3.0.x
git archive --format=tar --prefix=freeradius-server-3.0.19/ v3.0.x |
bzip2 -c >../freeradius-server-3.0.19.tar.bz2

build from freeradius.spec

results:

x86_64]# ls -1
freeradius-3.0.19-2.el7.centos.x86_64.rpm
freeradius-config-3.0.19-2.el7.centos.x86_64.rpm
freeradius-debuginfo-3.0.19-2.el7.centos.x86_64.rpm
freeradius-freetds-3.0.19-2.el7.centos.x86_64.rpm
freeradius-krb5-3.0.19-2.el7.centos.x86_64.rpm
freeradius-ldap-3.0.19-2.el7.centos.x86_64.rpm
freeradius-mysql-3.0.19-2.el7.centos.x86_64.rpm
freeradius-perl-3.0.19-2.el7.centos.x86_64.rpm
freeradius-postgresql-3.0.19-2.el7.centos.x86_64.rpm
freeradius-python-3.0.19-2.el7.centos.x86_64.rpm
freeradius-redis-3.0.19-2.el7.centos.x86_64.rpm
freeradius-rest-3.0.19-2.el7.centos.x86_64.rpm
freeradius-sqlite-3.0.19-2.el7.centos.x86_64.rpm
freeradius-unixODBC-3.0.19-2.el7.centos.x86_64.rpm
freeradius-utils-3.0.19-2.el7.centos.x86_64.rpm


Upgrade:

# yum localinstall freeradius-3.0.18-2.el7.centos.x86_64.rpm
freeradius-config-3.0.18-2.el7.centos.x86_64.rpm
freeradius-ldap-3.0.18-2.el7.centos.x86_64.rpm
freeradius-utils-3.0.18-2.el7.centos.x86_64.rpm

# systemctl daemon-reload

systemd read the new instructions from

# cat /usr/lib/systemd/system/radiusd.service
[Unit]
Description=FreeRADIUS multi-protocol policy server
After=network-online.target
Documentation=man:radiusd(8) man:radiusd.conf(5)
http://wiki.freeradius.org/ http://networkradius.com/doc/

[Service]
Type=notify
WatchdogSec=60
NotifyAccess=all
PIDFile=/var/run/radiusd/radiusd.pid
EnvironmentFile=-/etc/sysconfig/radiusd

# FreeRADIUS can do static evaluation of policy language rules based
# on environmental variables which is very useful for doing per-host
# customization.
# Unfortunately systemd does not allow variable substitutions such
# as %H or $(hostname) in the EnvironmentFile.
# We provide HOSTNAME here for convenience.
Environment=HOSTNAME=%H

# Limit memory to 2G this is fine for %99.99 of deployments.  FreeRADIUS
# is not memory hungry, if it's using more than this, then there's probably
# a leak somewhere.
MemoryLimit=2G

RuntimeDirectory=radiusd
RuntimeDirectoryMode=0775
ExecStartPre=/usr/sbin/radiusd $FREERADIUS_OPTIONS -Cx -lstdout
ExecStartPre=/usr/bin/chown radiusd:radiusd /var/run/radiusd
ExecStart=/usr/sbin/radiusd $FREERADIUS_OPTIONS
Restart=on-failure
RestartSec=5

[Install]
WantedBy=multi-user.target


STATUS works:

# systemctl status radiusd.service
● radiusd.service - FreeRADIUS multi-protocol policy server
   Loaded: loaded (/usr/lib/systemd/system/radiusd.service; enabled;
vendor preset: disabled)
   Active: activating (start) since Wed 2019-02-27 10:33:43 CET; 1min
13s ago
     Docs: man:radiusd(8)
           man:radiusd.conf(5)
           http://wiki.freeradius.org/
           http://networkradius.com/doc/
  Process: 31202 ExecStartPre=/usr/bin/chown radiusd:radiusd
/var/run/radiusd (code=exited, status=0/SUCCESS)
  Process: 31199 ExecStartPre=/usr/sbin/radiusd $FREERADIUS_OPTIONS -Cx
-lstdout (code=exited, status=0/SUCCESS)
 Main PID: 31208 (radiusd)
   Memory: 21.8M (limit: 2.0G)
   CGroup: /system.slice/radiusd.service
           └─31208 /usr/sbin/radiusd

STOP works:

# systemctl stop radiusd.service
#

START stuck in:

# systemctl start radiusd.service
^C
#

LOG from journalctl:

Feb 27 10:37:04 betty systemd[1]: Starting FreeRADIUS multi-protocol
policy server...
Feb 27 10:37:04 betty radiusd[31406]: FreeRADIUS Version 3.0.19
Feb 27 10:37:04 betty radiusd[31406]: Copyright (C) 1999-2019 The
FreeRADIUS server project and contributors
Feb 27 10:37:04 betty radiusd[31406]: There is NO warranty; not even for
MERCHANTABILITY or FITNESS FOR A
Feb 27 10:37:04 betty radiusd[31406]: PARTICULAR PURPOSE
Feb 27 10:37:04 betty radiusd[31406]: You may redistribute copies of
FreeRADIUS under the terms of the
Feb 27 10:37:04 betty radiusd[31406]: GNU General Public License
Feb 27 10:37:04 betty radiusd[31406]: For more information about these
matters, see the file named COPYRIGHT
Feb 27 10:37:04 betty radiusd[31406]: Starting - reading configuration
files ...
Feb 27 10:37:04 betty radiusd[31406]: Debugger not attached



Best regards.
Stefano




More information about the Freeradius-Users mailing list