blob: c17d56deaf70fbcb29950b6b8d3067457b0385c4 [file] [log] [blame]
Brad Bishop1a4b7ee2018-12-16 17:11:34 -08001DESCRIPTION = "FreeRADIUS is an Internet authentication daemon, which implements the RADIUS \
2protocol, as defined in RFC 2865 (and others). It allows Network Access \
3Servers (NAS boxes) to perform authentication for dial-up users. There are \
4also RADIUS clients available for Web servers, firewalls, Unix logins, and \
5more. Using RADIUS allows authentication and authorization for a network to \
6be centralized, and minimizes the amount of re-configuration which has to be \
7done when adding or deleting new users."
8
9SUMMARY = "High-performance and highly configurable RADIUS server"
10HOMEPAGE = "http://www.freeradius.org/"
11SECTION = "System/Servers"
12LICENSE = "GPLv2 & LGPLv2+"
13LIC_FILES_CHKSUM = "file://LICENSE;md5=eb723b61539feef013de476e68b5c50a"
14DEPENDS = "openssl-native openssl libidn libtool libpcap libtalloc"
15
16SRC_URI = "ftp://ftp.freeradius.org/pub/freeradius/freeradius-server-${PV}.tar.bz2 \
17 file://freeradius \
18 file://volatiles.58_radiusd \
19 file://freeradius-enble-user-in-conf.patch \
20 file://freeradius-configure.ac-allow-cross-compilation.patch \
21 file://freeradius-fix-issues-related-to-m4-include-path.patch \
22 file://freeradius-libtool-detection.patch \
23 file://freeradius-configure.ac-add-option-for-libcap.patch \
24 file://freeradius-avoid-searching-host-dirs.patch \
25 file://freeradius-rlm_python-add-PY_INC_DIR.patch \
26 file://freeradius-libtool-do-not-use-jlibtool.patch \
27 file://freeradius-fix-quoting-for-BUILT_WITH.patch \
28 file://freeradius-fix-error-for-expansion-of-macro.patch \
29 file://0001-rlm_mschap-Use-includedir-instead-of-hardcoding-usr-.patch \
30 file://radiusd.service \
31 file://radiusd-volatiles.conf \
32 file://0001-freeradius-correct-version-number-of-libssl-defect.patch \
33"
34SRC_URI[md5sum] = "1f4ad38f32101a7d50d818afa6f17339"
35SRC_URI[sha256sum] = "3f03404b6e4a4f410e1f15ea2ababfec7f8a7ae8a49836d8a0c137436d913b96"
36
37PARALLEL_MAKE = ""
38
39S = "${WORKDIR}/freeradius-server-${PV}"
40
41EXTRA_OECONF = " --enable-strict-dependencies \
42 --with-docdir=${docdir}/freeradius-${PV} \
43 --with-openssl-includes=${STAGING_INCDIR} \
44 --with-openssl-libraries=${STAGING_LIBDIR} \
45 --without-rlm_ippool \
46 --without-rlm_cache_memcached \
47 --without-rlm_counter \
48 --without-rlm_couchbase \
49 --without-rlm_dbm \
50 --without-rlm_eap_tnc \
51 --without-rlm_eap_ikev2 \
52 --without-rlm_opendirectory \
53 --without-rlm_redis \
54 --without-rlm_rediswho \
55 --without-rlm_sql_db2 \
56 --without-rlm_sql_firebird \
57 --without-rlm_sql_freetds \
58 --without-rlm_sql_iodbc \
59 --without-rlm_sql_oracle \
60 --without-rlm_sql_sybase \
61 --without-rlm_sqlhpwippool \
62 ac_cv_path_PERL=${bindir}/perl \
63 ax_cv_cc_builtin_choose_expr=no \
64 ax_cv_cc_builtin_types_compatible_p=no \
65 ax_cv_cc_builtin_bswap64=no \
66 ax_cv_cc_bounded_attribute=no \
67"
68
69PACKAGECONFIG ??= "${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'pam', '', d)} \
70 pcre libcap \
71"
72
73PACKAGECONFIG[krb5] = "--with-rlm_krb5,--without-rlm_krb5,krb5"
74PACKAGECONFIG[pam] = "--with-rlm_pam,--without-rlm_pam,libpam"
75PACKAGECONFIG[libcap] = "--with-libcap,--without-libcap,libcap"
76PACKAGECONFIG[ldap] = "--with-rlm_ldap,--without-rlm_ldap,openldap"
77PACKAGECONFIG[mysql] = "--with-rlm_sql_mysql,--without-rlm_sql_mysql,mysql5"
78PACKAGECONFIG[sqlite] = "--with-rlm_sql_sqlite,--without-rlm_sql_sqlite,sqlite3"
79PACKAGECONFIG[unixodbc] = "--with-rlm_sql_unixodbc,--without-rlm_sql_unixodbc,unixodbc"
80PACKAGECONFIG[postgresql] = "--with-rlm_sql_postgresql,--without-rlm_sql_postgresql,postgresql"
81PACKAGECONFIG[pcre] = "--with-pcre,--without-pcre,libpcre"
82PACKAGECONFIG[perl] = "--with-perl=${STAGING_BINDIR_NATIVE}/perl-native/perl --with-rlm_perl,--without-rlm_perl,perl-native perl,perl"
83PACKAGECONFIG[python] = "--with-rlm_python --with-rlm-python-bin=${STAGING_BINDIR_NATIVE}/python-native/python --with-rlm-python-include-dir=${STAGING_INCDIR}/${PYTHON_DIR},--without-rlm_python,python-native python"
84PACKAGECONFIG[rest] = "--with-rlm_rest,--without-rlm_rest,curl json-c"
85PACKAGECONFIG[ruby] = "--with-rlm_ruby,--without-rlm_ruby,ruby"
86
87inherit useradd autotools-brokensep update-rc.d systemd
88
89# This is not a cpan or python based package, but it needs some definitions
90# from cpan-base and python-dir bbclasses for building rlm_perl and rlm_python
91# correctly.
92inherit cpan-base python-dir
93
94# The modules subdirs also need to be processed by autoreconf. Use autogen.sh
95# in order to handle the subdirs correctly.
96do_configure () {
97 ./autogen.sh
98
99 # the configure of rlm_perl needs this to get correct
100 # mod_cflags and mod_ldflags
101 if ${@bb.utils.contains('PACKAGECONFIG', 'perl', 'true', 'false', d)}; then
102 export PERL5LIB="${STAGING_LIBDIR}${PERL_OWN_DIR}/perl/${@get_perl_version(d)}"
103 fi
104
105 oe_runconf
106
107 # we don't need dhcpclient
108 sed -i -e 's/dhcpclient.mk//' ${S}/src/modules/proto_dhcp/all.mk
109}
110
111INITSCRIPT_NAME = "radiusd"
112
113SYSTEMD_SERVICE_${PN} = "radiusd.service"
114
115USERADD_PACKAGES = "${PN}"
116USERADD_PARAM_${PN} = "--system --no-create-home --shell /bin/false --user-group radiusd"
117
118do_install() {
119 rm -rf ${D}
120 mkdir -p ${D}/${sysconfdir}/logrotate.d
121 mkdir -p ${D}/${sysconfdir}/pam.d
122 mkdir -p ${D}/${sysconfdir}/init.d
123 mkdir -p ${D}/${localstatedir}/lib/radiusd
124 mkdir -p ${D}${sysconfdir}/default/volatiles
125
126 export LD_LIBRARY_PATH=${D}/${libdir}
127 oe_runmake install R=${D} INSTALLSTRIP=""
128
129 # remove unsupported config files
130 rm -f ${D}/${sysconfdir}/raddb/experimental.conf
131
132 # remove scripts that required Perl(DBI)
133 rm -rf ${D}/${bindir}/radsqlrelay
134
135 cp -f ${WORKDIR}/freeradius ${D}/etc/init.d/radiusd
136 rm -f ${D}/${sbindir}/rc.radiusd
137 chmod +x ${D}/${sysconfdir}/init.d/radiusd
138 rm -rf ${D}/${localstatedir}/run/
139 install -m 0644 ${WORKDIR}/volatiles.58_radiusd ${D}${sysconfdir}/default/volatiles/58_radiusd
140
141 chown -R radiusd:radiusd ${D}/${sysconfdir}/raddb/
142 chown -R radiusd:radiusd ${D}/${localstatedir}/lib/radiusd
143
144 # For systemd
145 install -d ${D}${systemd_unitdir}/system
146 install -m 0644 ${WORKDIR}/radiusd.service ${D}${systemd_unitdir}/system
147 sed -i -e 's,@BASE_BINDIR@,${base_bindir},g' \
148 -e 's,@SBINDIR@,${sbindir},g' \
149 -e 's,@STATEDIR@,${localstatedir},g' \
150 -e 's,@SYSCONFDIR@,${sysconfdir},g' \
151 ${D}${systemd_unitdir}/system/radiusd.service
152
153 if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
154 install -d ${D}${sysconfdir}/tmpfiles.d/
155 install -m 0644 ${WORKDIR}/radiusd-volatiles.conf ${D}${sysconfdir}/tmpfiles.d/
156 fi
157}
158
159# This is only needed when we install/update on a running target.
160#
161pkg_postinst_${PN} () {
162 if [ -z "$D" ]; then
163 if command -v systemd-tmpfiles >/dev/null; then
164 # create /var/log/radius, /var/run/radiusd
165 systemd-tmpfiles --create ${sysconfdir}/tmpfiles.d/radiusd-volatiles.conf
166 elif [ -e ${sysconfdir}/init.d/populate-volatile.sh ]; then
167 ${sysconfdir}/init.d/populate-volatile.sh update
168 fi
169
170 # Fix ownership for /etc/raddb/*, /var/lib/radiusd
171 chown -R radiusd:radiusd ${sysconfdir}/raddb
172 chown -R radiusd:radiusd ${localstatedir}/lib/radiusd
173 fi
174}
175
176# We really need the symlink :(
177INSANE_SKIP_${PN} = "dev-so"
178INSANE_SKIP_${PN}-krb5 = "dev-so"
179INSANE_SKIP_${PN}-ldap = "dev-so"
180INSANE_SKIP_${PN}-mysql = "dev-so"
181INSANE_SKIP_${PN}-perl = "dev-so"
182INSANE_SKIP_${PN}-postgresql = "dev-so"
183INSANE_SKIP_${PN}-python = "dev-so"
184INSANE_SKIP_${PN}-unixodbc = "dev-so"
185
186PACKAGES =+ "${PN}-utils ${PN}-ldap ${PN}-krb5 ${PN}-perl \
187 ${PN}-python ${PN}-mysql ${PN}-postgresql ${PN}-unixodbc"
188
189FILES_${PN}-utils = "${bindir}/*"
190
191FILES_${PN}-ldap = "${libdir}/rlm_ldap.so* \
192 ${sysconfdir}/raddb/mods-available/ldap \
193"
194
195FILES_${PN}-krb5 = "${libdir}/rlm_krb5.so* \
196 ${sysconfdir}/raddb/mods-available/krb5 \
197"
198
199FILES_${PN}-perl = "${libdir}/rlm_perl.so* \
200 ${sysconfdir}/raddb/mods-config/perl \
201 ${sysconfdir}/raddb/mods-available/perl \
202"
203
204FILES_${PN}-python = "${libdir}/rlm_python.so* \
205 ${sysconfdir}/raddb/mods-config/python \
206 ${sysconfdir}/raddb/mods-available/python \
207"
208
209FILES_${PN}-mysql = "${libdir}/rlm_sql_mysql.so* \
210 ${sysconfdir}/raddb/mods-config/sql/*/mysql \
211 ${sysconfdir}/raddb/mods-available/sql \
212"
213
214FILES_${PN}-postgresql = "${libdir}/rlm_sql_postgresql.so* \
215 ${sysconfdir}/raddb/mods-config/sql/*/postgresql \
216"
217
218FILES_${PN}-unixodbc = "${libdir}/rlm_sql_unixodbc.so*"
219
220FILES_${PN} =+ "${libdir}/rlm_*.so* ${libdir}/proto_*so*"
221
222RDEPENDS_${PN} += "perl"
223RDEPENDS_${PN}-utils = "${PN}"