You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

491 lines
15 KiB

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