netplan generate incorrectly quotes WPA PSK hex

Bug #1867690 reported by Anurag Dulapalli
20
This bug affects 6 people
Affects Status Importance Assigned to Milestone
Netplan
Fix Released
Undecided
Łukasz Zemczak

Bug Description

This was discovered on an Ubuntu Core 18 running arm64 machine.

Please note that `wpa_supplicant` accepts (optionally) quoted plaintext strings as well as hex strings as field values for `psk=`. However, hex strings specifically are invalid unless they are un-quoted

Suppose the target `wpa_supplicant` compatible configuration is as follows:
```
network={
  ssid="<SSID_NAME>"
  psk=<PSK_HEX_STRING_UNQUOTED>
}
```

Then providing a `netplan` YAML configuration as follows, should result in the above:
```
network:
  ethernets:
    eth0:
      addresses: []
      dhcp4: true
  version: 2
  wifis:
    wlan0:
      access-points:
        "<SSID_NAME>":
          auth:
            key-management: psk
            password: <PSK_HEX_STRING_UNQUOTED>
      addresses: []
      dhcp4: true
      nameservers: {}

```

However, the actual resulting `wpa_supplicant` configuration by `netplan generate` is the following:
```
ctrl_interface=/run/wpa_supplicant
network={
  ssid="<SSID_NAME>"
  key_mgmt=WPA-PSK
  psk="<PSK_HEX_STRING_UNQUOTED>"
}
```

description: updated
description: updated
Revision history for this message
Anurag Dulapalli (anurag-k4) wrote :

There is a Pull Request available that addresses this issue, here:
https://github.com/CanonicalLtd/netplan/pull/118

Revision history for this message
Łukasz Zemczak (sil2100) wrote :

Thanks! As per PR comment, I have submitted a new PR for the other approach I mentioned:
https://github.com/CanonicalLtd/netplan/pull/120
What do you think?

Changed in netplan:
assignee: nobody → Łukasz Zemczak (sil2100)
status: New → In Progress
Changed in netplan:
status: In Progress → Fix Committed
tags: added: id-5e72d802f424721a8c367b4d
Revision history for this message
Lukas Märdian (slyon) wrote :

Released as of netplan.io 0.99

Changed in netplan:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.