Skip to contentSkip to conversation

package/freeradius-server: new package

PATCH In review Matthew Weber via buildroot 3 participants 3 messages Jan 4, 2022 – Jul 26, 2022

lore
Share & tools
lore
#0 lore raw

PATCH v9 1/1 package/freeradius-server: new package

From: David GOUARIN <[email protected]>

FreeRADIUS is an open source server which implements a protocol for remote user Authorization, Authentication and Accounting.

---
Changes
v8 -> v9:
- A systemd unit is installed if systemd is enabled. The default provided by freeradius-server/redhat/radiusd.service was not used because of extra options not compatible with Buildroot. The unit is instead based on a simplified version of that upstream file.

v7 -> v8:
- added dependencies to include libpcap
- version bump to 3.0.25

v6 -> v7
- resolve rlm_sql module compilation error (Newer GCC) (remove mysql_version.h as mysql.h is included)

v5 -> v6:
- cleaned up patches to all be git formatted
- added depends on BR2_USE_MMU
- rebased on master
- added CPE info

v4 -> v5:
- better package patches formatting

v3 -> v4:
Taken in account Thomas review
- fix build with BR2_COMPILER_PARANOID_UNSAFE_PATH
- import patches inside package directory instead of downloading them
- remove config.cache file, pass the answers on the command line instead
- add comments for weird TARGET_DIR and R directives
- remove broken python optional feature. Managed to get it to build with python 2.7, not 3.0 and it still fails basic testing

v2 -> v3:
- As suggested by Matt, merge with pending upstream patch. Included most of it, including patches based on Yocto work :
http://cgit.openembedded.org/meta-openembedded/tree/meta-networking/recipes-connectivity/freeradius/files
Didn't kept all the --without directive, as they do not seem useful, nor the custom INSTALL_TARGET_CMDS.

v1 -> v2:
- fix invalid characters in Config.in

---
 DEVELOPERS                                    |   2 +
 package/Config.in                             |   1 +
 .../0001-jlibtool-cross-with-host-CC.patch    |  33 +++
 .../0002-avoid-searching-host-dirs.patch      | 201 ++++++++++++++++++
 ...3-configure.ac-add-option-for-libcap.patch |  74 +++++++
 ...configure.ac-allow-cross-compilation.patch |  41 ++++
 ...r-for-expansion-of-macro-in-thread.h.patch |  65 ++++++
 ...dules-rlm_sql-remove-mysql_version.h.patch |  36 ++++
 package/freeradius-server/Config.in           |  21 ++
 .../freeradius-server/freeradius-server.hash  |   3 +
 .../freeradius-server/freeradius-server.mk    | 124 +++++++++++
 package/freeradius-server/radiusd.service     |  38 ++++
 12 files changed, 639 insertions(+)
 create mode 100644 package/freeradius-server/0001-jlibtool-cross-with-host-CC.patch
 create mode 100644 package/freeradius-server/0002-avoid-searching-host-dirs.patch
 create mode 100644 package/freeradius-server/0003-configure.ac-add-option-for-libcap.patch
 create mode 100644 package/freeradius-server/0004-configure.ac-allow-cross-compilation.patch
 create mode 100644 package/freeradius-server/0005-fix-error-for-expansion-of-macro-in-thread.h.patch
 create mode 100644 package/freeradius-server/0006-modules-rlm_sql-remove-mysql_version.h.patch
 create mode 100644 package/freeradius-server/Config.in
 create mode 100644 package/freeradius-server/freeradius-server.hash
 create mode 100644 package/freeradius-server/freeradius-server.mk
 create mode 100644 package/freeradius-server/radiusd.service
DEVELOPERS +2 -0
index 37c792816a..095e711197 100644
@@ -658,6 +658,7 @@ N:	David du Colombier <[email protected]>
 F:	package/x264/
 
 N:	David GOUARIN <[email protected]>
+F:	package/freeradius-server/
 F:	package/librelp/
 F:	package/libtalloc/
 
