Skip to content

RFC Encrypt secrets using systemd provided key

James Prestwood iwd 2 versions – New

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 RFC Latest3 patches 0 repliesNew
  2. v1 RFC2 patches 12 repliesSuperseded

Changes in v2 from the cover letter

- Encrypt entire [Settings] group. Rather than needing to add a new 'Encrypted' option for each key, encrypt the entire group. This makes 8021x much easier to handle as well since those options are recursively filled (e.g. -Phase2). Handling these individually would be quite nasty.

- Use a salt value when encrypting/decryption (EncryptedSalt)

- Use AES-SIV instead of AES-CTR. The auth data is set to the encrypted salt and network->ssid. This ensures a unique encrypted value even if the passphrase is the same. AES-SIV also verifies the IV on decrypt automatically so you know if it failed or succeeded.

- Added a new tool: decrypt-profile. This is nice for debugging and could be used to recover encrypted profiles if you know the secret.

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3main: add SystemdEncrypt option, and initialize keysrc/iwd.h src/main.c+66 -00 replies
2/3network: add support for encrypted [Security] groupsrc/network.c+157 -200 replies
3/3tools: add decrypt-profile toolMakefile.am tools/decrypt-profile.c+208 -10 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [RFCv2 0/3] Encrypt secrets using systemd provided key

v1 -> v2:
- Encrypt entire [Settings] group. Rather than needing to add a new 'Encrypted' option for each key, encrypt the entire group. This makes 8021x much easier to handle as well since those options are recursively filled (e.g. -Phase2). Handling these individually would be quite nasty.

- Use a salt value when encrypting/decryption (EncryptedSalt)

- Use AES-SIV instead of AES-CTR. The auth data is set to the encrypted salt and network->ssid. This ensures a unique encrypted value even if the passphrase is the same. AES-SIV also verifies the IV on decrypt automatically so you know if it failed or succeeded.

- Added a new tool: decrypt-profile. This is nice for debugging and could be used to recover encrypted profiles if you know the secret.

Also if you want to play with this this yourself you can try it out even without systemd. Systemd only sets the CREDENTIALS_DIRECTORY environment variable which can be done manually. It should point to a file containing the decrypted secret:

Create a file named 'iwd-secret' with a secret (can be binary too). For example:

/var/lib/iwd/iwd-secret:
secret123

Enable SystemdEncrypt=true in main.conf

Start IWD with CREDENTIALS_DIRECTORY set:

CREDENTIALS_DIRECTORY=/var/lib/iwd ./src/iwd

You may also want to use a separate storage directory as IWD will encrypt any profile once connected to that network (i.e. when IWD sync's).

James Prestwood (3):
main: add SystemdEncrypt option, and initialize key
network: add support for encrypted [Security] group
tools: add decrypt-profile tool

 Makefile.am             |   8 +-
 src/iwd.h               |   1 +
 src/main.c              |  65 +++++++++++++
 src/network.c           | 177 +++++++++++++++++++++++++++++++----
 tools/decrypt-profile.c | 201 ++++++++++++++++++++++++++++++++++++++++
 5 files changed, 431 insertions(+), 21 deletions(-)
 create mode 100644 tools/decrypt-profile.c
Signature · 1 line
2.31.1