0
0
Fork 0
mirror of https://github.com/NixOS/nixpkgs.git synced 2025-07-13 13:40:28 +03:00

nixos/hostapd: allow octothorpe characters in SAE password

The `saePasswordsFile` option mentions that lines beginning with `#` are
ignored, however the current regexp ignores all lines with `#` located
anywhere in the line. In order to better fit the documentation, the
regexp has been changed to only allow `#` at the beginning of the line,
with optional whitespace.
This commit is contained in:
Jared Baur 2024-11-14 21:54:37 -08:00
parent c598fc0ca3
commit 027e77778c
No known key found for this signature in database

View file

@ -1001,7 +1001,7 @@ in {
"20-addMacAllowFromSaeFile" = mkIf (bssCfg.authentication.saeAddToMacAllow && bssCfg.authentication.saePasswordsFile != null) (pkgs.writeShellScript "add-mac-allow-from-sae-file" ''
MAC_ALLOW_FILE=$2
grep mac= ${escapeShellArg bssCfg.authentication.saePasswordsFile} \
| grep -v '\s*#' \
| grep -v '^\s*#' \
| grep -Eo 'mac=([0-9A-Fa-f]{2}[:]){5}([0-9A-Fa-f]{2})' \
| sed 's|^mac=||' >> "$MAC_ALLOW_FILE"
'');
@ -1025,7 +1025,7 @@ in {
# Add sae passwords from file
"20-saePasswordsFile" = mkIf (bssCfg.authentication.saePasswordsFile != null) (pkgs.writeShellScript "sae-passwords-file" ''
HOSTAPD_CONFIG_FILE=$1
grep -v '\s*#' ${escapeShellArg bssCfg.authentication.saePasswordsFile} \
grep -v '^\s*#' ${escapeShellArg bssCfg.authentication.saePasswordsFile} \
| sed 's/^/sae_password=/' >> "$HOSTAPD_CONFIG_FILE"
'');
};