@@ -1833,6 +1834,7 @@ F:	package/ethtool/
 F:	package/flashbench/
 F:	package/fmc/
 F:	package/fmlib/
+F:	package/freeradius-server/
 F:	package/git/
 F:	package/gnutls/
 F:	package/hostapd/
package/Config.in +1 -0
index 7148639735..a095f6c536 100644
@@ -2186,6 +2186,7 @@ endif
 	source "package/flannel/Config.in"
 	source "package/fmc/Config.in"
 	source "package/fping/Config.in"
+	source "package/freeradius-server/Config.in"
 	source "package/freeswitch/Config.in"
 	source "package/freeswitch-mod-bcg729/Config.in"
 	source "package/frr/Config.in"
package/freeradius-server/0001-jlibtool-cross-with-host-CC.patch new file +33 -0
new file mode 100644
index 0000000000..398f88e4ad
@@ -0,0 +1,33 @@
+From 8a8506320acf3ea18940a6e3a447d7d394a3bd8e Mon Sep 17 00:00:00 2001
+From: David Gouarin <[email protected]>
+Date: Mon, 12 Apr 2021 11:05:54 -0500
+Subject: [PATCH] jlibtool cross with host CC
+
+jlibtool.c: while cross compiling, use host CC instead of target CC to build jlibtool
+
+Upstream: Not applicable
+
+Signed-off-by: David Gouarin <[email protected]>
+Signed-off-by: Matt Weber <[email protected]>
+---
+ scripts/libtool.mk | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/scripts/libtool.mk b/scripts/libtool.mk
+index 57915e1053..c28260dd7e 100644
+--- a/scripts/libtool.mk
++++ b/scripts/libtool.mk
+@@ -43,8 +43,8 @@ ifeq "${LIBTOOL}" "JLIBTOOL"
+     # binary!
+     ${JLIBTOOL}: ${top_makedir}/jlibtool.c
+ 	$(Q)mkdir -p $(dir $@)
+-	$(Q)echo CC jlibtool.c
+-	$(Q)${CC} $< -o $@
++	$(Q)echo HOSTCC jlibtool.c
++	$(Q)${HOSTCC} $< -o $@
+ 
+     clean: jlibtool_clean
+ 
+-- 
+2.17.1
+
package/freeradius-server/0002-avoid-searching-host-dirs.patch new file +201 -0

201 lines not on this page · raw message

package/freeradius-server/0003-configure.ac-add-option-for-libcap.patch new file +74 -0

74 lines not on this page · raw message

package/freeradius-server/0004-configure.ac-allow-cross-compilation.patch new file +41 -0

41 lines not on this page · raw message

package/freeradius-server/0005-fix-error-for-expansion-of-macro-in-thread.h.patch new file +65 -0

65 lines not on this page · raw message

