Files
Alexandru Ardelean 71223e9e07 freeradius3: update to 3.2.10
Patches:
- Drop 003-freeradius-fix-error-for-expansion-of-macro.patch (upstream
  restructured src/include/threads.h) and add
  003-configure-assume-cross-tls.patch instead: the AC_RUN_IFELSE
  __thread probe cannot run when cross-compiling, so TLS_STORAGE_CLASS
  stays undefined and threads.h hits '#error unsupported' (since 3.2.9).
- Drop 002-disable-session-cache-CVE-2017-9148.patch, 3.2.x is not
  affected per https://nvd.nist.gov/vuln/detail/CVE-2017-9148.
- Replace 004-get-hostname-from-proc-in-radtest.patch with
  004-radtest-nas-name-from-hostname-env.patch: prefer $HOSTNAME and keep
  the upstream `hostname || uname -n` fallback instead of reading
  /proc/sys/kernel/hostname unconditionally.
- Re-do 020-fix-freeradius3-krb5.patch, also sent upstream for review.
- Give the touched patches the git format-patch headers 'git am' needs,
  with the diff bodies unchanged so they still match 'quilt refresh'.

Depend on libopenssl-legacy when built against OpenSSL: with OpenSSL 3.x
tls_global_init() unconditionally does OSSL_PROVIDER_load(NULL, "legacy")
for MD4/MS-CHAP and errors out when it is missing, so radiusd exits during
startup before it ever serves a request.

Add a test.sh covering the freeradius3, -common, -utils and -democerts
packages: radiusd -XC starts the server for real, the config tree it reads
is checked, the dictionaries the master dictionary still $INCLUDEs must
all be packaged, and the demo certificates must be real PEM.

Signed-off-by: Alexandru Ardelean <alex@shruggie.ro>
2026-07-23 01:10:15 +02:00

110 lines
3.5 KiB
Bash
Executable File

#!/bin/sh
FR_ETC="/etc/freeradius3"
FR_LIB="/usr/lib/freeradius3"
FR_SHARE="/usr/share/freeradius3"
case "$1" in
freeradius3)
[ -x /usr/sbin/radiusd ] || { echo "FAIL: /usr/sbin/radiusd not installed"; exit 1; }
for f in radiusd.conf clients.conf proxy.conf \
policy.d/accounting policy.d/filter \
sites-available/default sites-enabled/default; do
[ -s "$FR_ETC/$f" ] || { echo "FAIL: $FR_ETC/$f missing or empty"; exit 1; }
done
# radiusd derives every other config path from raddbdir.
grep -q "^raddbdir = $FR_ETC\$" "$FR_ETC/radiusd.conf" || {
echo "FAIL: radiusd.conf does not set raddbdir to $FR_ETC"
grep -n '^raddbdir' "$FR_ETC/radiusd.conf"
exit 1
}
[ -x /etc/init.d/radiusd ] || { echo "FAIL: /etc/init.d/radiusd not installed"; exit 1; }
;;
freeradius3-default)
# Pulls in the modules radiusd.conf expects in mods-enabled/, so this is
# the first package where the server can start. -XC reads the whole
# config, loads every module and initialises OpenSSL, then exits.
radiusd -XC || {
echo "FAIL: 'radiusd -XC' could not start the server"
exit 1
}
;;
freeradius3-common)
for l in dhcp eap radius server; do
[ -s "$FR_LIB/libfreeradius-$l.so" ] || {
echo "FAIL: $FR_LIB/libfreeradius-$l.so not installed"; exit 1; }
done
[ -s "$FR_ETC/dictionary" ] || { echo "FAIL: $FR_ETC/dictionary missing or empty"; exit 1; }
[ -s "$FR_SHARE/dictionary" ] || { echo "FAIL: $FR_SHARE/dictionary missing or empty"; exit 1; }
# The Makefile packages only PKG_DICTIONARIES; a still-active $INCLUDE
# without a file behind it stops radiusd from starting.
includes=$(sed -n 's/^\$INCLUDE[[:space:]][[:space:]]*\(dictionary\.[^[:space:]]*\).*/\1/p' \
"$FR_SHARE/dictionary")
[ -n "$includes" ] || {
echo "FAIL: no active \$INCLUDE lines in $FR_SHARE/dictionary"; exit 1; }
missing=
for d in $includes; do
[ -f "$FR_SHARE/$d" ] || missing="$missing $d"
done
[ -z "$missing" ] || {
echo "FAIL: \$INCLUDE with no dictionary file behind it:$missing"; exit 1; }
;;
freeradius3-utils)
for t in radclient radeapclient radwho; do
[ -x "/usr/bin/$t" ] || { echo "FAIL: /usr/bin/$t not installed"; exit 1; }
"/usr/bin/$t" -h 2>&1 | grep -q "Usage: $t" || {
echo "FAIL: '$t -h' did not print its usage"
"/usr/bin/$t" -h 2>&1 | head -n 5
exit 1
}
done
[ -x /usr/bin/radtest ] || { echo "FAIL: /usr/bin/radtest not installed"; exit 1; }
radtest 2>&1 | grep -q "Usage: radtest" || {
echo "FAIL: 'radtest' did not print its usage"
radtest 2>&1 | head -n 5
exit 1
}
# Use a TEST-NET HOSTNAME with no NAS name to verify patch 004 passes it
# as NAS-IP-Address; capture xtrace and stop radclient with no server.
nas_ip="192.0.2.77"
radtest_out="/tmp/radtest-hostname.$$"
HOSTNAME="$nas_ip" sh -x /usr/bin/radtest u p 127.0.0.1:1812 0 testing123 \
>"$radtest_out" 2>&1 &
radtest_pid=$!
sleep 3
kill "$radtest_pid" 2>/dev/null
killall radclient 2>/dev/null
grep -q "NAS-IP-Address = $nas_ip" "$radtest_out" || {
echo "FAIL: radtest did not use \$HOSTNAME ($nas_ip) for NAS-IP-Address"
grep -E 'nas=|NAS-IP-Address' "$radtest_out" | head -n 10
rm -f "$radtest_out"
exit 1
}
rm -f "$radtest_out"
;;
freeradius3-democerts)
for f in ca.pem server.pem; do
[ -s "$FR_ETC/certs/$f" ] || { echo "FAIL: $FR_ETC/certs/$f missing or empty"; exit 1; }
grep -q "BEGIN CERTIFICATE" "$FR_ETC/certs/$f" || {
echo "FAIL: $FR_ETC/certs/$f holds no certificate"; exit 1; }
done
grep -q "BEGIN .*PRIVATE KEY" "$FR_ETC/certs/server.pem" || {
echo "FAIL: $FR_ETC/certs/server.pem holds no private key"; exit 1; }
;;
esac
exit 0