Commit 5a59b8ea authored by Tapio Lehtonen's avatar Tapio Lehtonen
Browse files

Update htf-common-issues.php to detect OS version and subversion

parent 3fc7e1c9
Loading
Loading
Loading
Loading
+31 −0
Original line number Diff line number Diff line
@@ -127,6 +127,9 @@ function checkservice($port) {
	return $services;
}


/* MAIN PROGRAM STARTS */

$has_ispconfig = false;


@@ -163,6 +166,34 @@ if($ip_address && count($ips) > 0 && in_array($ip_address, $ips, true) == false)
	outlog("[WARN] ip addresses from hostname differ from ifconfig output. Please check your ip settings.");
}

//Check OS version
$lsbrel='/usr/bin/lsb_release';
$rhatrel = '/etc/redhat-release';
$osrelease='/etc/os-release';
$suserel = '/etc/SuSE-release';
$gentoorel = '/etc/gentoo-release';

if (file_exists($lsbrel)) {
    $os_version = shell_exec($lsbrel.' -d');
} elseif (file_exists($rhatrel)) {
    $os_version = shell_exec('cat '.$redhatrel);
} elseif (file_exists($suserel)) {
    $os_version = shell_exec('cat '.$suserel);
} elseif (file_exists($gentoorel)) {
    $os_version = shell_exec('cat '.$gentoorel);
} elseif (file_exists($osrelease)) {
    $os_version = shell_exec('cat '.$osrelease.' | grep "PRETTY_NAME"');
} else {
    $lslisting = shell_exec('ls -lhd /etc/*versio* /etc/*releas* /etc/*issue*');
}

if ($os_version == '') {
  echo "ls listing to help show OS:\n".$lslisting;
} else {
  echo "OS version is ".$os_version;
}

outlog("[INFO] OS version is $os_version ");

// check for ISPConfig
if(@is_dir("/usr/local/ispconfig")) $has_ispconfig = true;