Browse Source

Merge pull request #209 from nmeyerhans/ipsec-tools-0.8.2

ipsec-tools: Re-introduce package ipsec-tools and update to v0.8.2
sbyx 10 years ago
parent
commit
d8caaf6ea5

+ 99
- 0
net/ipsec-tools/Makefile View File

@@ -0,0 +1,99 @@
1
+#
2
+# Copyright (C) 2006-2011 OpenWrt.org
3
+#               2014 Noah Meyerhans <frodo@morgul.net>
4
+#
5
+# This is free software, licensed under the GNU General Public License v2.
6
+# See /LICENSE for more information.
7
+#
8
+
9
+include $(TOPDIR)/rules.mk
10
+include $(INCLUDE_DIR)/kernel.mk
11
+
12
+PKG_NAME:=ipsec-tools
13
+PKG_VERSION:=0.8.2
14
+PKG_RELEASE:=1
15
+PKG_MAINTAINER := "Noah Meyerhans <frodo@morgul.net>"
16
+PKG_LICENSE := BSD-3-Clause
17
+
18
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
19
+PKG_SOURCE_URL:=@SF/ipsec-tools
20
+PKG_MD5SUM:=d53ec14a0a3ece64e09e5e34b3350b41
21
+
22
+PKG_BUILD_PARALLEL:=1
23
+PKG_INSTALL:=1
24
+
25
+PKG_FIXUP:=autoreconf
26
+
27
+include $(INCLUDE_DIR)/package.mk
28
+
29
+define Package/ipsec-tools
30
+  SECTION:=net
31
+  CATEGORY:=Network
32
+  SUBMENU:=VPN
33
+  DEPENDS:=+libopenssl +kmod-ipsec
34
+  TITLE:=IPsec management tools
35
+  URL:=http://ipsec-tools.sourceforge.net/
36
+  MAINTAINER:=Noah Meyerhans <frodo@morgul.net>
37
+endef
38
+
39
+CONFIGURE_ARGS += \
40
+	--enable-shared \
41
+	--enable-static \
42
+	--with-kernel-headers="$(LINUX_DIR)/include" \
43
+	--without-readline \
44
+	--with-openssl="$(STAGING_DIR)/usr" \
45
+	--without-libradius \
46
+	--without-libpam \
47
+	--enable-dpd \
48
+	--enable-hybrid \
49
+	--enable-security-context=no \
50
+	--enable-natt \
51
+	--enable-adminport \
52
+	--enable-frag \
53
+	 $(call autoconf_bool,CONFIG_IPV6,ipv6)
54
+
55
+# override CFLAGS holding "-Werror" that break builds on compile warnings
56
+MAKE_FLAGS+=\
57
+	CFLAGS="$(TARGET_CFLAGS) $(EXTRA_CFLAGS) $(TARGET_CPPFLAGS) $(EXTRA_CPPFLAGS)"
58
+
59
+define Build/Prepare
60
+	$(call Build/Prepare/Default)
61
+	chmod -R u+w $(PKG_BUILD_DIR)
62
+endef
63
+
64
+define Build/Configure
65
+	(cd $(PKG_BUILD_DIR); touch \
66
+		configure.ac \
67
+		aclocal.m4 \
68
+		Makefile.in \
69
+		config.h.in \
70
+		configure \
71
+	);
72
+	$(call Build/Configure/Default)
73
+	echo "#undef HAVE_SHADOW_H" >> $(PKG_BUILD_DIR)/config.h
74
+endef
75
+
76
+define Package/ipsec-tools/install
77
+	$(INSTALL_DIR) $(1)/etc
78
+	$(INSTALL_CONF) $(PKG_BUILD_DIR)/src/racoon/samples/racoon.conf $(1)/etc/
79
+	$(SED) 's|@sysconfdir_x@|/etc|g' $(1)/etc/racoon.conf
80
+	$(INSTALL_DIR) $(1)/etc/racoon
81
+	$(INSTALL_CONF) $(PKG_BUILD_DIR)/src/racoon/samples/psk.txt $(1)/etc/racoon/
82
+	$(INSTALL_DIR) $(1)/etc/init.d
83
+	$(INSTALL_BIN) ./files/racoon.init $(1)/etc/init.d/racoon
84
+	$(INSTALL_DIR) $(1)/usr/lib
85
+	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libipsec.so.* $(1)/usr/lib/
86
+	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libracoon.so.* $(1)/usr/lib/
87
+	$(INSTALL_DIR) $(1)/usr/sbin
88
+	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/plainrsa-gen $(1)/usr/sbin/
89
+	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/racoon $(1)/usr/sbin/
90
+	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/racoonctl $(1)/usr/sbin/
91
+	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/setkey $(1)/usr/sbin/
92
+endef
93
+
94
+define Package/ipsec-tools/conffiles
95
+/etc/racoon.conf
96
+/etc/racoon/psk.txt
97
+endef
98
+
99
+$(eval $(call BuildPackage,ipsec-tools))

