1 |
5d98aeb1
|
Scott Ullrich
|
#!/usr/local/bin/php
|
2 |
18330d38
|
Scott Ullrich
|
<?php
|
3 |
5b237745
|
Scott Ullrich
|
/*
|
4 |
|
|
diag_logs_vpn.php
|
5 |
5d98aeb1
|
Scott Ullrich
|
part of m0n0wall (http://m0n0.ch/wall)
|
6 |
18330d38
|
Scott Ullrich
|
|
7 |
5d98aeb1
|
Scott Ullrich
|
Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
|
8 |
5b237745
|
Scott Ullrich
|
All rights reserved.
|
9 |
18330d38
|
Scott Ullrich
|
|
10 |
5b237745
|
Scott Ullrich
|
Redistribution and use in source and binary forms, with or without
|
11 |
|
|
modification, are permitted provided that the following conditions are met:
|
12 |
18330d38
|
Scott Ullrich
|
|
13 |
5b237745
|
Scott Ullrich
|
1. Redistributions of source code must retain the above copyright notice,
|
14 |
|
|
this list of conditions and the following disclaimer.
|
15 |
18330d38
|
Scott Ullrich
|
|
16 |
5b237745
|
Scott Ullrich
|
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 |
18330d38
|
Scott Ullrich
|
|
20 |
5b237745
|
Scott Ullrich
|
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 |
13d193c2
|
Scott Ullrich
|
/*
|
33 |
|
|
pfSense_BUILDER_BINARIES: /usr/sbin/fifolog_reader /usr/sbin/clog
|
34 |
|
|
pfSense_MODULE: vpn
|
35 |
|
|
*/
|
36 |
|
|
|
37 |
6b07c15a
|
Matthew Grooms
|
##|+PRIV
|
38 |
|
|
##|*IDENT=page-diagnostics-logs-pptpvpn
|
39 |
|
|
##|*NAME=Diagnostics: Logs: PPTP VPN page
|
40 |
|
|
##|*DESCR=Allow access to the 'Diagnostics: Logs: PPTP VPN' page.
|
41 |
|
|
##|*MATCH=diag_logs_vpn.php*
|
42 |
|
|
##|-PRIV
|
43 |
|
|
|
44 |
d88c6a9f
|
Scott Ullrich
|
$pgtitle = array("Status","System logs","PPTP VPN");
|
45 |
5b237745
|
Scott Ullrich
|
require("guiconfig.inc");
|
46 |
|
|
|
47 |
|
|
$nentries = $config['syslog']['nentries'];
|
48 |
|
|
if (!$nentries)
|
49 |
|
|
$nentries = 50;
|
50 |
|
|
|
51 |
d6abaa18
|
Scott Ullrich
|
if ($_POST['clear'])
|
52 |
|
|
clear_log_file("/var/log/vpn.log");
|
53 |
5d98aeb1
|
Scott Ullrich
|
|
54 |
|
|
function dump_clog_vpn($logfile, $tail) {
|
55 |
|
|
global $g, $config;
|
56 |
|
|
|
57 |
|
|
$sor = isset($config['syslog']['reverse']) ? "-r" : "";
|
58 |
|
|
|
59 |
ba8ee067
|
Scott Ullrich
|
$logarr = "";
|
60 |
568f30c2
|
Scott Ullrich
|
|
61 |
|
|
if(isset($config['system']['usefifolog']))
|
62 |
|
|
exec("/usr/sbin/fifolog_reader " . $logfile . " | tail {$sor} -n " . $tail, $logarr);
|
63 |
|
|
else
|
64 |
|
|
exec("/usr/sbin/clog " . $logfile . " | grep -v \"CLOG\" | grep -v \"\033\" | tail {$sor} -n " . $tail, $logarr);
|
65 |
18330d38
|
Scott Ullrich
|
|
66 |
5d98aeb1
|
Scott Ullrich
|
foreach ($logarr as $logent) {
|
67 |
|
|
$logent = preg_split("/\s+/", $logent, 6);
|
68 |
|
|
$llent = explode(",", $logent[5]);
|
69 |
18330d38
|
Scott Ullrich
|
|
70 |
5d98aeb1
|
Scott Ullrich
|
echo "<tr>\n";
|
71 |
|
|
echo "<td class=\"listlr\" nowrap>" . htmlspecialchars(join(" ", array_slice($logent, 0, 3))) . "</td>\n";
|
72 |
18330d38
|
Scott Ullrich
|
|
73 |
5d98aeb1
|
Scott Ullrich
|
if ($llent[0] == "login")
|
74 |
88d26bcb
|
Scott Ullrich
|
echo "<td class=\"listr\"><img src=\"/themes/{$g['theme']}/images/icons/icon_in.gif\" width=\"11\" height=\"11\" title=\"login\"></td>\n";
|
75 |
5d98aeb1
|
Scott Ullrich
|
else
|
76 |
88d26bcb
|
Scott Ullrich
|
echo "<td class=\"listr\"><img src=\"/themes/{$g['theme']}/images/icons/icon_out.gif\" width=\"11\" height=\"11\" title=\"logout\"></td>\n";
|
77 |
18330d38
|
Scott Ullrich
|
|
78 |
5d98aeb1
|
Scott Ullrich
|
echo "<td class=\"listr\">" . htmlspecialchars($llent[3]) . "</td>\n";
|
79 |
|
|
echo "<td class=\"listr\">" . htmlspecialchars($llent[2]) . " </td>\n";
|
80 |
|
|
echo "</tr>\n";
|
81 |
|
|
}
|
82 |
5b237745
|
Scott Ullrich
|
}
|
83 |
|
|
|
84 |
b63695db
|
Scott Ullrich
|
include("head.inc");
|
85 |
|
|
|
86 |
5b237745
|
Scott Ullrich
|
?>
|
87 |
|
|
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
|
88 |
|
|
<?php include("fbegin.inc"); ?>
|
89 |
|
|
<table width="100%" border="0" cellpadding="0" cellspacing="0">
|
90 |
5d98aeb1
|
Scott Ullrich
|
<tr><td class="tabnavtbl">
|
91 |
b63695db
|
Scott Ullrich
|
<?php
|
92 |
|
|
$tab_array = array();
|
93 |
9972f533
|
Bill Marquette
|
$tab_array[] = array("System", false, "diag_logs.php");
|
94 |
|
|
$tab_array[] = array("Firewall", false, "diag_logs_filter.php");
|
95 |
|
|
$tab_array[] = array("DHCP", false, "diag_logs_dhcp.php");
|
96 |
|
|
$tab_array[] = array("Portal Auth", false, "diag_logs_auth.php");
|
97 |
0f266b2e
|
Chris Buechler
|
$tab_array[] = array("IPsec VPN", false, "diag_logs_ipsec.php");
|
98 |
9972f533
|
Bill Marquette
|
$tab_array[] = array("PPTP VPN", true, "diag_logs_vpn.php");
|
99 |
1348a09b
|
Seth Mos
|
$tab_array[] = array("Load Balancer", false, "diag_logs_relayd.php");
|
100 |
5d98aeb1
|
Scott Ullrich
|
$tab_array[] = array("OpenVPN", false, "diag_logs_openvpn.php");
|
101 |
18330d38
|
Scott Ullrich
|
$tab_array[] = array("OpenNTPD", false, "diag_logs_ntpd.php");
|
102 |
9972f533
|
Bill Marquette
|
$tab_array[] = array("Settings", false, "diag_logs_settings.php");
|
103 |
b63695db
|
Scott Ullrich
|
display_top_tabs($tab_array);
|
104 |
|
|
?>
|
105 |
5b237745
|
Scott Ullrich
|
</td></tr>
|
106 |
|
|
<tr>
|
107 |
5d98aeb1
|
Scott Ullrich
|
<td class="tabcont">
|
108 |
|
|
<table width="100%" border="0" cellpadding="0" cellspacing="0"><tr>
|
109 |
18330d38
|
Scott Ullrich
|
<td colspan="4" class="listtopic">
|
110 |
5d98aeb1
|
Scott Ullrich
|
Last <?=$nentries;?> PPTP VPN log entries</td>
|
111 |
5b237745
|
Scott Ullrich
|
</tr>
|
112 |
|
|
<tr>
|
113 |
|
|
<td class="listhdrr">Time</td>
|
114 |
|
|
<td class="listhdrr">Action</td>
|
115 |
|
|
<td class="listhdrr">User</td>
|
116 |
|
|
<td class="listhdrr">IP address</td>
|
117 |
|
|
</tr>
|
118 |
5d98aeb1
|
Scott Ullrich
|
<?php dump_clog_vpn("/var/log/vpn.log", $nentries); ?>
|
119 |
|
|
</table>
|
120 |
|
|
<br><form action="diag_logs_vpn.php" method="post">
|
121 |
|
|
<input name="clear" type="submit" class="formbtn" value="Clear log">
|
122 |
|
|
</form>
|
123 |
5b237745
|
Scott Ullrich
|
</td>
|
124 |
|
|
</tr>
|
125 |
|
|
</table>
|
126 |
|
|
<?php include("fend.inc"); ?>
|