X-Git-Url: http://git.ipfire.org/?a=blobdiff_plain;f=html%2Fcgi-bin%2Fservices.cgi;h=26ab4f3143fff36434287ec085aaa47993726ff1;hb=d346d474677b9507fce16ee2d2774435658d6ba1;hp=fbff41fb9d0cc22b324ad702af371b2bcac92222;hpb=057652c5e548c5e0b0e4e07559c21b7916335af9;p=people%2Fpmueller%2Fipfire-2.x.git diff --git a/html/cgi-bin/services.cgi b/html/cgi-bin/services.cgi index fbff41fb9d..26ab4f3143 100644 --- a/html/cgi-bin/services.cgi +++ b/html/cgi-bin/services.cgi @@ -49,13 +49,14 @@ my %servicenames =( $Lang::tr{'dhcp server'} => 'dhcpd', $Lang::tr{'web server'} => 'httpd', $Lang::tr{'cron server'} => 'fcron', - $Lang::tr{'dns proxy server'} => 'dnsmasq', + $Lang::tr{'dns proxy server'} => 'unbound', $Lang::tr{'logging server'} => 'syslogd', $Lang::tr{'kernel logging server'} => 'klogd', $Lang::tr{'ntp server'} => 'ntpd', $Lang::tr{'secure shell server'} => 'sshd', $Lang::tr{'vpn'} => 'charon', $Lang::tr{'web proxy'} => 'squid', + $Lang::tr{'intrusion detection system'} => 'suricata', 'OpenVPN' => 'openvpn' ); @@ -71,30 +72,15 @@ my %link =( $Lang::tr{'vpn'} => "$Lang::tr{'vpn'}", $Lang::tr{'web proxy'} => "$Lang::tr{'web proxy'}", 'OpenVPN' => "OpenVPN", - "$Lang::tr{'intrusion detection system'} (GREEN)" => "$Lang::tr{'intrusion detection system'} (GREEN)", - "$Lang::tr{'intrusion detection system'} (RED)" => "$Lang::tr{'intrusion detection system'} (RED)", - "$Lang::tr{'intrusion detection system'} (ORANGE)" => "$Lang::tr{'intrusion detection system'} (ORANGE)", - "$Lang::tr{'intrusion detection system'} (BLUE)" => "$Lang::tr{'intrusion detection system'} (BLUE)" + "$Lang::tr{'intrusion detection system'}" => "$Lang::tr{'intrusion detection system'}", ); -my $lines=0; # Used to count the outputlines to make different bgcolor - -my $iface = ''; -if (open(FILE, "${General::swroot}/red/iface")){ - $iface = ; - close FILE; - chomp $iface; -} - -$servicenames{"$Lang::tr{'intrusion detection system'} (RED)"} = "snort_${iface}"; -$servicenames{"$Lang::tr{'intrusion detection system'} (GREEN)"} = "snort_$netsettings{'GREEN_DEV'}"; +# Hash to overwrite the process name of a process if it differs fromt the launch command. +my %overwrite_exename_hash = ( + "suricata" => "Suricata-Main" +); -if ($netsettings{'ORANGE_DEV'} ne ''){ - $servicenames{"$Lang::tr{'intrusion detection system'} (ORANGE)"} = "snort_$netsettings{'ORANGE_DEV'}"; -} -if ($netsettings{'BLUE_DEV'} ne ''){ - $servicenames{"$Lang::tr{'intrusion detection system'} (BLUE)"} = "snort_$netsettings{'BLUE_DEV'}"; -} +my $lines=0; # Used to count the outputlines to make different bgcolor my @querry = split(/\?/,$ENV{'QUERY_STRING'}); $querry[0] = '' unless defined $querry[0]; @@ -188,6 +174,9 @@ END # mdadm should not stopped with webif because this could crash the system # chomp($_); + if ( $_ eq 'squid' ) { + next; + } if ( ($_ ne "alsa") && ($_ ne "mdadm") ) { $lines++; if ($lines % 2){ @@ -200,8 +189,8 @@ END print "$_ "; my $status = isautorun($_,$col); print "$status "; - print "$Lang::tr{"; - print "$Lang::tr{ "; + print "$Lang::tr{"; + print "$Lang::tr{ "; my $status = &isrunningaddon($_,$col); $status =~ s/\\[[0-1]\;[0-9]+m//g; @@ -234,12 +223,12 @@ sub isautorun{ my $init = `find /etc/rc.d/rc3.d/S??${cmd} 2>/dev/null`; chomp ($init); if ($init ne ''){ - $status = "$Lang::tr{"; + $status = "$Lang::tr{"; } $init = `find /etc/rc.d/rc3.d/off/S??${cmd} 2>/dev/null`; chomp ($init); if ($init ne ''){ - $status = "$Lang::tr{"; + $status = "$Lang::tr{"; } return $status; @@ -255,7 +244,20 @@ sub isrunning{ my $memory; $cmd =~ /(^[a-z]+)/; - $exename = $1; + + # Check if the exename needs to be overwritten. + # This happens if the expected process name string + # differs from the real one. This may happened if + # a service uses multiple processes or threads. + if (exists($overwrite_exename_hash{$1})) { + # Grab the string which will be reported by + # the process from the corresponding hash. + $exename = $overwrite_exename_hash{$1}; + } else { + # Directly expect the launched command as + # process name. + $exename = $1; + } if (open(FILE, "/var/run/${cmd}.pid")){ $pid = ; chomp $pid;