package/freeradius-server/0006-modules-rlm_sql-remove-mysql_version.h.patch new file +36 -0
new file mode 100644
index 0000000000..03f8ef8805
@@ -0,0 +1,36 @@
+From 77b8c75f9904897768f87e20fef5d7739ddcd3c7 Mon Sep 17 00:00:00 2001
+From: Jared Bents <[email protected]>
+Date: Tue, 4 Feb 2020 08:22:11 -0600
+Subject: [PATCH] modules/rlm_sql: remove mysql_version.h
+
+remove mysql_version.h as mysql.h is included and mysql_version.h
+should not be included by per the header file warning
+
+Upstream: http://lists.freeradius.org/pipermail/freeradius-devel/2021-April/014218.html
+
+Signed-off-by: Jared Bents <[email protected]>
+Signed-off-by: Matt Weber <[email protected]>
+---
+ src/modules/rlm_sql/drivers/rlm_sql_mysql/rlm_sql_mysql.c | 2 --
+ 1 file changed, 2 deletions(-)
+
+diff --git a/src/modules/rlm_sql/drivers/rlm_sql_mysql/rlm_sql_mysql.c b/src/modules/rlm_sql/drivers/rlm_sql_mysql/rlm_sql_mysql.c
+index a7992647cd..ea44d0cc7a 100644
+--- a/src/modules/rlm_sql/drivers/rlm_sql_mysql/rlm_sql_mysql.c
++++ b/src/modules/rlm_sql/drivers/rlm_sql_mysql/rlm_sql_mysql.c
+@@ -34,12 +34,10 @@ RCSID("$Id$")
+ #include "config.h"
+ 
+ #ifdef HAVE_MYSQL_MYSQL_H
+-#  include <mysql/mysql_version.h>
+ #  include <mysql/errmsg.h>
+ #  include <mysql/mysql.h>
+ #  include <mysql/mysqld_error.h>
+ #elif defined(HAVE_MYSQL_H)
+-#  include <mysql_version.h>
+ #  include <errmsg.h>
+ #  include <mysql.h>
+ #  include <mysqld_error.h>
+-- 
+2.17.1
+
package/freeradius-server/Config.in new file +21 -0
new file mode 100644
index 0000000000..0f796e21d2
@@ -0,0 +1,21 @@
+config BR2_PACKAGE_FREERADIUS_SERVER
+	bool "freeradius-server"
+	depends on BR2_TOOLCHAIN_HAS_THREADS
+	depends on BR2_TOOLCHAIN_USES_GLIBC
+	depends on BR2_USE_MMU
+	select BR2_PACKAGE_LIBTALLOC
+	help
+	  FreeRADIUS is an open source server which implements
+	  a protocol for remote user Authorization, Authentication
+	  and Accounting.
+
+	  http://wiki.freeradius.org/
+
+comment "freeradius-server needs a toolchain w/ threads"
+	depends on !BR2_TOOLCHAIN_HAS_THREADS
+
+comment "freeradius-server needs a glibc toolchain"
+	depends on !BR2_TOOLCHAIN_USES_GLIBC
+
+comment "freeradius-server needs a target w/ MMU"
+	depends on !BR2_USE_MMU
package/freeradius-server/freeradius-server.hash new file +3 -0
new file mode 100644
index 0000000000..68f7e05435
@@ -0,0 +1,3 @@
+# Locally computed
+sha256  4883a68bb3cee46025359a97c1691ce655e8babfd6dc3c021d00e109a2ff4c10  freeradius-server-3.0.25.tar.gz
+sha256  0a0e46014fc2efd5144a30359c0e6e1ea9fa3dd407d3318204150efd7b4caf6a  COPYRIGHT
package/freeradius-server/freeradius-server.mk new file +124 -0

124 lines not on this page · raw message

package/freeradius-server/radiusd.service new file +38 -0
new file mode 100644
index 0000000000..a55bce62d3
@@ -0,0 +1,38 @@
+# Reference from: freeradius-server/redhat/radiusd.service
+
+[Unit]
+Description=FreeRADIUS multi-protocol policy server
+After=network-online.target
+Documentation=man:radiusd(8) man:radiusd.conf(5) http://wiki.freeradius.org/ http://networkradius.com/doc/
+
+[Service]
+Type=notify
+WatchdogSec=60
+NotifyAccess=all
+EnvironmentFile=-/etc/sysconfig/radiusd
+
+# FreeRADIUS can do static evaluation of policy language rules based
+# on environmental variables which is very useful for doing per-host
+# customization.
+# Unfortunately systemd does not allow variable substitutions such
+# as %H or $(hostname) in the EnvironmentFile.
+# We provide HOSTNAME here for convenience.
+Environment=HOSTNAME=%H
+
+# Limit memory to 2G this is fine for %99.99 of deployments.  FreeRADIUS
+# is not memory hungry, if it's using more than this, then there's probably
+# a leak somewhere.
+MemoryLimit=2G
+
+ExecStartPre=/usr/sbin/radiusd $FREERADIUS_OPTIONS -Cx -lstdout
+ExecStart=/usr/sbin/radiusd -f $FREERADIUS_OPTIONS
+Restart=on-failure
+RestartSec=5
+ExecReload=/usr/sbin/radiusd $FREERADIUS_OPTIONS -Cxm -lstdout
+ExecReload=/bin/kill -HUP $MAINPID
+
+# Only allow native system calls
+SystemCallArchitectures=native
+
+[Install]
+WantedBy=multi-user.target
Signature · 6 lines
2.17.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw

