[packages] strongswan: add package (version 5.0.0)
[packages.git] / net / strongswan / Makefile
1
2 # Copyright (C) 2012 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
10 PKG_NAME:=strongswan
11 PKG_VERSION:=5.0.0
12 PKG_RELEASE:=1
13
14 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
15 PKG_SOURCE_URL:=http://download.strongswan.org/
16 PKG_MD5SUM:=c8b861305def7c0abae04f7bbefec212
17
18 PKG_MOD_AVAILABLE:= \
19         addrblock \
20         aes \
21         af-alg \
22         agent \
23         attr \
24         attr-sql \
25         blowfish \
26         ccm \
27         cmac \
28         constraints \
29         coupling \
30         ctr \
31         curl \
32         des \
33         dhcp \
34         dnskey \
35         duplicheck \
36         eap-identity \
37         eap-md5 \
38         eap-mschapv2 \
39         farp \
40         fips-prf \
41         gcm \
42         gcrypt \
43         gmp \
44         ha \
45         hmac \
46         kernel-klips \
47         kernel-netlink \
48         kernel-pfkey \
49         ldap \
50         led \
51         load-tester \
52         nonce \
53         md4 \
54         md5 \
55         mysql \
56         openssl \
57         padlock \
58         pem \
59         pgp \
60         pkcs1 \
61         pkcs8 \
62         pkcs11 \
63         pubkey \
64         random \
65         resolve \
66         revocation \
67         sha1 \
68         sha2 \
69         smp \
70         socket-default \
71         socket-dynamic \
72         socket-raw \
73         sql \
74         sqlite \
75         stroke \
76         test-vectors \
77         uci \
78         updown \
79         whitelist \
80         x509 \
81         xauth-eap \
82         xauth-generic \
83         xcbc \
84
85 PKG_CONFIG_DEPENDS:= \
86         CONFIG_STRONGSWAN_DEVICE_RANDOM \
87         CONFIG_STRONGSWAN_DEVICE_URANDOM \
88         CONFIG_STRONGSWAN_ROUTING_TABLE \
89         CONFIG_STRONGSWAN_ROUTING_TABLE_PRIO \
90         $(patsubst %,CONFIG_PACKAGE_strongswan-mod-%,$(PKG_MOD_AVAILABLE)) \
91
92 PKG_FIXUP:=autoreconf
93 PKG_INSTALL:=1
94 PKG_BUILD_PARALLEL:=1
95
96 include $(INCLUDE_DIR)/package.mk
97
98 define Package/strongswan/Default
99   SUBMENU:=VPN
100   SECTION:=net
101   CATEGORY:=Network
102   TITLE:=StrongSwan
103   URL:=http://www.strongswan.org/
104 endef
105
106 define Package/strongswan/description/Default
107  StrongSwan is an OpenSource IPsec implementation for the Linux operating system.
108 endef
109
110 define Package/strongswan
111 $(call Package/strongswan/Default)
112   DEPENDS:= +libpthread +ip \
113         +kmod-crypto-authenc \
114         +kmod-ipsec +kmod-ipsec4 +kmod-ipsec6 \
115         +kmod-ipt-ipsec +iptables-mod-ipsec
116 endef
117
118 define Package/strongswan/config
119   source "$(SOURCE)/Config.in"
120 endef
121
122 define Package/strongswan/description
123 $(call Package/strongswan/description/Default)
124  This package contains shared libraries and scripts.
125 endef
126
127 define Package/strongswan-full
128 $(call Package/strongswan/Default)
129   TITLE+= (full)
130   DEPENDS:= +strongswan \
131         +strongswan-charon \
132         +strongswan-libfast \
133         +strongswan-mod-addrblock \
134         +strongswan-mod-aes \
135         +strongswan-mod-af-alg \
136         +strongswan-mod-agent \
137         +strongswan-mod-attr \
138         +strongswan-mod-attr-sql \
139         +strongswan-mod-blowfish \
140         +strongswan-mod-ccm \
141         +strongswan-mod-cmac \
142         +strongswan-mod-constraints \
143         +strongswan-mod-coupling \
144         +strongswan-mod-ctr \
145         +strongswan-mod-curl \
146         +strongswan-mod-des \
147         +strongswan-mod-dhcp \
148         +strongswan-mod-dnskey \
149         +strongswan-mod-duplicheck \
150         +strongswan-mod-eap-identity \
151         +strongswan-mod-eap-md5 \
152         +strongswan-mod-eap-mschapv2 \
153         +strongswan-mod-farp \
154         +strongswan-mod-fips-prf \
155         +strongswan-mod-gcm \
156         +strongswan-mod-gcrypt \
157         +strongswan-mod-gmp \
158         +strongswan-mod-ha \
159         +strongswan-mod-hmac \
160         +strongswan-mod-kernel-netlink \
161         +strongswan-mod-ldap \
162         +strongswan-mod-led \
163         +strongswan-mod-load-tester \
164         +strongswan-mod-nonce \
165         +strongswan-mod-md4 \
166         +strongswan-mod-md5 \
167         +strongswan-mod-mysql \
168         +strongswan-mod-openssl \
169         +TARGET_x86:strongswan-mod-padlock \
170         +strongswan-mod-pem \
171         +strongswan-mod-pgp \
172         +strongswan-mod-pkcs1 \
173         +strongswan-mod-pkcs8 \
174         +strongswan-mod-pkcs11 \
175         +strongswan-mod-pubkey \
176         +strongswan-mod-random \
177         +strongswan-mod-resolve \
178         +strongswan-mod-revocation \
179         +strongswan-mod-sha1 \
180         +strongswan-mod-sha2 \
181         +strongswan-mod-smp \
182         +strongswan-mod-socket-default \
183         +strongswan-mod-sql \
184         +strongswan-mod-sqlite \
185         +strongswan-mod-stroke \
186         +strongswan-mod-test-vectors \
187         +strongswan-mod-uci \
188         +strongswan-mod-updown \
189         +strongswan-mod-whitelist \
190         +strongswan-mod-x509 \
191         +strongswan-mod-xauth-eap \
192         +strongswan-mod-xauth-generic \
193         +strongswan-mod-xcbc \
194         +strongswan-utils \
195         @DEVEL
196 endef
197
198 define Package/strongswan-full/description
199 $(call Package/strongswan/description/Default)
200  This meta-package contains dependencies for all of the strongswan plugins
201  except kernel-klips, kernel-pfkey, socket-dynamic and socket-raw which are
202  ommitted in favor of the kernel-netlink and socket-default plugins.
203 endef
204
205
206 define Package/strongswan-default
207 $(call Package/strongswan/Default)
208   TITLE+= (default)
209   DEPENDS:= +strongswan \
210         +strongswan-charon \
211         +strongswan-mod-aes \
212         +strongswan-mod-attr \
213         +strongswan-mod-constraints \
214         +strongswan-mod-des \
215         +strongswan-mod-dnskey \
216         +strongswan-mod-fips-prf \
217         +strongswan-mod-gmp \
218         +strongswan-mod-hmac \
219         +strongswan-mod-kernel-netlink \
220         +strongswan-mod-md5 \
221         +strongswan-mod-nonce \
222         +strongswan-mod-pem \
223         +strongswan-mod-pgp \
224         +strongswan-mod-pkcs1 \
225         +strongswan-mod-pubkey \
226         +strongswan-mod-random \
227         +strongswan-mod-resolve \
228         +strongswan-mod-revocation \
229         +strongswan-mod-sha1 \
230         +strongswan-mod-sha2 \
231         +strongswan-mod-socket-default \
232         +strongswan-mod-stroke \
233         +strongswan-mod-updown \
234         +strongswan-mod-x509 \
235         +strongswan-mod-xauth-generic \
236         +strongswan-mod-xcbc \
237         +strongswan-utils
238 endef
239
240 define Package/strongswan-default/description
241 $(call Package/strongswan/description/Default)
242  This meta-package contains only dependencies to match upstream defaults.
243 endef
244
245 define Package/strongswan-minimal
246 $(call Package/strongswan/Default)
247   TITLE+= (minimal)
248   DEPENDS:= +strongswan \
249         +strongswan-charon \
250         +strongswan-mod-aes \
251         +strongswan-mod-gmp \
252         +strongswan-mod-hmac \
253         +strongswan-mod-kernel-netlink \
254         +strongswan-mod-nonce \
255         +strongswan-mod-pubkey \
256         +strongswan-mod-random \
257         +strongswan-mod-sha1 \
258         +strongswan-mod-socket-default \
259         +strongswan-mod-stroke \
260         +strongswan-mod-updown \
261         +strongswan-mod-x509 \
262         +strongswan-mod-xcbc
263 endef
264
265 define Package/strongswan-minimal/description
266 $(call Package/strongswan/description/Default)
267  This meta-package contains only dependencies for a minimal IKEv2 setup.
268 endef
269
270 define Package/strongswan-charon
271 $(call Package/strongswan/Default)
272   TITLE+= IKEv1/IKEv2 keying daemon
273   DEPENDS:= +strongswan
274 endef
275
276 define Package/strongswan-charon/description
277 $(call Package/strongswan/description/Default)
278  This package contains charon, an IKEv2 keying daemon.
279 endef
280
281 define Package/strongswan-libfast
282 $(call Package/strongswan/Default)
283   TITLE+= libfast
284   DEPENDS:= +strongswan \
285                 +PACKAGE_strongswan-libfast:zlib \
286                 +PACKAGE_strongswan-libfast:fcgi \
287                 +PACKAGE_strongswan-libfast:clearsilver
288 endef
289
290 define Package/strongswan-libfast/description
291 $(call Package/strongswan/description/Default)
292  This package contains libfast, a lightweight framework to build native web
293  applications using ClearSilver and FastCGI.
294 endef
295
296 define Package/strongswan-utils
297 $(call Package/strongswan/Default)
298   TITLE+= utilities
299   DEPENDS:= +strongswan
300 endef
301
302 define Package/strongswan-utils/description
303 $(call Package/strongswan/description/Default)
304  This package contains the openac, pki & scepclient utilities.
305 endef
306
307 define BuildPlugin
308   define Package/strongswan-mod-$(1)
309     $$(call Package/strongswan/Default)
310     TITLE:= StrongSwan $(2) plugin
311     DEPENDS:= +strongswan $(3)
312   endef
313
314   define Package/strongswan-mod-$(1)/install
315         $(INSTALL_DIR) $$(1)/usr/lib/ipsec/plugins
316         $(CP) $(PKG_INSTALL_DIR)/usr/lib/ipsec/plugins/libstrongswan-$(1).so \
317                 $$(1)/usr/lib/ipsec/plugins/
318         $(call Plugin/$(1)/install,$$(1))
319   endef
320
321   $$(eval $$(call BuildPackage,strongswan-mod-$(1)))
322 endef
323
324 CONFIGURE_ARGS+= \
325         --disable-scripts \
326         --disable-static \
327         $(if $(CONFIG_PACKAGE_strongswan-libfast),--enable-fast,--disable-fast) \
328         $(if $(CONFIG_PACKAGE_strongswan-utils),--enable-tools,--disable-tools) \
329         --with-random-device="$(call qstrip,$(CONFIG_STRONGSWAN_DEVICE_RANDOM))" \
330         --with-urandom-device="$(call qstrip,$(CONFIG_STRONGSWAN_DEVICE_URANDOM))" \
331         --with-routing-table="$(call qstrip,$(CONFIG_STRONGSWAN_ROUTING_TABLE))" \
332         --with-routing-table-prio="$(call qstrip,$(CONFIG_STRONGSWAN_ROUTING_TABLE_PRIO))" \
333         $(foreach m,$(PKG_MOD_AVAILABLE), \
334           $(if $(CONFIG_PACKAGE_strongswan-mod-$(m)),--enable-$(m),--disable-$(m)) \
335         )
336
337 ifneq ($(CONFIG_PACKAGE_strongswan-libfast),)
338   EXTRA_CPPFLAGS+= -I$(STAGING_DIR)/usr/include/ClearSilver
339 endif
340
341 EXTRA_LDFLAGS+= -Wl,-rpath-link,$(STAGING_DIR)/usr/lib
342
343 define Package/strongswan/conffiles
344 /etc/ipsec.conf
345 /etc/ipsec.secrets
346 /etc/strongswan.conf
347 endef
348
349 define Package/strongswan/install
350         $(INSTALL_DIR) $(1)/etc
351         $(CP) $(PKG_INSTALL_DIR)/etc/strongswan.conf $(1)/etc/
352         $(INSTALL_DIR) $(1)/usr/lib/ipsec
353         $(CP) $(PKG_INSTALL_DIR)/usr/lib/ipsec/{libstrongswan.so.*,libhydra.so.*} $(1)/usr/lib/ipsec/
354         $(INSTALL_CONF) ./files/ipsec.secrets $(1)/etc/
355 endef
356
357 define Package/strongswan-default/install
358         true
359 endef
360
361 define Package/strongswan-full/install
362         true
363 endef
364
365 define Package/strongswan-minimal/install
366         true
367 endef
368
369 define Package/strongswan-charon/install
370         $(INSTALL_DIR) $(1)/usr/lib/ipsec
371         $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/ipsec/charon $(1)/usr/lib/ipsec/
372         $(CP) $(PKG_INSTALL_DIR)/usr/lib/ipsec/libcharon.so.* $(1)/usr/lib/ipsec/
373 endef
374
375 define Package/strongswan-libfast/install
376         $(INSTALL_DIR) $(1)/usr/lib/ipsec
377         $(CP) $(PKG_INSTALL_DIR)/usr/lib/ipsec/libfast.so.* $(1)/usr/lib/ipsec/
378 endef
379
380 define Package/strongswan-utils/install
381         $(INSTALL_DIR) $(1)/usr/sbin
382         $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ipsec $(1)/usr/sbin/
383         $(INSTALL_DIR) $(1)/usr/lib/ipsec
384         $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/ipsec/{openac,pki,scepclient,_copyright} $(1)/usr/lib/ipsec/
385 endef
386
387 define Plugin/duplicheck/install
388         $(INSTALL_DIR) $(1)/usr/lib/ipsec/plugins
389         $(CP) $(PKG_INSTALL_DIR)/usr/lib/ipsec/duplicheck $(1)/usr/lib/ipsec/
390         $(CP) $(PKG_INSTALL_DIR)/usr/lib/ipsec/plugins/libstrongswan-duplicheck.so $(1)/usr/lib/ipsec/plugins/
391 endef
392
393 define Plugin/attr-sql/install
394         $(INSTALL_DIR) $(1)/usr/lib/ipsec
395         $(CP) $(PKG_INSTALL_DIR)/usr/lib/ipsec/pool $(1)/usr/lib/ipsec/
396 endef
397
398 define Plugin/stroke/install
399         $(INSTALL_DIR) $(1)/etc/ipsec.d/aacerts
400         $(INSTALL_DIR) $(1)/etc/ipsec.d/acerts
401         $(INSTALL_DIR) $(1)/etc/ipsec.d/cacerts
402         $(INSTALL_DIR) $(1)/etc/ipsec.d/certs
403         $(INSTALL_DIR) $(1)/etc/ipsec.d/crls
404         $(INSTALL_DIR) $(1)/etc/ipsec.d/ocspcerts
405         $(INSTALL_DIR) $(1)/etc/ipsec.d/private
406         $(INSTALL_DIR) $(1)/etc/ipsec.d/reqs
407
408         $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/ipsec.conf $(1)/etc/
409
410         $(INSTALL_DIR) $(1)/usr/lib/ipsec/plugins
411         $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/ipsec/{starter,stroke,_copyright} $(1)/usr/lib/ipsec/
412         $(CP) $(PKG_INSTALL_DIR)/usr/lib/ipsec/plugins/libstrongswan-stroke.so $(1)/usr/lib/ipsec/plugins/
413 endef
414
415 define Plugin/updown/install
416         $(INSTALL_DIR) $(1)/usr/lib/ipsec/plugins
417         $(CP) $(PKG_INSTALL_DIR)/usr/lib/ipsec/{_updown,_updown_espmark} $(1)/usr/lib/ipsec/
418         $(CP) $(PKG_INSTALL_DIR)/usr/lib/ipsec/plugins/libstrongswan-updown.so $(1)/usr/lib/ipsec/plugins/
419 endef
420
421 define Plugin/whitelist/install
422         $(INSTALL_DIR) $(1)/usr/lib/ipsec/plugins
423         $(CP) $(PKG_INSTALL_DIR)/usr/lib/ipsec/whitelist $(1)/usr/lib/ipsec/
424         $(CP) $(PKG_INSTALL_DIR)/usr/lib/ipsec/plugins/libstrongswan-whitelist.so $(1)/usr/lib/ipsec/plugins/
425 endef
426
427 $(eval $(call BuildPackage,strongswan))
428 $(eval $(call BuildPackage,strongswan-default))
429 $(eval $(call BuildPackage,strongswan-full))
430 $(eval $(call BuildPackage,strongswan-minimal))
431 $(eval $(call BuildPackage,strongswan-charon))
432 $(eval $(call BuildPackage,strongswan-libfast))
433 $(eval $(call BuildPackage,strongswan-utils))
434 $(eval $(call BuildPlugin,addrblock,RFC 3779 address block constraint support,))
435 $(eval $(call BuildPlugin,aes,AES crypto,))
436 $(eval $(call BuildPlugin,af-alg,AF_ALG crypto interface to Linux Crypto API,+kmod-crypto-user))
437 $(eval $(call BuildPlugin,agent,SSH agent signing,))
438 $(eval $(call BuildPlugin,attr,file based config,))
439 $(eval $(call BuildPlugin,attr-sql,SQL based config,+strongswan-mod-sql))
440 $(eval $(call BuildPlugin,blowfish,Blowfish crypto,))
441 $(eval $(call BuildPlugin,ccm,CCM AEAD wrapper crypto,))
442 $(eval $(call BuildPlugin,cmac,CMAC crypto,))
443 $(eval $(call BuildPlugin,constraints,advanced X509 constraint checking,))
444 $(eval $(call BuildPlugin,coupling,IKEv2 plugin to couple peer certificates permanently to authentication,))
445 $(eval $(call BuildPlugin,ctr,Counter Mode wrapper crypto,))
446 $(eval $(call BuildPlugin,curl,cURL fetcher plugin,+PACKAGE_strongswan-mod-curl:libcurl))
447 $(eval $(call BuildPlugin,des,DES crypto,))
448 $(eval $(call BuildPlugin,dhcp,DHCP based attribute provider,))
449 $(eval $(call BuildPlugin,dnskey,DNS RR key decoding,))
450 $(eval $(call BuildPlugin,duplicheck,advanced duplicate checking,))
451 $(eval $(call BuildPlugin,eap-identity,EAP identity helper,))
452 $(eval $(call BuildPlugin,eap-md5,EAP MD5 (CHAP) EAP auth,))
453 $(eval $(call BuildPlugin,eap-mschapv2,EAP MS-CHAPv2 EAP auth,))
454 $(eval $(call BuildPlugin,farp,fake arp respsonses,))
455 $(eval $(call BuildPlugin,fips-prf,FIPS PRF crypto,+strongswan-mod-sha1))
456 $(eval $(call BuildPlugin,gcm,GCM AEAD wrapper crypto,))
457 $(eval $(call BuildPlugin,gcrypt,libgcrypt,+PACKAGE_strongswan-mod-gcrypt:libgcrypt))
458 $(eval $(call BuildPlugin,gmp,libgmp,+PACKAGE_strongswan-mod-gmp:libgmp))
459 $(eval $(call BuildPlugin,ha,high availability cluster,))
460 $(eval $(call BuildPlugin,hmac,HMAC crypto,))
461 $(eval $(call BuildPlugin,kernel-klips,KLIPS kernel interface,))
462 $(eval $(call BuildPlugin,kernel-netlink,netlink kernel interface,))
463 $(eval $(call BuildPlugin,kernel-pfkey,PK_KEY kernel interface,))
464 $(eval $(call BuildPlugin,ldap,LDAP,+PACKAGE_strongswan-mod-ldap:libopenldap))
465 $(eval $(call BuildPlugin,led,LED blink on IKE activity,))
466 $(eval $(call BuildPlugin,load-tester,load testing,))
467 $(eval $(call BuildPlugin,nonce,nonce genereation,))
468 $(eval $(call BuildPlugin,md4,MD4 crypto,))
469 $(eval $(call BuildPlugin,md5,MD5 crypto,))
470 $(eval $(call BuildPlugin,mysql,MySQL database interface,+strongswan-mod-sql +PACKAGE_strongswan-mod-mysql:libmysqlclient-r))
471 $(eval $(call BuildPlugin,openssl,OpenSSL crypto,+PACKAGE_strongswan-mod-openssl:libopenssl))
472 $(eval $(call BuildPlugin,padlock,VIA PadLock crypto,@TARGET_x86))
473 $(eval $(call BuildPlugin,pem,PEM decoding,))
474 $(eval $(call BuildPlugin,pgp,PGP key decoding,))
475 $(eval $(call BuildPlugin,pkcs1,PKCS1 key decoding,))
476 $(eval $(call BuildPlugin,pkcs8,PKCS8 key decoding,))
477 $(eval $(call BuildPlugin,pkcs11,PKCS11 key decoding,))
478 $(eval $(call BuildPlugin,pubkey,raw public key,))
479 $(eval $(call BuildPlugin,random,RNG,))
480 $(eval $(call BuildPlugin,resolve,DNS resolver,))
481 $(eval $(call BuildPlugin,revocation,X509 CRL/OCSP revocation,))
482 $(eval $(call BuildPlugin,sha1,SHA1 crypto,))
483 $(eval $(call BuildPlugin,sha2,SHA2 crypto,))
484 $(eval $(call BuildPlugin,smp,SMP configuration and control interface,+PACKAGE_strongswan-mod-smp:libxml2))
485 $(eval $(call BuildPlugin,socket-default,default socket implementation for charon,))
486 $(eval $(call BuildPlugin,socket-dynamic,dynamic socket implementation for charon,))
487 $(eval $(call BuildPlugin,socket-raw,raw socket implementation for charon,))
488 $(eval $(call BuildPlugin,sql,SQL database interface,))
489 $(eval $(call BuildPlugin,sqlite,SQLite database interface,+strongswan-mod-sql +PACKAGE_strongswan-mod-sqlite:libsqlite3))
490 $(eval $(call BuildPlugin,stroke,Stroke,+strongswan-utils))
491 $(eval $(call BuildPlugin,test-vectors,crypto test vectors,))
492 $(eval $(call BuildPlugin,uci,UCI config interface,+PACKAGE_strongswan-mod-uci:libuci))
493 $(eval $(call BuildPlugin,updown,updown firewall,))
494 $(eval $(call BuildPlugin,whitelist,peer identity whitelisting,))
495 $(eval $(call BuildPlugin,x509,x509 certificate,))
496 $(eval $(call BuildPlugin,xauth-eap,EAP XAuth backend,))
497 $(eval $(call BuildPlugin,xauth-generic,generic XAuth backend,))
498 $(eval $(call BuildPlugin,xcbc,xcbc crypto,))