uboot: (firmwareOdroidC2/C4) don't invoke patch tool, use patches = [] instead
https://github.com/NixOS/nixpkgs/blob/master/pkgs/stdenv/generic/setup.sh#L948 this can do it nicely. Signed-off-by: Anton Arapov <anton@deadbeef.mx>
This commit is contained in:
commit
56de2bcd43
30691 changed files with 3076956 additions and 0 deletions
113
pkgs/tools/networking/strongswan/default.nix
Normal file
113
pkgs/tools/networking/strongswan/default.nix
Normal file
|
|
@ -0,0 +1,113 @@
|
|||
{ lib, stdenv, fetchFromGitHub
|
||||
, pkg-config, autoreconfHook, perl, gperf, bison, flex
|
||||
, gmp, python3, iptables, ldns, unbound, openssl, pcsclite, glib
|
||||
, openresolv
|
||||
, systemd, pam
|
||||
, curl
|
||||
, enableTNC ? false, trousers, sqlite, libxml2
|
||||
, enableNetworkManager ? false, networkmanager
|
||||
, darwin
|
||||
, nixosTests
|
||||
}:
|
||||
|
||||
# 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.
|
||||
|
||||
with lib;
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "strongswan";
|
||||
version = "5.9.5"; # Make sure to also update <nixpkgs/nixos/modules/services/networking/strongswan-swanctl/swanctl-params.nix> when upgrading!
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "strongswan";
|
||||
repo = "strongswan";
|
||||
rev = version;
|
||||
sha256 = "sha256-Jx0Wd/xgkl/WrBfcEvZPogPAQp0MW9HE+AQR2anP5Vo=";
|
||||
};
|
||||
|
||||
dontPatchELF = true;
|
||||
|
||||
nativeBuildInputs = [ pkg-config autoreconfHook perl gperf bison flex ];
|
||||
buildInputs =
|
||||
[ curl gmp python3 ldns unbound openssl pcsclite ]
|
||||
++ optionals enableTNC [ trousers sqlite libxml2 ]
|
||||
++ optionals stdenv.isLinux [ systemd.dev pam iptables ]
|
||||
++ optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [ SystemConfiguration ])
|
||||
++ optionals enableNetworkManager [ networkmanager glib ];
|
||||
|
||||
patches = [
|
||||
./ext_auth-path.patch
|
||||
./firewall_defaults.patch
|
||||
./updown-path.patch
|
||||
];
|
||||
|
||||
postPatch = optionalString stdenv.isLinux ''
|
||||
# glibc-2.26 reorganized internal includes
|
||||
sed '1i#include <stdint.h>' -i src/libstrongswan/utils/utils/memory.h
|
||||
|
||||
substituteInPlace src/libcharon/plugins/resolve/resolve_handler.c --replace "/sbin/resolvconf" "${openresolv}/sbin/resolvconf"
|
||||
'';
|
||||
|
||||
configureFlags =
|
||||
[ "--enable-swanctl"
|
||||
"--enable-cmd"
|
||||
"--enable-openssl"
|
||||
"--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"
|
||||
"--enable-eap-mschapv2" "--enable-eap-radius" "--enable-xauth-eap" "--enable-ext-auth"
|
||||
"--enable-acert"
|
||||
"--enable-pkcs11" "--enable-eap-sim-pcsc" "--enable-dnscert" "--enable-unbound"
|
||||
"--enable-chapoly"
|
||||
"--enable-curl" ]
|
||||
++ optionals stdenv.isLinux [
|
||||
"--enable-farp" "--enable-dhcp"
|
||||
"--enable-systemd" "--with-systemdsystemunitdir=${placeholder "out"}/etc/systemd/system"
|
||||
"--enable-xauth-pam"
|
||||
"--enable-forecast"
|
||||
"--enable-connmark"
|
||||
"--enable-af-alg" ]
|
||||
++ optionals stdenv.isx86_64 [ "--enable-aesni" "--enable-rdrand" ]
|
||||
++ optional (stdenv.hostPlatform.system == "i686-linux") "--enable-padlock"
|
||||
++ optionals enableTNC [
|
||||
"--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"
|
||||
"--enable-tnc-ifmap" "--enable-tnc-imc" "--enable-tnc-imv"
|
||||
"--with-tss=trousers"
|
||||
"--enable-aikgen"
|
||||
"--enable-sqlite" ]
|
||||
++ optionals enableNetworkManager [
|
||||
"--enable-nm"
|
||||
"--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"
|
||||
];
|
||||
|
||||
postInstall = ''
|
||||
# this is needed for l2tp
|
||||
echo "include /etc/ipsec.secrets" >> $out/etc/ipsec.secrets
|
||||
'';
|
||||
|
||||
NIX_LDFLAGS = optionalString stdenv.cc.isGNU "-lgcc_s" ;
|
||||
|
||||
passthru.tests = { inherit (nixosTests) strongswan-swanctl; };
|
||||
|
||||
meta = {
|
||||
description = "OpenSource IPsec-based VPN Solution";
|
||||
homepage = "https://www.strongswan.org";
|
||||
license = licenses.gpl2Plus;
|
||||
platforms = platforms.all;
|
||||
};
|
||||
}
|
||||
13
pkgs/tools/networking/strongswan/ext_auth-path.patch
Normal file
13
pkgs/tools/networking/strongswan/ext_auth-path.patch
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
Index: strongswan-5.2.1/src/libcharon/plugins/ext_auth/ext_auth_listener.c
|
||||
===================================================================
|
||||
--- strongswan-5.2.1.orig/src/libcharon/plugins/ext_auth/ext_auth_listener.c
|
||||
+++ strongswan-5.2.1/src/libcharon/plugins/ext_auth/ext_auth_listener.c
|
||||
@@ -101,6 +101,8 @@ METHOD(listener_t, authorize, bool,
|
||||
|
||||
*success = FALSE;
|
||||
|
||||
+ push_env(envp, countof(envp), "PATH=%s", getenv("PATH"));
|
||||
+
|
||||
push_env(envp, countof(envp), "IKE_UNIQUE_ID=%u",
|
||||
ike_sa->get_unique_id(ike_sa));
|
||||
push_env(envp, countof(envp), "IKE_NAME=%s",
|
||||
32
pkgs/tools/networking/strongswan/firewall_defaults.patch
Normal file
32
pkgs/tools/networking/strongswan/firewall_defaults.patch
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
Index: strongswan-5.2.1/src/starter/confread.c
|
||||
===================================================================
|
||||
--- strongswan-5.2.1.orig/src/starter/confread.c
|
||||
+++ strongswan-5.2.1/src/starter/confread.c
|
||||
@@ -43,7 +43,7 @@
|
||||
static const char ike_defaults[] = "aes128-sha1-modp2048,3des-sha1-modp1536";
|
||||
static const char esp_defaults[] = "aes128-sha1,3des-sha1";
|
||||
|
||||
-static const char firewall_defaults[] = IPSEC_SCRIPT " _updown iptables";
|
||||
+static const char firewall_defaults[] = IPSEC_SBINDIR "/" IPSEC_SCRIPT " _updown iptables";
|
||||
|
||||
/**
|
||||
* Provided by GPERF
|
||||
Index: strongswan-5.2.1/src/starter/Makefile.am
|
||||
===================================================================
|
||||
--- strongswan-5.2.1.orig/src/starter/Makefile.am
|
||||
+++ strongswan-5.2.1/src/starter/Makefile.am
|
||||
@@ -18,10 +18,12 @@ AM_CPPFLAGS = \
|
||||
-I$(top_srcdir)/src/libhydra \
|
||||
-I$(top_srcdir)/src/starter \
|
||||
-I$(top_srcdir)/src/stroke \
|
||||
- -DIPSEC_DIR=\"${ipsecdir}\" \
|
||||
+ -DIPSEC_BINDIR=\"${bindir}\" \
|
||||
-DIPSEC_CONFDIR=\"${sysconfdir}\" \
|
||||
- -DIPSEC_PIDDIR=\"${piddir}\" \
|
||||
+ -DIPSEC_DIR=\"${ipsecdir}\" \
|
||||
-DIPSEC_EAPDIR=\"${eapdir}\" \
|
||||
+ -DIPSEC_PIDDIR=\"${piddir}\" \
|
||||
+ -DIPSEC_SBINDIR=\"${sbindir}\" \
|
||||
-DIPSEC_SCRIPT=\"${ipsec_script}\" \
|
||||
-DDEV_RANDOM=\"${random_device}\" \
|
||||
-DDEV_URANDOM=\"${urandom_device}\" \
|
||||
26
pkgs/tools/networking/strongswan/updown-path.patch
Normal file
26
pkgs/tools/networking/strongswan/updown-path.patch
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
Index: strongswan-5.2.1/src/_updown/_updown.in
|
||||
===================================================================
|
||||
--- strongswan-5.2.1.orig/src/_updown/_updown.in
|
||||
+++ strongswan-5.2.1/src/_updown/_updown.in
|
||||
@@ -125,7 +125,7 @@
|
||||
#
|
||||
|
||||
# define a minimum PATH environment in case it is not set
|
||||
-PATH="/sbin:/bin:/usr/sbin:/usr/bin:@sbindir@"
|
||||
+PATH="${PATH:-/sbin:/bin:/usr/sbin:/usr/bin}"
|
||||
export PATH
|
||||
|
||||
# uncomment to log VPN connections
|
||||
Index: strongswan-5.2.1/src/libcharon/plugins/updown/updown_listener.c
|
||||
===================================================================
|
||||
--- strongswan-5.2.1.orig/src/libcharon/plugins/updown/updown_listener.c
|
||||
+++ strongswan-5.2.1/src/libcharon/plugins/updown/updown_listener.c
|
||||
@@ -240,6 +240,8 @@ static void invoke_once(private_updown_l
|
||||
process_t *process;
|
||||
char *envp[128] = {};
|
||||
|
||||
+ push_env(envp, countof(envp), "PATH=%s", getenv("PATH"));
|
||||
+
|
||||
me = ike_sa->get_my_host(ike_sa);
|
||||
other = ike_sa->get_other_host(ike_sa);
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue