Error pid mismatch or missing, causing lfd to stop

Post Reply
d-u-a-l
Junior Member
Posts: 1
Joined: 07 Mar 2021, 15:47

Error pid mismatch or missing, causing lfd to stop

Post by d-u-a-l »

Hi there. Lately I was getting a lot of errors like

Code: Select all

*Error* pid mismatch or missing, at line 1160
daemon stopped
This error is caused by trying to block some IP address, which triggered csf of lfd rule few times in a row. After that csf is disabled, but it was reenabled by cron job, which monitors services state

This is from lfd.pl (including line 1160, where an error is triggered)

Code: Select all

while (1)  {
	$0 = "lfd - processing";
	$maintimer = time;

	seek ($PIDFILE, 0, 0);
	my @piddata = <$PIDFILE>;
	chomp @piddata;
	if (($pid ne $piddata[0]) or ($pidino ne (stat($pidfile))[1])) {
		&cleanup(__LINE__,"*Error* pid mismatch or missing");
	}


After rebooting container, I can't enable csf at all, I get the same error, here's lfd.log

Code: Select all

csf startup completed
LOAD Tracking...
Country Code Lookups...
System Integrity Tracking...
Exploit Tracking...
Directory Watching...
Temp to Perm Block Tracking...
Process Tracking...
Account Tracking...
SSH Tracking...
Webmin Tracking...
SU Tracking...
Console Tracking...
*Error* pid mismatch or missing, at line 1160
daemon stopped
daemon started on srv - csf v14.09 (CentOS Web Panel)
LF_APACHE_ERRPORT: Set to [2]
CSF Tracking...
iptables appears to have been flushed - running *csf startup*...
Main Process: open3: exec of /usr/sbin/csf -sf failed at /usr/sbin/lfd line 8197.
faulty line 8197

Code: Select all

my $cmdpid = open3($childin, $childout, $childout, @cmd);
in /usr/sbin/lfd

Code: Select all

sub syscommand {
	my ($line, @cmd) = @_;
	my $cmdline = join(" ",@cmd);
	my $status = 0;
	my @output;

	if (-e "/etc/csf/csf.error") {
		&cleanup(__LINE__,"*Error* csf reported an error (see /etc/csf/csf.error). *lfd stopped*");
		exit 1;
	}

	if ($config{VPS}) {$status = &checkvps}
	if ($status) {
		logfile($status);
	} else {
		if ($config{DEBUG} >= 2) {logfile("debug[$line]: Command:$cmdline")}
		if (&csflock) {
			logfile("csf is currently restarting - command [$cmdline] skipped on line $line");
			unless ($masterpid == $$) {exit}
		}
		my ($childin, $childout);
		my $cmdpid = open3($childin, $childout, $childout, @cmd);
		@output = <$childout>;
		waitpid ($cmdpid, 0);
		if ($output[0] =~ /# Warning: iptables-legacy tables present/) {shift @output}
		if ($output[0] =~ /^deny failed\:/) {logfile("*Error*: csf output: $output[0]")}
		if ($output[0] =~ /^Error\:/) {logfile("*Error*: csf output: $output[0]")}
	}
	return @output;
}
It all started after csf automatically updated to v14.09 from v14.08 (I've got email, notifying about files have been changed /usr/sbin/csf and /sbin/csf)

Can someone help?
Post Reply