From 861f2e81e24067e4f962a1b244d4f5c9d7796749 Mon Sep 17 00:00:00 2001 From: prescientmoon Date: Wed, 11 Sep 2024 15:59:57 +0200 Subject: [PATCH] Connect to eduroam via iwd declaratively --- hosts/nixos/calypso/default.nix | 3 +- hosts/nixos/common/optional/services/iwd.nix | 12 --- .../common/optional/services/iwd/README.md | 1 + .../common/optional/services/iwd/default.nix | 29 ++++++ .../common/optional/services/iwd/eduroam.pem | 98 +++++++++++++++++++ hosts/nixos/common/secrets.yaml | 5 +- 6 files changed, 133 insertions(+), 15 deletions(-) delete mode 100644 hosts/nixos/common/optional/services/iwd.nix create mode 100644 hosts/nixos/common/optional/services/iwd/README.md create mode 100644 hosts/nixos/common/optional/services/iwd/default.nix create mode 100644 hosts/nixos/common/optional/services/iwd/eduroam.pem diff --git a/hosts/nixos/calypso/default.nix b/hosts/nixos/calypso/default.nix index 438ef9a..b200274 100644 --- a/hosts/nixos/calypso/default.nix +++ b/hosts/nixos/calypso/default.nix @@ -17,11 +17,12 @@ ../common/optional/desktop/steam.nix ../common/optional/wayland/hyprland.nix - ../common/optional/services/iwd.nix ../common/optional/services/kanata.nix ../common/optional/services/nginx.nix ../common/optional/services/syncthing.nix + ../common/optional/services/tailscale.nix ../common/optional/services/restic + ../common/optional/services/iwd ./services/snapper.nix diff --git a/hosts/nixos/common/optional/services/iwd.nix b/hosts/nixos/common/optional/services/iwd.nix deleted file mode 100644 index 7cad45c..0000000 --- a/hosts/nixos/common/optional/services/iwd.nix +++ /dev/null @@ -1,12 +0,0 @@ -{ - networking.wireless.iwd = { - enable = true; - - settings = { - IPv6.Enabled = true; - Settings.AutoConnect = true; - }; - }; - - environment.persistence."/persist/state".directories = [ "/var/lib/iwd" ]; -} diff --git a/hosts/nixos/common/optional/services/iwd/README.md b/hosts/nixos/common/optional/services/iwd/README.md new file mode 100644 index 0000000..e912aba --- /dev/null +++ b/hosts/nixos/common/optional/services/iwd/README.md @@ -0,0 +1 @@ +The certificate is taken from the source code of the python script found at [cat.eduroam.org](https://cat.eduroam.org/) for my university, so I assume it's ok to share around? diff --git a/hosts/nixos/common/optional/services/iwd/default.nix b/hosts/nixos/common/optional/services/iwd/default.nix new file mode 100644 index 0000000..a3d2af3 --- /dev/null +++ b/hosts/nixos/common/optional/services/iwd/default.nix @@ -0,0 +1,29 @@ +{ config, ... }: +{ + networking.wireless.iwd = { + enable = true; + + settings = { + IPv6.Enabled = true; + Settings.AutoConnect = true; + }; + }; + + environment.persistence."/persist/state".directories = [ "/var/lib/iwd" ]; + + sops.templates."eduroam.8021x".path = "/var/lib/iwd/eduroam.8021x"; + sops.secrets.eduroam_pass.sopsFile = ../../../secrets.yaml; + sops.templates."eduroam.8021x".content = '' + [Security] + EAP-Method=PEAP + EAP-Identity=s5260329@rug.nl + EAP-PEAP-CACert=${./eduroam.pem} + EAP-PEAP-Phase2-Method=MSCHAPV2 + EAP-PEAP-Phase2-Identity=s5260329@rug.nl + EAP-PEAP-Phase2-Password=${config.sops.placeholder.eduroam_pass} + EAP-PEAP-ServerDomainMask=radius.rug.nl + + [Settings] + AutoConnect=true + ''; +} diff --git a/hosts/nixos/common/optional/services/iwd/eduroam.pem b/hosts/nixos/common/optional/services/iwd/eduroam.pem new file mode 100644 index 0000000..719974e --- /dev/null +++ b/hosts/nixos/common/optional/services/iwd/eduroam.pem @@ -0,0 +1,98 @@ +-----BEGIN CERTIFICATE----- +MIIEMjCCAxqgAwIBAgIBATANBgkqhkiG9w0BAQUFADB7MQswCQYDVQQGEwJHQjEb +MBkGA1UECAwSR3JlYXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHDAdTYWxmb3JkMRow +GAYDVQQKDBFDb21vZG8gQ0EgTGltaXRlZDEhMB8GA1UEAwwYQUFBIENlcnRpZmlj +YXRlIFNlcnZpY2VzMB4XDTA0MDEwMTAwMDAwMFoXDTI4MTIzMTIzNTk1OVowezEL +MAkGA1UEBhMCR0IxGzAZBgNVBAgMEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4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bsEBF1EOFpz/YS2H6mSwcFaNJbnYqqJHIvm3PLJHkFm +EoLXRVrQXdCT+3wgBfgU6heCV5CYBz/YkrdWES7tiiT8sVUDqXmVlTsbiRNiyLs2 +bmEWWFUl76jViIJog5fongEqN3jLIGTG/mXrJT1UyymIcobnIGrbwwRVz/mpFQo0 +vBYIi1k2ThVh0Dx88BbF9YiP84dd8Fkn5wbE6FxXYJ287qfRTgmhePecPc73Yrzt +apdRcsKVGkOpaTIJP/l+lAHRLZxk/dUtyN95G++bOSQqnOCpVPabUGl2E/OEyFrp +Ipwgu2L/WJclvd6g+ZA/iWkLSMcpnFb+uX6QBqvD6+RNxul1FaB5iHY= +-----END CERTIFICATE----- diff --git a/hosts/nixos/common/secrets.yaml b/hosts/nixos/common/secrets.yaml index 919ac67..6b5ab79 100644 --- a/hosts/nixos/common/secrets.yaml +++ b/hosts/nixos/common/secrets.yaml @@ -1,4 +1,5 @@ wireless: ENC[AES256_GCM,data:uHQOb3ilMi0kHsLFz9QZpSiYB6w9cTjCKwBN+TONY+H4arV4EUxzTottEDKQAFZbrNIeq2BU22QpfYMdmiH/6QiODLybWDJQ4fG3L2RzzUTlqZ9uL/uvkRmIXVh9Y4yHn9F+HftYvUaPgKEuVtHfqWleNCjOl6caKZcWEGM0/ow4nGcEfpT5PZsFn27yzKpcVn8A6XUJLTGhdvSSnkixauybEsQh9IszESVb44QYabjEemB7w05bBHn3R148OqDXaBs4LdrDQNjEIJlGTaMeE4WRrRMXu6DMcYexUFRUHZQBJ+RbOkL+qh0U2127AoC7lUTSO0isHw+LG1U78he80sQzvqBBAeK3Crgk,iv:Rmqsj4j69JEKkmuJTn7+JR9q72Fx+Ko7DZeGakxPCFc=,tag:zKXYbjdvgCkvuZLQEubt9g==,type:str] +eduroam_pass: ENC[AES256_GCM,data:MFEwZVi9zF3N67sqGtTY,iv:oxwpPaXZlzHv7BEZhAnT+/Tr3QGm15d6suGMaV1W7Kw=,tag:0G/wXkjNkfh8mjpXBJxaxA==,type:str] pilot_password: ENC[AES256_GCM,data:PiKJCv5x68O9HFM4UvqLnsSPtqFslBLeAg67OkvFAbw7WaqbXh/p5SQblhPHcJ7jQDc4kI3XesOxruZrfJ0aZNDV1g7MWecgKg==,iv:EVs/m83Zfx2NRQMO52cF6pCe1ETpYfaR6lmXg2Na/DI=,tag:dl2x1aTsaTgtHEZYdW2lmg==,type:str] cloudflare_dns_api_token: ENC[AES256_GCM,data:QlLxQ/4AQsdqdWJC//FRgbMRqR0Ni51JgCDlyXfNe4pfPtiPs+Gb6Q==,iv:7SS+EzeHk0J1DzVvKxd40AuZUidV2asoQbSr5vyxl+U=,tag:T1KGXOsZ26sICYbrcmU8+w==,type:str] backup_password: ENC[AES256_GCM,data:Tu7ODTALfQLX7Mbo/BqiM6gaErGv07urwN1iHwGgurKWDuuE1h5NMV5J0cJqW6orTIloVtoZTJgSJ2lZlMcfUQ==,iv:78ha833ZzgEDChIuGjCMVA89U4qY9lWqUmfPCiiQeQM=,tag:u8KWw/060UVP+OOoPhbjRA==,type:str] @@ -62,8 +63,8 @@ sops: YnQ4SnljYXBBOUZWQisxZTBrcERYZVUKvMK8LbBt482Vs5i+yBE6SmKWiLLIaEwD oSnmItFMeqtW+D1YR+YfODckgKjCuDYoIHmHe0TGYnYZpd/xo0vHTA== -----END AGE ENCRYPTED FILE----- - lastmodified: "2024-07-29T19:34:39Z" - mac: ENC[AES256_GCM,data:ruCV2JKgFN6BiTYjOwlhNmjDCh9ZRJ9E+H0x0uVevZnsTEcFlTUh5iNSiw3uJtcKcA4H4kuGPXlolyxuGVGsAhVFD4G3zR84i9TTHmGT4STC2dNebcA9VUXVnfPhEUFAExrPRxbEqvx3o0QPZIfGonPQzl3xhJzOPahYsRJOwTQ=,iv:rSuuhOgzOgE7DosgVEWDT1jenF3m+NqnCSEKjoCBrfE=,tag:7pAV4jKvJYG1vPqEEMqOPg==,type:str] + lastmodified: "2024-09-11T13:44:03Z" + mac: ENC[AES256_GCM,data:uRdBwVDRiagp3Wh8e/JxxVK4p8SE5BardFh8Jin0wDg9VIILzPrYjoqb3qMS10xqrM3QcXy3CfobrogfWLaS2G88FziiUFGm0eSQnq29gGrFDJFOu7zUwGHwFIQ4BaABytj04bLY6u4E1AAEIpaTCs9ODc0c/WS0Cpaad/XtdF0=,iv:dkkH0/cBVk4WjqXgsbhjHMjF2QhcrRlA9ckok83jlfw=,tag:hHobJ9oWlTIo2PQgt6WnTA==,type:str] pgp: [] unencrypted_suffix: _unencrypted version: 3.8.1