PDA

View Full Version : How to monitor csf/lfd service if is running & restart if down



Fli
01-16-2016, 02:32 PM
lfd is the config server firewall (csf) daemon. In my case it happened that lfd crashed because of no memory and it was not restarted:

tail /var/log/lfd.log

*Error* cannot fork: Cannot allocate memory, at line 3318
daemon stopped

In case of a cPanel/WHM server, tell the server to check the lfd service and restart it if needed:
WHM » Service Configuration »Service Manager and check if you can enable "lfd" here. If its not here, one can do following commands via Linux command line:


echo "service[lfd]=x,x,x,/etc/init.d/lfd restart,lfd,root" > /etc/chkserv.d/lfd
echo "lfd:1" >> /etc/chkserv.d/chkservd.conf

First command will add lfd service to the list of services that should be checked/monitored by WHM
Second command will enable monitoring of the lfd service

-----

custom non-cpanel way of checking & restarting

I think this may work to check if lfd process is running and if not, it will restart csf+lfd:

run:

crontab -e

paste on new line:

* * * * * if [ "$(ps ax|grep lfd|grep -v grep|wc -l)" == "0" ];then csf -ra;fi 1>/dev/null

save

coop31
04-13-2016, 06:47 PM
Login Failure Daemon (lfd) is a process that runs all the time and periodically (every X seconds) scans the latest log file entries for login attempts against your server that continually fail within a short period of time. Such attempts are often called "Brute-force attacks" and the daemon process responds very quickly to such patterns and blocks offending IP's quickly. To check why lfd has failed look at the end of /var/log/lfd.log Support for csf+lfd is over here - http://forum.configserver.com

kumkum
06-24-2022, 03:19 PM
You have to monitor csf firewall with various linux commands.
For that it is must to have root access of server. You can check all the csf commands here (https://hoststud.com/resources/useful-csf-commands-for-linux-servers.99/).