2017-10-24 22:55:05 +01:00
|
|
|
{ stdenv, fetchurl
|
|
|
|
, pkgconfig, autoreconfHook
|
|
|
|
, gmp, python, iptables, ldns, unbound, openssl, pcsclite
|
|
|
|
, openresolv
|
|
|
|
, systemd, pam
|
2018-04-30 18:28:46 +01:00
|
|
|
, curl
|
|
|
|
, enableTNC ? false, trousers, sqlite, libxml2
|
2017-10-24 22:55:05 +01:00
|
|
|
, enableNetworkManager ? false, networkmanager
|
|
|
|
}:
|
|
|
|
|
2018-04-30 18:28:46 +01: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.
|
|
|
|
|
2017-10-24 22:55:05 +01:00
|
|
|
with stdenv.lib;
|
2014-09-16 19:10:37 +01:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2016-05-23 13:55:05 +01:00
|
|
|
name = "strongswan-${version}";
|
2018-05-30 22:44:54 +01:00
|
|
|
version = "5.6.3";
|
2014-09-16 19:10:37 +01:00
|
|
|
|
|
|
|
src = fetchurl {
|
2018-06-28 19:43:35 +01:00
|
|
|
url = "https://download.strongswan.org/${name}.tar.bz2";
|
2018-05-30 22:44:54 +01:00
|
|
|
sha256 = "095zg7h7qwsc456sqgwb1lhhk29ac3mk5z9gm6xja1pl061driy3";
|
2014-09-16 19:10:37 +01:00
|
|
|
};
|
|
|
|
|
2014-11-25 01:50:17 +00:00
|
|
|
dontPatchELF = true;
|
|
|
|
|
2017-07-19 22:46:49 +01:00
|
|
|
nativeBuildInputs = [ pkgconfig autoreconfHook ];
|
2015-08-03 15:59:33 +01:00
|
|
|
buildInputs =
|
2018-04-30 18:28:46 +01:00
|
|
|
[ curl gmp python iptables ldns unbound openssl pcsclite ]
|
|
|
|
++ optionals enableTNC [ trousers sqlite libxml2 ]
|
2017-10-24 22:55:05 +01:00
|
|
|
++ optionals stdenv.isLinux [ systemd.dev pam ]
|
|
|
|
++ optionals enableNetworkManager [ networkmanager ];
|
2014-12-22 17:24:19 +00:00
|
|
|
|
|
|
|
patches = [
|
2014-12-22 19:55:01 +00:00
|
|
|
./ext_auth-path.patch
|
2014-12-22 17:24:19 +00:00
|
|
|
./firewall_defaults.patch
|
2014-12-22 19:55:01 +00:00
|
|
|
./updown-path.patch
|
2014-12-22 17:24:19 +00:00
|
|
|
];
|
2014-09-19 06:09:00 +01:00
|
|
|
|
2015-08-05 11:12:09 +01:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace src/libcharon/plugins/resolve/resolve_handler.c --replace "/sbin/resolvconf" "${openresolv}/sbin/resolvconf"
|
2017-01-14 19:41:51 +00:00
|
|
|
|
|
|
|
# swanctl can be configured by files in SWANCTLDIR which defaults to
|
|
|
|
# $out/etc/swanctl. Since that directory is in the nix store users can't
|
|
|
|
# modify it. Ideally swanctl accepts a command line option for specifying
|
|
|
|
# the configuration files. In the absence of that we patch swanctl to look
|
|
|
|
# for configuration files in /etc/swanctl.
|
|
|
|
substituteInPlace src/swanctl/swanctl.h --replace "SWANCTLDIR" "\"/etc/swanctl\""
|
2017-11-07 15:40:12 +00:00
|
|
|
# glibc-2.26 reorganized internal includes
|
|
|
|
sed '1i#include <stdint.h>' -i src/libstrongswan/utils/utils/memory.h
|
2015-08-05 11:12:09 +01:00
|
|
|
'';
|
|
|
|
|
2017-01-14 19:41:51 +00:00
|
|
|
preConfigure = ''
|
|
|
|
configureFlagsArray+=("--with-systemdsystemunitdir=$out/etc/systemd/system")
|
|
|
|
'';
|
|
|
|
|
2015-08-03 15:59:33 +01:00
|
|
|
configureFlags =
|
2017-01-14 19:41:51 +00:00
|
|
|
[ "--enable-swanctl" "--enable-cmd" "--enable-systemd"
|
2015-08-04 18:16:27 +01:00
|
|
|
"--enable-farp" "--enable-dhcp"
|
2017-10-17 09:10:42 +01:00
|
|
|
"--enable-openssl"
|
2015-08-04 18:16:27 +01: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 09:25:37 +01:00
|
|
|
"--enable-eap-mschapv2" "--enable-eap-radius" "--enable-xauth-eap" "--enable-ext-auth"
|
2015-08-04 18:16:27 +01:00
|
|
|
"--enable-forecast" "--enable-connmark" "--enable-acert"
|
2015-09-06 20:05:11 +01:00
|
|
|
"--enable-pkcs11" "--enable-eap-sim-pcsc" "--enable-dnscert" "--enable-unbound"
|
2018-04-30 18:28:46 +01:00
|
|
|
"--enable-af-alg" "--enable-xauth-pam" "--enable-chapoly"
|
|
|
|
"--enable-curl" ]
|
2017-10-24 22:55:05 +01:00
|
|
|
++ optionals stdenv.isx86_64 [ "--enable-aesni" "--enable-rdrand" ]
|
|
|
|
++ optional (stdenv.system == "i686-linux") "--enable-padlock"
|
|
|
|
++ optionals enableTNC [
|
2015-08-03 15:59:33 +01: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 18:16:27 +01:00
|
|
|
"--enable-tnc-ifmap" "--enable-tnc-imc" "--enable-tnc-imv"
|
2015-08-03 15:59:33 +01:00
|
|
|
"--with-tss=trousers"
|
|
|
|
"--enable-aikgen"
|
2017-10-24 22:55:05 +01:00
|
|
|
"--enable-sqlite" ]
|
|
|
|
++ optional enableNetworkManager "--enable-nm";
|
2014-09-16 19:10:37 +01:00
|
|
|
|
2017-10-31 11:14:00 +00:00
|
|
|
postInstall = ''
|
|
|
|
# this is needed for l2tp
|
|
|
|
echo "include /etc/ipsec.secrets" >> $out/etc/ipsec.secrets
|
|
|
|
'';
|
|
|
|
|
2014-11-11 06:40:52 +00:00
|
|
|
NIX_LDFLAGS = "-lgcc_s" ;
|
|
|
|
|
2014-09-16 19:10:37 +01:00
|
|
|
meta = {
|
|
|
|
description = "OpenSource IPsec-based VPN Solution";
|
|
|
|
homepage = https://www.strongswan.org;
|
2017-10-24 22:55:05 +01:00
|
|
|
license = licenses.gpl2Plus;
|
|
|
|
platforms = platforms.all;
|
2014-09-16 19:10:37 +01:00
|
|
|
};
|
|
|
|
}
|