Skip to content

Instantly share code, notes, and snippets.

@erictapen
Created February 14, 2019 19:48
Show Gist options
  • Save erictapen/841190c8b7d63b775df21123d55eddcb to your computer and use it in GitHub Desktop.
Save erictapen/841190c8b7d63b775df21123d55eddcb to your computer and use it in GitHub Desktop.
My NixOS module for the eduroam at FH Potsdam
{ config, pkgs, ... }:{
networking.wireless = {
enable = true;
userControlled.enable = true;
networks = {
eduroam =
let
# define an awk script, that cuts one certificate out of the
# ca-bundle.crt file
cert = pkgs.stdenv.mkDerivation rec{
name = "telesec-globalroot-class-2.pem";
src = builtins.toFile "${name}-awk-helper" ''
{
if(a > 0) {
print
}
}
/-----END CERTIFICATE-----/ {
a = 0
}
/T-TeleSec GlobalRoot Class 2/ {
a = 1
}
'';
nativeBuildInputs = with pkgs; [ cacert gawk ];
phases = "installPhase";
installPhase = "${pkgs.gawk}/bin/awk -f $src ${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt > $out";
};
in
{
auth = ''
key_mgmt=WPA-EAP
eap=PEAP
identity="s12345@fh-potsdam.de"
password="mypassword"
altsubject_match="DNS:dc1.campus.fh-potsdam.de"
anonymous_identity="eduroam@fh-potsdam.de"
phase2="auth=MSCHAPV2"
ca_cert="${cert}"
'';
};
};
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment