1
|
#!/usr/local/bin/php
|
2
|
<?php
|
3
|
/*
|
4
|
diag_logs_vpn.php
|
5
|
part of m0n0wall (http://m0n0.ch/wall)
|
6
|
|
7
|
Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
|
8
|
All rights reserved.
|
9
|
|
10
|
Redistribution and use in source and binary forms, with or without
|
11
|
modification, are permitted provided that the following conditions are met:
|
12
|
|
13
|
1. Redistributions of source code must retain the above copyright notice,
|
14
|
this list of conditions and the following disclaimer.
|
15
|
|
16
|
2. Redistributions in binary form must reproduce the above copyright
|
17
|
notice, this list of conditions and the following disclaimer in the
|
18
|
documentation and/or other materials provided with the distribution.
|
19
|
|
20
|
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
21
|
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
22
|
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
23
|
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
24
|
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
25
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
26
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
27
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
28
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
29
|
POSSIBILITY OF SUCH DAMAGE.
|
30
|
*/
|
31
|
|
32
|
$pgtitle = "Diagnostics: System logs: PPTP VPN";
|
33
|
require("guiconfig.inc");
|
34
|
|
35
|
$nentries = $config['syslog']['nentries'];
|
36
|
if (!$nentries)
|
37
|
$nentries = 50;
|
38
|
|
39
|
if ($_POST['clear']) {
|
40
|
exec("/usr/sbin/clog -i -s 65536 /var/log/vpn.log");
|
41
|
/* redirect to avoid reposting form data on refresh */
|
42
|
header("Location: diag_logs_vpn.php");
|
43
|
exit;
|
44
|
}
|
45
|
|
46
|
function dump_clog_vpn($logfile, $tail) {
|
47
|
global $g, $config;
|
48
|
|
49
|
$sor = isset($config['syslog']['reverse']) ? "-r" : "";
|
50
|
|
51
|
$logarr = "";
|
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=\"/themes/{$g['theme']}/images/icons/icon_in.gif\" width=\"11\" height=\"11\" title=\"login\"></td>\n";
|
63
|
else
|
64
|
echo "<td class=\"listr\"><img src=\"/themes/{$g['theme']}/images/icons/icon_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
|
include("head.inc");
|
73
|
|
74
|
?>
|
75
|
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
|
76
|
<?php include("fbegin.inc"); ?>
|
77
|
<p class="pgtitle"><?=$pgtitle?></p>
|
78
|
<table width="100%" border="0" cellpadding="0" cellspacing="0">
|
79
|
<tr><td class="tabnavtbl">
|
80
|
<?php
|
81
|
$tab_array = array();
|
82
|
$tab_array[] = array("System", false, "diag_logs.php");
|
83
|
$tab_array[] = array("Firewall", false, "diag_logs_filter.php");
|
84
|
$tab_array[] = array("DHCP", false, "diag_logs_dhcp.php");
|
85
|
$tab_array[] = array("Portal Auth", false, "diag_logs_auth.php");
|
86
|
$tab_array[] = array("IPsec VPN", false, "diag_logs_ipsec.php");
|
87
|
$tab_array[] = array("PPTP VPN", true, "diag_logs_vpn.php");
|
88
|
$tab_array[] = array("Load Balancer", false, "diag_logs_slbd.php");
|
89
|
$tab_array[] = array("OpenVPN", false, "diag_logs_openvpn.php");
|
90
|
$tab_array[] = array("OpenNTPD", false, "diag_logs_ntpd.php");
|
91
|
$tab_array[] = array("Settings", false, "diag_logs_settings.php");
|
92
|
display_top_tabs($tab_array);
|
93
|
?>
|
94
|
</td></tr>
|
95
|
<tr>
|
96
|
<td class="tabcont">
|
97
|
<table width="100%" border="0" cellpadding="0" cellspacing="0"><tr>
|
98
|
<td colspan="4" class="listtopic">
|
99
|
Last <?=$nentries;?> PPTP VPN log entries</td>
|
100
|
</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
|
<?php dump_clog_vpn("/var/log/vpn.log", $nentries); ?>
|
108
|
</table>
|
109
|
<br><form action="diag_logs_vpn.php" method="post">
|
110
|
<input name="clear" type="submit" class="formbtn" value="Clear log">
|
111
|
</form>
|
112
|
</td>
|
113
|
</tr>
|
114
|
</table>
|
115
|
<?php include("fend.inc"); ?>
|