Hello Matt,

Le 04/01/2022 à 22:55, Matthew Weber via buildroot a écrit :

Quoted 17 lines

From: David GOUARIN <[email protected]>

FreeRADIUS is an open source server which implements a protocol for remote user Authorization, Authentication and Accounting.

---
Changes
v8 -> v9:
- A systemd unit is installed if systemd is enabled. The default provided by freeradius-server/redhat/radiusd.service was not used because of extra options not compatible with Buildroot. The unit is instead based on a simplified version of that upstream file.

[...]

Quoted 138 lines
package/freeradius-server/freeradius-server.mk new file +124 -0
new file mode 100644
index 0000000000..0c071a2378
@@ -0,0 +1,124 @@
+################################################################################
+#
+# freeradius-server
+#
+################################################################################
+
+FREERADIUS_SERVER_VERSION = 3.0.25
+FREERADIUS_SERVER_SITE = ftp://ftp.freeradius.org/pub/freeradius
+FREERADIUS_SERVER_LICENSE = GPL-2.0
+FREERADIUS_SERVER_LICENSE_FILES = COPYRIGHT
+FREERADIUS_SERVER_DEPENDENCIES = libtalloc
+
+# some compiler checks are not supported while cross compiling.
+# instead of removing those checks, we cache the answers
+FREERADIUS_SERVER_CONF_OPTS += \
+	ax_cv_cc_bounded_attribute=no \
+	ax_cv_cc_builtin_bswap64=no \
+	ax_cv_cc_builtin_choose_expr=no \
+	ax_cv_cc_builtin_types_compatible_p=no
+
+ifeq ($(BR2_PACKAGE_LIBCAP),y)
+FREERADIUS_SERVER_CONF_OPTS += --with-libcap
+FREERADIUS_SERVER_DEPENDENCIES += libcap
+else
+FREERADIUS_SERVER_CONF_OPTS += --without-libcap
+endif
+
+ifeq ($(BR2_PACKAGE_LIBPCAP),y)
+FREERADIUS_SERVER_CONF_OPTS += --with-libpcap
+FREERADIUS_SERVER_DEPENDENCIES += libpcap
+else
+FREERADIUS_SERVER_CONF_OPTS += --without-libpcap
+endif
+
+ifeq ($(BR2_PACKAGE_LIBKRB5),y)
+FREERADIUS_SERVER_CONF_OPTS += --with-rlm_krb5
+FREERADIUS_SERVER_DEPENDENCIES += libkrb5
+else
+FREERADIUS_SERVER_CONF_OPTS += --without-rlm_krb5
+endif
+
+ifeq ($(BR2_PACKAGE_LINUX_PAM),y)
+FREERADIUS_SERVER_CONF_OPTS += --with-rlm_pam
+FREERADIUS_SERVER_DEPENDENCIES += linux-pam
+else
+FREERADIUS_SERVER_CONF_OPTS += --without-rlm_pam
+endif
+
+ifeq ($(BR2_PACKAGE_OPENLDAP),y)
+FREERADIUS_SERVER_CONF_OPTS += --with-rlm_ldap
+FREERADIUS_SERVER_DEPENDENCIES += openldap
+else
+FREERADIUS_SERVER_CONF_OPTS += --without-rlm_ldap
+endif
+
+ifeq ($(BR2_PACKAGE_MYSQL),y)
+FREERADIUS_SERVER_CONF_OPTS += --with-rlm_sql_mysql
+FREERADIUS_SERVER_DEPENDENCIES += mysql
+else
+FREERADIUS_SERVER_CONF_OPTS += --without-rlm_sql_mysql
+endif
+
+ifeq ($(BR2_PACKAGE_SQLITE),y)
+FREERADIUS_SERVER_CONF_OPTS += --with-rlm_sql_sqlite
+FREERADIUS_SERVER_DEPENDENCIES += sqlite
+else
+FREERADIUS_SERVER_CONF_OPTS += --without-rlm_sql_sqlite
+endif
+
+ifeq ($(BR2_PACKAGE_UNIXODBC),y)
+FREERADIUS_SERVER_CONF_OPTS += --with-rlm_sql_unixodbc
+FREERADIUS_SERVER_DEPENDENCIES += unixodbc
+else
+FREERADIUS_SERVER_CONF_OPTS += --without-rlm_sql_unixodbc
+endif
+
+ifeq ($(BR2_PACKAGE_POSTGRESQL),y)
+FREERADIUS_SERVER_CONF_OPTS += --with-rlm_sql_postgresql
+FREERADIUS_SERVER_DEPENDENCIES += postgresql
+else
+FREERADIUS_SERVER_CONF_OPTS += --without-rlm_sql_postgresql
+endif
+
+ifeq ($(BR2_PACKAGE_HAS_OPENSSL),y)
+FREERADIUS_SERVER_DEPENDENCIES += openssl
+FREERADIUS_SERVER_CONF_OPTS += --with-openssl
+else
+FREERADIUS_SERVER_CONF_OPTS += --without-openssl
+endif
+
+ifeq ($(BR2_PACKAGE_PCRE),y)
+FREERADIUS_SERVER_CONF_OPTS += --with-pcre
+FREERADIUS_SERVER_DEPENDENCIES += pcre
+else
+FREERADIUS_SERVER_CONF_OPTS += --without-pcre
+endif
+
+ifeq ($(BR2_PACKAGE_RUBY),y)
+FREERADIUS_SERVER_CONF_OPTS += --with-rlm_ruby
+FREERADIUS_SERVER_DEPENDENCIES += ruby
+else
+FREERADIUS_SERVER_CONF_OPTS += --without-rlm_ruby
+endif
+
+ifeq ($(BR2_INIT_SYSTEMD),y)
+FREERADIUS_SERVER_CONF_OPTS += --with-systemd
+FREERADIUS_SERVER_DEPENDENCIES += systemd
+else
+FREERADIUS_SERVER_CONF_OPTS += --without-systemd
+endif
+
+# TARGET_DIR is set to empty to avoid creation of symlinks in hardcoded host directories
+# freeradius Makefile does not support an alternate DESTDIR, instead it uses the magic $(R) variable
+FREERADIUS_SERVER_MAKE_ENV = R=$(TARGET_DIR) TARGET_DIR=""
+
+# use MAKE1 because make install does not support parallel build
+FREERADIUS_SERVER_MAKE = $(MAKE1)
+
+define FREERADIUS_SERVER_INSTALL_INIT_SYSTEMD
+	$(INSTALL) -D -m 644 package/freeradius-server/radiusd.service \
+		$(TARGET_DIR)/usr/lib/systemd/system/radiusd.service
+endef
+
+$(eval $(autotools-package))
package/freeradius-server/radiusd.service new file +2 -0
new file mode 100644
index 0000000000..a55bce62d3
@@ -0,0 +1,38 @@
+# Reference from: freeradius-server/redhat/radiusd.service
+

