diff --git a/hooks/post_iptables_rules b/hooks/post_iptables_rules index cb99f53..01e3966 100644 --- a/hooks/post_iptables_rules +++ b/hooks/post_iptables_rules @@ -25,7 +25,7 @@ do subnet="${ip6_prefix}1/64" fi - mac_addresses=$(grep "${prefix}" /etc/hotspot/allowed.csv | cut -d, -f3) + mac_addresses=$(grep "${prefix}" /etc/hostapd/$app/allowed.csv | cut -d, -f3) # Allow to request 4253 port $iptables_cmd -w -A INPUT -i "${wifi_device}" -m udp -p udp --dport 4253 -j ACCEPT diff --git a/scripts/install b/scripts/install index 957fc61..57b9110 100644 --- a/scripts/install +++ b/scripts/install @@ -107,7 +107,7 @@ chown root: /etc/hostapd/$app/ mkdir -pm 0755 /etc/dnsmasq.$app/ chown root: /etc/dnsmasq.$app/ -touch /etc/hotspot/allowed.csv +touch /etc/hostapd/$app/allowed.csv # Copy init script ynh_add_config --template="../conf/ynh-hotspot" --destination="/usr/local/bin/$service_name" diff --git a/scripts/upgrade b/scripts/upgrade index 096bd4d..a6a2e61 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -166,7 +166,7 @@ chown root: /etc/hostapd/$app/ mkdir -pm 0755 /etc/dnsmasq.$app/ chown root: /etc/dnsmasq.$app/ -touch /etc/hotspot/allowed.csv +touch /etc/hostapd/$app/allowed.csv if [[ -n "${wifi_device:-}" ]]; then configure_hostapd diff --git a/sources/captiveportal_allow b/sources/captiveportal_allow index 03c671d..321869a 100644 --- a/sources/captiveportal_allow +++ b/sources/captiveportal_allow @@ -4,8 +4,8 @@ date=$(date +"%Y-%m-%d %T") ip=$1 mac=$(arp -a $ip | cut -d" " -f4 | head -n1) interface=$(grep wifi_device /etc/yunohost/apps/hotspot/settings.yml | cut -d: -f2 | sed "s/[ ']//g") -if ! grep $mac /etc/hotspot/allowed.csv ; then - echo "$date,$ip,$mac" >> /etc/hotspot/allowed.csv +if ! grep $mac /etc/hostapd/$app/allowed.csv ; then + echo "$date,$ip,$mac" >> /etc/hostapd/$app/allowed.csv iptables -w -I hotspot_fwd 1 -s $ip -m mac --mac-source $mac -j ACCEPT iptables -t nat -w -I PREROUTING 1 -i $interface -s $ip -m mac --mac-source $mac -j ACCEPT fi