+ 17
- 0
net/ipsec-tools/files/racoon.init View File

@@ -0,0 +1,17 @@
1
+#!/bin/sh /etc/rc.common
2
+# Copyright (C) 2009-2011 OpenWrt.org
3
+# Copyright (C) 2011 Artem Makhutov
4
+
5
+START=49
6
+
7
+SERVICE_USE_PID=1
8
+
9
+start() {
10
+	mkdir -m 0700 -p /var/racoon
11
+	[ -f /etc/ipsec.conf ] && /usr/sbin/setkey -f /etc/ipsec.conf
12
+	service_start /usr/sbin/racoon -f /etc/racoon.conf
13
+}
14
+
15
+stop() {
16
+	service_stop /usr/sbin/racoon
17
+}

+ 24
- 0
net/ipsec-tools/patches/001-ipsec-tools-def-psk.patch View File

@@ -0,0 +1,24 @@
1
+--- a/src/racoon/oakley.c
2
++++ b/src/racoon/oakley.c
3
+@@ -2424,8 +2424,21 @@ oakley_skeyid(iph1)
4
+ 				plog(LLV_ERROR, LOCATION, iph1->remote,
5
+ 					"couldn't find the pskey for %s.\n",
6
+ 					saddrwop2str(iph1->remote));
7
++			}
8
++		}
9
++		if (iph1->authstr == NULL) {
10
++			/*
11
++			 * If we could not locate a psk above try and locate
12
++			 * the default psk, ie, "*".
13
++			 */
14
++			iph1->authstr = privsep_getpsk("*", 1);
15
++			if (iph1->authstr == NULL) {
16
++				plog(LLV_ERROR, LOCATION, iph1->remote,
17
++					"couldn't find the the default pskey either.\n");
18
+ 				goto end;
19
+ 			}
20
++			plog(LLV_NOTIFY, LOCATION, iph1->remote,
21
++					"Using default PSK.\n");
22
+ 		}
23
+ 		plog(LLV_DEBUG, LOCATION, NULL, "the psk found.\n");
24
+ 		/* should be secret PSK */

+ 22
- 0
net/ipsec-tools/patches/001-no_libfl.patch View File

@@ -0,0 +1,22 @@
1
+--- a/src/racoon/cftoken.l
2
++++ b/src/racoon/cftoken.l
3
+@@ -104,6 +104,8 @@ static struct include_stack {
4
+ static int incstackp = 0;
5
+ 
6
+ static int yy_first_time = 1;
7
++
8
++int yywrap(void) { return 1; }
9
+ %}
10
+ 
11
+ /* common seciton */
12
+--- a/src/setkey/token.l
13
++++ b/src/setkey/token.l
14
+@@ -86,6 +86,8 @@
15
+ #if defined(SADB_X_EALG_AES) && ! defined(SADB_X_EALG_AESCBC)
16
+ #define SADB_X_EALG_AESCBC  SADB_X_EALG_AES
17
+ #endif
18
++
19
++int yywrap(void) { return 1; }
20
+ %}
21
+ 
22
+ /* common section */

+ 72
- 0
net/ipsec-tools/patches/002-patch8-utmp.patch View File