package/freeradius-server/radiusd.service line 12

Quoted 10 lines
package/freeradius-server/radiusd.service new file +10 -0
+[Unit]
+Description=FreeRADIUS multi-protocol policy server
+After=network-online.target
+Documentation=man:radiusd(8) man:radiusd.conf(5) http://wiki.freeradius.org/ http://networkradius.com/doc/
+
+[Service]
+Type=notify
+WatchdogSec=60
+NotifyAccess=all
+EnvironmentFile=-/etc/sysconfig/radiusd

/etc/sysconfig is a redhat things. I don't think it apply to Buildroot.

This file is not installed by the package.

Otherwise the package seems ok even if it requires some magic $(R).

Best regards,
Romain

Quoted 17 lines
package/freeradius-server/radiusd.service new file +16 -0
+
+# FreeRADIUS can do static evaluation of policy language rules based
+# on environmental variables which is very useful for doing per-host
+# customization.
+# Unfortunately systemd does not allow variable substitutions such
+# as %H or $(hostname) in the EnvironmentFile.
+# We provide HOSTNAME here for convenience.
+Environment=HOSTNAME=%H
+
+# Limit memory to 2G this is fine for %99.99 of deployments.  FreeRADIUS
+# is not memory hungry, if it's using more than this, then there's probably
+# a leak somewhere.
+MemoryLimit=2G
+
+ExecStartPre=/usr/sbin/radiusd $FREERADIUS_OPTIONS -Cx -lstdout
+ExecStart=/usr/sbin/radiusd -f $FREERADIUS_OPTIONS

