Message ID | 20240304214243.3677-3-ansuelsmth@gmail.com |
---|---|
State | Handled Elsewhere |
Delegated to: | Ansuel Smith |
Headers | show |
Series | wifi-scripts: fix WPS usage | expand |
The sender domain has a DMARC Reject/Quarantine policy which disallows sending mailing list messages using the original "From" header. To mitigate this problem, the original message has been wrapped automatically by the mailing list software. On Monday, March 4th, 2024 at 13:42, Christian Marangi <ansuelsmth@gmail.com> wrote: > Save wpa_psk_file on permanent storage by default. Currently it's always > created in /var/run with the hostapd files. > > Any user that would use this option would save this file on permanent > storage to declare specific PSK per devices or for each VLAN. > > The file is also used for WPS to store the per-device PSK and keeping it > on /var/run on normal installation (excluding installation with > permanent /var) would result in the wpa_psk_file getting wiped on > reboot, losing all the per-device PSK saved by hostapd. > > To fix this, move the wpa_psk_file to /etc/hostapd and set the default > value for the wpa_psk_file option to point to this directory. > > Signed-off-by: Christian Marangi ansuelsmth@gmail.com > > --- > package/network/config/wifi-scripts/Makefile | 2 +- > .../config/wifi-scripts/files/lib/netifd/hostapd.sh | 9 ++++++++- > 2 files changed, 9 insertions(+), 2 deletions(-) > > diff --git a/package/network/config/wifi-scripts/Makefile b/package/network/config/wifi-scripts/Makefile > index 085860d7c6..539d9a03c3 100644 > --- a/package/network/config/wifi-scripts/Makefile > +++ b/package/network/config/wifi-scripts/Makefile > @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk > > PKG_NAME:=wifi-scripts > PKG_VERSION:=1.0 > -PKG_RELEASE:=1 > +PKG_RELEASE:=2 > PKG_LICENSE:=GPL-2.0 > > PKG_MAINTAINER:=Felix Fietkau nbd@nbd.name > > diff --git a/package/network/config/wifi-scripts/files/lib/netifd/hostapd.sh b/package/network/config/wifi-scripts/files/lib/netifd/hostapd.sh > index a357418fe1..71be4db67d 100644 > --- a/package/network/config/wifi-scripts/files/lib/netifd/hostapd.sh > +++ b/package/network/config/wifi-scripts/files/lib/netifd/hostapd.sh > @@ -687,7 +687,14 @@ hostapd_set_bss_options() { > wireless_setup_vif_failed INVALID_WPA_PSK > return 1 > fi > - [ -z "$wpa_psk_file" ] && set_default wpa_psk_file /var/run/hostapd-$ifname.psk > + [ -z "$wpa_psk_file" ] && { > + [ -d /etc/hostapd ] || { > + mkdir /etc/hostapd > + chown network:netwrok /etc/hostapd Typo: network:network > + } > + set_default wpa_psk_file /etc/hostapd/hostapd-$ifname.psk > + ln -s /etc/hostapd/hostapd-$ifname.psk /var/run/hostapd-$ifname.psk > + } > [ -n "$wpa_psk_file" ] && { > [ -e "$wpa_psk_file" ] || { > touch "$wpa_psk_file" > -- > 2.43.0
diff --git a/package/network/config/wifi-scripts/Makefile b/package/network/config/wifi-scripts/Makefile index 085860d7c6..539d9a03c3 100644 --- a/package/network/config/wifi-scripts/Makefile +++ b/package/network/config/wifi-scripts/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=wifi-scripts PKG_VERSION:=1.0 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_LICENSE:=GPL-2.0 PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name> diff --git a/package/network/config/wifi-scripts/files/lib/netifd/hostapd.sh b/package/network/config/wifi-scripts/files/lib/netifd/hostapd.sh index a357418fe1..71be4db67d 100644 --- a/package/network/config/wifi-scripts/files/lib/netifd/hostapd.sh +++ b/package/network/config/wifi-scripts/files/lib/netifd/hostapd.sh @@ -687,7 +687,14 @@ hostapd_set_bss_options() { wireless_setup_vif_failed INVALID_WPA_PSK return 1 fi - [ -z "$wpa_psk_file" ] && set_default wpa_psk_file /var/run/hostapd-$ifname.psk + [ -z "$wpa_psk_file" ] && { + [ -d /etc/hostapd ] || { + mkdir /etc/hostapd + chown network:netwrok /etc/hostapd + } + set_default wpa_psk_file /etc/hostapd/hostapd-$ifname.psk + ln -s /etc/hostapd/hostapd-$ifname.psk /var/run/hostapd-$ifname.psk + } [ -n "$wpa_psk_file" ] && { [ -e "$wpa_psk_file" ] || { touch "$wpa_psk_file"
Save wpa_psk_file on permanent storage by default. Currently it's always created in /var/run with the hostapd files. Any user that would use this option would save this file on permanent storage to declare specific PSK per devices or for each VLAN. The file is also used for WPS to store the per-device PSK and keeping it on /var/run on normal installation (excluding installation with permanent /var) would result in the wpa_psk_file getting wiped on reboot, losing all the per-device PSK saved by hostapd. To fix this, move the wpa_psk_file to /etc/hostapd and set the default value for the wpa_psk_file option to point to this directory. Signed-off-by: Christian Marangi <ansuelsmth@gmail.com> --- package/network/config/wifi-scripts/Makefile | 2 +- .../config/wifi-scripts/files/lib/netifd/hostapd.sh | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-)