Revision eb3a6710
Added by Seth Mos almost 18 years ago
usr/local/www/diag_logs_ipsec.php | ||
---|---|---|
34 | 34 |
require("guiconfig.inc"); |
35 | 35 |
|
36 | 36 |
$ipsec_logfile = "{$g['varlog_path']}/ipsec.log"; |
37 |
$ipsec_logarr = return_clog($ipsec_logfile, $nentries); |
|
38 | 37 |
|
39 | 38 |
/* Create array with all IPSEC tunnel descriptions */ |
40 | 39 |
$search = array(); |
41 | 40 |
$replace = array(); |
42 | 41 |
foreach($config['ipsec']['tunnel'] as $tunnel) { |
43 | 42 |
$gateway = "{$tunnel['remote-gateway']}"; |
44 |
$search[] = "/(racoon: )([A-Z:].*?)({$gateway}\[[0-9].+\]|{$gateway})/i"; |
|
43 |
$search[] = "/(racoon: )([A-Z:].*?)({$gateway}\[[0-9].+\]|{$gateway})(.*)/i";
|
|
45 | 44 |
$replace[] = "$1<strong>[{$tunnel['descr']}]</strong>: $2$3$4"; |
46 | 45 |
} |
46 |
/* collect all our own ip addresses */ |
|
47 |
exec("/sbin/ifconfig|/usr/bin/awk '/inet / {print $2}'", $ip_address_list); |
|
48 |
foreach($ip_address_list as $address) { |
|
49 |
$search[] = "/(racoon: )([A-Z:].*?)({$address}\[[0-9].+\])(.*isakmp.*)/i"; |
|
50 |
$replace[] = "$1<strong>[Self]</strong>: $2$3$4"; |
|
51 |
} |
|
47 | 52 |
|
48 | 53 |
$nentries = $config['syslog']['nentries']; |
49 | 54 |
if (!$nentries) |
... | ... | |
55 | 60 |
system_syslogd_start(); |
56 | 61 |
} |
57 | 62 |
|
63 |
$ipsec_logarr = return_clog($ipsec_logfile, $nentries); |
|
64 |
|
|
58 | 65 |
$pgtitle = "Diagnostics: System logs: IPSEC VPN"; |
59 | 66 |
include("head.inc"); |
60 | 67 |
|
... | ... | |
90 | 97 |
</tr> |
91 | 98 |
<?php |
92 | 99 |
foreach($ipsec_logarr as $logent){ |
93 |
$logent = preg_replace($search, $replace, $logent); |
|
100 |
foreach($search as $string) { |
|
101 |
if(preg_match($string, $logent)) |
|
102 |
$match = true; |
|
103 |
} |
|
104 |
if(isset($match)) { |
|
105 |
$logent = preg_replace($search, $replace, $logent); |
|
106 |
} else { |
|
107 |
$searchs = "/(racoon: )([A-Z:].*?)([0-9].+\.[0-9].+.[0-9].+.[0-9].+\[[0-9].+\])(.*)/i"; |
|
108 |
$replaces = "$1<strong><font color=red>[Unknown Gateway/Dynamic]</font></strong>: $2$3$4"; |
|
109 |
$logent = preg_replace($searchs, $replaces, $logent); |
|
110 |
} |
|
94 | 111 |
$logent = preg_split("/\s+/", $logent, 6); |
95 | 112 |
echo "<tr valign=\"top\">\n"; |
96 | 113 |
$entry_date_time = htmlspecialchars(join(" ", array_slice($logent, 0, 3))); |
Also available in: Unified diff
IPSEC log highlighting got better