Browse Source

net/ipsec-tools: Import net/ipsec-tools from oldpackages

Signed-off-by: Noah Meyerhans <noahm@debian.org>
Noah Meyerhans 10 years ago
parent
commit
5117da7925

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

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