Commit e821b018 authored by Franco Fichtner's avatar Franco Fichtner

logs: split up VPN logs, closes #507

We're moving PPTP back, the whole discussion is rather pointless
to be honest.  We'll make it a plugin for 16.7, I think that's
only fair for users who know what they are doing.
parent 06a383ce
...@@ -47,13 +47,6 @@ ...@@ -47,13 +47,6 @@
<GroupStatus VisibleName="Group Status" url="/status_gateway_groups.php"/> <GroupStatus VisibleName="Group Status" url="/status_gateway_groups.php"/>
<Log VisibleName="Log File" url="/diag_logs_gateways.php"/> <Log VisibleName="Log File" url="/diag_logs_gateways.php"/>
</Gateways> </Gateways>
<LogFiles order="160" VisibleName="Log Files" cssClass="fa fa-eye">
<General url="/diag_logs.php"/>
<DHCP url="/diag_logs_dhcp.php"/>
<VPN url="/diag_logs_vpn.php?vpntype=pptp">
<Type url="/diag_logs_vpn.php*"/>
</VPN>
</LogFiles>
<Settings order="20" cssClass="fa fa-cogs"> <Settings order="20" cssClass="fa fa-cogs">
<General order="100" url="/system_general.php"/> <General order="100" url="/system_general.php"/>
<AdminAccess VisibleName="Admin Access" order="200" url="/system_advanced_admin.php"/> <AdminAccess VisibleName="Admin Access" order="200" url="/system_advanced_admin.php"/>
...@@ -66,6 +59,7 @@ ...@@ -66,6 +59,7 @@
<Edit url="/system_advanced_sysctl.php*"/> <Edit url="/system_advanced_sysctl.php*"/>
</Tunables> </Tunables>
</Settings> </Settings>
<LogFile order="150" VisibleName="Log File" url="/diag_logs.php" cssClass="fa fa-eye"/>
<Wizard order="140" url="/wizard.php" cssClass="fa fa-magic"> <Wizard order="140" url="/wizard.php" cssClass="fa fa-magic">
<Step url="/wizard.php*"/> <Step url="/wizard.php*"/>
</Wizard> </Wizard>
...@@ -84,7 +78,7 @@ ...@@ -84,7 +78,7 @@
</Servers> </Servers>
<Tester order="50" url="/diag_authentication.php"/> <Tester order="50" url="/diag_authentication.php"/>
</Access> </Access>
<Diagnostics order="150" cssClass="fa fa-medkit"> <Diagnostics order="160" cssClass="fa fa-medkit">
<Activity VisibleName="Activity Monitor" url="/diag_system_activity.php"/> <Activity VisibleName="Activity Monitor" url="/diag_system_activity.php"/>
<Factory VisibleName="Factory Defaults" url="/diag_defaults.php"/> <Factory VisibleName="Factory Defaults" url="/diag_defaults.php"/>
<Halt VisibleName="Halt System" url="/diag_halt.php"/> <Halt VisibleName="Halt System" url="/diag_halt.php"/>
...@@ -228,6 +222,7 @@ ...@@ -228,6 +222,7 @@
<Leases order="300" url="/status_dhcp_leases.php"> <Leases order="300" url="/status_dhcp_leases.php">
<Details url="/status_dhcp_leases.php?*"/> <Details url="/status_dhcp_leases.php?*"/>
</Leases> </Leases>
<LogFile VisibleName="Log File" order="400" url="/diag_logs_dhcp.php"/>
</DHCP> </DHCP>
<DHCPv6 cssClass="fa fa-bullseye"> <DHCPv6 cssClass="fa fa-bullseye">
<Server order="100" url="/services_dhcpv6.php"> <Server order="100" url="/services_dhcpv6.php">
...@@ -288,15 +283,14 @@ ...@@ -288,15 +283,14 @@
<Status url="/status_ntpd.php"/> <Status url="/status_ntpd.php"/>
<Log VisibleName="Log File" url="/diag_logs_ntpd.php"/> <Log VisibleName="Log File" url="/diag_logs_ntpd.php"/>
</NTP> </NTP>
<PPPoEServer VisibleName="PPPoE Server" url="/vpn_pppoe.php" cssClass="fa fa-tty"> <PPPoEServer VisibleName="PPPoE Server" cssClass="fa fa-tty">
<PPPoeServerEdit url="/vpn_pppoe_edit.php"/> <Settings order="10" url="/vpn_pppoe.php">
<Edit url="/vpn_pppoe_edit.php*"/>
</Settings>
<LogFile order="20" VisibleName="Log File" url="/diag_logs_poes.php">
<Type url="/diag_logs_poes.php*"/>
</LogFile>
</PPPoEServer> </PPPoEServer>
<PPTP cssClass="fa fa-unlock">
<Settings url="/vpn_pptp.php"/>
<Users url="/vpn_pptp_users.php">
<Edit url="/vpn_pptp_users_edit.php*"/>
</Users>
</PPTP>
<Proxy VisibleName="Proxy Server" cssClass="fa fa-bolt"> <Proxy VisibleName="Proxy Server" cssClass="fa fa-bolt">
<Administration url="/ui/proxy/"/> <Administration url="/ui/proxy/"/>
<Log VisibleName="Log File" url="/diag_logs_proxy.php?type=cache"> <Log VisibleName="Log File" url="/diag_logs_proxy.php?type=cache">
...@@ -314,7 +308,7 @@ ...@@ -314,7 +308,7 @@
<WoLEdit url="/services_wol_edit.php*"/> <WoLEdit url="/services_wol_edit.php*"/>
</WoL> </WoL>
</Services> </Services>
<VPN order="4" cssClass="glyphicon glyphicon-lock"> <VPN order="4" cssClass="fa fa-globe">
<IPsec cssClass="fa fa-lock"> <IPsec cssClass="fa fa-lock">
<Tunnels order="10" VisibleName="Tunnel Settings" url="/vpn_ipsec.php"> <Tunnels order="10" VisibleName="Tunnel Settings" url="/vpn_ipsec.php">
<Phase1 url="/vpn_ipsec_phase1.php*"/> <Phase1 url="/vpn_ipsec_phase1.php*"/>
...@@ -333,11 +327,14 @@ ...@@ -333,11 +327,14 @@
<SPD order="80" VisibleName="Security Policy Database" url="/diag_ipsec_spd.php"/> <SPD order="80" VisibleName="Security Policy Database" url="/diag_ipsec_spd.php"/>
<Log order="90" VisibleName="Log File" url="/diag_logs_ipsec.php"/> <Log order="90" VisibleName="Log File" url="/diag_logs_ipsec.php"/>
</IPsec> </IPsec>
<L2TP cssClass="fa fa-lock"> <L2TP cssClass="fa fa-unlock">
<Settings order="10" url="/vpn_l2tp.php"/> <Settings order="10" url="/vpn_l2tp.php"/>
<Users order="20" url="/vpn_l2tp_users.php"> <Users order="20" url="/vpn_l2tp_users.php">
<Edit url="/vpn_l2tp_users_edit.php*"/> <Edit url="/vpn_l2tp_users_edit.php*"/>
</Users> </Users>
<LogFile order="30" VisibleName="Log File" url="/diag_logs_l2tp.php">
<Type url="/diag_logs_l2tp.php*"/>
</LogFile>
</L2TP> </L2TP>
<OpenVPN cssClass="fa fa-lock"> <OpenVPN cssClass="fa fa-lock">
<Server order="10" VisibleName="Server Settings" url="/vpn_openvpn_server.php"> <Server order="10" VisibleName="Server Settings" url="/vpn_openvpn_server.php">
...@@ -356,6 +353,15 @@ ...@@ -356,6 +353,15 @@
<Status order="60" VisibleName="Connection Status" url="/status_openvpn.php"/> <Status order="60" VisibleName="Connection Status" url="/status_openvpn.php"/>
<Log order="70" VisibleName="Log File" url="/diag_logs_openvpn.php"/> <Log order="70" VisibleName="Log File" url="/diag_logs_openvpn.php"/>
</OpenVPN> </OpenVPN>
<PPTP cssClass="fa fa-unlock">
<Settings order="10" url="/vpn_pptp.php"/>
<Users order="20" url="/vpn_pptp_users.php">
<Edit url="/vpn_pptp_users_edit.php*"/>
</Users>
<LogFile order="30" VisibleName="Log File" url="/diag_logs_pptp.php">
<Type url="/diag_logs_pptp.php*"/>
</LogFile>
</PPTP>
</VPN> </VPN>
<Help order="6" cssClass="glyphicon glyphicon-question-sign"> <Help order="6" cssClass="glyphicon glyphicon-question-sign">
<AboutThisPage VisibleName="About this Page" url="/help.php" IsExternal="Y"/> <AboutThisPage VisibleName="About this Page" url="/help.php" IsExternal="Y"/>
......
...@@ -165,11 +165,25 @@ ...@@ -165,11 +165,25 @@
"diag_logs.php*" "diag_logs.php*"
] ]
}, },
"page-diagnostics-logs-pptpvpn": { "page-diagnostics-logs-pptp": {
"name": "WebCfg - Diagnostics: Logs: VPN page", "name": "WebCfg - Diagnostics: Logs: PPTP page",
"descr": "Allow access to the 'Diagnostics: Logs: VPN' page.", "descr": "Allow access to the 'Diagnostics: Logs: PPTP' page.",
"match": [ "match": [
"diag_logs_vpn.php*" "diag_logs_pptp.php*"
]
},
"page-diagnostics-logs-poes": {
"name": "WebCfg - Diagnostics: Logs: PPPoE page",
"descr": "Allow access to the 'Diagnostics: Logs: PPPoE' page.",
"match": [
"diag_logs_poes.php*"
]
},
"page-diagnostics-logs-l2tp": {
"name": "WebCfg - Diagnostics: Logs: L2TP page",
"descr": "Allow access to the 'Diagnostics: Logs: L2TP' page.",
"match": [
"diag_logs_l2tp.php*"
] ]
}, },
"page-diagnostics-nanobsd": { "page-diagnostics-nanobsd": {
......
<?php
if (htmlspecialchars($_POST['mode']))
$mode = htmlspecialchars($_POST['mode']);
elseif (htmlspecialchars($_GET['mode']))
$mode = htmlspecialchars($_GET['mode']);
else
$mode = "login";
if ($mode != 'raw') {
$logfile = '/var/log/vpn.log';
} else {
$logfile = '/var/log/l2tps.log';
}
$logtype = 'l2tp';
$tab_array = array();
$tab_array[] = array(gettext("L2TP Logins"), $mode != "raw", "/diag_logs_l2tp.php");
$tab_array[] = array(gettext("L2TP Raw"), $mode == "raw", "/diag_logs_l2tp.php?mode=raw");
require_once 'diag_logs_vpn.inc';
<?php
if (htmlspecialchars($_POST['mode']))
$mode = htmlspecialchars($_POST['mode']);
elseif (htmlspecialchars($_GET['mode']))
$mode = htmlspecialchars($_GET['mode']);
else
$mode = "login";
if ($mode != 'raw') {
$logfile = '/var/log/vpn.log';
} else {
$logfile = '/var/log/poes.log';
}
$logtype = 'poes';
$tab_array = array();
$tab_array[] = array(gettext("PPPoE Logins"), $mode != "raw", "/diag_logs_poes.php");
$tab_array[] = array(gettext("PPPoE Raw"), $mode == "raw", "/diag_logs_poes.php?mode=raw");
require_once 'diag_logs_vpn.inc';
<?php
if (htmlspecialchars($_POST['mode']))
$mode = htmlspecialchars($_POST['mode']);
elseif (htmlspecialchars($_GET['mode']))
$mode = htmlspecialchars($_GET['mode']);
else
$mode = "login";
if ($mode != 'raw') {
$logfile = '/var/log/vpn.log';
} else {
$logfile = '/var/log/pptps.log';
}
$logtype = 'pptp';
$tab_array = array();
$tab_array[] = array(gettext("PPTP Logins"), $mode != "raw", "/diag_logs_pptp.php");
$tab_array[] = array(gettext("PPTP Raw"), $mode == "raw", "/diag_logs_pptp.php?mode=raw");
require_once 'diag_logs_vpn.inc';
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
/* /*
Copyright (C) 2014 Deciso B.V. Copyright (C) 2014 Deciso B.V.
Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>. Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>
All rights reserved. All rights reserved.
Redistribution and use in source and binary forms, with or without Redistribution and use in source and binary forms, with or without
...@@ -32,56 +32,19 @@ require_once("vpn.inc"); ...@@ -32,56 +32,19 @@ require_once("vpn.inc");
require_once("system.inc"); require_once("system.inc");
require_once("interfaces.inc"); require_once("interfaces.inc");
$tab_array = array();
$tab_array[] = array(gettext("PPTP Logins"), (($vpntype == "pptp") && ($mode != "raw")), "/diag_logs_vpn.php?vpntype=pptp");
$tab_array[] = array(gettext("PPTP Raw"), (($vpntype == "pptp") && ($mode == "raw")), "/diag_logs_vpn.php?vpntype=pptp&amp;mode=raw");
$tab_array[] = array(gettext("PPPoE Logins"), (($vpntype == "poes") && ($mode != "raw")), "/diag_logs_vpn.php?vpntype=poes");
$tab_array[] = array(gettext("PPPoE Raw"), (($vpntype == "poes") && ($mode == "raw")), "/diag_logs_vpn.php?vpntype=poes&amp;mode=raw");
$tab_array[] = array(gettext("L2TP Logins"), (($vpntype == "l2tp") && ($mode != "raw")), "/diag_logs_vpn.php?vpntype=l2tp");
$tab_array[] = array(gettext("L2TP Raw"), (($vpntype == "l2tp") && ($mode == "raw")), "/diag_logs_vpn.php?vpntype=l2tp&amp;mode=raw");
if (empty($config['syslog']['nentries'])) { if (empty($config['syslog']['nentries'])) {
$nentries = 50; $nentries = 50;
} else { } else {
$nentries = $config['syslog']['nentries']; $nentries = $config['syslog']['nentries'];
} }
if (htmlspecialchars($_POST['vpntype']))
$vpntype = htmlspecialchars($_POST['vpntype']);
elseif (htmlspecialchars($_GET['vpntype']))
$vpntype = htmlspecialchars($_GET['vpntype']);
else
$vpntype = "pptp";
if (htmlspecialchars($_POST['mode']))
$mode = htmlspecialchars($_POST['mode']);
elseif (htmlspecialchars($_GET['mode']))
$mode = htmlspecialchars($_GET['mode']);
else
$mode = "login";
switch ($vpntype) {
case 'pptp':
$logname = "pptps";
break;
case 'poes':
$logname = "poes";
break;
case 'l2tp':
$logname = "l2tps";
break;
}
if ($_POST['clear']) { if ($_POST['clear']) {
if ($mode != "raw") { clear_clog($logfile);
clear_clog("/var/log/vpn.log");
} else {
clear_clog("/var/log/{$logname}.log");
}
} }
function dump_clog_vpn($logfile, $tail) { function dump_clog_vpn($logfile, $tail, $logtype)
global $g, $config, $vpntype; {
global $config;
$sor = isset($config['syslog']['reverse']) ? "-r" : ""; $sor = isset($config['syslog']['reverse']) ? "-r" : "";
...@@ -93,8 +56,9 @@ function dump_clog_vpn($logfile, $tail) { ...@@ -93,8 +56,9 @@ function dump_clog_vpn($logfile, $tail) {
$logent = preg_split("/\s+/", $logent, 6); $logent = preg_split("/\s+/", $logent, 6);
$llent = explode(",", $logent[5]); $llent = explode(",", $logent[5]);
$iftype = substr($llent[1], 0, 4); $iftype = substr($llent[1], 0, 4);
if ($iftype != $vpntype) if ($iftype != $logtype) {
continue; continue;
}
echo "<tr>\n"; echo "<tr>\n";
echo "<td class=\"listlr nowrap\">" . htmlspecialchars(join(" ", array_slice($logent, 0, 3))) . "</td>\n"; echo "<td class=\"listlr nowrap\">" . htmlspecialchars(join(" ", array_slice($logent, 0, 3))) . "</td>\n";
...@@ -145,13 +109,12 @@ include("head.inc"); ...@@ -145,13 +109,12 @@ include("head.inc");
<td class="listhdrr"><?=gettext("User");?></td> <td class="listhdrr"><?=gettext("User");?></td>
<td class="listhdrr"><?=gettext("IP address");?></td> <td class="listhdrr"><?=gettext("IP address");?></td>
</tr> </tr>
<?php dump_clog_vpn("/var/log/vpn.log", $nentries); ?> <?php dump_clog_vpn($logfile, $nentries, $logname); ?>
<?php else: <?php else:
dump_clog("/var/log/{$logname}.log", $nentries); dump_clog($logfile, $nentries);
endif; ?> endif; ?>
<tr><td colspan="4"> <tr><td colspan="4">
<form action="diag_logs_vpn.php" method="post"> <form action="<? $_SERVER['REQUEST_URI'] ?>" method="post">
<input type="hidden" name="vpntype" id="vpntype" value="<?=$vpntype;?>" />
<input type="hidden" name="mode" id="mode" value="<?=$mode;?>" /> <input type="hidden" name="mode" id="mode" value="<?=$mode;?>" />
<input name="clear" type="submit" class="btn" value="<?= gettext("Clear log");?>" /> <input name="clear" type="submit" class="btn" value="<?= gettext("Clear log");?>" />
</form> </form>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment