From f077aedde038c92f67e3df83eae821f9d94848b4 Mon Sep 17 00:00:00 2001 From: billz Date: Wed, 17 Nov 2021 18:06:43 +0000 Subject: [PATCH] Define RASPI_DHCPCD_LOG. Resolves #1058 --- config/config.php | 1 + includes/adblock.php | 2 +- includes/defaults.php | 1 + includes/dhcp.php | 2 +- installers/raspap.sudoers | 2 +- templates/dhcp/logging.php | 4 ++-- 6 files changed, 7 insertions(+), 5 deletions(-) diff --git a/config/config.php b/config/config.php index 62199065..c618c3ba 100755 --- a/config/config.php +++ b/config/config.php @@ -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'); diff --git a/includes/adblock.php b/includes/adblock.php index 034971b7..54e51f55 100755 --- a/includes/adblock.php +++ b/includes/adblock.php @@ -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) { diff --git a/includes/defaults.php b/includes/defaults.php index 1edb9802..e388b77c 100755 --- a/includes/defaults.php +++ b/includes/defaults.php @@ -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', diff --git a/includes/dhcp.php b/includes/dhcp.php index 2329838b..850d5847 100755 --- a/includes/dhcp.php +++ b/includes/dhcp.php @@ -226,7 +226,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") { diff --git a/installers/raspap.sudoers b/installers/raspap.sudoers index 60759f3d..d2091b82 100644 --- a/installers/raspap.sudoers +++ b/installers/raspap.sudoers @@ -37,7 +37,7 @@ www-data ALL=(ALL) NOPASSWD:/etc/raspap/hostapd/servicestart.sh www-data ALL=(ALL) NOPASSWD:/etc/raspap/lighttpd/configport.sh www-data ALL=(ALL) NOPASSWD:/etc/raspap/openvpn/configauth.sh www-data ALL=(ALL) NOPASSWD:/bin/chmod o+r /tmp/hostapd.log -www-data ALL=(ALL) NOPASSWD:/bin/chmod o+r /tmp/dnsmasq.log +www-data ALL=(ALL) NOPASSWD:/bin/chmod o+r /var/log/dnsmasq.log www-data ALL=(ALL) NOPASSWD:/bin/cp /tmp/dnsmasqdata /etc/dnsmasq.d/090_adblock.conf www-data ALL=(ALL) NOPASSWD:/bin/cp /tmp/dnsmasq_custom /etc/raspap/adblock/custom.txt www-data ALL=(ALL) NOPASSWD:/etc/raspap/adblock/update_blocklist.sh diff --git a/templates/dhcp/logging.php b/templates/dhcp/logging.php index ce451e6d..46307536 100644 --- a/templates/dhcp/logging.php +++ b/templates/dhcp/logging.php @@ -16,8 +16,8 @@
'.htmlspecialchars($log, ENT_QUOTES).''; } else { echo '';