2 # Copyright (C) 2008-2014 OpenWrt.org
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
8 include $(TOPDIR)/rules.mk
14 PKG_SOURCE:=freeradius-server-$(PKG_VERSION).tar.bz2
15 PKG_SOURCE_URL:=ftp://ftp.freeradius.org/pub/freeradius/
16 PKG_MD5SUM:=25fb44cc1bc121f44f61f439bf45a420
18 PKG_BUILD_DIR:=$(BUILD_DIR)/freeradius-server-$(PKG_VERSION)
21 PKG_CONFIG_DEPENDS := \
25 include $(INCLUDE_DIR)/package.mk
27 define Package/freeradius2/config
28 source "$(SOURCE)/Config.in"
31 define Package/freeradius2/Default
34 URL:=http://freeradius.org/
35 SUBMENU:=FreeRADIUS (version 2)
38 define Package/freeradius2
39 $(call Package/freeradius2/Default)
40 DEPENDS:=+libltdl +libreadline +freeradius2-common
41 TITLE:=A flexible RADIUS server (version 2)
44 define Package/freeradius2/conffiles
45 /etc/freeradius2/clients.conf
46 /etc/freeradius2/radiusd.conf
47 /etc/freeradius2/sites/default
50 define Package/freeradius2-democerts
51 $(call Package/freeradius2/Default)
53 TITLE:=Demo certificates to test the server
56 define Package/freeradius2-common
57 $(call Package/freeradius2/Default)
59 DEPENDS:=+libpthread +FREERADIUS_OPENSSL:libopenssl
62 define Package/freeradius2-mod-chap
63 $(call Package/freeradius2/Default)
68 define Package/freeradius2-mod-chap/conffiles
69 /etc/freeradius2/modules/chap
72 define Package/freeradius2-mod-detail
73 $(call Package/freeradius2/Default)
75 TITLE:=Detailed accounting module
78 define Package/freeradius2-mod-detail/conffiles
79 /etc/freeradius2/modules/detail
82 define Package/freeradius2-mod-eap
83 $(call Package/freeradius2/Default)
85 TITLE:=Base EAP module
88 define Package/freeradius2-mod-eap/conffiles
89 /etc/freeradius2/eap.conf
92 define Package/freeradius2-mod-eap-gtc
93 $(call Package/freeradius2/Default)
94 DEPENDS:=freeradius2-mod-eap
98 define Package/freeradius2-mod-eap-md5
99 $(call Package/freeradius2/Default)
100 DEPENDS:=freeradius2-mod-eap
101 TITLE:=EAP/MD5 module
104 define Package/freeradius2-mod-eap-mschapv2
105 $(call Package/freeradius2/Default)
106 DEPENDS:=freeradius2-mod-eap +freeradius2-mod-mschap
107 TITLE:=EAP/MS-CHAPv2 module
110 define Package/freeradius2-mod-eap-peap
111 $(call Package/freeradius2/Default)
112 DEPENDS:=freeradius2-mod-eap @FREERADIUS_OPENSSL
113 TITLE:=EAP/PEAP module
116 define Package/freeradius2-mod-eap-tls
117 $(call Package/freeradius2/Default)
118 DEPENDS:=freeradius2-mod-eap @FREERADIUS_OPENSSL
119 TITLE:=EAP/TLS module
122 define Package/freeradius2-mod-eap-ttls
123 $(call Package/freeradius2/Default)
124 DEPENDS:=freeradius2-mod-eap-tls
125 TITLE:=EAP/TTLS module
128 define Package/freeradius2-mod-exec
129 $(call Package/freeradius2/Default)
134 define Package/freeradius2-mod-exec/conffiles
135 /etc/freeradius2/modules/exec
138 define Package/freeradius2-mod-expiration
139 $(call Package/freeradius2/Default)
141 TITLE:=Expiration module
144 define Package/freeradius2-mod-expiration/conffiles
145 /etc/freeradius2/modules/expiration
148 define Package/freeradius2-mod-always
149 $(call Package/freeradius2/Default)
154 define Package/freeradius2-mod-always/conffiles
155 /etc/freeradius2/modules/always
158 define Package/freeradius2-mod-expr
159 $(call Package/freeradius2/Default)
164 define Package/freeradius2-mod-expr/conffiles
165 /etc/freeradius2/modules/expr
168 define Package/freeradius2-mod-attr-filter
169 $(call Package/freeradius2/Default)
171 TITLE:=ATTR filter module
174 define Package/freeradius2-mod-attr-filter/conffiles
175 /etc/freeradius2/modules/attr_filter
176 /etc/freeradius2/attrs
177 /etc/freeradius2/attrs.access_reject
178 /etc/freeradius2/attrs.accounting_response
179 /etc/freeradius2/attrs.pre-proxy
182 define Package/freeradius2-mod-attr-rewrite
183 $(call Package/freeradius2/Default)
185 TITLE:=ATTR rewrite module
188 define Package/freeradius2-mod-attr-rewrite/conffiles
189 /etc/freeradius2/modules/attr_rewrite
192 define Package/freeradius2-mod-files
193 $(call Package/freeradius2/Default)
195 TITLE:=Module using local files for authorization
198 define Package/freeradius2-mod-files/conffiles
199 /etc/freeradius2/acct_users
200 /etc/freeradius2/preproxy_users
201 /etc/freeradius2/users
202 /etc/freeradius2/modules/files
205 define Package/freeradius2-mod-passwd
206 $(call Package/freeradius2/Default)
208 TITLE:=Rlm passwd module
211 define Package/freeradius2-mod-passwd/conffiles
212 /etc/freeradius2/modules/passwd
215 define Package/freeradius2-mod-ldap
216 $(call Package/freeradius2/Default)
217 DEPENDS:=freeradius2 +PACKAGE_freeradius2-mod-ldap:libopenldap
221 define Package/freeradius2-mod-ldap/conffiles
222 /etc/freeradius2/ldap.attrmap
223 /etc/freeradius2/modules/ldap
226 define Package/freeradius2-mod-logintime
227 $(call Package/freeradius2/Default)
229 TITLE:=Logintime module
232 define Package/freeradius2-mod-logintime/conffiles
233 /etc/freeradius2/modules/logintime
236 define Package/freeradius2-mod-mschap
237 $(call Package/freeradius2/Default)
239 TITLE:=MS-CHAP and MS-CHAPv2 module
242 define Package/freeradius2-mod-mschap/conffiles
243 /etc/freeradius2/modules/mschap
246 define Package/freeradius2-mod-pap
247 $(call Package/freeradius2/Default)
252 define Package/freeradius2-mod-pap/conffiles
253 /etc/freeradius2/modules/pap
256 define Package/freeradius2-mod-preprocess
257 $(call Package/freeradius2/Default)
259 TITLE:=Request pre-processing module
262 define Package/freeradius2-mod-preprocess/conffiles
263 /etc/freeradius2/hints
264 /etc/freeradius2/huntgroups
265 /etc/freeradius2/modules/preprocess
268 define Package/freeradius2-mod-realm
269 $(call Package/freeradius2/Default)
271 TITLE:=Realms handling module
274 define Package/freeradius2-mod-realm/conffiles
275 /etc/freeradius2/proxy.conf
276 /etc/freeradius2/modules/realm
279 define Package/freeradius2-mod-sql
280 $(call Package/freeradius2/Default)
282 TITLE:=Base SQL module
285 define Package/freeradius2-mod-sql/conffiles
286 /etc/freeradius2/sql.conf
289 define Package/freeradius2-mod-sql-mysql
290 $(call Package/freeradius2/Default)
291 DEPENDS:=freeradius2-mod-sql \
292 +PACKAGE_freeradius2-mod-sql-mysql:libmysqlclient-r
296 define Package/freeradius2-mod-sql-pgsql
297 $(call Package/freeradius2/Default)
298 DEPENDS:=freeradius2-mod-sql \
299 +PACKAGE_freeradius2-mod-sql-pgsql:libpq
300 TITLE:=PostgreSQL module
303 define Package/freeradius2-mod-sql-sqlite
304 $(call Package/freeradius2/Default)
305 DEPENDS:=freeradius2-mod-sql \
306 +PACKAGE_freeradius2-mod-sql-sqlite:libsqlite3
310 define Package/freeradius2-mod-sqlcounter
311 $(call Package/freeradius2/Default)
312 DEPENDS:=freeradius2-mod-sql
313 TITLE:=Generic SQL Counter module
316 define Package/freeradius2-mod-radutmp
317 $(call Package/freeradius2/Default)
319 TITLE:=Radius UTMP module
322 define Package/freeradius2-mod-radutmp/conffiles
323 /etc/freeradius2/modules/radutmp
324 /etc/freeradius2/modules/sradutmp
327 define Package/freeradius2-utils
328 $(call Package/freeradius2/Default)
329 DEPENDS:=+freeradius2-common
330 TITLE:=Misc. client utilities
333 define Package/freeradius2-mod-sqllog
334 $(call Package/freeradius2/Default)
336 TITLE:=SQL Logging module
340 --libdir=/usr/lib/freeradius2 \
341 --libexecdir=/usr/lib/freeradius2 \
344 --disable-developer \
346 $(if $(CONFIG_FREERADIUS_OPENSSL),--with,--without)-openssl \
347 $(if $(CONFIG_FREERADIUS_OPENSSL),--with-openssl-includes="$(STAGING_DIR)/usr/include",) \
348 $(if $(CONFIG_FREERADIUS_OPENSSL),--with-openssl-libraries="$(STAGING_DIR)/usr/lib",) \
349 --with-system-libtool \
350 --with-system-libltdl \
351 --enable-strict-dependencies \
352 --with-raddbdir=/etc/freeradius2 \
353 --with-radacctdir=/var/db/radacct \
354 --with-logdir=/var/log \
357 --without-rlm_checkval \
359 --without-rlm_counter \
362 --without-rlm_eap_sim \
363 --without-rlm_example \
364 --without-rlm_ippool \
367 --without-rlm_smsotp \
370 --without-rlm_python \
373 --with-rlm_sqlcounter \
374 --without-rlm_sqlhpwippool \
375 --without-rlm_sqlippool \
376 --without-rlm_sql_db2 \
377 --without-rlm_sql_firebird \
378 --without-rlm_sql_freetds \
379 --without-rlm_sql_iodbc \
380 --without-rlm_sql_oracle \
381 --without-rlm_sql_sybase \
382 --without-rlm_sql_unixodbc \
383 --without-rlm_sql_log \
385 --without-rlm_eap_tnc \
386 --without-rlm_eap_ikev2 \
387 --without-rlm_opendirectory \
388 --without-rlm_wimax \
390 --without-rlm_caching \
391 --without-rlm_redis \
392 --without-rlm_rediswho \
395 --without-rlm_replicate \
396 --without-rlm_protocol_filter \
397 --without-rlm_policy \
398 --without-rlm_linelog \
399 --without-rlm_jradius \
400 --without-rlm_fastusers \
401 --without-rlm_eap_leap \
402 --without-rlm_dynamic_clients \
403 --without-rlm_digest \
405 --without-rlm_copy_packet \
406 --without-rlm_acct_unique \
407 --without-rlm_acctlog
411 freeradius freeradius.internal \
412 rfc2865 rfc2866 rfc2867 rfc2868 rfc2869 rfc3162 rfc3576 rfc3580 \
413 rfc4372 rfc4675 rfc4679 \
417 ifneq ($(SDK)$(CONFIG_PACKAGE_freeradius2-mod-ldap),)
419 --with-rlm_ldap-include-dir="$(STAGING_DIR)/usr/include" \
420 --with-rlm_ldap-lib-dir="$(STAGING_DIR)/usr/lib"
421 CONFIGURE_LIBS+= -lcrypto -lssl
423 CONFIGURE_ARGS+= --without-rlm_ldap
426 ifneq ($(SDK)$(CONFIG_PACKAGE_freeradius2-mod-sql-mysql),)
428 --with-mysql-include-dir="$(STAGING_DIR)/usr/include" \
429 --with-mysql-lib-dir="$(STAGING_DIR)/usr/lib/mysql"
431 CONFIGURE_VARS+= ac_cv_lib_mysqlclient_r_mysql_init=yes
433 CONFIGURE_ARGS+= --without-rlm_sql_mysql
436 ifneq ($(SDK)$(CONFIG_PACKAGE_freeradius2-mod-sql-pgsql),)
438 --with-rlm_sql_postgresql-include-dir="$(STAGING_DIR)/usr/include" \
439 --with-rlm_sql_postgresql-lib-dir="$(STAGING_DIR)/usr/lib"
441 CONFIGURE_ARGS+= --without-rlm_sql_postgresql
444 ifneq ($(SDK)$(CONFIG_PACKAGE_freeradius2-mod-sqllog),)
447 --with-experimental-modules \
449 CONFIGURE_ARGS+= --without-rlm_sql_log
453 ifneq ($(SDK)$(CONFIG_PACKAGE_freeradius2-mod-sql-sqlite),)
455 --with-rlm_sql_sqlite \
456 --with-experimental-modules \
457 --with-sqlite-include-dir="$(STAGING_DIR)/usr/include" \
458 --with-sqlite-lib-dir="$(STAGING_DIR)/usr/lib"
460 CONFIGURE_ARGS+= --without-rlm_sql_sqlite
463 ifneq ($(SDK)$(CONFIG_PACKAGE_freeradius2-mod-eap-peap),)
465 --with-rlm_eap_peap \
466 --with-rlm_eap_peap-include-dir="$(STAGING_DIR)/usr/include" \
467 --with-rlm_eap_peap-lib-dir="$(STAGING_DIR)/usr/lib"
468 CONFIGURE_LIBS+= -lcrypto -lssl
470 CONFIGURE_ARGS+= --without-rlm_eap_peap
473 ifneq ($(SDK)$(CONFIG_PACKAGE_freeradius2-mod-eap-tls),)
476 --with-rlm_eap_tls-include-dir="$(STAGING_DIR)/usr/include" \
477 --with-rlm_eap_tls-lib-dir="$(STAGING_DIR)/usr/lib"
478 CONFIGURE_LIBS+= -lcrypto -lssl
480 CONFIGURE_ARGS+= --without-rlm_eap_tls
483 ifneq ($(SDK)$(CONFIG_PACKAGE_freeradius2-mod-eap-ttls),)
485 --with-rlm_eap_ttls \
486 --with-rlm_eap_ttls-include-dir="$(STAGING_DIR)/usr/include" \
487 --with-rlm_eap_ttls-lib-dir="$(STAGING_DIR)/usr/lib"
488 CONFIGURE_LIBS+= -lcrypto -lssl
490 CONFIGURE_ARGS+= --without-rlm_eap_ttls
493 ifneq ($(SDK)$(CONFIG_PACKAGE_freeradius2-mod-attr-rewrite),)
494 CONFIGURE_ARGS+= --with-rlm_attr-rewrite
496 CONFIGURE_ARGS+= --without-rlm_attr-rewrite
499 ifneq ($(SDK)$(CONFIG_PACKAGE_freeradius2-mod-radutmp),)
500 CONFIGURE_ARGS+= --with-rlm_radutmp
502 CONFIGURE_ARGS+= --without-rlm_radutmp
505 ifneq ($(SDK)$(CONFIG_PACKAGE_freeradius2-mod-logintime),)
506 CONFIGURE_ARGS+= --with-rlm_logintime
508 CONFIGURE_ARGS+= --without-rlm_logintime
511 ifneq ($(SDK)$(CONFIG_PACKAGE_freeradius2-mod-expiration),)
512 CONFIGURE_ARGS+= --with-rlm_expiration
514 CONFIGURE_ARGS+= --without-rlm_expiration
517 ifneq ($(SDK)$(CONFIG_PACKAGE_freeradius2-mod-always),)
518 CONFIGURE_ARGS+= --with-rlm_always
520 CONFIGURE_ARGS+= --without-rlm_always
524 LDFLAGS="$$$$LDFLAGS" \
525 LIBS="$(CONFIGURE_LIBS)" \
527 ac_cv_lib_readline=no \
530 $(MAKE) -C $(PKG_BUILD_DIR) \
531 R="$(PKG_INSTALL_DIR)" \
536 define Package/freeradius2-common/install
537 $(INSTALL_DIR) $(1)/etc/freeradius2
538 chmod 771 $(1)/etc/freeradius2
539 $(CP) $(PKG_INSTALL_DIR)/etc/freeradius2/dictionary $(1)/etc/freeradius2/ ; \
540 $(INSTALL_DIR) $(1)/usr/lib/freeradius2
541 $(CP) $(PKG_INSTALL_DIR)/usr/lib/freeradius2/libfreeradius-radius{,-*}.so $(1)/usr/lib/freeradius2
542 $(CP) $(PKG_INSTALL_DIR)/usr/lib/freeradius2/libfreeradius-eap{,-*}.so $(1)/usr/lib/freeradius2
543 $(INSTALL_DIR) $(1)/usr/share/freeradius2
544 $(CP) $(PKG_INSTALL_DIR)/usr/share/freeradius/dictionary $(1)/usr/share/freeradius2/
545 $(SED) "s,^\(\$$$$INCLUDE\),#\1,g" $(1)/usr/share/freeradius2/dictionary
546 for f in $(PKG_DICTIONARIES); do \
547 $(CP) $(PKG_INSTALL_DIR)/usr/share/freeradius/dictionary.$$$${f} $(1)/usr/share/freeradius2/ ; \
548 $(SED) "s,^#\(\$$$$INCLUDE dictionary\.$$$${f}\),\1,g" $(1)/usr/share/freeradius2/dictionary ; \
552 define Package/freeradius2/install
553 $(INSTALL_DIR) $(1)/etc/freeradius2/modules
554 $(INSTALL_DIR) $(1)/etc/freeradius2/sites
555 for f in clients.conf radiusd.conf policy.conf; do \
556 $(CP) $(PKG_INSTALL_DIR)/etc/freeradius2/$$$${f} $(1)/etc/freeradius2/ ; \
558 $(CP) $(PKG_INSTALL_DIR)/etc/freeradius2/sites-available/default $(1)/etc/freeradius2/sites/default
559 $(INSTALL_DIR) $(1)/usr/sbin
560 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/radiusd $(1)/usr/sbin/
561 $(INSTALL_DIR) $(1)/etc/init.d
562 $(INSTALL_BIN) ./files/radiusd.init $(1)/etc/init.d/radiusd
565 define Package/freeradius2-democerts/install
566 $(INSTALL_DIR) $(1)/etc/freeradius2/certs
568 $(PKG_BUILD_DIR)/raddb/certs/ca.pem \
569 $(PKG_BUILD_DIR)/raddb/certs/dh \
570 $(PKG_BUILD_DIR)/raddb/certs/random \
571 $(PKG_BUILD_DIR)/raddb/certs/server.pem \
572 $(1)/etc/freeradius2/certs/
575 define Package/freeradius2-utils/install
576 $(INSTALL_DIR) $(1)/usr/bin
577 for f in radclient radeapclient radwho; do \
578 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/$$$${f} $(1)/usr/bin/ ; \
583 define Package/$(1)/install
584 [ -z "$(2)" ] || $(INSTALL_DIR) $$(1)/usr/lib/freeradius2
586 $(CP) $(PKG_INSTALL_DIR)/usr/lib/freeradius2/$$$$$$$${m}{,-*}.so $$(1)/usr/lib/freeradius2 ; \
588 [ -z "$(3)" ] || $(INSTALL_DIR) $$(1)/etc/freeradius2
589 [ -z "$(4)" ] || $(INSTALL_DIR) $$(1)/etc/freeradius2/$(4)
591 $(CP) $(PKG_INSTALL_DIR)/etc/freeradius2/$$$$$$$${f} $$(1)/etc/freeradius2/$$$$$$$${f} ; \
595 $$(eval $$(call BuildPackage,$(1)))
598 $(eval $(call BuildPackage,freeradius2))
599 $(eval $(call BuildPackage,freeradius2-common))
600 $(eval $(call BuildPackage,freeradius2-democerts))
601 $(eval $(call BuildPlugin,freeradius2-mod-chap,rlm_chap,modules/chap,modules,))
602 $(eval $(call BuildPlugin,freeradius2-mod-detail,rlm_detail,modules/detail,modules,))
603 $(eval $(call BuildPlugin,freeradius2-mod-eap,rlm_eap,eap.conf))
604 $(eval $(call BuildPlugin,freeradius2-mod-eap-gtc,rlm_eap_gtc,))
605 $(eval $(call BuildPlugin,freeradius2-mod-eap-md5,rlm_eap_md5,))
606 $(eval $(call BuildPlugin,freeradius2-mod-eap-mschapv2,rlm_eap_mschapv2,))
607 $(eval $(call BuildPlugin,freeradius2-mod-eap-peap,rlm_eap_peap,))
608 $(eval $(call BuildPlugin,freeradius2-mod-eap-tls,rlm_eap_tls,))
609 $(eval $(call BuildPlugin,freeradius2-mod-eap-ttls,rlm_eap_ttls,))
610 $(eval $(call BuildPlugin,freeradius2-mod-exec,rlm_exec,modules/exec modules/echo ,modules,))
611 $(eval $(call BuildPlugin,freeradius2-mod-attr-rewrite,rlm_attr_rewrite,modules/attr_rewrite,modules,))
612 $(eval $(call BuildPlugin,freeradius2-mod-files,rlm_files,acct_users preproxy_users users modules/files,modules,))
613 $(eval $(call BuildPlugin,freeradius2-mod-passwd,rlm_passwd,modules/passwd,modules,))
614 $(eval $(call BuildPlugin,freeradius2-mod-ldap,rlm_ldap,ldap.attrmap modules/ldap,modules,))
615 $(eval $(call BuildPlugin,freeradius2-mod-mschap,rlm_mschap,modules/mschap,modules,))
616 $(eval $(call BuildPlugin,freeradius2-mod-pap,rlm_pap,modules/pap,modules,))
617 $(eval $(call BuildPlugin,freeradius2-mod-preprocess,rlm_preprocess,hints huntgroups modules/preprocess,modules,))
618 $(eval $(call BuildPlugin,freeradius2-mod-realm,rlm_realm,proxy.conf modules/realm modules/inner-eap,modules,))
619 $(eval $(call BuildPlugin,freeradius2-mod-sql,rlm_sql,sql.conf,))
620 $(eval $(call BuildPlugin,freeradius2-mod-sql-mysql,rlm_sql_mysql,))
621 $(eval $(call BuildPlugin,freeradius2-mod-sql-pgsql,rlm_sql_postgresql,))
622 $(eval $(call BuildPlugin,freeradius2-mod-sql-sqlite,rlm_sql_sqlite,))
623 $(eval $(call BuildPlugin,freeradius2-mod-sqlcounter,rlm_sqlcounter,))
624 $(eval $(call BuildPlugin,freeradius2-mod-sqllog,rlm_sql_log,))
625 $(eval $(call BuildPlugin,freeradius2-mod-radutmp,rlm_radutmp,modules/radutmp modules/sradutmp,modules,))
626 $(eval $(call BuildPlugin,freeradius2-mod-logintime,rlm_logintime,modules/logintime,modules,))
627 $(eval $(call BuildPlugin,freeradius2-mod-expr,rlm_expr,modules/expr,modules,))
628 $(eval $(call BuildPlugin,freeradius2-mod-attr-filter,rlm_attr_filter,modules/attr_filter attrs attrs.access_reject attrs.accounting_response attrs.pre-proxy,modules,,))
629 $(eval $(call BuildPlugin,freeradius2-mod-expiration,rlm_expiration,modules/expiration,modules,))
630 $(eval $(call BuildPlugin,freeradius2-mod-always,rlm_always,modules/always,modules,))
631 $(eval $(call BuildPackage,freeradius2-utils))