1
|
#!/usr/local/bin/php
|
2
|
<?php
|
3
|
/* $Id$ */
|
4
|
/*
|
5
|
diag_logs_vpn.php
|
6
|
Copyright (C) 2004 Scott Ullrich
|
7
|
All rights reserved.
|
8
|
|
9
|
originially part of m0n0wall (http://m0n0.ch/wall)
|
10
|
Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
|
11
|
All rights reserved.
|
12
|
|
13
|
Redistribution and use in source and binary forms, with or without
|
14
|
modification, are permitted provided that the following conditions are met:
|
15
|
|
16
|
1. Redistributions of source code must retain the above copyright notice,
|
17
|
this list of conditions and the following disclaimer.
|
18
|
|
19
|
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
|
|
23
|
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
|
$pptp_logfile = "{$g['varlog_path']}/vpn.log";
|
38
|
|
39
|
$nentries = $config['syslog']['nentries'];
|
40
|
if (!$nentries)
|
41
|
$nentries = 50;
|
42
|
|
43
|
if ($_POST['clear']) {
|
44
|
exec("/usr/sbin/clog -i -s 262144 {$pptp_logfile}");
|
45
|
}
|
46
|
|
47
|
function dump_clog_vpn($logfile, $tail) {
|
48
|
global $g, $config;
|
49
|
|
50
|
$sor = isset($config['syslog']['reverse']) ? "-r" : "";
|
51
|
|
52
|
exec("/usr/sbin/clog {$logfile} | tail {$sor} -n {$tail}", $logarr);
|
53
|
|
54
|
foreach ($logarr as $logent) {
|
55
|
$logent = preg_split("/\s+/", $logent, 6);
|
56
|
$llent = explode(",", $logent[5]);
|
57
|
|
58
|
echo "<tr>\n";
|
59
|
echo "<td class=\"listlr\" nowrap>" . htmlspecialchars(join(" ", array_slice($logent, 0, 3))) . "</td>\n";
|
60
|
|
61
|
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
|
|
66
|
echo "<td class=\"listr\">" . htmlspecialchars($llent[3]) . "</td>\n";
|
67
|
echo "<td class=\"listr\">" . htmlspecialchars($llent[2]) . " </td>\n";
|
68
|
echo "</tr>\n";
|
69
|
}
|
70
|
}
|
71
|
|
72
|
?>
|
73
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
74
|
<html>
|
75
|
<head>
|
76
|
<title><?=gentitle("Diagnostics: System logs: PPTP VPN");?></title>
|
77
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
78
|
<link href="gui.css" rel="stylesheet" type="text/css">
|
79
|
</head>
|
80
|
|
81
|
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
|
82
|
<?php include("fbegin.inc"); ?>
|
83
|
<p class="pgtitle">Diagnostics: System logs: PPTP VPN</p>
|
84
|
<table width="100%" border="0" cellpadding="0" cellspacing="0">
|
85
|
<tr><td>
|
86
|
<ul id="tabnav">
|
87
|
<li class="tabinact"><a href="diag_logs.php">System</a></li>
|
88
|
<li class="tabinact"><a href="diag_logs_filter.php">Firewall</a></li>
|
89
|
<li class="tabinact"><a href="diag_logs_dhcp.php">DHCP</a></li>
|
90
|
<li class="tabinact"><a href="diag_logs_auth.php">Portal Auth</a></li>
|
91
|
<li class="tabinact"><a href="diag_logs_ipsec.php">IPSEC VPN</a></li>
|
92
|
<li class="tabact">PPTP VPN</li>
|
93
|
<li class="tabinact"><a href="diag_logs_settings.php">Settings</a></li>
|
94
|
</ul>
|
95
|
</td></tr>
|
96
|
<tr>
|
97
|
<td class="tabcont">
|
98
|
<table width="100%" border="0" cellpadding="0" cellspacing="0"><tr>
|
99
|
<td colspan="4" class="listtopic">
|
100
|
Last <?=$nentries;?> PPTP log entries</td>
|
101
|
</tr>
|
102
|
<tr>
|
103
|
<td class="listhdrr">Time</td>
|
104
|
<td class="listhdrr">Action</td>
|
105
|
<td class="listhdrr">User</td>
|
106
|
<td class="listhdrr">IP address</td>
|
107
|
</tr>
|
108
|
<?php dump_clog_vpn($pptp_logfile, $nentries); ?>
|
109
|
</table>
|
110
|
<br><form action="diag_logs_vpn.php" method="post">
|
111
|
<input name="clear" type="submit" class="formbtn" value="Clear log">
|
112
|
</form>
|
113
|
</td>
|
114
|
</tr>
|
115
|
</table>
|
116
|
<?php include("fend.inc"); ?>
|
117
|
</body>
|
118
|
</html>
|