Projet

Général

Profil

« Précédent | Suivant » 

Révision 537940c8

Ajouté par Ermal il y a plus de 9 ans

Remove all remnants of racoon from log page

Voir les différences:

usr/local/www/diag_logs_ipsec.php
48 48

  
49 49
$ipsec_logfile = "{$g['varlog_path']}/ipsec.log";
50 50

  
51
/* Create array with all IPsec tunnel descriptions */
52
$search = array();
53
$replace = array();
54
if(is_array($config['ipsec']['phase1']))
55
	foreach($config['ipsec']['phase1'] as $ph1ent) {
56
		$gateway = ipsec_get_phase1_dst($ph1ent);
57
		if(!is_ipaddr($gateway))
58
			continue;
59
		$search[] = "/(racoon: )(INFO[:].*?)({$gateway}\[[0-9].+\]|{$gateway})(.*)/i";
60
		$search[] = "/(racoon: )(\[{$gateway}\]|{$gateway})(.*)/i";
61
		$replace[] = "$1<strong>[{$ph1ent['descr']}]</strong>: $2$3$4";
62
		$replace[] = "$1<strong>[{$ph1ent['descr']}]</strong>: $2$3$4";
63
	}
64
/* collect all our own ip addresses */
65
exec("/sbin/ifconfig | /usr/bin/awk '/inet/ {print $2}'", $ip_address_list);
66
foreach($ip_address_list as $address) {
67
	$search[] = "/(racoon: )(INFO[:].*?)({$address}\[[0-9].+\])/i";
68
	$search[] = "/(racoon: )(\[{$address}\]|{$address})(.*)/i";
69
	$replace[] = "$1<strong>[Self]</strong>: $2$3$4";
70
	$replace[] = "$1<strong>[Self]</strong>: $2$3$4";
71
}
72

  
73
$search[] = "/(time up waiting for phase1)/i";
74
$search[] = "/(failed to pre-process ph1 packet)/i";
75
$search[] = "/(failed to pre-process ph2 packet)/i";
76
$search[] = "/(no proposal chosen)/i";
77
$replace[] = "$1 <strong>[Remote Side not responding]</strong>";
78
$replace[] = "$1 <strong>[Check Phase 1 settings, lifetime, algorithm]</strong>";
79
$replace[] = "$1 <strong>[Check Phase 2 settings, networks]</strong>";
80
$replace[] = "$1 <strong>[Check Phase 2 settings, algorithm]</strong>";
81

  
82 51
$nentries = $config['syslog']['nentries'];
83 52
if (!$nentries)
84 53
	$nentries = 50;
......
125 94
				<?php
126 95
				foreach($ipsec_logarr as $logent){
127 96
					$logent = htmlspecialchars($logent);
128
					foreach($search as $string) {
129
						if(preg_match($string, $logent))
130
							$match = true;
131
					}
132
					if(isset($match)) {
133
						$logent = preg_replace($search, $replace, $logent);
134
					} else {
135
						$searchs = "/(racoon: )([A-Z:].*?)([0-9].+\.[0-9].+.[0-9].+.[0-9].+\[[0-9].+\])(.*)/i";
136
						$replaces = "$1<strong><font color=\"red\">[".gettext("Unknown Gateway/Dynamic")."]</font></strong>: $2$3$4";
137
						$logent = preg_replace($searchs, $replaces, $logent);
138
					}
139 97
					$logent = preg_split("/\s+/", $logent, 6);
140 98
					echo "<tr valign=\"top\">\n";
141 99
					$entry_date_time = htmlspecialchars(join(" ", array_slice($logent, 0, 3)));

Formats disponibles : Unified diff