Skip to content

hostapd: convert wpa_psk_file items to sae_password parameters - #14343

Closed
rany2 wants to merge 1 commit into
openwrt:mainfrom
rany2:wpa-file-to-sae-passwd
Closed

rany2 wants to merge 1 commit into
openwrt:mainfrom
rany2:wpa-file-to-sae-passwd

Conversation

@rany2

@rany2 rany2 commented Jan 5, 2024 •

Copy link
Copy Markdown
Contributor

When SAE-only or SAE mixed mode is set and wpa_psk_file is enabled; SAE will not work without manually adding the sae_passphrase items to the hostapd config as well. This automatically handles the conversion of the wpa_psk_file file to the sae_passphrase analogues.

Only the pk parameter to sae_password doesn't have an analogue in wpa_psk_file however this shouldn't be needed for most users.

Limitations:

  • WPA PSK file supports duplicate (mac,id) pairs but SAE does not. This is most problematic for a common use case where someone wants to have two wildcard entries that point to different VLANs (like a LAN and IoT).

@rany2
rany2 force-pushed the wpa-file-to-sae-passwd branch from 2ff8658 to c4e29af Compare January 5, 2024 19:49
@github-actions github-actions Bot added the core packages pull request/issue for core (in-tree) packages label Jan 5, 2024
When SAE-only or SAE mixed mode is set and wpa_psk_file is enabled; SAE
will not work without manually adding the sae_passphrase items to the
hostapd config as well. This automatically handles the conversion of the
wpa_psk_file file to the sae_passphrase analogues.

Only the pk parameter to sae_password doesn't have an analogue in
wpa_psk_file however this shouldn't be needed for most users.

Limitations:

- WPA PSK file supports duplicate (mac,id) pairs but SAE does not. This
  is most problematic for a common use case where someone wants to have
  two wildcard entries that point to different VLANs (like a LAN and IoT).

Signed-off-by: Rany Hany <[email protected]>
@rany2
rany2 force-pushed the wpa-file-to-sae-passwd branch from c4e29af to 26575d4 Compare January 14, 2024 18:58
@roshii

roshii commented Jan 21, 2024

Copy link
Copy Markdown

I came upon the same issue but took a different approach to resolve it, actually leading to no know limitations.
See #14448

@rany2

rany2 commented Jan 21, 2024 •

Copy link
Copy Markdown
Contributor Author

@roshii I suggest you wait until the sae_password_file parameter is added to hostapd that is available in OpenWRT. See https://w1.fi/cgit/hostap/commit/hostapd/hostapd.conf?id=e748e50c629f3e8d3c1c99843ef5439e568ed3ec

This is just so that the user doesn't have to set both WPA2 and SAE parameters.

@rany2

rany2 commented Jan 21, 2024 •

Copy link
Copy Markdown
Contributor Author

actually leading to no know limitations

The limitation is fundamentally because SAE is different from WPA2. In SAE, if you set the same macaddr and keyId pair to some other config entry; it will override it. With WPA2, you can do something like:

00:00:00:00:00:00 password1
00:00:00:00:00:00 password2

and both password1 and password2 will be accepted. With SAE, this does not work and you will need to set a different keyid for password2; which is not supported for any mainstream OS (Android, iOS, Windows, etc.)

@roshii

roshii commented Jan 21, 2024 •

Copy link
Copy Markdown

In SAE, if you set the same macaddr and keyId pair to some other config entry; it will override it

mac entry is optional in sae_password, so if mac address is 00:00:00:00:00:00 (catch-all) mac should not be set for SAE. so the limitation can easily be overcome with you approach as well.

This is just so that the user doesn't have to set both WPA2 and SAE parameters.

It definitely make sense. I will therefore adapt my PR to make it a definitive solution for once sae_password_file parameter is added to hostapd that is available in OpenWRT.

@rany2

rany2 commented Jan 21, 2024

Copy link
Copy Markdown
Contributor Author

mac entry is optional in sae_password, so if mac address is 00:00:00:00:00:00 (catch-all) mac should not be set for SAE. so the limitation can easily be overcome with you approach as well.

