From eb3a6710d55a25c0e92f20f2034680e67abe82a5 Mon Sep 17 00:00:00 2001 From: Seth Mos Date: Mon, 27 Aug 2007 13:14:43 +0000 Subject: IPSEC log highlighting got better --- usr/local/www/diag_logs_ipsec.php | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/usr/local/www/diag_logs_ipsec.php b/usr/local/www/diag_logs_ipsec.php index 6a4a117..9f86b06 100755 --- a/usr/local/www/diag_logs_ipsec.php +++ b/usr/local/www/diag_logs_ipsec.php @@ -34,16 +34,21 @@ require("guiconfig.inc"); $ipsec_logfile = "{$g['varlog_path']}/ipsec.log"; -$ipsec_logarr = return_clog($ipsec_logfile, $nentries); /* Create array with all IPSEC tunnel descriptions */ $search = array(); $replace = array(); foreach($config['ipsec']['tunnel'] as $tunnel) { $gateway = "{$tunnel['remote-gateway']}"; - $search[] = "/(racoon: )([A-Z:].*?)({$gateway}\[[0-9].+\]|{$gateway})/i"; + $search[] = "/(racoon: )([A-Z:].*?)({$gateway}\[[0-9].+\]|{$gateway})(.*)/i"; $replace[] = "$1[{$tunnel['descr']}]: $2$3$4"; } +/* collect all our own ip addresses */ +exec("/sbin/ifconfig|/usr/bin/awk '/inet / {print $2}'", $ip_address_list); +foreach($ip_address_list as $address) { + $search[] = "/(racoon: )([A-Z:].*?)({$address}\[[0-9].+\])(.*isakmp.*)/i"; + $replace[] = "$1[Self]: $2$3$4"; +} $nentries = $config['syslog']['nentries']; if (!$nentries) @@ -55,6 +60,8 @@ if ($_POST['clear']) { system_syslogd_start(); } +$ipsec_logarr = return_clog($ipsec_logfile, $nentries); + $pgtitle = "Diagnostics: System logs: IPSEC VPN"; include("head.inc"); @@ -90,7 +97,17 @@ include("head.inc"); [Unknown Gateway/Dynamic]: $2$3$4"; + $logent = preg_replace($searchs, $replaces, $logent); + } $logent = preg_split("/\s+/", $logent, 6); echo "\n"; $entry_date_time = htmlspecialchars(join(" ", array_slice($logent, 0, 3))); -- cgit v1.1