[package] update freeradius2 to 2.1.4, add more modules (#4930)
[openwrt/svn-archive/archive.git] / net / freeradius2 / Makefile
1 #
2 # Copyright (C) 2008-2009 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:=freeradius2
11 PKG_VERSION:=2.1.4
12 PKG_RELEASE:=1
13
14 PKG_SOURCE:=freeradius-server-$(PKG_VERSION).tar.bz2
15 PKG_SOURCE_URL:=ftp://ftp.freeradius.org/pub/freeradius/
16 PKG_MD5SUM:=4ccf748ef9851d90844d085647351ca4
17
18 PKG_BUILD_DIR:=$(BUILD_DIR)/freeradius-server-$(PKG_VERSION)
19
20 include $(INCLUDE_DIR)/package.mk
21
22 define Package/freeradius2/Default
23 SECTION:=net
24 CATEGORY:=Network
25 URL:=http://www.freeradius2.org/
26 endef
27
28 define Package/freeradius2
29 $(call Package/freeradius2/Default)
30 DEPENDS:=+libltdl +libopenssl +libpthread +libreadline
31 TITLE:=A flexible RADIUS server (version 2)
32 MENU:=1
33 endef
34
35 define Package/freeradius2/conffiles
36 /etc/freeradius2/clients.conf
37 /etc/freeradius2/radiusd.conf
38 /etc/freeradius2/sites/default
39 endef
40
41 define Package/freeradius2-democerts
42 $(call Package/freeradius2/Default)
43 DEPENDS:=freeradius2
44 TITLE:=Demo certificates to test the server
45 endef
46
47 define Package/freeradius2-mod-chap
48 $(call Package/freeradius2/Default)
49 DEPENDS:=freeradius2
50 TITLE:=CHAP module
51 endef
52
53 define Package/freeradius2-mod-chap/conffiles
54 /etc/freeradius2/modules/chap
55 endef
56
57 define Package/freeradius2-mod-detail
58 $(call Package/freeradius2/Default)
59 DEPENDS:=freeradius2
60 TITLE:=Detailed accounting module
61 endef
62
63 define Package/freeradius2-mod-detail/conffiles
64 /etc/freeradius2/modules/detail
65 endef
66
67 define Package/freeradius2-mod-eap
68 $(call Package/freeradius2/Default)
69 DEPENDS:=freeradius2
70 TITLE:=Base EAP module
71 endef
72
73 define Package/freeradius2-mod-eap/conffiles
74 /etc/freeradius2/eap.conf
75 endef
76
77 define Package/freeradius2-mod-eap-gtc
78 $(call Package/freeradius2/Default)
79 DEPENDS:=freeradius2-mod-eap
80 TITLE:=EAP/GTC module
81 endef
82
83 define Package/freeradius2-mod-eap-md5
84 $(call Package/freeradius2/Default)
85 DEPENDS:=freeradius2-mod-eap
86 TITLE:=EAP/MD5 module
87 endef
88
89 define Package/freeradius2-mod-eap-mschapv2
90 $(call Package/freeradius2/Default)
91 DEPENDS:=freeradius2-mod-eap
92 TITLE:=EAP/MS-CHAPv2 module
93 endef
94
95 define Package/freeradius2-mod-eap-peap
96 $(call Package/freeradius2/Default)
97 DEPENDS:=freeradius2-mod-eap
98 TITLE:=EAP/PEAP module
99 endef
100
101 define Package/freeradius2-mod-eap-tls
102 $(call Package/freeradius2/Default)
103 DEPENDS:=freeradius2-mod-eap
104 TITLE:=EAP/TLS module
105 endef
106
107 define Package/freeradius2-mod-eap-ttls
108 $(call Package/freeradius2/Default)
109 DEPENDS:=freeradius2-mod-eap-tls
110 TITLE:=EAP/TTLS module
111 endef
112
113 define Package/freeradius2-mod-exec
114 $(call Package/freeradius2/Default)
115 DEPENDS:=freeradius2
116 TITLE:=EXEC module
117 endef
118
119 define Package/freeradius2-mod-exec/conffiles
120 /etc/freeradius2/modules/exec
121 endef
122
123 define Package/freeradius2-mod-expiration
124 $(call Package/freeradius2/Default)
125 DEPENDS:=freeradius2
126 TITLE:=Expiration module
127 endef
128
129 define Package/freeradius2-mod-expiration/conffiles
130 /etc/freeradius2/modules/expiration
131 endef
132
133 define Package/freeradius2-mod-expr
134 $(call Package/freeradius2/Default)
135 DEPENDS:=freeradius2
136 TITLE:=EXPR module
137 endef
138
139 define Package/freeradius2-mod-expr/conffiles
140 /etc/freeradius2/modules/expr
141 endef
142
143 define Package/freeradius2-mod-attr-filter
144 $(call Package/freeradius2/Default)
145 DEPENDS:=freeradius2
146 TITLE:=ATTR filter module
147 endef
148
149 define Package/freeradius2-mod-attr-filter/conffiles
150 /etc/freeradius2/modules/attr_filter
151 /etc/freeradius2/attrs
152 /etc/freeradius2/attrs.access_reject
153 /etc/freeradius2/attrs.accounting_response
154 /etc/freeradius2/attrs.pre-proxy
155 endef
156
157 define Package/freeradius2-mod-attr-rewrite
158 $(call Package/freeradius2/Default)
159 DEPENDS:=freeradius2
160 TITLE:=ATTR rewrite module
161 endef
162
163 define Package/freeradius2-mod-attr-rewrite/conffiles
164 /etc/freeradius2/modules/attr_rewrite
165 endef
166
167 define Package/freeradius2-mod-files
168 $(call Package/freeradius2/Default)
169 DEPENDS:=freeradius2
170 TITLE:=Module using local files for authorization
171 endef
172
173 define Package/freeradius2-mod-files/conffiles
174 /etc/freeradius2/acct_users
175 /etc/freeradius2/preproxy_users
176 /etc/freeradius2/users
177 /etc/freeradius2/modules/files
178 endef
179
180 define Package/freeradius2-mod-ldap
181 $(call Package/freeradius2/Default)
182 DEPENDS:=freeradius2 +libopenldap
183 TITLE:=LDAP module
184 endef
185
186 define Package/freeradius2-mod-ldap/conffiles
187 /etc/freeradius2/ldap.attrmap
188 /etc/freeradius2/modules/ldap
189 endef
190
191 define Package/freeradius2-mod-logintime
192 $(call Package/freeradius2/Default)
193 DEPENDS:=freeradius2
194 TITLE:=Logintime module
195 endef
196
197 define Package/freeradius2-mod-logintime/conffiles
198 /etc/freeradius2/modules/logintime
199 endef
200
201 define Package/freeradius2-mod-mschap
202 $(call Package/freeradius2/Default)
203 DEPENDS:=freeradius2
204 TITLE:=MS-CHAP and MS-CHAPv2 module
205 endef
206
207 define Package/freeradius2-mod-mschap/conffiles
208 /etc/freeradius2/modules/mschap
209 endef
210
211 define Package/freeradius2-mod-pap
212 $(call Package/freeradius2/Default)
213 DEPENDS:=freeradius2
214 TITLE:=PAP module
215 endef
216
217 define Package/freeradius2-mod-pap/conffiles
218 /etc/freeradius2/modules/pap
219 endef
220
221 define Package/freeradius2-mod-preprocess
222 $(call Package/freeradius2/Default)
223 DEPENDS:=freeradius2
224 TITLE:=Request pre-processing module
225 endef
226
227 define Package/freeradius2-mod-preprocess/conffiles
228 /etc/freeradius2/hints
229 /etc/freeradius2/huntgroups
230 /etc/freeradius2/modules/preprocess
231 endef
232
233 define Package/freeradius2-mod-realm
234 $(call Package/freeradius2/Default)
235 DEPENDS:=freeradius2
236 TITLE:=Realms handling module
237 endef
238
239 define Package/freeradius2-mod-realm/conffiles
240 /etc/freeradius2/proxy.conf
241 /etc/freeradius2/modules/realm
242 endef
243
244 define Package/freeradius2-mod-sql
245 $(call Package/freeradius2/Default)
246 DEPENDS:=freeradius2
247 TITLE:=Base SQL module
248 endef
249
250 define Package/freeradius2-mod-sql/conffiles
251 /etc/freeradius2/sql.conf
252 endef
253
254 define Package/freeradius2-mod-sql-mysql
255 $(call Package/freeradius2/Default)
256 DEPENDS:=freeradius2-mod-sql +libmysqlclient
257 TITLE:=MySQL module
258 endef
259
260 define Package/freeradius2-mod-sql-pgsql
261 $(call Package/freeradius2/Default)
262 DEPENDS:=freeradius2-mod-sql +libpq
263 TITLE:=PostgreSQL module
264 endef
265
266 define Package/freeradius2-mod-sqlcounter
267 $(call Package/freeradius2/Default)
268 DEPENDS:=freeradius2-mod-sql
269 TITLE:=Generic SQL Counter module
270 endef
271
272 define Package/freeradius2-mod-radutmp
273 $(call Package/freeradius2/Default)
274 DEPENDS:=freeradius2
275 TITLE:=Radius UTMP module
276 endef
277
278 define Package/freeradius2-mod-radutmp/conffiles
279 /etc/freeradius2/modules/radutmp
280 /etc/freeradius2/modules/sradutmp
281 endef
282
283 define Package/freeradius2-utils
284 $(call Package/freeradius2/Default)
285 DEPENDS:=freeradius2
286 TITLE:=Misc. client utilities
287 endef
288
289 CONFIGURE_ARGS+= \
290 --libdir=/usr/lib/freeradius2 \
291 --libexecdir=/usr/lib/freeradius2 \
292 --enable-shared \
293 --disable-static \
294 --disable-developer \
295 --with-threads \
296 --with-openssl-includes="$(STAGING_DIR)/usr/include" \
297 --with-openssl-libraries="$(STAGING_DIR)/usr/lib" \
298 --enable-strict-dependencies \
299 --with-raddbdir=/etc/freeradius2 \
300 --with-radacctdir=/var/db/radacct \
301 --with-logdir=/var/log \
302 --without-edir \
303 --without-snmp \
304 --without-rlm_checkval \
305 --without-rlm_dbm \
306 --without-rlm_counter \
307 --with-rlm_expr \
308 --with-rlm_eap \
309 --without-rlm_eap_sim \
310 --without-rlm_example \
311 --without-rlm_ippool \
312 --without-rlm_krb5 \
313 --without-rlm_otp \
314 --without-rlm_smsotp \
315 --without-rlm_pam \
316 --without-rlm_perl \
317 --without-rlm_python \
318 --without-rlm_smb \
319 --without-rlm_always \
320 --with-rlm_sql \
321 --with-rlm_sqlcounter \
322 --without-rlm_sqlhpwippool \
323 --without-rlm_sqlippool \
324 --without-rlm_sql_db2 \
325 --without-rlm_sql_firebird \
326 --without-rlm_sql_freetds \
327 --without-rlm_sql_iodbc \
328 --without-rlm_sql_oracle \
329 --without-rlm_sql_sybase \
330 --without-rlm_sql_unixodbc \
331 --without-rlm_sql_log \
332 --without-rlm_sql_sqlite \
333 --without-rlm_unix \
334 --without-rlm_eap_tnc \
335 --without-rlm_eap_ikev2 \
336 --without-rlm_opendirectory \
337 --without-rlm_wimax \
338
339 PKG_DICTIONARIES:= \
340 freeradius freeradius.internal \
341 rfc2865 rfc2866 rfc2867 rfc2868 rfc2869 rfc3162 rfc3576 rfc3580 \
342 rfc4372 rfc4675 rfc4679 \
343 microsoft \
344 wispr \
345
346 ifneq ($(SDK)$(CONFIG_PACKAGE_freeradius2-mod-ldap),)
347 CONFIGURE_ARGS+= \
348 --with-rlm_ldap-include-dir="$(STAGING_DIR)/usr/include" \
349 --with-rlm_ldap-lib-dir="$(STAGING_DIR)/usr/lib"
350 CONFIGURE_LIBS+= -lcrypto -lssl
351 else
352 CONFIGURE_ARGS+= --without-rlm_ldap
353 endif
354
355 ifneq ($(SDK)$(CONFIG_PACKAGE_freeradius2-mod-sql-mysql),)
356 CONFIGURE_ARGS+= \
357 --with-mysql-include-dir="$(STAGING_DIR)/usr/include" \
358 --with-mysql-lib-dir="$(STAGING_DIR)/usr/lib/mysql"
359 CONFIGURE_LIBS+= -lz
360 CONFIGURE_VARS+= ac_cv_lib_mysqlclient_r_mysql_init=yes
361 else
362 CONFIGURE_ARGS+= --without-rlm_sql_mysql
363 endif
364
365 ifneq ($(SDK)$(CONFIG_PACKAGE_freeradius2-mod-sql-pgsql),)
366 CONFIGURE_ARGS+= \
367 --with-rlm_sql_postgresql-include-dir="$(STAGING_DIR)/usr/include" \
368 --with-rlm_sql_postgresql-lib-dir="$(STAGING_DIR)/usr/lib"
369 else
370 CONFIGURE_ARGS+= --without-rlm_sql_postgresql
371 endif
372
373 ifneq ($(SDK)$(CONFIG_PACKAGE_freeradius2-mod-eap-peap),)
374 CONFIGURE_ARGS+= \
375 --with-rlm_eap_peap \
376 --with-rlm_eap_peap-include-dir="$(STAGING_DIR)/usr/include" \
377 --with-rlm_eap_peap-lib-dir="$(STAGING_DIR)/usr/lib"
378 CONFIGURE_LIBS+= -lcrypto -lssl
379 else
380 CONFIGURE_ARGS+= --without-rlm_eap_peap
381 endif
382
383 ifneq ($(SDK)$(CONFIG_PACKAGE_freeradius2-mod-eap-tls),)
384 CONFIGURE_ARGS+= \
385 --with-rlm_eap_tls \
386 --with-rlm_eap_tls-include-dir="$(STAGING_DIR)/usr/include" \
387 --with-rlm_eap_tls-lib-dir="$(STAGING_DIR)/usr/lib"
388 CONFIGURE_LIBS+= -lcrypto -lssl
389 else
390 CONFIGURE_ARGS+= --without-rlm_eap_tls
391 endif
392
393 ifneq ($(SDK)$(CONFIG_PACKAGE_freeradius2-mod-eap-ttls),)
394 CONFIGURE_ARGS+= \
395 --with-rlm_eap_ttls \
396 --with-rlm_eap_ttls-include-dir="$(STAGING_DIR)/usr/include" \
397 --with-rlm_eap_ttls-lib-dir="$(STAGING_DIR)/usr/lib"
398 CONFIGURE_LIBS+= -lcrypto -lssl
399 else
400 CONFIGURE_ARGS+= --without-rlm_eap_ttls
401 endif
402
403 ifneq ($(SDK)$(CONFIG_PACKAGE_freeradius2-mod-attr-rewrite),)
404 CONFIGURE_ARGS+= --with-rlm_attr-rewrite
405 else
406 CONFIGURE_ARGS+= --without-rlm_attr-rewrite
407 endif
408
409 ifneq ($(SDK)$(CONFIG_PACKAGE_freeradius2-mod-radutmp),)
410 CONFIGURE_ARGS+= --with-rlm_radutmp
411 else
412 CONFIGURE_ARGS+= --without-rlm_radutmp
413 endif
414
415 ifneq ($(SDK)$(CONFIG_PACKAGE_freeradius2-mod-logintime),)
416 CONFIGURE_ARGS+= --with-rlm_logintime
417 else
418 CONFIGURE_ARGS+= --without-rlm_logintime
419 endif
420
421 ifneq ($(SDK)$(CONFIG_PACKAGE_freeradius2-mod-expiration),)
422 CONFIGURE_ARGS+= --with-rlm_expiration
423 else
424 CONFIGURE_ARGS+= --without-rlm_expiration
425 endif
426
427 CONFIGURE_VARS+= \
428 LDFLAGS="$$$$LDFLAGS" \
429 LIBS="$(CONFIGURE_LIBS)" \
430 MYSQL_CONFIG="no" \
431 ac_cv_lib_readline=no \
432
433 define Build/Compile
434 $(MAKE) -C $(PKG_BUILD_DIR) \
435 R="$(PKG_INSTALL_DIR)" \
436 INSTALLSTRIP="" \
437 all certs install
438 endef
439
440 define Package/freeradius2/install
441 $(INSTALL_DIR) $(1)/etc/freeradius2
442 $(INSTALL_DIR) $(1)/etc/freeradius2/modules
443 $(INSTALL_DIR) $(1)/etc/freeradius2/sites
444 for f in clients.conf dictionary radiusd.conf policy.conf; do \
445 $(CP) $(PKG_INSTALL_DIR)/etc/freeradius2/$$$${f} $(1)/etc/freeradius2/ ; \
446 done
447 $(CP) $(PKG_INSTALL_DIR)/etc/freeradius2/sites-available/default $(1)/etc/freeradius2/sites/default
448 $(INSTALL_DIR) $(1)/usr/share/freeradius2
449 $(CP) $(PKG_INSTALL_DIR)/usr/share/freeradius/dictionary $(1)/usr/share/freeradius2/
450 $(SED) "s,^\(\$$$$INCLUDE\),#\1,g" $(1)/usr/share/freeradius2/dictionary
451 for f in $(PKG_DICTIONARIES); do \
452 $(CP) $(PKG_INSTALL_DIR)/usr/share/freeradius/dictionary.$$$${f} $(1)/usr/share/freeradius2/ ; \
453 $(SED) "s,^#\(\$$$$INCLUDE dictionary\.$$$${f}\),\1,g" $(1)/usr/share/freeradius2/dictionary ; \
454 done
455 $(INSTALL_DIR) $(1)/usr/lib/freeradius2
456 $(CP) $(PKG_INSTALL_DIR)/usr/lib/freeradius2/libfreeradius-radius{,-*}.so $(1)/usr/lib/freeradius2
457 $(INSTALL_DIR) $(1)/usr/sbin
458 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/radiusd $(1)/usr/sbin/
459 $(INSTALL_DIR) $(1)/etc/init.d
460 $(INSTALL_BIN) ./files/radiusd.init $(1)/etc/init.d/radiusd
461 endef
462
463 define Package/freeradius2-democerts/install
464 $(INSTALL_DIR) $(1)/etc/freeradius2
465 $(CP) $(PKG_INSTALL_DIR)/etc/freeradius2/certs $(1)/etc/freeradius2/
466 rm -rf $(1)/etc/freeradius2/certs/README
467 rm -rf $(1)/etc/freeradius2/certs/new*
468 rm -rf $(1)/etc/freeradius2/certs/demoCA/index*
469 rm -rf $(1)/etc/freeradius2/certs/demoCA/serial*
470 rm -rf $(1)/etc/freeradius2/certs/bootstrap
471 rm -rf $(1)/etc/freeradius2/certs/Makefile
472 rm -rf $(1)/etc/freeradius2/certs/ca.cnf
473 rm -rf $(1)/etc/freeradius2/certs/client.cnf
474 rm -rf $(1)/etc/freeradius2/certs/server.cnf
475 endef
476
477 define Package/freeradius2-utils/install
478 $(INSTALL_DIR) $(1)/usr/bin
479 for f in radclient radeapclient; do \
480 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/$$$${f} $(1)/usr/bin/ ; \
481 done
482 endef
483
484 define BuildPlugin
485 define Package/$(1)/install
486 [ -z "$(2)" ] || $(INSTALL_DIR) $$(1)/usr/lib/freeradius2
487 for m in $(2); do \
488 $(CP) $(PKG_INSTALL_DIR)/usr/lib/freeradius2/$$$$$$$${m}{,-*}.so $$(1)/usr/lib/freeradius2 ; \
489 done
490 [ -z "$(3)" ] || $(INSTALL_DIR) $$(1)/etc/freeradius2
491 [ -z "$(4)" ] || $(INSTALL_DIR) $$(1)/etc/freeradius2/$(4)
492 for f in $(3); do \
493 $(CP) $(PKG_INSTALL_DIR)/etc/freeradius2/$$$$$$$${f} $$(1)/etc/freeradius2/$$$$$$$${f} ; \
494 done
495 endef
496
497 $$(eval $$(call BuildPackage,$(1)))
498 endef
499
500 $(eval $(call BuildPackage,freeradius2))
501 $(eval $(call BuildPackage,freeradius2-democerts))
502 $(eval $(call BuildPlugin,freeradius2-mod-chap,rlm_chap,modules/chap,modules,))
503 $(eval $(call BuildPlugin,freeradius2-mod-detail,rlm_detail,modules/detail,modules,))
504 $(eval $(call BuildPlugin,freeradius2-mod-eap,libfreeradius-eap rlm_eap,eap.conf))
505 $(eval $(call BuildPlugin,freeradius2-mod-eap-gtc,rlm_eap_gtc,))
506 $(eval $(call BuildPlugin,freeradius2-mod-eap-md5,rlm_eap_md5,))
507 $(eval $(call BuildPlugin,freeradius2-mod-eap-mschapv2,rlm_eap_mschapv2,))
508 $(eval $(call BuildPlugin,freeradius2-mod-eap-peap,rlm_eap_peap,))
509 $(eval $(call BuildPlugin,freeradius2-mod-eap-tls,rlm_eap_tls,))
510 $(eval $(call BuildPlugin,freeradius2-mod-eap-ttls,rlm_eap_ttls,))
511 $(eval $(call BuildPlugin,freeradius2-mod-exec,rlm_exec,modules/exec modules/echo ,modules,))
512 $(eval $(call BuildPlugin,freeradius2-mod-attr-rewrite,rlm_attr_rewrite,modules/attr_rewrite,modules,))
513 $(eval $(call BuildPlugin,freeradius2-mod-files,rlm_files,acct_users preproxy_users users modules/files,modules,))
514 $(eval $(call BuildPlugin,freeradius2-mod-ldap,rlm_ldap,ldap.attrmap modules/ldap,modules,))
515 $(eval $(call BuildPlugin,freeradius2-mod-mschap,rlm_mschap,modules/mschap,modules,))
516 $(eval $(call BuildPlugin,freeradius2-mod-pap,rlm_pap,modules/pap,modules,))
517 $(eval $(call BuildPlugin,freeradius2-mod-preprocess,rlm_preprocess,hints huntgroups modules/preprocess,modules,))
518 $(eval $(call BuildPlugin,freeradius2-mod-realm,rlm_realm,proxy.conf modules/realm modules/inner-eap,modules,))
519 $(eval $(call BuildPlugin,freeradius2-mod-sql,rlm_sql,sql.conf,))
520 $(eval $(call BuildPlugin,freeradius2-mod-sql-mysql,rlm_sql_mysql,))
521 $(eval $(call BuildPlugin,freeradius2-mod-sql-pgsql,rlm_sql_postgresql,))
522 $(eval $(call BuildPlugin,freeradius2-mod-sqlcounter,rlm_sqlcounter,))
523 $(eval $(call BuildPlugin,freeradius2-mod-radutmp,rlm_radutmp,modules/radutmp modules/sradutmp,modules,))
524 $(eval $(call BuildPlugin,freeradius2-mod-logintime,rlm_logintime,modules/logintime,modules,))
525 $(eval $(call BuildPlugin,freeradius2-mod-expr,rlm_expr,modules/expr,modules,))
526 $(eval $(call BuildPlugin,freeradius2-mod-attr-filter,rlm_attr_filter,modules/attr_filter attrs attrs.access_reject attrs.accounting_response attrs.pre-proxy,modules,,))
527 $(eval $(call BuildPlugin,freeradius2-mod-expiration,rlm_expiration,modules/expiration,modules,))
528 $(eval $(call BuildPackage,freeradius2-utils))