1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/hotspot_ynh.git synced 2024-09-03 19:25:53 +02:00

Fix unsecured ssid

This commit is contained in:
Julien VAUBOURG 2015-05-02 12:32:19 +02:00
parent 7c54c97ccc
commit adc0d4d3b2
2 changed files with 14 additions and 8 deletions

View file

@ -1,4 +1,4 @@
bss=<TPL:WIFI_INTERFACE> <TPL:BSS_COMMENT>bss=<TPL:WIFI_INTERFACE>
ssid=<TPL:WIFI_SSID> ssid=<TPL:WIFI_SSID>
<TPL:SEC_COMMENT>wpa=2 <TPL:SEC_COMMENT>wpa=2
<TPL:SEC_COMMENT>wpa_passphrase=<TPL:WIFI_PASSPHRASE> <TPL:SEC_COMMENT>wpa_passphrase=<TPL:WIFI_PASSPHRASE>

View file

@ -167,6 +167,12 @@ start_hostapd() {
sed "s|<TPL:SEC_COMMENT>|#|g" -i /etc/hostapd/hostapd.conf.tmp sed "s|<TPL:SEC_COMMENT>|#|g" -i /etc/hostapd/hostapd.conf.tmp
fi fi
if [ "${i}" -eq 0 ]; then
sed "s|<TPL:BSS_COMMENT>|#|g" -i /etc/hostapd/hostapd.conf.tmp
else
sed "s|<TPL:BSS_COMMENT>||g" -i /etc/hostapd/hostapd.conf.tmp
fi
cat /etc/hostapd/hostapd.conf.tmp >> /etc/hostapd/hostapd.conf cat /etc/hostapd/hostapd.conf.tmp >> /etc/hostapd/hostapd.conf
rm /etc/hostapd/hostapd.conf.tmp rm /etc/hostapd/hostapd.conf.tmp
done done
@ -356,7 +362,7 @@ case "$1" in
sleep 1 && (( i++ )) sleep 1 && (( i++ ))
[ ${i} -gt 20 ] && stop_hostapd [ ${i} -gt 20 ] && stop_hostapd
[ ${i} -gt 20 ] && exit 1 [ ${i} -gt 20 ] && exit 1
ip link show dev ssid0 &> /dev/null ip link show dev "mon.${ynh_wifi_device}" &> /dev/null
done done
fi fi
@ -365,19 +371,19 @@ case "$1" in
# Set ipv4 NAT address # Set ipv4 NAT address
if ! is_ip4nataddr_set ${i}; then if ! is_ip4nataddr_set ${i}; then
echo "Set IPv4 NAT address" echo "SSID ${i}: Set IPv4 NAT address"
set_ip4nataddr ${i} set_ip4nataddr ${i}
fi fi
# Set the ipv6 address # Set the ipv6 address
if has_ip6delegatedprefix ${i} && ! is_ip6addr_set ${i}; then if has_ip6delegatedprefix ${i} && ! is_ip6addr_set ${i}; then
echo "Set IPv6 address" echo "SSID ${i}: Set IPv6 address"
set_ip6addr ${i} set_ip6addr ${i}
fi fi
# Run DHCP servers # Run DHCP servers
if ! is_dhcpd_running ${i}; then if ! is_dhcpd_running ${i}; then
echo "Set DHCP servers (dnsmasq)" echo "SSID ${i}: Set DHCP servers (dnsmasq)"
start_dhcpd ${i} start_dhcpd ${i}
fi fi
done done
@ -402,17 +408,17 @@ case "$1" in
for i in $(seq 0 $((${ynh_multissid} - 1))); do for i in $(seq 0 $((${ynh_multissid} - 1))); do
if is_ip4nataddr_set ${i}; then if is_ip4nataddr_set ${i}; then
echo "Unset IPv4 NAT address" echo "SSID ${i}: Unset IPv4 NAT address"
unset_ip4nataddr ${i} unset_ip4nataddr ${i}
fi fi
if has_ip6delegatedprefix ${i} && is_ip6addr_set ${i}; then if has_ip6delegatedprefix ${i} && is_ip6addr_set ${i}; then
echo "Unset IPv6 address" echo "SSID ${i}: Unset IPv6 address"
unset_ip6addr ${i} unset_ip6addr ${i}
fi fi
if is_dhcpd_running ${i}; then if is_dhcpd_running ${i}; then
echo "Stop DHCP servers" echo "SSID ${i}: Stop DHCP servers"
stop_dhcpd ${i} stop_dhcpd ${i}
fi fi
done done