package/freeradius-server/radiusd.service line 38

Quoted 10 lines
package/freeradius-server/radiusd.service new file +10 -0
+Restart=on-failure
+RestartSec=5
+ExecReload=/usr/sbin/radiusd $FREERADIUS_OPTIONS -Cxm -lstdout
+ExecReload=/bin/kill -HUP $MAINPID
+
+# Only allow native system calls
+SystemCallArchitectures=native
+
+[Install]
+WantedBy=multi-user.target

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#2 lore raw
In reply to Matthew Weber via buildroot
Quoted 9 lines · Matthew Weber via buildroot

From: David GOUARIN <[email protected]>

FreeRADIUS is an open source server which implements a protocol for remote user Authorization, Authentication and Accounting.

Finally applied to master, thanks. I still made a large number of changes.

- remove second patch, superseded by other patches;
- add upstream links to patches;
- add 3 more patches to avoid looking in host directories;
- explicitly add dependency on !static inherited from talloc (redundant with glibc, but future-safe);
- simplify Config.in comment;
- check hash with PGP signature;
- add conf opts for runtime paths;
- add conf opts to disable unsupported modules;
- add more optional dependencies;
- enable/disable all modules that use a dependency;
- search defaults file in /etc/default, not /etc/sysconfig.

I also created an upstream pull request for all the patches that are not yet
upstream.

Regards,
Arnout

Quoted 41 lines

---
Changes
v8 -> v9:
- A systemd unit is installed if systemd is enabled. The default provided by freeradius-server/redhat/radiusd.service was not used because of extra options not compatible with Buildroot. The unit is instead based on a simplified version of that upstream file.

v7 -> v8:
- added dependencies to include libpcap
- version bump to 3.0.25

v6 -> v7
- resolve rlm_sql module compilation error (Newer GCC) (remove mysql_version.h as mysql.h is included)

v5 -> v6:
- cleaned up patches to all be git formatted
- added depends on BR2_USE_MMU
- rebased on master
- added CPE info

v4 -> v5:
- better package patches formatting

v3 -> v4:
Taken in account Thomas review
- fix build with BR2_COMPILER_PARANOID_UNSAFE_PATH
- import patches inside package directory instead of downloading them
- remove config.cache file, pass the answers on the command line instead
- add comments for weird TARGET_DIR and R directives
- remove broken python optional feature. Managed to get it to build with python 2.7, not 3.0 and it still fails basic testing

v2 -> v3:
- As suggested by Matt, merge with pending upstream patch. Included most of it, including patches based on Yocto work :
http://cgit.openembedded.org/meta-openembedded/tree/meta-networking/recipes-connectivity/freeradius/files
Didn't kept all the --without directive, as they do not seem useful, nor the custom INSTALL_TARGET_CMDS.

Quoted 2 lines

v1 -> v2:
- fix invalid characters in Config.in

[snip]
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot