Project

General

Profile

Download (3.93 KB) Statistics
| Branch: | Tag: | Revision:
1 5b237745 Scott Ullrich
#!/usr/local/bin/php
2 4d875b4f Scott Ullrich
<?php
3 b46bfcf5 Bill Marquette
/* $Id$ */
4 5b237745 Scott Ullrich
/*
5
	diag_logs_vpn.php
6 4d875b4f Scott Ullrich
	Copyright (C) 2004 Scott Ullrich
7
	All rights reserved.
8
9
	originially part of m0n0wall (http://m0n0.ch/wall)
10 5b237745 Scott Ullrich
	Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
11
	All rights reserved.
12 4d875b4f Scott Ullrich
13 5b237745 Scott Ullrich
	Redistribution and use in source and binary forms, with or without
14
	modification, are permitted provided that the following conditions are met:
15 4d875b4f Scott Ullrich
16 5b237745 Scott Ullrich
	1. Redistributions of source code must retain the above copyright notice,
17
	   this list of conditions and the following disclaimer.
18 4d875b4f Scott Ullrich
19 5b237745 Scott Ullrich
	2. Redistributions in binary form must reproduce the above copyright
20
	   notice, this list of conditions and the following disclaimer in the
21
	   documentation and/or other materials provided with the distribution.
22 4d875b4f Scott Ullrich
23 5b237745 Scott Ullrich
	THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
24
	INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
25
	AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
26
	AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
27
	OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28
	SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29
	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
30
	CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31
	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32
	POSSIBILITY OF SUCH DAMAGE.
33
*/
34
35
require("guiconfig.inc");
36
37 7a893851 Scott Ullrich
$pptp_logfile = "{$g['varlog_path']}/ipsec.log";
38 963d5343 Bill Marquette
39 5b237745 Scott Ullrich
$nentries = $config['syslog']['nentries'];
40
if (!$nentries)
41
	$nentries = 50;
42
43
if ($_POST['clear']) {
44 7a893851 Scott Ullrich
	exec("/usr/sbin/clog -i -s 262144 {$ipsec_logfile}");
45 5b237745 Scott Ullrich
}
46
47 e584d229 Colin Smith
function dump_clog_vpn($logfile, $tail) {
48 63637de9 Bill Marquette
	global $config;
49 5b237745 Scott Ullrich
50
	$sor = isset($config['syslog']['reverse']) ? "-r" : "";
51
52 963d5343 Bill Marquette
	exec("/usr/sbin/clog {$logfile} | tail {$sor} -n {$tail}", $logarr);
53 4d875b4f Scott Ullrich
54 5b237745 Scott Ullrich
	foreach ($logarr as $logent) {
55
		$logent = preg_split("/\s+/", $logent, 6);
56
		$llent = explode(",", $logent[5]);
57 4d875b4f Scott Ullrich
58 5b237745 Scott Ullrich
		echo "<tr>\n";
59
		echo "<td class=\"listlr\" nowrap>" . htmlspecialchars(join(" ", array_slice($logent, 0, 3))) . "</td>\n";
60 4d875b4f Scott Ullrich
61 5b237745 Scott Ullrich
		if ($llent[0] == "login")
62
			echo "<td class=\"listr\"><img src=\"in.gif\" width=\"11\" height=\"11\" title=\"login\"></td>\n";
63
		else
64
			echo "<td class=\"listr\"><img src=\"out.gif\" width=\"11\" height=\"11\" title=\"logout\"></td>\n";
65 4d875b4f Scott Ullrich
66 5b237745 Scott Ullrich
		echo "<td class=\"listr\">" . htmlspecialchars($llent[3]) . "</td>\n";
67
		echo "<td class=\"listr\">" . htmlspecialchars($llent[2]) . "&nbsp;</td>\n";
68
		echo "</tr>\n";
69
	}
70
}
71
72 b63695db Scott Ullrich
$pgtitle = "Diagnostics: System logs: PPTP VPN";
73
include("head.inc");
74
75 5b237745 Scott Ullrich
?>
76
77
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
78
<?php include("fbegin.inc"); ?>
79 310b2c06 Bill Marquette
<p class="pgtitle"><?=$pgtitle?></p>
80 5b237745 Scott Ullrich
<table width="100%" border="0" cellpadding="0" cellspacing="0">
81
  <tr><td>
82 b63695db Scott Ullrich
<?php
83
	$tab_array = array();
84 8ed15ffb Scott Ullrich
	$tab_array[0] = array("System", false, "diag_logs.php");
85
	$tab_array[1] = array("Firewall", false, "diag_logs_filter.php");
86
	$tab_array[2] = array("DHCP", false, "diag_logs_dhcp.php");
87
	$tab_array[3] = array("Portal Auth", false, "diag_logs_auth.php");
88
	$tab_array[4] = array("IPSEC VPN", false, "diag_logs_ipsec.php");
89
	$tab_array[5] = array("PPTP VPN", true, "diag_logs_vpn.php");
90
	$tab_array[6] = array("Settings", false, "diag_logs_settings.php");
91 b63695db Scott Ullrich
	display_top_tabs($tab_array);
92
?>
93 5b237745 Scott Ullrich
  </td></tr>
94
  <tr>
95 0f10aee4 Bill Marquette
    <td>
96
	<div id="mainarea">
97
		<table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0"><tr>
98 4d875b4f Scott Ullrich
		  <td colspan="4" class="listtopic">
99 963d5343 Bill Marquette
			    Last <?=$nentries;?> PPTP log entries</td>
100 5b237745 Scott Ullrich
			</tr>
101
			<tr>
102
			  <td class="listhdrr">Time</td>
103
			  <td class="listhdrr">Action</td>
104
			  <td class="listhdrr">User</td>
105
			  <td class="listhdrr">IP address</td>
106
			</tr>
107 0f10aee4 Bill Marquette
		<tr><td><?php dump_clog_vpn($pptp_logfile, $nentries); ?>
108 5b237745 Scott Ullrich
		<br><form action="diag_logs_vpn.php" method="post">
109
<input name="clear" type="submit" class="formbtn" value="Clear log">
110 0f10aee4 Bill Marquette
</form></td></tr>
111
          </table>
112
	</div>
113 5b237745 Scott Ullrich
	</td>
114
  </tr>
115
</table>
116
<?php include("fend.inc"); ?>
117
</body>
118
</html>