Skip to content

[24.10] hostapd: add SAE support for wifi-station and optimize PSK file creation - #17248

Merged
openwrt-bot merged 1 commit into
openwrt:openwrt-24.10from
rany2:24.10-sae-wifi-station
Dec 26, 2024
Merged

openwrt-bot merged 1 commit into
openwrt:openwrt-24.10from
rany2:24.10-sae-wifi-station

Conversation

@rany2

@rany2 rany2 commented Dec 12, 2024 •

Copy link
Copy Markdown
Contributor

Regarding SAE support in wifi-station:

Important Note: Unlike PSK wifi-stations, both mac and key options are required to make it work. With PSK, hostapd used to perform a brute-force match to find which PSK entry to use, but with SAE this is infeasible due to SAE's design.

When mac is omitted, it will allow any MAC address to use the SAE password if it didn't have a MAC address assigned to it, but this could only be done once. The last wildcard entry would be used.

Also, unlike "hostapd: add support for SAE in PPSK option" (commit 913368a), it is not required to set sae_pwe to 0. This gives it a slight advantage over using PPSK that goes beyond not needing RADIUS.

Example Configuration:

config wifi-vlan
        option iface default_radio0
        option name 999
        option vid 999
        option network management

config wifi-station
        # Allow user with MAC address 00:11:22:33:44:55 and matching
        # key "secretadminpass" to access the management network.
        option iface default_radio0
        option vid 999
        option mac '00:11:22:33:44:55'
        option key secretadminpass

config wifi-vlan
        option iface default_radio0
        option name 100
        option vid 100
        option network guest

config wifi-station
        # With SAE, when 'mac' is omitted it will be the fallback in case no
        # other MAC address matches. It won't be possible for a user that
        # has a matching MAC to use this network (i.e., 00:11:22:33:44:55
        # in this example).
        option iface default_radio0
        option vid 100
        option key guestpass

Regarding PSK file creation optimization:

This patch now conditionally runs hostapd_set_psk_file depending on auth_type. Previously, hostapd_set_psk would always execute hostapd_set_psk_file, which would create a new file if wifi-station was in use even if PSK was not enabled. This change checks the auth_type to ensure that it is appropriate to parse the wifi-station entries and create those files.

Furthermore, we now only configure wpa_psk_file when it is a supported option (i.e., psk or psk-sae is used). Previously, we used to configure it when it was not necessary. While it didn't cause any issues, it would litter /var/run with unnecessary files. This patch fixes that case by configuring it depending on the auth_type.

The new SAE support is aligned with these PSK file changes.

Link: #17145
(cherry picked from commit 65a1c66)

@rany2
rany2 force-pushed the 24.10-sae-wifi-station branch from 0a5f676 to 2c13514 Compare December 12, 2024 15:07
@github-actions github-actions Bot added core packages pull request/issue for core (in-tree) packages release/24.10 pull request/issue targeted (also) for OpenWrt 24.10 release labels Dec 12, 2024
@rany2
rany2 force-pushed the 24.10-sae-wifi-station branch from 9a06476 to 2b33d70 Compare December 20, 2024 23:59
Regarding SAE support in wifi-station:

Important Note: Unlike PSK wifi-stations, both `mac` and `key` options are required
to make it work. With PSK, hostapd used to perform a brute-force match to find which
PSK entry to use, but with SAE this is infeasible due to SAE's design.

When `mac` is omitted, it will allow any MAC address to use the SAE password if it
didn't have a MAC address assigned to it, but this could only be done once.
The last wildcard entry would be used.

Also, unlike "hostapd: add support for SAE in PPSK option" (commit 913368a),
it is not required to set `sae_pwe` to `0`. This gives it a slight advantage
over using PPSK that goes beyond not needing RADIUS.

Example Configuration:

```
config wifi-vlan
        option iface default_radio0
        option name 999
        option vid 999
        option network management

config wifi-station
        # Allow user with MAC address 00:11:22:33:44:55 and matching
        # key "secretadminpass" to access the management network.
        option iface default_radio0
        option vid 999
        option mac '00:11:22:33:44:55'
        option key secretadminpass

config wifi-vlan
        option iface default_radio0
        option name 100
        option vid 100
        option network guest

config wifi-station
        # With SAE, when 'mac' is omitted it will be the fallback in case no
        # other MAC address matches. It won't be possible for a user that
        # has a matching MAC to use this network (i.e., 00:11:22:33:44:55
        # in this example).
        option iface default_radio0
        option vid 100
        option key guestpass
```

Regarding PSK file creation optimization:

This patch now conditionally runs `hostapd_set_psk_file` depending on `auth_type`.
Previously, `hostapd_set_psk` would always execute `hostapd_set_psk_file`, which
would create a new file if `wifi-station` was in use even if PSK was not enabled.
This change checks the `auth_type` to ensure that it is appropriate to parse the
`wifi-station` entries and create those files.

Furthermore, we now only configure `wpa_psk_file` when it is a supported option
(i.e., psk or psk-sae is used). Previously, we used to configure it when it was
not necessary. While it didn't cause any issues, it would litter `/var/run` with
unnecessary files. This patch fixes that case by configuring it depending on the
`auth_type`.

The new SAE support is aligned with these PSK file changes.

Signed-off-by: Rany Hany <[email protected]>
Link: openwrt#17145
Signed-off-by: John Crispin <[email protected]>
(cherry picked from commit 65a1c66)
Link: openwrt#17248
Signed-off-by: Hauke Mehrtens <[email protected]>
@hauke
hauke force-pushed the 24.10-sae-wifi-station branch from 2b33d70 to 4cc1da1 Compare December 26, 2024 13:56
@openwrt-bot
openwrt-bot merged commit 4cc1da1 into openwrt:openwrt-24.10 Dec 26, 2024
@rany2
rany2 deleted the 24.10-sae-wifi-station branch December 26, 2024 14:25
Lauri-Nomme added a commit to Lauri-Nomme/openwrt that referenced this pull request Sep 23, 2026
…89 (frank asks to move RSS to openwrt#26071; iperf2 posted), no new netdev RSS/LRO rev, OpenWrt 6.18.53 bump PR openwrt#25331, stintel staging mtk TX series, R4Pro_RSS still 1 fix behind; revert run red = empty-targets artifact
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core packages pull request/issue for core (in-tree) packages release/24.10 pull request/issue targeted (also) for OpenWrt 24.10 release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants