2017-08-22 22:09:16 +00:00
|
|
|
{ stdenv, fetchurl, gmp, pkgconfig, python, autoreconfHook
|
2015-08-05 10:12:09 +00:00
|
|
|
, curl, trousers, sqlite, iptables, libxml2, openresolv
|
2017-07-19 21:46:49 +00:00
|
|
|
, ldns, unbound, pcsclite, openssl, systemd, pam
|
2015-08-03 14:59:33 +00:00
|
|
|
, enableTNC ? false }:
|
2014-09-16 18:10:37 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2016-05-23 12:55:05 +00:00
|
|
|
name = "strongswan-${version}";
|
2017-11-27 16:36:09 +00:00
|
|
|
version = "5.6.1";
|
2014-09-16 18:10:37 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "http://download.strongswan.org/${name}.tar.bz2";
|
2017-11-27 16:36:09 +00:00
|
|
|
sha256 = "0lxbyiary8iapx3ysw40czrmxf983fhfzs5mvz2hk1j1mpc85hp0";
|
2014-09-16 18:10:37 +00:00
|
|
|
};
|
|
|
|
|
2014-11-25 01:50:17 +00:00
|
|
|
dontPatchELF = true;
|
|
|
|
|
2017-07-19 21:46:49 +00:00
|
|
|
nativeBuildInputs = [ pkgconfig autoreconfHook ];
|
2015-08-03 14:59:33 +00:00
|
|
|
buildInputs =
|
2017-07-19 21:46:49 +00:00
|
|
|
[ gmp python iptables ldns unbound openssl pcsclite ]
|
|
|
|
++ stdenv.lib.optionals enableTNC [ curl trousers sqlite libxml2 ]
|
|
|
|
++ stdenv.lib.optionals stdenv.isLinux [ systemd.dev pam ];
|
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 05:09:00 +00:00
|
|
|
|
2015-08-05 10:12:09 +00: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 10:12:09 +00:00
|
|
|
'';
|
|
|
|
|
2017-01-14 19:41:51 +00:00
|
|
|
preConfigure = ''
|
|
|
|
configureFlagsArray+=("--with-systemdsystemunitdir=$out/etc/systemd/system")
|
|
|
|
'';
|
|
|
|
|
2015-08-03 14:59:33 +00:00
|
|
|
configureFlags =
|
2017-01-14 19:41:51 +00:00
|
|
|
[ "--enable-swanctl" "--enable-cmd" "--enable-systemd"
|
2015-08-04 17:16:27 +00:00
|
|
|
"--enable-farp" "--enable-dhcp"
|
2017-10-17 08:10:42 +00:00
|
|
|
"--enable-openssl"
|
2015-08-04 17:16:27 +00: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 08:25:37 +00:00
|
|
|
"--enable-eap-mschapv2" "--enable-eap-radius" "--enable-xauth-eap" "--enable-ext-auth"
|
2015-08-04 17:16:27 +00:00
|
|
|
"--enable-forecast" "--enable-connmark" "--enable-acert"
|
2015-09-06 19:05:11 +00:00
|
|
|
"--enable-pkcs11" "--enable-eap-sim-pcsc" "--enable-dnscert" "--enable-unbound"
|
2017-07-19 21:48:05 +00:00
|
|
|
"--enable-af-alg" "--enable-xauth-pam" "--enable-chapoly" ]
|
2016-12-31 13:26:17 +00:00
|
|
|
++ stdenv.lib.optional stdenv.isx86_64 [ "--enable-aesni" "--enable-rdrand" ]
|
|
|
|
++ stdenv.lib.optional (stdenv.system == "i686-linux") "--enable-padlock"
|
2015-08-03 14:59:33 +00:00
|
|
|
++ stdenv.lib.optionals enableTNC [
|
|
|
|
"--disable-gmp" "--disable-aes" "--disable-md5" "--disable-sha1" "--disable-sha2" "--disable-fips-prf"
|
2017-10-17 08:10:42 +00:00
|
|
|
"--enable-curl"
|
2015-08-03 14:59:33 +00:00
|
|
|
"--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 17:16:27 +00:00
|
|
|
"--enable-tnc-ifmap" "--enable-tnc-imc" "--enable-tnc-imv"
|
2015-08-03 14:59:33 +00:00
|
|
|
"--with-tss=trousers"
|
|
|
|
"--enable-aikgen"
|
|
|
|
"--enable-sqlite" ];
|
2014-09-16 18:10:37 +00:00
|
|
|
|
2014-11-11 06:40:52 +00:00
|
|
|
NIX_LDFLAGS = "-lgcc_s" ;
|
|
|
|
|
2014-09-16 18:10:37 +00:00
|
|
|
meta = {
|
|
|
|
description = "OpenSource IPsec-based VPN Solution";
|
|
|
|
homepage = https://www.strongswan.org;
|
|
|
|
license = stdenv.lib.licenses.gpl2Plus;
|
2014-11-26 20:04:59 +00:00
|
|
|
platforms = stdenv.lib.platforms.all;
|
2014-09-16 18:10:37 +00:00
|
|
|
};
|
|
|
|
}
|