From 4a85188a22a94ba2cb6224a97a47a8cb0352ba0a Mon Sep 17 00:00:00 2001 From: Taikuh Date: Tue, 10 Mar 2020 05:08:26 +0800 Subject: [PATCH] Workaround for logs permissions not sticking --- installers/common.sh | 12 ++---------- installers/enablelog.sh | 1 - templates/dhcp/logging.php | 1 + templates/hostapd.php | 1 + 4 files changed, 4 insertions(+), 11 deletions(-) diff --git a/installers/common.sh b/installers/common.sh index 576c0f07..86eb05bc 100755 --- a/installers/common.sh +++ b/installers/common.sh @@ -108,13 +108,6 @@ function create_hostapd_scripts() { sudo chmod 750 "$raspap_dir/hostapd/"*.sh || install_error "Unable to change file permissions" } -# Generate dnsmasq logfile -function create_dnsmasq_log() { - install_log "Creating dnsmasq logfile" - sudo touch /tmp/dnsmasq.log || install_error "Unable to create logfile /tmp/dnsmasq.log" - sudo chown dnsmasq:"$raspap_user" /tmp/dnsmasq.log || install_error "Unable to change file ownership" -} - # Generate lighttpd service control scripts function create_lighttpd_scripts() { install_log "Creating lighttpd control scripts" @@ -252,8 +245,6 @@ function default_configuration() { 'echo 1 > \/proc\/sys\/net\/ipv4\/ip_forward #RASPAP' 'iptables -t nat -A POSTROUTING -j MASQUERADE #RASPAP' 'iptables -t nat -A POSTROUTING -s 192.168.50.0\/24 ! -d 192.168.50.0\/24 -j MASQUERADE #RASPAP' - 'chown dnsmasq:www-data \/tmp\/dnsmasq.log #RASPAP' - 'chown root:www-data \/tmp\/hostapd.log #RASPAP' ) for line in "${lines[@]}"; do @@ -335,6 +326,8 @@ function patch_system_files() { "/etc/raspap/hostapd/servicestart.sh" "/etc/raspap/lighttpd/configport.sh" "/etc/raspap/openvpn/configauth.sh" + "/bin/chmod o+r /tmp/hostapd.log" + "/bin/chmod o+r /tmp/dnsmasq.log" ) # Check if sudoers needs patching @@ -449,7 +442,6 @@ function install_raspap() { download_latest_files change_file_ownership create_hostapd_scripts - create_dnsmasq_log create_lighttpd_scripts move_config_file default_configuration diff --git a/installers/enablelog.sh b/installers/enablelog.sh index 9985d626..84a714b8 100755 --- a/installers/enablelog.sh +++ b/installers/enablelog.sh @@ -1,4 +1,3 @@ #!/bin/bash /bin/sed -i 's|#DAEMON_OPTS=""|DAEMON_OPTS=" -f /tmp/hostapd.log"|' /etc/default/hostapd touch /tmp/hostapd.log -chmod o+r /tmp/hostapd.log diff --git a/templates/dhcp/logging.php b/templates/dhcp/logging.php index 60e7166e..2a39e236 100644 --- a/templates/dhcp/logging.php +++ b/templates/dhcp/logging.php @@ -13,6 +13,7 @@ '.htmlspecialchars($log, ENT_QUOTES).''; ?> diff --git a/templates/hostapd.php b/templates/hostapd.php index b4f4c8f7..cde019f7 100755 --- a/templates/hostapd.php +++ b/templates/hostapd.php @@ -113,6 +113,7 @@
'; } else {