From bd5e72734cfdf9a2692a4579e57fb6745767f8b1 Mon Sep 17 00:00:00 2001 From: Ivan Malison Date: Mon, 17 Jun 2019 00:59:34 -0700 Subject: [PATCH] [NixOS] Patch nm/strongswan to allow psk < 20 --- nixos/configuration.nix | 6 +++++- nixos/overlays.nix | 11 +++++++++++ nixos/patch-strongswan.patch | 33 +++++++++++++++++++++++++++++++++ 3 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 nixos/patch-strongswan.patch diff --git a/nixos/configuration.nix b/nixos/configuration.nix index bfb83838..df8e81a9 100644 --- a/nixos/configuration.nix +++ b/nixos/configuration.nix @@ -44,7 +44,11 @@ in # Security and networking security.sudo.wheelNeedsPassword = false; - networking.networkmanager.enable = true; + networking.networkmanager = { + enable = true; + enableStrongSwan = true; + packages = [ pkgs.networkmanager-l2tp ]; + }; networking.firewall.enable = false; # Audio diff --git a/nixos/overlays.nix b/nixos/overlays.nix index c2f41b4c..d959fb4f 100644 --- a/nixos/overlays.nix +++ b/nixos/overlays.nix @@ -65,4 +65,15 @@ self: super: --replace run_keybase $out/bin/keybase-gui ''; }); + networkmanager_strongswan = super.networkmanager_strongswan.overrideAttrs (oldAttrs: rec { + src = super.fetchFromGitHub { + owner = "IvanMalison"; + repo = "NetworkManager-strongswan"; + sha256 = "0vcg58xrjacdswz2fxahgi7shgf2v14mfpscnwza6wns8qx37yzb"; + rev = "2849b1817926b7973a5dc530bed7250c95c733bf"; + }; + }); + strongswanNM = super.strongswanNM.overrideAttrs (oldAttrs: rec { + patches = oldAttrs.patches ++ [ ./patch-strongswan.patch ]; + }); } diff --git a/nixos/patch-strongswan.patch b/nixos/patch-strongswan.patch new file mode 100644 index 00000000..b2932764 --- /dev/null +++ b/nixos/patch-strongswan.patch @@ -0,0 +1,33 @@ +From 71c28adfc1da51bb112ba1c83909d4292f2353cf Mon Sep 17 00:00:00 2001 +From: Ivan Malison +Date: Fri, 14 Jun 2019 16:03:58 -0700 +Subject: [PATCH] Remove dumbass restriction on length of used PSK + +--- + src/charon-nm/nm/nm_service.c | 10 ---------- + 1 file changed, 10 deletions(-) + +diff --git a/src/charon-nm/nm/nm_service.c b/src/charon-nm/nm/nm_service.c +index fb9044d29..ccad2f635 100644 +--- a/src/charon-nm/nm/nm_service.c ++++ b/src/charon-nm/nm/nm_service.c +@@ -409,16 +409,6 @@ static gboolean connect_(NMVpnServicePlugin *plugin, NMConnection *connection, + { + user = identification_create_from_string((char*)str); + str = nm_setting_vpn_get_secret(vpn, "password"); +- if (auth_class == AUTH_CLASS_PSK && +- strlen(str) < 20) +- { +- g_set_error(err, NM_VPN_PLUGIN_ERROR, +- NM_VPN_PLUGIN_ERROR_BAD_ARGUMENTS, +- "pre-shared key is too short."); +- gateway->destroy(gateway); +- user->destroy(user); +- return FALSE; +- } + priv->creds->set_username_password(priv->creds, user, (char*)str); + } + } +-- +2.21.0 +