2021-01-15 10:19:50 +01:00
|
|
|
{ lib, stdenv, fetchurl, fetchpatch
|
2021-01-17 04:51:22 +01:00
|
|
|
, pkg-config, autoreconfHook
|
2019-12-25 07:46:32 +01:00
|
|
|
, gmp, python3, iptables, ldns, unbound, openssl, pcsclite, glib
|
2017-10-24 23:55:05 +02:00
|
|
|
, openresolv
|
|
|
|
, systemd, pam
|
2018-04-30 19:28:46 +02:00
|
|
|
, curl
|
|
|
|
, enableTNC ? false, trousers, sqlite, libxml2
|
2017-10-24 23:55:05 +02:00
|
|
|
, enableNetworkManager ? false, networkmanager
|
2019-03-06 15:14:57 +01:00
|
|
|
, darwin
|
2017-10-24 23:55:05 +02:00
|
|
|
}:
|
|
|
|
|
2018-04-30 19:28:46 +02:00
|
|
|
# Note on curl support: If curl is built with gnutls as its backend, the
|
|
|
|
# strongswan curl plugin may break.
|
|
|
|
# See https://wiki.strongswan.org/projects/strongswan/wiki/Curl for more info.
|
|
|
|
|
2021-01-15 10:19:50 +01:00
|
|
|
with lib;
|
2014-09-16 20:10:37 +02:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2019-08-15 14:41:18 +02:00
|
|
|
pname = "strongswan";
|
2019-09-29 06:57:15 +02:00
|
|
|
version = "5.8.1"; # Make sure to also update <nixpkgs/nixos/modules/services/networking/strongswan-swanctl/swanctl-params.nix> when upgrading!
|
2014-09-16 20:10:37 +02:00
|
|
|
|
|
|
|
src = fetchurl {
|
2019-08-15 14:41:18 +02:00
|
|
|
url = "https://download.strongswan.org/${pname}-${version}.tar.bz2";
|
2019-09-29 06:57:15 +02:00
|
|
|
sha256 = "034rd6kr1bmnvj8rg2kcxdjb0cgj3dn9310mmm94j1awxan71byr";
|
2014-09-16 20:10:37 +02:00
|
|
|
};
|
|
|
|
|
2014-11-25 02:50:17 +01:00
|
|
|
dontPatchELF = true;
|
|
|
|
|
2021-01-17 04:51:22 +01:00
|
|
|
nativeBuildInputs = [ pkg-config autoreconfHook ];
|
2015-08-03 16:59:33 +02:00
|
|
|
buildInputs =
|
2019-12-25 07:46:32 +01:00
|
|
|
[ curl gmp python3 ldns unbound openssl pcsclite ]
|
2018-04-30 19:28:46 +02:00
|
|
|
++ optionals enableTNC [ trousers sqlite libxml2 ]
|
2019-03-06 15:14:57 +01:00
|
|
|
++ optionals stdenv.isLinux [ systemd.dev pam iptables ]
|
|
|
|
++ optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [ SystemConfiguration ])
|
2019-10-15 16:03:21 +02:00
|
|
|
++ optionals enableNetworkManager [ networkmanager glib ];
|
2014-12-22 18:24:19 +01:00
|
|
|
|
|
|
|
patches = [
|
2014-12-22 20:55:01 +01:00
|
|
|
./ext_auth-path.patch
|
2014-12-22 18:24:19 +01:00
|
|
|
./firewall_defaults.patch
|
2014-12-22 20:55:01 +01:00
|
|
|
./updown-path.patch
|
2019-09-16 18:13:42 +02:00
|
|
|
|
|
|
|
# Don't use etc/dbus-1/system.d
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://patch-diff.githubusercontent.com/raw/strongswan/strongswan/pull/150.patch";
|
|
|
|
sha256 = "1irfxb99blb8v3hs0kmlhzkkwbmds1p0gq319z8lmacz36cgyj2c";
|
|
|
|
})
|
2014-12-22 18:24:19 +01:00
|
|
|
];
|
2014-09-19 07:09:00 +02:00
|
|
|
|
2019-03-08 14:16:15 +01:00
|
|
|
postPatch = optionalString stdenv.isLinux ''
|
2017-11-07 16:40:12 +01:00
|
|
|
# glibc-2.26 reorganized internal includes
|
|
|
|
sed '1i#include <stdint.h>' -i src/libstrongswan/utils/utils/memory.h
|
2019-03-06 15:14:57 +01:00
|
|
|
|
|
|
|
substituteInPlace src/libcharon/plugins/resolve/resolve_handler.c --replace "/sbin/resolvconf" "${openresolv}/sbin/resolvconf"
|
2015-08-05 12:12:09 +02:00
|
|
|
'';
|
|
|
|
|
2015-08-03 16:59:33 +02:00
|
|
|
configureFlags =
|
2019-03-06 15:14:57 +01:00
|
|
|
[ "--enable-swanctl"
|
|
|
|
"--enable-cmd"
|
2017-10-17 10:10:42 +02:00
|
|
|
"--enable-openssl"
|
2015-08-04 19:16:27 +02:00
|
|
|
"--enable-eap-sim" "--enable-eap-sim-file" "--enable-eap-simaka-pseudonym"
|
|
|
|
"--enable-eap-simaka-reauth" "--enable-eap-identity" "--enable-eap-md5"
|
|
|
|
"--enable-eap-gtc" "--enable-eap-aka" "--enable-eap-aka-3gpp2"
|
2017-10-22 10:25:37 +02:00
|
|
|
"--enable-eap-mschapv2" "--enable-eap-radius" "--enable-xauth-eap" "--enable-ext-auth"
|
2019-03-06 15:14:57 +01:00
|
|
|
"--enable-acert"
|
2015-09-06 21:05:11 +02:00
|
|
|
"--enable-pkcs11" "--enable-eap-sim-pcsc" "--enable-dnscert" "--enable-unbound"
|
2019-03-06 15:14:57 +01:00
|
|
|
"--enable-chapoly"
|
2018-04-30 19:28:46 +02:00
|
|
|
"--enable-curl" ]
|
2019-03-06 15:14:57 +01:00
|
|
|
++ optionals stdenv.isLinux [
|
|
|
|
"--enable-farp" "--enable-dhcp"
|
2019-04-30 10:27:49 +02:00
|
|
|
"--enable-systemd" "--with-systemdsystemunitdir=${placeholder "out"}/etc/systemd/system"
|
2019-03-06 15:14:57 +01:00
|
|
|
"--enable-xauth-pam"
|
|
|
|
"--enable-forecast"
|
|
|
|
"--enable-connmark"
|
|
|
|
"--enable-af-alg" ]
|
2017-10-24 23:55:05 +02:00
|
|
|
++ optionals stdenv.isx86_64 [ "--enable-aesni" "--enable-rdrand" ]
|
2018-08-20 21:11:29 +02:00
|
|
|
++ optional (stdenv.hostPlatform.system == "i686-linux") "--enable-padlock"
|
2017-10-24 23:55:05 +02:00
|
|
|
++ optionals enableTNC [
|
2015-08-03 16:59:33 +02:00
|
|
|
"--disable-gmp" "--disable-aes" "--disable-md5" "--disable-sha1" "--disable-sha2" "--disable-fips-prf"
|
|
|
|
"--enable-eap-tnc" "--enable-eap-ttls" "--enable-eap-dynamic" "--enable-tnccs-20"
|
|
|
|
"--enable-tnc-imc" "--enable-imc-os" "--enable-imc-attestation"
|
|
|
|
"--enable-tnc-imv" "--enable-imv-attestation"
|
2015-08-04 19:16:27 +02:00
|
|
|
"--enable-tnc-ifmap" "--enable-tnc-imc" "--enable-tnc-imv"
|
2015-08-03 16:59:33 +02:00
|
|
|
"--with-tss=trousers"
|
|
|
|
"--enable-aikgen"
|
2017-10-24 23:55:05 +02:00
|
|
|
"--enable-sqlite" ]
|
2018-09-06 16:17:52 +02:00
|
|
|
++ optionals enableNetworkManager [
|
|
|
|
"--enable-nm"
|
2019-03-06 15:14:57 +01:00
|
|
|
"--with-nm-ca-dir=/etc/ssl/certs" ]
|
|
|
|
# Taken from: https://wiki.strongswan.org/projects/strongswan/wiki/MacOSX
|
|
|
|
++ optionals stdenv.isDarwin [
|
|
|
|
"--disable-systemd"
|
|
|
|
"--disable-xauth-pam"
|
|
|
|
"--disable-kernel-netlink"
|
|
|
|
"--enable-kernel-pfkey"
|
|
|
|
"--enable-kernel-pfroute"
|
|
|
|
"--enable-kernel-libipsec"
|
|
|
|
"--enable-osx-attr"
|
|
|
|
"--disable-scripts"
|
2018-09-06 16:17:52 +02:00
|
|
|
];
|
2014-09-16 20:10:37 +02:00
|
|
|
|
2017-10-31 12:14:00 +01:00
|
|
|
postInstall = ''
|
|
|
|
# this is needed for l2tp
|
|
|
|
echo "include /etc/ipsec.secrets" >> $out/etc/ipsec.secrets
|
|
|
|
'';
|
|
|
|
|
2019-03-06 15:14:57 +01:00
|
|
|
NIX_LDFLAGS = optionalString stdenv.cc.isGNU "-lgcc_s" ;
|
2014-11-11 07:40:52 +01:00
|
|
|
|
2014-09-16 20:10:37 +02:00
|
|
|
meta = {
|
|
|
|
description = "OpenSource IPsec-based VPN Solution";
|
2020-04-01 03:11:51 +02:00
|
|
|
homepage = "https://www.strongswan.org";
|
2017-10-24 23:55:05 +02:00
|
|
|
license = licenses.gpl2Plus;
|
|
|
|
platforms = platforms.all;
|
2014-09-16 20:10:37 +02:00
|
|
|
};
|
|
|
|
}
|