That doesn't work. It behaves the same, in effect the default parameter when mac is not specified is ff:ff:ff:ff:ff:ff...

@roshii

roshii commented Jan 21, 2024 •

Copy link
Copy Markdown

That doesn't work. It behaves the same, in effect the default parameter when mac is not specified is ff:ff:ff:ff:ff:ff...

Works fine for me with the implementation from my PR. I can connect WPA3 clients and assign VLAN IDs without specifying any mac address

From https://w1.fi/cgit/hostap/plain/hostapd/hostapd.conf:

# If the peer MAC address is not included or is set to the wildcard address
# (ff:ff:ff:ff:ff:ff), the entry is available for any station to use. If a
# specific peer MAC address is included, only a station with that MAC address
# is allowed to use the entry.
#
# If the password identifier (with non-zero length) is included, the entry is
# limited to be used only with that specified identifier.

# The last matching (based on peer MAC address and identifier) entry is used to
# select which password to use. Setting sae_password to an empty string has a
# special meaning of removing all previously added entries.
#
# sae_password uses the following encoding:
#<password/credential>[|mac=<peer mac>][|vlanid=<VLAN ID>]
#[|pk=<m:ECPrivateKey-base64>][|id=<identifier>]
# Examples:
#sae_password=secret
#sae_password=really secret|mac=ff:ff:ff:ff:ff:ff
#sae_password=example secret|mac=02:03:04:05:06:07|id=pw identifier
#sae_password=example secret|vlanid=3|id=pw identifier

@rany2

rany2 commented Jan 21, 2024 •

Copy link
Copy Markdown
Contributor Author

Works fine for me with the implementation from my PR. I can connect WPA3 clients and assign VLAN IDs without specifying any mac address

Are you sure? The issue at hand is that you can't set the same SAE password for the same macaddr, keyid pair. So for example, if you had:

sae_password=password1|vlanid=1
sae_password=password2|vlanid=2

HostAPd will override password1 and you will only be able to access VLAN 2 with password2. This is because, as previously stated the macaddr,keyid pairs are duplicates. HostAPd overrides the previous entry when that happens.

Edit: even if macaddr,keyid is not explicitly set, they do have a value.

@roshii

roshii commented Jan 21, 2024

Copy link
Copy Markdown

Are you sure?

You are right, unfortunately... I could connect with the different password I had set only because the client I used kept the same mac address. Randomizing mac on the client causes authentication to fail.

@roshii

roshii commented Jan 22, 2024

Copy link
Copy Markdown

I could connect with the different password I had set only because the client I used kept the same mac address. Randomizing mac on the client causes authentication to fail.

Further testing demonstrate the following.

  • When a client connects to the AP with the password set in the last sae_password entry it connects as intended and is assigned the correct VLAN ID.
  • When the client, keeping the same mac address, connects to the AP using a random (!?) password, he is authenticated and assigned to the default network, as defined by wifi-iface config section.

@rany2 do you think the could be related to OpenWrt? I am suspecting hostap and would like to hear your opinion before raising the issue.

@rany2

rany2 commented Jan 22, 2024

Copy link
Copy Markdown
Contributor Author

When a client connects to the AP with the password set in the last sae_password entry it connects as intended and is assigned the correct VLAN ID.

This is expected per the hostapd documentation.

When the client, keeping the same mac address, connects to the AP using a random (!?) password, he is authenticated and assigned to the default network, as defined by wifi-iface config section.

I really doubt this, how are you testing this?

@roshii

roshii commented Jan 22, 2024 •

Copy link
Copy Markdown

I really doubt this, how are you testing this?

(edited)
Removed bug description, now available at #14458

@rany2

rany2 commented Jan 22, 2024

Copy link
Copy Markdown
Contributor Author

I suggest you make a new issue about this, I can't reproduce it myself and don't see why it should be discussed in this PR.

@rany2 rany2 closed this Jun 11, 2024
@rany2
rany2 deleted the wpa-file-to-sae-passwd branch December 12, 2024 11:26
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants