blob: 9a2bbab39fe14bb075985c3da4bf2bca50cdece8 [file] [log] [blame]
Andrew Geissler82c905d2020-04-13 13:39:40 -05001DESCRIPTION = "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"
Andrew Geissler9aee5002022-03-30 16:27:02 +000012LICENSE = "GPL-2.0-only & LGPL-2.0-or-later"
Andrew Geissler82c905d2020-04-13 13:39:40 -050013LIC_FILES_CHKSUM = "file://LICENSE;md5=eb723b61539feef013de476e68b5c50a"
14DEPENDS = "openssl-native openssl libidn libtool libpcap libtalloc"
15
Andrew Geissler595f6302022-01-24 19:11:47 +000016SRC_URI = "git://github.com/FreeRADIUS/freeradius-server.git;branch=v3.0.x;lfs=0;;protocol=https \
Andrew Geissler82c905d2020-04-13 13:39:40 -050017 file://freeradius \
18 file://volatiles.58_radiusd \
Andrew Geissler82c905d2020-04-13 13:39:40 -050019 file://radiusd.service \
20 file://radiusd-volatiles.conf \
Andrew Geisslerc5535c92023-01-27 16:10:19 -060021 file://0001-Add-autogen.sh.patch \
22 file://0002-Enable-and-change-user-and-group-of-freeradius-serve.patch \
23 file://0003-configure.ac-allow-cross-compilation.patch \
24 file://0004-Fix-libtool-detection.patch \
25 file://0005-configure.ac-add-option-for-libcap.patch \
26 file://0006-Avoid-searching-host-dirs.patch \
27 file://0007-rlm_python-add-PY_INC_DIR-in-search-dir.patch \
28 file://0008-libtool-do-not-use-jlibtool.patch \
29 file://0009-Fix-quoting-for-BUILD_WITH.patch \
30 file://0010-fix-error-for-expansion-of-macro-in-thread.h.patch \
31 file://0011-rlm_mschap-Use-includedir-instead-of-hardcoding-usr-.patch \
32 file://0012-raddb-certs-Makefile-fix-the-existed-certificate-err.patch \
33 file://0013-raddb-certs-Makefile-fix-the-occasional-verification.patch \
34 file://0014-Workaround-error-with-autoconf-2.7.patch \
35 file://0015-bootstrap-check-commands-of-openssl-exist.patch \
36 file://0016-version.c-don-t-print-build-flags.patch \
37 file://0017-add-python.m4-for-detecting-python-3.10.patch \
Andrew Geissler82c905d2020-04-13 13:39:40 -050038"
39
Andrew Geisslerc5535c92023-01-27 16:10:19 -060040raddbdir = "${sysconfdir}/${MLPREFIX}raddb"
Andrew Geissler615f2f12022-07-15 14:00:58 -050041
Andrew Geisslerc5535c92023-01-27 16:10:19 -060042SRCREV = "d956f683d37ea40e7977cc5907361f3e6988a439"
Andrew Geissler82c905d2020-04-13 13:39:40 -050043
Andrew Geisslerfc113ea2023-03-31 09:59:46 -050044UPSTREAM_CHECK_GITTAGREGEX = "release_(?P<pver>\d+(\_\d+)+)"
45
Patrick Williamsdb4c27e2022-08-05 08:10:29 -050046CVE_CHECK_IGNORE = "\
47 CVE-2002-0318 \
48 CVE-2011-4966 \
49"
50
Andrew Geissler82c905d2020-04-13 13:39:40 -050051PARALLEL_MAKE = ""
52
53S = "${WORKDIR}/git"
54
Patrick Williams213cb262021-08-07 19:21:33 -050055LDFLAGS:append:powerpc = " -latomic"
56LDFLAGS:append:mipsarch = " -latomic"
57LDFLAGS:append:armv5 = " -latomic"
Andrew Geissler82c905d2020-04-13 13:39:40 -050058
59EXTRA_OECONF = " --enable-strict-dependencies \
60 --with-docdir=${docdir}/freeradius-${PV} \
61 --with-openssl-includes=${STAGING_INCDIR} \
62 --with-openssl-libraries=${STAGING_LIBDIR} \
Andrew Geissler615f2f12022-07-15 14:00:58 -050063 --with-raddbdir=${raddbdir} \
Andrew Geissler82c905d2020-04-13 13:39:40 -050064 --without-rlm_ippool \
65 --without-rlm_cache_memcached \
66 --without-rlm_counter \
67 --without-rlm_couchbase \
68 --without-rlm_dbm \
69 --without-rlm_eap_tnc \
70 --without-rlm_eap_ikev2 \
71 --without-rlm_opendirectory \
72 --without-rlm_redis \
73 --without-rlm_rediswho \
74 --without-rlm_sql_db2 \
75 --without-rlm_sql_firebird \
76 --without-rlm_sql_freetds \
77 --without-rlm_sql_iodbc \
78 --without-rlm_sql_oracle \
79 --without-rlm_sql_sybase \
80 --without-rlm_sql_mongo \
81 --without-rlm_sqlhpwippool \
82 --without-rlm_securid \
83 --without-rlm_unbound \
84 --without-rlm_python \
85 ac_cv_path_PERL=${bindir}/perl \
86 ax_cv_cc_builtin_choose_expr=no \
87 ax_cv_cc_builtin_types_compatible_p=no \
88 ax_cv_cc_builtin_bswap64=no \
89 ax_cv_cc_bounded_attribute=no \
90"
91
92PACKAGECONFIG ??= "${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'pam', '', d)} \
93 pcre libcap \
94 openssl rlm-eap-fast rlm-eap-pwd \
95"
96
97PACKAGECONFIG[krb5] = "--with-rlm_krb5,--without-rlm_krb5,krb5"
98PACKAGECONFIG[pam] = "--with-rlm_pam,--without-rlm_pam,libpam"
99PACKAGECONFIG[libcap] = "--with-libcap,--without-libcap,libcap"
100PACKAGECONFIG[ldap] = "--with-rlm_ldap,--without-rlm_ldap,openldap"
101PACKAGECONFIG[mysql] = "--with-rlm_sql_mysql,--without-rlm_sql_mysql,mysql5"
102PACKAGECONFIG[sqlite] = "--with-rlm_sql_sqlite,--without-rlm_sql_sqlite,sqlite3"
103PACKAGECONFIG[unixodbc] = "--with-rlm_sql_unixodbc,--without-rlm_sql_unixodbc,unixodbc"
104PACKAGECONFIG[postgresql] = "--with-rlm_sql_postgresql,--without-rlm_sql_postgresql,postgresql"
105PACKAGECONFIG[pcre] = "--with-pcre,--without-pcre,libpcre"
106PACKAGECONFIG[perl] = "--with-perl=${STAGING_BINDIR_NATIVE}/perl-native/perl --with-rlm_perl,--without-rlm_perl,perl-native perl,perl"
107PACKAGECONFIG[python3] = "--with-rlm_python3 --with-rlm-python3-bin=${STAGING_BINDIR_NATIVE}/python3-native/python3 --with-rlm-python3-include-dir=${STAGING_INCDIR}/${PYTHON_DIR},--without-rlm_python3,python3-native python3"
108PACKAGECONFIG[rest] = "--with-rlm_rest,--without-rlm_rest,curl json-c"
109PACKAGECONFIG[ruby] = "--with-rlm_ruby,--without-rlm_ruby,ruby"
110PACKAGECONFIG[openssl] = "--with-openssl, --without-openssl"
111PACKAGECONFIG[rlm-eap-fast] = "--with-rlm_eap_fast, --without-rlm_eap_fast"
112PACKAGECONFIG[rlm-eap-pwd] = "--with-rlm_eap_pwd, --without-rlm_eap_pwd"
113
Andrew Geissler615f2f12022-07-15 14:00:58 -0500114inherit useradd autotools-brokensep update-rc.d systemd multilib_script multilib_header
115
116MULTILIB_SCRIPTS = "${PN}:${sbindir}/checkrad"
Andrew Geissler82c905d2020-04-13 13:39:40 -0500117
118# This is not a cpan or python based package, but it needs some definitions
119# from cpan-base and python3-dir bbclasses for building rlm_perl and rlm_python
120# correctly.
121inherit cpan-base python3-dir
122
123# The modules subdirs also need to be processed by autoreconf. Use autogen.sh
124# in order to handle the subdirs correctly.
Andrew Geisslerc5535c92023-01-27 16:10:19 -0600125do_configure() {
Andrew Geissler82c905d2020-04-13 13:39:40 -0500126 ./autogen.sh
127
128 # the configure of rlm_perl needs this to get correct
129 # mod_cflags and mod_ldflags
130 if ${@bb.utils.contains('PACKAGECONFIG', 'perl', 'true', 'false', d)}; then
131 export PERL5LIB="${STAGING_LIBDIR}${PERL_OWN_DIR}/perl/${@get_perl_version(d)}"
132 fi
133
134 oe_runconf
135
136 # we don't need dhcpclient
137 sed -i -e 's/dhcpclient.mk//' ${S}/src/modules/proto_dhcp/all.mk
138}
139
140INITSCRIPT_NAME = "radiusd"
141
Patrick Williams213cb262021-08-07 19:21:33 -0500142SYSTEMD_SERVICE:${PN} = "radiusd.service"
Andrew Geissler82c905d2020-04-13 13:39:40 -0500143
144USERADD_PACKAGES = "${PN}"
Patrick Williams213cb262021-08-07 19:21:33 -0500145USERADD_PARAM:${PN} = "--system --no-create-home --shell /bin/false --user-group radiusd"
Andrew Geissler82c905d2020-04-13 13:39:40 -0500146
147do_install() {
148 rm -rf ${D}
Andrew Geisslerc5535c92023-01-27 16:10:19 -0600149 install -d ${D}/${sysconfdir}/logrotate.d
150 install -d ${D}/${sysconfdir}/pam.d
151 install -d ${D}/${localstatedir}/lib/radiusd
Andrew Geissler82c905d2020-04-13 13:39:40 -0500152
153 export LD_LIBRARY_PATH=${D}/${libdir}
154 oe_runmake install R=${D} INSTALLSTRIP=""
155
156 # remove unsupported config files
Andrew Geissler615f2f12022-07-15 14:00:58 -0500157 rm -f ${D}/${raddbdir}/experimental.conf
Andrew Geissler82c905d2020-04-13 13:39:40 -0500158
159 # remove scripts that required Perl(DBI)
160 rm -rf ${D}/${bindir}/radsqlrelay
161
Andrew Geissler82c905d2020-04-13 13:39:40 -0500162 rm -f ${D}/${sbindir}/rc.radiusd
Andrew Geissler82c905d2020-04-13 13:39:40 -0500163 rm -rf ${D}/${localstatedir}/run/
164 rm -rf ${D}/${localstatedir}/log/
Andrew Geissler82c905d2020-04-13 13:39:40 -0500165
Andrew Geissler615f2f12022-07-15 14:00:58 -0500166 chown -R radiusd:radiusd ${D}/${raddbdir}
Andrew Geissler82c905d2020-04-13 13:39:40 -0500167 chown -R radiusd:radiusd ${D}/${localstatedir}/lib/radiusd
168
Andrew Geisslerc5535c92023-01-27 16:10:19 -0600169 # For sysvinit
170 if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then
171 install -d ${D}${sysconfdir}/init.d
172 install -d ${D}${sysconfdir}/default/volatiles
173 install -m 0755 ${WORKDIR}/freeradius ${D}/etc/init.d/radiusd
174 install -m 0644 ${WORKDIR}/volatiles.58_radiusd ${D}${sysconfdir}/default/volatiles/58_radiusd
175 fi
176
Andrew Geissler82c905d2020-04-13 13:39:40 -0500177 # For systemd
178 if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
179 install -d ${D}${systemd_unitdir}/system
180 install -m 0644 ${WORKDIR}/radiusd.service ${D}${systemd_unitdir}/system
181 sed -i -e 's,@BASE_BINDIR@,${base_bindir},g' \
182 -e 's,@SBINDIR@,${sbindir},g' \
183 -e 's,@STATEDIR@,${localstatedir},g' \
184 -e 's,@SYSCONFDIR@,${sysconfdir},g' \
185 ${D}${systemd_unitdir}/system/radiusd.service
186
187 install -d ${D}${sysconfdir}/tmpfiles.d/
188 install -m 0644 ${WORKDIR}/radiusd-volatiles.conf ${D}${sysconfdir}/tmpfiles.d/radiusd.conf
189 fi
Andrew Geisslerc5535c92023-01-27 16:10:19 -0600190
191 oe_multilib_header freeradius/autoconf.h
Andrew Geissler615f2f12022-07-15 14:00:58 -0500192 oe_multilib_header freeradius/missing.h
193 oe_multilib_header freeradius/radpaths.h
Andrew Geissler82c905d2020-04-13 13:39:40 -0500194}
195
196# This is only needed when we install/update on a running target.
197#
Patrick Williams213cb262021-08-07 19:21:33 -0500198pkg_postinst:${PN} () {
Andrew Geissler82c905d2020-04-13 13:39:40 -0500199 if [ -z "$D" ]; then
200 if command -v systemd-tmpfiles >/dev/null; then
201 # create /var/log/radius, /var/run/radiusd
202 systemd-tmpfiles --create ${sysconfdir}/tmpfiles.d/radiusd.conf
203 elif [ -e ${sysconfdir}/init.d/populate-volatile.sh ]; then
204 ${sysconfdir}/init.d/populate-volatile.sh update
205 fi
206
207 # Fix ownership for /etc/raddb/*, /var/lib/radiusd
Andrew Geissler615f2f12022-07-15 14:00:58 -0500208 chown -R radiusd:radiusd ${raddbdir}
Andrew Geissler82c905d2020-04-13 13:39:40 -0500209 chown -R radiusd:radiusd ${localstatedir}/lib/radiusd
Andrew Geissler517393d2023-01-13 08:55:19 -0600210
211 # for radiusd.service with multilib
212 if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
213 install -d ${sysconfdir}/sysconfig
214 echo "MLPREFIX=${MLPREFIX}" > ${sysconfdir}/sysconfig/radiusd
215 fi
216 else
217 if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
218 install -d $D${sysconfdir}/sysconfig
219 echo "MLPREFIX=${MLPREFIX}" > $D${sysconfdir}/sysconfig/radiusd
220 fi
Andrew Geissler82c905d2020-04-13 13:39:40 -0500221 fi
222}
223
Andrew Geissler517393d2023-01-13 08:55:19 -0600224pkg_postrm:${PN} () {
225 # only try to remove ${sysconfdir}/sysconfig/radiusd for systemd
226 if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'false', 'true', d)}; then
227 exit 0
228 fi
229
230 if [ -d ${sysconfdir}/raddb ]; then
231 exit 0
232 fi
233 for variant in ${MULTILIB_GLOBAL_VARIANTS}; do
234 if [ -d ${sysconfdir}/${variant}-raddb ]; then
235 exit 0
236 fi
237 done
238
239 rm -f ${sysconfdir}/sysconfig/radiusd
240 rmdir --ignore-fail-on-non-empty ${sysconfdir}/sysconfig
241}
242
Andrew Geissler82c905d2020-04-13 13:39:40 -0500243# We really need the symlink :(
Patrick Williams213cb262021-08-07 19:21:33 -0500244INSANE_SKIP:${PN} = "dev-so"
245INSANE_SKIP:${PN}-krb5 = "dev-so"
246INSANE_SKIP:${PN}-ldap = "dev-so"
247INSANE_SKIP:${PN}-mysql = "dev-so"
248INSANE_SKIP:${PN}-perl = "dev-so"
249INSANE_SKIP:${PN}-postgresql = "dev-so"
250INSANE_SKIP:${PN}-python = "dev-so"
251INSANE_SKIP:${PN}-unixodbc = "dev-so"
Andrew Geissler82c905d2020-04-13 13:39:40 -0500252
253PACKAGES =+ "${PN}-utils ${PN}-ldap ${PN}-krb5 ${PN}-perl \
254 ${PN}-python ${PN}-mysql ${PN}-postgresql ${PN}-unixodbc"
255
Patrick Williams213cb262021-08-07 19:21:33 -0500256FILES:${PN}-utils = "${bindir}/*"
Andrew Geissler82c905d2020-04-13 13:39:40 -0500257
Patrick Williams213cb262021-08-07 19:21:33 -0500258FILES:${PN}-ldap = "${libdir}/rlm_ldap.so* \
Andrew Geissler615f2f12022-07-15 14:00:58 -0500259 ${raddbdir}/mods-available/ldap \
Andrew Geissler82c905d2020-04-13 13:39:40 -0500260"
261
Patrick Williams213cb262021-08-07 19:21:33 -0500262FILES:${PN}-krb5 = "${libdir}/rlm_krb5.so* \
Andrew Geissler615f2f12022-07-15 14:00:58 -0500263 ${raddbdir}/mods-available/krb5 \
Andrew Geissler82c905d2020-04-13 13:39:40 -0500264"
265
Patrick Williams213cb262021-08-07 19:21:33 -0500266FILES:${PN}-perl = "${libdir}/rlm_perl.so* \
Andrew Geissler615f2f12022-07-15 14:00:58 -0500267 ${raddbdir}/mods-config/perl \
268 ${raddbdir}/mods-available/perl \
Andrew Geissler82c905d2020-04-13 13:39:40 -0500269"
270
Patrick Williams213cb262021-08-07 19:21:33 -0500271FILES:${PN}-python = "${libdir}/rlm_python3.so* \
Andrew Geissler615f2f12022-07-15 14:00:58 -0500272 ${raddbdir}/mods-config/python3 \
273 ${raddbdir}/mods-available/python3 \
Andrew Geissler82c905d2020-04-13 13:39:40 -0500274"
275
Patrick Williams213cb262021-08-07 19:21:33 -0500276FILES:${PN}-mysql = "${libdir}/rlm_sql_mysql.so* \
Andrew Geissler615f2f12022-07-15 14:00:58 -0500277 ${raddbdir}/mods-config/sql/*/mysql \
278 ${raddbdir}/mods-available/sql \
Andrew Geissler82c905d2020-04-13 13:39:40 -0500279"
280
Patrick Williams213cb262021-08-07 19:21:33 -0500281FILES:${PN}-postgresql = "${libdir}/rlm_sql_postgresql.so* \
Andrew Geissler615f2f12022-07-15 14:00:58 -0500282 ${raddbdir}/mods-config/sql/*/postgresql \
Andrew Geissler82c905d2020-04-13 13:39:40 -0500283"
284
Patrick Williams213cb262021-08-07 19:21:33 -0500285FILES:${PN}-unixodbc = "${libdir}/rlm_sql_unixodbc.so*"
Andrew Geissler82c905d2020-04-13 13:39:40 -0500286
Patrick Williams213cb262021-08-07 19:21:33 -0500287FILES:${PN} =+ "${libdir}/rlm_*.so* ${libdir}/proto_*so*"
Andrew Geissler82c905d2020-04-13 13:39:40 -0500288
Patrick Williams213cb262021-08-07 19:21:33 -0500289RDEPENDS:${PN} += "perl"
290RDEPENDS:${PN}-utils = "${PN} perl"
Andrew Geissler82c905d2020-04-13 13:39:40 -0500291
292CLEANBROKEN = "1"