Parcourir la source

Add strongswan

master
Alarig Le Lay il y a 1 an
Parent
révision
00792888fb

+ 3
- 0
net-vpn/strongswan/Manifest Voir le fichier

@@ -0,0 +1,3 @@
1
+AUX ipsec 450 SHA256 c579fb596ef504b0707db0bc54a986b5f7e88d021e102478d26867434c8f8ecf SHA512 8a1b0610d4d7f1772cfa85bac4819946f3462ee063b4b1d47023a81fd650e6183a71b9a79d098d5394765cb9a6deedb91942885501af916c27fad2886226e5b9 WHIRLPOOL eb7ca1ad4f7db0bf1c41100bcacbf43235159a26be0744141531db112408875ecc93d59845f2585c23b83cc81a39d23e8374026609e7442eef6adff217cc3592
2
+DIST strongswan-5.2.2.tar.bz2 4169095 SHA256 cf2fbfdf200a5eced796f00dc11fea67ce477d38c54d5f073ac6c51618b172f4 SHA512 80ae5551d16e8ddcff71426c1ec996388f32cec8a027f722e8f5151cdd67f09d65705a702ff8c3f2702dca6470e525eb2af2459f7ced9d5923570a331491d534 WHIRLPOOL e968131c6372111154f3b0f376ebbfa35668ba21bab8bd179f48130822e257eb5c3fcd80b80a341fd7489dcd023718ccf15921575c42ea8d7656b7bd2485a1d5
3
+EBUILD strongswan-5.2.2.ebuild 9367 SHA256 4232bf3046942a874d8bbda8e57628f208b2f3e1b886efd21f396b692aa87880 SHA512 7c22f4acaf294aef0a86f347b028afd14014a7ccaa8a0b84fca3807560708721a17fc063364612430c783553e3ef741b91bded77cdf8ca03c68f2d1201c32921 WHIRLPOOL 690caee44ae5d3fe866a66079175bdfd7511281c02f89bec92e994372ac551ebc8ad141fa0026cae6e1264c30abfc8aa85eea7b3df0d0652257f4d1ea214c4bc

+ 34
- 0
net-vpn/strongswan/files/ipsec Voir le fichier

@@ -0,0 +1,34 @@
1
+#!/sbin/runscript
2
+# Copyright 1999-2014 Gentoo Foundation
3
+# Distributed under the terms of the GNU General Public License v2
4
+
5
+depend() {
6
+	need net
7
+	use logger
8
+}
9
+
10
+start() {
11
+	ebegin "Starting ${IPSECD}"
12
+	ipsec start
13
+	eend $?
14
+}
15
+
16
+stop() {
17
+	ebegin "Stopping ${IPSECD}"
18
+	ipsec stop
19
+	eend $?
20
+}
21
+
22
+restart() {
23
+	ebegin "Restarting ${IPSECD}"
24
+	svc_stop
25
+	sleep 2
26
+	svc_start
27
+	eend $?
28
+}
29
+
30
+status() {
31
+	ebegin "${IPSECD} Status (verbose):"
32
+	ipsec statusall
33
+	eend $?
34
+}

+ 303
- 0
net-vpn/strongswan/strongswan-5.2.2.ebuild Voir le fichier

