mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-18 10:35:27 +00:00
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.
This commit is contained in:
parent
06a383cef4
commit
e821b018ad
@ -47,13 +47,6 @@
|
||||
<GroupStatus VisibleName="Group Status" url="/status_gateway_groups.php"/>
|
||||
<Log VisibleName="Log File" url="/diag_logs_gateways.php"/>
|
||||
</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">
|
||||
<General order="100" url="/system_general.php"/>
|
||||
<AdminAccess VisibleName="Admin Access" order="200" url="/system_advanced_admin.php"/>
|
||||
@ -66,6 +59,7 @@
|
||||
<Edit url="/system_advanced_sysctl.php*"/>
|
||||
</Tunables>
|
||||
</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">
|
||||
<Step url="/wizard.php*"/>
|
||||
</Wizard>
|
||||
@ -84,7 +78,7 @@
|
||||
</Servers>
|
||||
<Tester order="50" url="/diag_authentication.php"/>
|
||||
</Access>
|
||||
<Diagnostics order="150" cssClass="fa fa-medkit">
|
||||
<Diagnostics order="160" cssClass="fa fa-medkit">
|
||||
<Activity VisibleName="Activity Monitor" url="/diag_system_activity.php"/>
|
||||
<Factory VisibleName="Factory Defaults" url="/diag_defaults.php"/>
|
||||
<Halt VisibleName="Halt System" url="/diag_halt.php"/>
|
||||
@ -228,6 +222,7 @@
|
||||
<Leases order="300" url="/status_dhcp_leases.php">
|
||||
<Details url="/status_dhcp_leases.php?*"/>
|
||||
</Leases>
|
||||
<LogFile VisibleName="Log File" order="400" url="/diag_logs_dhcp.php"/>
|
||||
</DHCP>
|
||||
<DHCPv6 cssClass="fa fa-bullseye">
|
||||
<Server order="100" url="/services_dhcpv6.php">
|
||||
@ -288,15 +283,14 @@
|
||||
<Status url="/status_ntpd.php"/>
|
||||
<Log VisibleName="Log File" url="/diag_logs_ntpd.php"/>
|
||||
</NTP>
|
||||
<PPPoEServer VisibleName="PPPoE Server" url="/vpn_pppoe.php" cssClass="fa fa-tty">
|
||||
<PPPoeServerEdit url="/vpn_pppoe_edit.php"/>
|
||||
<PPPoEServer VisibleName="PPPoE Server" cssClass="fa fa-tty">
|
||||
<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>
|
||||
<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">
|
||||
<Administration url="/ui/proxy/"/>
|
||||
<Log VisibleName="Log File" url="/diag_logs_proxy.php?type=cache">
|
||||
@ -314,7 +308,7 @@
|
||||
<WoLEdit url="/services_wol_edit.php*"/>
|
||||
</WoL>
|
||||
</Services>
|
||||
<VPN order="4" cssClass="glyphicon glyphicon-lock">
|
||||
<VPN order="4" cssClass="fa fa-globe">
|
||||
<IPsec cssClass="fa fa-lock">
|
||||
<Tunnels order="10" VisibleName="Tunnel Settings" url="/vpn_ipsec.php">
|
||||
<Phase1 url="/vpn_ipsec_phase1.php*"/>
|
||||
@ -333,11 +327,14 @@
|
||||
<SPD order="80" VisibleName="Security Policy Database" url="/diag_ipsec_spd.php"/>
|
||||
<Log order="90" VisibleName="Log File" url="/diag_logs_ipsec.php"/>
|
||||
</IPsec>
|
||||
<L2TP cssClass="fa fa-lock">
|
||||
<L2TP cssClass="fa fa-unlock">
|
||||
<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*"/>
|
||||
</Users>
|
||||
<LogFile order="30" VisibleName="Log File" url="/diag_logs_l2tp.php">
|
||||
<Type url="/diag_logs_l2tp.php*"/>
|
||||
</LogFile>
|
||||
</L2TP>
|
||||
<OpenVPN cssClass="fa fa-lock">
|
||||
<Server order="10" VisibleName="Server Settings" url="/vpn_openvpn_server.php">
|
||||
@ -356,6 +353,15 @@
|
||||
<Status order="60" VisibleName="Connection Status" url="/status_openvpn.php"/>
|
||||
<Log order="70" VisibleName="Log File" url="/diag_logs_openvpn.php"/>
|
||||
</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>
|
||||
<Help order="6" cssClass="glyphicon glyphicon-question-sign">
|
||||
<AboutThisPage VisibleName="About this Page" url="/help.php" IsExternal="Y"/>
|
||||
|
||||
@ -165,11 +165,25 @@
|
||||
"diag_logs.php*"
|
||||
]
|
||||
},
|
||||
"page-diagnostics-logs-pptpvpn": {
|
||||
"name": "WebCfg - Diagnostics: Logs: VPN page",
|
||||
"descr": "Allow access to the 'Diagnostics: Logs: VPN' page.",
|
||||
"page-diagnostics-logs-pptp": {
|
||||
"name": "WebCfg - Diagnostics: Logs: PPTP page",
|
||||
"descr": "Allow access to the 'Diagnostics: Logs: PPTP' page.",
|
||||
"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": {
|
||||
|
||||
22
src/www/diag_logs_l2tp.php
Normal file
22
src/www/diag_logs_l2tp.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?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';
|
||||
22
src/www/diag_logs_poes.php
Normal file
22
src/www/diag_logs_poes.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?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';
|
||||
22
src/www/diag_logs_pptp.php
Normal file
22
src/www/diag_logs_pptp.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?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 @@
|
||||
|
||||
/*
|
||||
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.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
@ -32,56 +32,19 @@ require_once("vpn.inc");
|
||||
require_once("system.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&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&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&mode=raw");
|
||||
|
||||
if (empty($config['syslog']['nentries'])) {
|
||||
$nentries = 50;
|
||||
} else {
|
||||
$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 ($mode != "raw") {
|
||||
clear_clog("/var/log/vpn.log");
|
||||
} else {
|
||||
clear_clog("/var/log/{$logname}.log");
|
||||
}
|
||||
clear_clog($logfile);
|
||||
}
|
||||
|
||||
function dump_clog_vpn($logfile, $tail) {
|
||||
global $g, $config, $vpntype;
|
||||
function dump_clog_vpn($logfile, $tail, $logtype)
|
||||
{
|
||||
global $config;
|
||||
|
||||
$sor = isset($config['syslog']['reverse']) ? "-r" : "";
|
||||
|
||||
@ -93,8 +56,9 @@ function dump_clog_vpn($logfile, $tail) {
|
||||
$logent = preg_split("/\s+/", $logent, 6);
|
||||
$llent = explode(",", $logent[5]);
|
||||
$iftype = substr($llent[1], 0, 4);
|
||||
if ($iftype != $vpntype)
|
||||
if ($iftype != $logtype) {
|
||||
continue;
|
||||
}
|
||||
echo "<tr>\n";
|
||||
echo "<td class=\"listlr nowrap\">" . htmlspecialchars(join(" ", array_slice($logent, 0, 3))) . "</td>\n";
|
||||
|
||||
@ -145,13 +109,12 @@ include("head.inc");
|
||||
<td class="listhdrr"><?=gettext("User");?></td>
|
||||
<td class="listhdrr"><?=gettext("IP address");?></td>
|
||||
</tr>
|
||||
<?php dump_clog_vpn("/var/log/vpn.log", $nentries); ?>
|
||||
<?php dump_clog_vpn($logfile, $nentries, $logname); ?>
|
||||
<?php else:
|
||||
dump_clog("/var/log/{$logname}.log", $nentries);
|
||||
dump_clog($logfile, $nentries);
|
||||
endif; ?>
|
||||
<tr><td colspan="4">
|
||||
<form action="diag_logs_vpn.php" method="post">
|
||||
<input type="hidden" name="vpntype" id="vpntype" value="<?=$vpntype;?>" />
|
||||
<form action="<? $_SERVER['REQUEST_URI'] ?>" method="post">
|
||||
<input type="hidden" name="mode" id="mode" value="<?=$mode;?>" />
|
||||
<input name="clear" type="submit" class="btn" value="<?= gettext("Clear log");?>" />
|
||||
</form>
|
||||
Loading…
x
Reference in New Issue
Block a user