Define RASPI_DHCPCD_LOG

This commit is contained in:
billz 2021-11-17 18:20:03 +00:00
parent 8cef08cc81
commit e75333e29d
5 changed files with 6 additions and 4 deletions

View File

@ -15,6 +15,7 @@ define('RASPI_ADBLOCK_LISTPATH', '/etc/raspap/adblock/');
define('RASPI_ADBLOCK_CONFIG', RASPI_DNSMASQ_PREFIX.'adblock.conf');
define('RASPI_HOSTAPD_CONFIG', '/etc/hostapd/hostapd.conf');
define('RASPI_DHCPCD_CONFIG', '/etc/dhcpcd.conf');
define('RASPI_DHCPCD_LOG', '/var/log/dnsmasq.log'),
define('RASPI_WPA_SUPPLICANT_CONFIG', '/etc/wpa_supplicant/wpa_supplicant.conf');
define('RASPI_HOSTAPD_CTRL_INTERFACE', '/var/run/hostapd');
define('RASPI_WPA_CTRL_INTERFACE', '/var/run/wpa_supplicant');

View File

@ -78,7 +78,7 @@ function DisplayAdBlockConfig()
$adblock_custom_content = file_get_contents(RASPI_ADBLOCK_LISTPATH .'custom.txt');
$adblock_log = '';
exec('sudo chmod o+r /tmp/dnsmasq.log');
exec('sudo chmod o+r '.RASPI_DHCPCD_LOG);
$handle = fopen("/tmp/dnsmasq.log", "r");
if ($handle) {
while (($line = fgets($handle)) !== false) {

View File

@ -20,6 +20,7 @@ $defaults = [
'RASPI_ADBLOCK_CONFIG' => RASPI_DNSMASQ_PREFIX.'adblock.conf',
'RASPI_HOSTAPD_CONFIG' => '/etc/hostapd/hostapd.conf',
'RASPI_DHCPCD_CONFIG' => '/etc/dhcpcd.conf',
'RASPI_DHCPCD_LOG' => '/var/log/dnsmasq.log',
'RASPI_WPA_SUPPLICANT_CONFIG' => '/etc/wpa_supplicant/wpa_supplicant.conf',
'RASPI_HOSTAPD_CTRL_INTERFACE' => '/var/run/hostapd',
'RASPI_WPA_CTRL_INTERFACE' => '/var/run/wpa_supplicant',

View File

@ -228,7 +228,7 @@ function updateDnsmasqConfig($iface,$status)
// write default 090_raspap.conf
$config = '# RaspAP default config'.PHP_EOL;
$config .='log-facility=/tmp/dnsmasq.log'.PHP_EOL;
$config .='log-facility='.RASPI_DHCPCD_LOG.PHP_EOL;
$config .='conf-dir=/etc/dnsmasq.d'.PHP_EOL;
// handle log option
if ($_POST['log-dhcp'] == "1") {

View File

@ -16,8 +16,8 @@
<div class="form-group col-md-8 mt-2">
<?php
if ($conf['log-dhcp'] == 1 || $conf['log-queries'] == 1) {
exec('sudo chmod o+r /tmp/dnsmasq.log');
$log = file_get_contents('/tmp/dnsmasq.log');
exec('sudo chmod o+r '.RASPI_DHCPCD_LOG);
$log = file_get_contents(RASPI_DHCPCD_LOG);
echo '<textarea class="logoutput">'.htmlspecialchars($log, ENT_QUOTES).'</textarea>';
} else {
echo '<textarea class="logoutput my-3"></textarea>';