@@ -0,0 +1,303 @@
1
+# Copyright 1999-2015 Gentoo Foundation
2
+# Distributed under the terms of the GNU General Public License v2
3
+# $Header: /var/cvsroot/gentoo-x86/net-misc/strongswan/strongswan-5.2.2.ebuild,v 1.5 2015/01/17 20:02:35 maekke Exp $
4
+
5
+EAPI=5
6
+inherit eutils linux-info systemd user
7
+
8
+DESCRIPTION="IPsec-based VPN solution focused on security and ease of use, supporting IKEv1/IKEv2 and MOBIKE"
9
+HOMEPAGE="http://www.strongswan.org/"
10
+SRC_URI="http://download.strongswan.org/${P}.tar.bz2"
11
+
12
+LICENSE="GPL-2 RSA DES"
13
+SLOT="0"
14
+KEYWORDS="amd64 arm ppc ~ppc64 x86"
15
+IUSE="+caps curl +constraints debug dhcp eap farp gcrypt +gmp ldap mysql networkmanager +non-root +openssl sqlite pam pkcs11"
16
+
17
+STRONGSWAN_PLUGINS_STD="led lookip systime-fix unity vici"
18
+STRONGSWAN_PLUGINS_OPT="blowfish ccm ctr gcm ha ipseckey ntru padlock rdrand unbound whitelist"
19
+for mod in $STRONGSWAN_PLUGINS_STD; do
20
+	IUSE="${IUSE} +strongswan_plugins_${mod}"
21
+done
22
+
23
+for mod in $STRONGSWAN_PLUGINS_OPT; do
24
+	IUSE="${IUSE} strongswan_plugins_${mod}"
25
+done
26
+
27
+COMMON_DEPEND="!net-misc/openswan
28
+	gmp? ( >=dev-libs/gmp-4.1.5 )
29
+	gcrypt? ( dev-libs/libgcrypt:0 )
30
+	caps? ( sys-libs/libcap )
31
+	curl? ( net-misc/curl )
32
+	ldap? ( net-nds/openldap )
33
+	openssl? ( >=dev-libs/openssl-0.9.8[-bindist] )
34
+	mysql? ( virtual/mysql )
35
+	sqlite? ( >=dev-db/sqlite-3.3.1 )
36
+	networkmanager? ( net-misc/networkmanager )
37
+	pam? ( sys-libs/pam )
38
+	strongswan_plugins_unbound? ( net-dns/unbound )"
39
+DEPEND="${COMMON_DEPEND}
40
+	virtual/linux-sources
41
+	sys-kernel/linux-headers"
42
+RDEPEND="${COMMON_DEPEND}
43
+	virtual/logger
44
+	sys-apps/iproute2
45
+	!net-misc/libreswan"
46
+
47
+UGID="ipsec"
48
+
49
+pkg_setup() {
50
+	linux-info_pkg_setup
51
+	elog "Linux kernel version: ${KV_FULL}"
52
+
53
+	if ! kernel_is -ge 2 6 16; then
54
+		eerror
55
+		eerror "This ebuild currently only supports ${PN} with the"
56
+		eerror "native Linux 2.6 IPsec stack on kernels >= 2.6.16."
57
+		eerror
58
+	fi
59
+
60
+	if kernel_is -lt 2 6 34; then
61
+		ewarn
62
+		ewarn "IMPORTANT KERNEL NOTES: Please read carefully..."
63
+		ewarn
64
+
65
+		if kernel_is -lt 2 6 29; then
66
+			ewarn "[ < 2.6.29 ] Due to a missing kernel feature, you have to"
67
+			ewarn "include all required IPv6 modules even if you just intend"
68
+			ewarn "to run on IPv4 only."
69
+			ewarn
70
+			ewarn "This has been fixed with kernels >= 2.6.29."
71
+			ewarn
72
+		fi
73
+
74
+		if kernel_is -lt 2 6 33; then
75
+			ewarn "[ < 2.6.33 ] Kernels prior to 2.6.33 include a non-standards"
76
+			ewarn "compliant implementation for SHA-2 HMAC support in ESP and"
77
+			ewarn "miss SHA384 and SHA512 HMAC support altogether."
78
+			ewarn
79
+			ewarn "If you need any of those features, please use kernel >= 2.6.33."
80
+			ewarn
81
+		fi
82
+
83
+		if kernel_is -lt 2 6 34; then
84
+			ewarn "[ < 2.6.34 ] Support for the AES-GMAC authentification-only"
85
+			ewarn "ESP cipher is only included in kernels >= 2.6.34."
86
+			ewarn
87
+			ewarn "If you need it, please use kernel >= 2.6.34."
88
+			ewarn
89
+		fi
90
+	fi
91
+
92
+	if use non-root; then
93
+		enewgroup ${UGID}
94
+		enewuser ${UGID} -1 -1 -1 ${UGID}
95
+	fi
96
+}
97
+
98
+src_prepare() {
99
+	epatch_user
100
+}
101
+
102
+src_configure() {
103
+	local myconf=""
104
+
105
+	if use non-root; then
106
+		myconf="${myconf} --with-user=${UGID} --with-group=${UGID}"
107
+	fi
108
+
109
+	# If a user has already enabled db support, those plugins will
110
+	# most likely be desired as well. Besides they don't impose new
111
+	# dependencies and come at no cost (except for space).
112
+	if use mysql || use sqlite; then
113
+		myconf="${myconf} --enable-attr-sql --enable-sql"
114
+	fi
115
+
116
+	# strongSwan builds and installs static libs by default which are
117
+	# useless to the user (and to strongSwan for that matter) because no
118
+	# header files or alike get installed... so disabling them is safe.
119
+	if use pam && use eap; then
120
+		myconf="${myconf} --enable-eap-gtc"
121
+	else
122
+		myconf="${myconf} --disable-eap-gtc"
123
+	fi
124
+
125
+	for mod in $STRONGSWAN_PLUGINS_STD; do
126
+		if use strongswan_plugins_${mod}; then
127
+			myconf+=" --enable-${mod}"
128
+		fi
129
+	done
130
+
131
+	for mod in $STRONGSWAN_PLUGINS_OPT; do
132
+		if use strongswan_plugins_${mod}; then
133
+			myconf+=" --enable-${mod}"
134
+		fi
135
+	done
136
+
137
+	econf \
138
+		--disable-static \
139
+		--enable-ikev1 \
140
+		--enable-ikev2 \
141
+		--enable-swanctl \
142
+		--enable-socket-dynamic \
143
+		$(use_with caps capabilities libcap) \
144
+		$(use_enable curl) \
145
+		$(use_enable constraints) \
146
+		$(use_enable ldap) \
147
+		$(use_enable debug leak-detective) \
148
+		$(use_enable dhcp) \
149
+		$(use_enable eap eap-sim) \
150
+		$(use_enable eap eap-sim-file) \
151
+		$(use_enable eap eap-simaka-sql) \
152
+		$(use_enable eap eap-simaka-pseudonym) \
153
+		$(use_enable eap eap-simaka-reauth) \
154
+		$(use_enable eap eap-identity) \
155
+		$(use_enable eap eap-md5) \
156
+		$(use_enable eap eap-aka) \
157
+		$(use_enable eap eap-aka-3gpp2) \
158
+		$(use_enable eap md4) \
159
+		$(use_enable eap eap-mschapv2) \
160
+		$(use_enable eap eap-radius) \
161
+		$(use_enable eap eap-tls) \
162
+		$(use_enable eap xauth-eap) \
163
+		$(use_enable eap eap-ttls) \
164
+		$(use_enable farp) \
165
+		$(use_enable gmp) \
166
+		$(use_enable gcrypt) \
167
+		$(use_enable mysql) \
168
+		$(use_enable networkmanager nm) \
169
+		$(use_enable openssl) \
170
+		$(use_enable pam xauth-pam) \
171
+		$(use_enable pkcs11) \
172
+		$(use_enable sqlite) \
173
+		"$(systemd_with_unitdir)" \
174
+		${myconf}
175
+}
176
+
177
+src_install() {
178
+	emake DESTDIR="${D}" install
179
+
180
+	doinitd "${FILESDIR}"/ipsec
181
+
182
+	local dir_ugid
183
+	if use non-root; then
184
+		fowners ${UGID}:${UGID} \
185
+			/etc/ipsec.conf \
186
+			/etc/strongswan.conf
187
+
188
+		dir_ugid="${UGID}"
189
+	else
190
+		dir_ugid="root"
191
+	fi
192
+
193
+	diropts -m 0750 -o ${dir_ugid} -g ${dir_ugid}
194
+	dodir /etc/ipsec.d \
195
+		/etc/ipsec.d/aacerts \
196
+		/etc/ipsec.d/acerts \
197
+		/etc/ipsec.d/cacerts \
198
+		/etc/ipsec.d/certs \
199
+		/etc/ipsec.d/crls \
200
+		/etc/ipsec.d/ocspcerts \
201
+		/etc/ipsec.d/private \
202
+		/etc/ipsec.d/reqs
203
+
204
+	dodoc NEWS README TODO || die
205
+
206
+	# shared libs are used only internally and there are no static libs,
207
+	# so it's safe to get rid of the .la files
208
+	find "${D}" -name '*.la' -delete || die "Failed to remove .la files."
209
+}
210
+
211
+pkg_preinst() {
212
+	has_version "<net-misc/strongswan-4.3.6-r1"
213
+	upgrade_from_leq_4_3_6=$(( !$? ))
214
+
215
+	has_version "<net-misc/strongswan-4.3.6-r1[-caps]"
216
+	previous_4_3_6_with_caps=$(( !$? ))
217
+}
218
+
219
+pkg_postinst() {
220
+	if ! use openssl && ! use gcrypt; then
221
+		elog
222
+		elog "${PN} has been compiled without both OpenSSL and libgcrypt support."
223
+		elog "Please note that this might effect availability and speed of some"
224
+		elog "cryptographic features. You are advised to enable the OpenSSL plugin."
225
+	elif ! use openssl; then
226
+		elog
227
+		elog "${PN} has been compiled without the OpenSSL plugin. This might effect"
228
+		elog "availability and speed of some cryptographic features. There will be"
229
+		elog "no support for Elliptic Curve Cryptography (Diffie-Hellman groups 19-21,"
230
+		elog "25, 26) and ECDSA."
231
+	fi
232
+
233
+	if [[ $upgrade_from_leq_4_3_6 == 1 ]]; then
234
+		chmod 0750 "${ROOT}"/etc/ipsec.d \
235
+			"${ROOT}"/etc/ipsec.d/aacerts \
236
+			"${ROOT}"/etc/ipsec.d/acerts \
237
+			"${ROOT}"/etc/ipsec.d/cacerts \
238
+			"${ROOT}"/etc/ipsec.d/certs \
239
+			"${ROOT}"/etc/ipsec.d/crls \
240
+			"${ROOT}"/etc/ipsec.d/ocspcerts \
241
+			"${ROOT}"/etc/ipsec.d/private \
242
+			"${ROOT}"/etc/ipsec.d/reqs
243
+
244
+		ewarn
245
+		ewarn "The default permissions for /etc/ipsec.d/* have been tightened for"
246
+		ewarn "security reasons. Your system installed directories have been"
247
+		ewarn "updated accordingly. Please check if necessary."
248
+		ewarn
249
+
250
+		if [[ $previous_4_3_6_with_caps == 1 ]]; then
251
+			if ! use non-root; then
252
+				ewarn
253
+				ewarn "IMPORTANT: You previously had ${PN} installed without root"
254
+				ewarn "privileges because it was implied by the 'caps' USE flag."
255
+				ewarn "This has been changed. If you want ${PN} with user privileges,"
256
+				ewarn "you have to re-emerge it with the 'non-root' USE flag enabled."
257
+				ewarn
258
+			fi
259
+		fi
260
+	fi
261
+	if ! use caps && ! use non-root; then
262
+		ewarn
263
+		ewarn "You have decided to run ${PN} with root privileges and built it"
264
+		ewarn "without support for POSIX capability dropping. It is generally"
265
+		ewarn "strongly suggested that you reconsider- especially if you intend"
266
+		ewarn "to run ${PN} as server with a public ip address."
267
+		ewarn
268
+		ewarn "You should re-emerge ${PN} with at least the 'caps' USE flag enabled."
269
+		ewarn
270
+	fi
271
+	if use non-root; then
272
+		elog
273
+		elog "${PN} has been installed without superuser privileges (USE=non-root)."
274
+		elog "This imposes several limitations mainly to the IKEv1 daemon 'pluto'"
275
+		elog "but also a few to the IKEv2 daemon 'charon'."
276
+		elog
277
+		elog "Please carefully read: http://wiki.strongswan.org/wiki/nonRoot"
278
+		elog
279
+		elog "pluto uses a helper script by default to insert/remove routing and"
280
+		elog "policy rules upon connection start/stop which requires superuser"
281
+		elog "privileges. charon in contrast does this internally and can do so"
282
+		elog "even with reduced (user) privileges."
283
+		elog
284
+		elog "Thus if you require IKEv1 (pluto) or need to specify a custom updown"
285
+		elog "script to pluto or charon which requires superuser privileges, you"
286
+		elog "can work around this limitation by using sudo to grant the"
287
+		elog "user \"ipsec\" the appropriate rights."
288
+		elog "For example (the default case):"
289
+		elog "/etc/sudoers:"
290
+		elog "  ipsec ALL=(ALL) NOPASSWD: SETENV: /usr/sbin/ipsec"
291
+		elog "Under the specific connection block in /etc/ipsec.conf:"
292
+		elog "  leftupdown=\"sudo -E ipsec _updown iptables\""
293
+		elog
294
+	fi
295
+	elog
296
+	elog "Make sure you have _all_ required kernel modules available including"
297
+	elog "the appropriate cryptographic algorithms. A list is available at:"
298
+	elog "  http://wiki.strongswan.org/projects/strongswan/wiki/KernelModules"
299
+	elog
300
+	elog "The up-to-date manual is available online at:"
301
+	elog "  http://wiki.strongswan.org/"
302
+	elog
303
+}

Chargement…
Annuler
Enregistrer