@@ -0,0 +1,72 @@
1
+--- a/src/racoon/isakmp_cfg.c
2
++++ b/src/racoon/isakmp_cfg.c
3
+@@ -38,7 +38,7 @@
4
+ #include <sys/socket.h>
5
+ #include <sys/queue.h>
6
+ 
7
+-#include <utmpx.h>
8
++#include <utmp.h>
9
+ #if defined(__APPLE__) && defined(__MACH__)
10
+ #include <util.h>
11
+ #endif
12
+@@ -1661,7 +1661,8 @@ isakmp_cfg_accounting_system(port, raddr
13
+ 	int inout;
14
+ {
15
+ 	int error = 0;
16
+-	struct utmpx ut;
17
++	struct utmp ut;
18
++	char term[UT_LINESIZE];
19
+ 	char addr[NI_MAXHOST];
20
+ 	
21
+ 	if (usr == NULL || usr[0]=='\0') {
22
+@@ -1670,34 +1671,37 @@ isakmp_cfg_accounting_system(port, raddr
23
+ 		return -1;
24
+ 	}
25
+ 
26
+-	memset(&ut, 0, sizeof ut);
27
+-	gettimeofday((struct timeval *)&ut.ut_tv, NULL);
28
+-	snprintf(ut.ut_id, sizeof ut.ut_id, TERMSPEC, port);
29
++	sprintf(term, TERMSPEC, port);
30
+ 
31
+ 	switch (inout) {
32
+ 	case ISAKMP_CFG_LOGIN:
33
+-		ut.ut_type = USER_PROCESS;
34
+-		strncpy(ut.ut_user, usr, sizeof ut.ut_user);
35
++		strncpy(ut.ut_name, usr, UT_NAMESIZE);
36
++		ut.ut_name[UT_NAMESIZE - 1] = '\0';
37
++		
38
++		strncpy(ut.ut_line, term, UT_LINESIZE);
39
++		ut.ut_line[UT_LINESIZE - 1] = '\0';
40
+ 
41
+ 		GETNAMEINFO_NULL(raddr, addr);
42
+-		strncpy(ut.ut_host, addr, sizeof ut.ut_host);
43
++		strncpy(ut.ut_host, addr, UT_HOSTSIZE);
44
++		ut.ut_host[UT_HOSTSIZE - 1] = '\0';
45
++
46
++		ut.ut_time = time(NULL);
47
+ 
48
+ 		plog(LLV_INFO, LOCATION, NULL,
49
+ 			"Accounting : '%s' logging on '%s' from %s.\n",
50
+-			ut.ut_user, ut.ut_id, addr);
51
+-
52
+-		pututxline(&ut);
53
++			ut.ut_name, ut.ut_line, ut.ut_host);
54
+ 
55
++		login(&ut);
56
++		
57
+ 		break;
58
+ 	case ISAKMP_CFG_LOGOUT:	
59
+-		ut.ut_type = DEAD_PROCESS;
60
+ 
61
+ 		plog(LLV_INFO, LOCATION, NULL,
62
+ 			"Accounting : '%s' unlogging from '%s'.\n",
63
+-			usr, ut.ut_id);
64
+-
65
+-		pututxline(&ut);
66
++			usr, term);
67
+ 
68
++		logout(term);
69
++		
70
+ 		break;
71
+ 	default:
72
+ 		plog(LLV_ERROR, LOCATION, NULL, "Unepected inout\n");

+ 13
- 0
net/ipsec-tools/patches/003-microsoft-fqdn-in-main.patch View File

@@ -0,0 +1,13 @@
1
+--- a/src/racoon/ipsec_doi.c
2
++++ b/src/racoon/ipsec_doi.c
3
+@@ -3582,8 +3582,8 @@ ipsecdoi_checkid1(iph1)
4
+ 	    iph1->approval->authmethod == OAKLEY_ATTR_AUTH_METHOD_PSKEY) {
5
+ 		 if (id_b->type != IPSECDOI_ID_IPV4_ADDR
6
+ 		  && id_b->type != IPSECDOI_ID_IPV6_ADDR) {
7
+-			plog(LLV_ERROR, LOCATION, NULL,
8
+-				"Expecting IP address type in main mode, "
9
++			plog(LLV_WARNING, LOCATION, NULL,
10
++				"Expecting IP address type in main mode (RFC2409) , "
11
+ 				"but %s.\n", s_ipsecdoi_ident(id_b->type));
12
+ 			return ISAKMP_NTYPE_INVALID_ID_INFORMATION;
13
+ 		}

+ 11
- 0
net/ipsec-tools/patches/005-isakmp-fix.patch View File

@@ -0,0 +1,11 @@
1
+--- a/src/racoon/isakmp.c
2
++++ b/src/racoon/isakmp.c
3
+@@ -31,6 +31,8 @@
4
+  * SUCH DAMAGE.
5
+  */
6
+ 
7
++#define __packed __attribute__((__packed__))
8
++
9
+ #include "config.h"
10
+ 
11
+ #include <sys/types.h>

+ 50
- 0
net/ipsec-tools/patches/006-linux-3.7-compat.patch View File

@@ -0,0 +1,50 @@
1
+--- a/configure.ac
2
++++ b/configure.ac
3
+@@ -74,9 +74,10 @@ case "$host_os" in
4
+ 	    [ KERNEL_INCLUDE="/lib/modules/`uname -r`/build/include" ])
5
+ 
6
+     AC_CHECK_HEADER($KERNEL_INCLUDE/linux/pfkeyv2.h, ,
7
+-	[ AC_CHECK_HEADER(/usr/src/linux/include/linux/pfkeyv2.h,
8
+-	  KERNEL_INCLUDE=/usr/src/linux/include ,
9
+-	  [ AC_MSG_ERROR([Unable to find linux-2.6 kernel headers. Aborting.]) ] ) ] )
10
++	[ AC_CHECK_HEADER($KERNEL_INCLUDE/uapi/linux/pfkeyv2.h, ,
11
++	  [ AC_CHECK_HEADER(/usr/src/linux/include/linux/pfkeyv2.h,
12
++	    KERNEL_INCLUDE=/usr/src/linux/include ,
13
++	    [ AC_MSG_ERROR([Unable to find linux-2.6 kernel headers. Aborting.]) ] ) ] ) ] )
14
+     AC_SUBST(KERNEL_INCLUDE)
15
+     # We need the configure script to run with correct kernel headers.
16
+     # However we don't want to point to kernel source tree in compile time,
17
+@@ -643,7 +644,14 @@ AC_EGREP_CPP(yes,
18
+ #ifdef SADB_X_EXT_NAT_T_TYPE
19
+ yes
20
+ #endif
21
+-], [kernel_natt="yes"])
22
++], [kernel_natt="yes"], [
23
++  AC_EGREP_CPP(yes,
24
++  [#include <uapi/linux/pfkeyv2.h>
25
++  #ifdef SADB_X_EXT_NAT_T_TYPE
26
++  yes
27
++  #endif
28
++  ], [kernel_natt="yes"])
29
++])
30
+ 	;;
31
+ freebsd*|netbsd*)
32
+ # NetBSD case
33
+--- a/src/include-glibc/Makefile.am
34
++++ b/src/include-glibc/Makefile.am
35
+@@ -1,14 +1,7 @@
36
+-
37
+-.includes: ${top_builddir}/config.status
38
+-	ln -snf $(KERNEL_INCLUDE)/linux
39
+-	touch .includes
40
+-
41
+-all: .includes
42
+-
43
+ EXTRA_DIST = \
44
+   glibc-bugs.h \
45
+   net/pfkeyv2.h \
46
+   netinet/ipsec.h \
47
+   sys/queue.h
48
+ 
49
+-DISTCLEANFILES = .includes linux
50
++DISTCLEANFILES = linux

+ 14
- 0
net/ipsec-tools/patches/force_HAVE_POLICY_FWD View File

@@ -0,0 +1,14 @@
1
+diff --git a/configure.ac b/configure.ac
2
+index 8506245..eca8895 100644
3
+--- a/configure.ac
4
++++ b/configure.ac
5
+@@ -724,7 +724,8 @@ case $host in
6
+ 			],
7
+ 			[AC_MSG_RESULT(yes)
8
+ 			 AC_DEFINE([HAVE_POLICY_FWD], [], [Have forward policy])],
9
+-			[AC_MSG_RESULT(no)])
10
++			[AC_MSG_RESULT(forced)
11
++			 AC_DEFINE([HAVE_POLICY_FWD], [], [Have forward policy])])
12
+ 		;;
13
+ 	*)
14
+ 		AC_MSG_RESULT(no)