diff options
-rw-r--r-- | main/freeradius/APKBUILD | 4 | ||||
-rw-r--r-- | main/freeradius/readme-setup-script.patch | 12 | ||||
-rw-r--r-- | main/freeradius/setup-freeradius.in | 81 |
3 files changed, 90 insertions, 7 deletions
diff --git a/main/freeradius/APKBUILD b/main/freeradius/APKBUILD index 6003a459c5..f897ac2a10 100644 --- a/main/freeradius/APKBUILD +++ b/main/freeradius/APKBUILD @@ -75,6 +75,7 @@ source="ftp://ftp.freeradius.org/pub/freeradius/$pkgname-server-$pkgver.tar.gz fix-scopeid.patch default-config.patch remove-eap-from-default-mods.patch + readme-setup-script.patch Fix-permissions-of-certs-in-bootstrap-fallback.patch fix-request_running-segfault.patch " @@ -391,11 +392,12 @@ sha512sums="513ed0a5d9e6b9a8d89a9b02c86ff528a9ff14d928f4c1040ca44702465abd711588 c3ae1ee6bd7743f883310612ba2c20c6ff7f288fedc308735df05b097ecb2f7fa4d1679b844e262757808978c7bb2d7630b99e4b87ce6d6ba7f84013f9c49f1d freeradius.logrotated bb3df1fa2c9ed95514ae090e0f6619c4e3280f424c4351bc79f5254bf1a327fa7d27e5fe3add5ab8d9e5ba3792c9553bd9a0481fe9c5bc34945ce46627ef2638 radiusd.confd a66ab5d3f1c86450e9c50aa8be10a40fb4118467670048773ad8c80b5f3fb958dd3addc6ef245289d93ce2b184ce2c9882a8a2585d4a134d55c2326c9559f558 radiusd.initd -51f47db8dce93c4c4984093e8256bd0fb4d9c511fbbce610ef72478d8b216fb828fee3f70ae124d44c2a60b35d7792d05602480826845bb5bd4847ef6f745d84 setup-freeradius.in +0a3d7c5a3d33186903fdf0fd9d0d817bdc3e81567dbd72646492652cddbad458936d7cd662f41b747a023f59ddbab1456b9cdd6c6997d9bc5d039bd4be92fb4f setup-freeradius.in 5f940e200aa39b2fbbfaf5b24f2ad99869fa75bb7e2008876940ea96cb9dbc7f2b27dd1672aa56cdb5243faabdcbc38875594dd8792af965987183c0aa2aefd1 print-var.mk c49e5eec7497fccde5fd09dba1ea9b846e57bc88015bd81640aa531fb5c9b449f37136f42c85fe1d7940c5963aed664b85da28442b388c9fb8cc27873df03b2d musl-fix-headers.patch 41d478c0e40ff82fc36232964037c1ab8ffca9fdbb7dca02ed49319906e751c133b5d7bc7773c645cec6d9d39d1de69cba25e8d59afa8d6662563dd17f35f234 fix-scopeid.patch 656bdadf8adc7c5ace0aab688dd7b812aa2aa09765bf9fba57fd8b974e0ed658650f580f3c0d54c801f6c6eebc05c21f0a34c88e8209f0a562fb512cd49cd37b default-config.patch f96b7b2e0fc614cb8b70bd500933538e98e05b58718af931a62bc7ba2307600cf8c2a8a99de856ad2e18101dd5bfe95c50ee34de20eef21ba0ad795577a6619b remove-eap-from-default-mods.patch +55e179d5e6b31d289c2da7f907e494a6a6f5900483fdff8d3bb25ee15a583b8705942eca1f0d5390e91376966e66e457dce9b2cf1a1f61c8eac6d8fb825404dd readme-setup-script.patch f88cb4ae335d67211c8563b6df88e20ee3729e57aa56423f99b518f83b190479b38bb189a0ab53c70ef9709a6229ccaa506ea6b79844cbfd4f2a7f0c7c292045 Fix-permissions-of-certs-in-bootstrap-fallback.patch 7ddf75901f635216b0d972c14631334a8138e0dbb021685bb6b3a996f38d232b84146c621dae541b00f6149fa401e835d1579bbacd27fad72a80bacd4391b404 fix-request_running-segfault.patch" diff --git a/main/freeradius/readme-setup-script.patch b/main/freeradius/readme-setup-script.patch new file mode 100644 index 0000000000..71a9cb146c --- /dev/null +++ b/main/freeradius/readme-setup-script.patch @@ -0,0 +1,12 @@ +--- a/raddb/README.rst ++++ b/raddb/README.rst +@@ -89,6 +89,9 @@ + there are fewer files in the main ``raddb`` directory. See + ``mods-config/README.rst`` for more details. + ++On Alpine Linux you can use helper script ``setup-freeradius`` for ++enabling/disabling modules and sites. ++ + Changed Modules + --------------- + diff --git a/main/freeradius/setup-freeradius.in b/main/freeradius/setup-freeradius.in index b6cad29f24..52c9e3ac33 100644 --- a/main/freeradius/setup-freeradius.in +++ b/main/freeradius/setup-freeradius.in @@ -1,23 +1,92 @@ #!/bin/sh set -eu +PROGNAME='setup-freeradius' DEFAULT_MODULES='@@DEFAULT_MODULES@@' +MODS_AVAILABLE_DIR='/etc/raddb/mods-available' +MODS_ENABLED_DIR='/etc/raddb/mods-enabled' +SITES_AVAILABLE_DIR='/etc/raddb/sites-available' +SITES_ENABLED_DIR='/etc/raddb/sites-enabled' + + +die() { + echo "$PROGNAME: $2" >&2 + exit $1 +} case "${1:-}" in '' | -h | --help) cat >&2 <<-EOF - Usage: $0 [-h | <action>] + Usage: $PROGNAME [-h | <action> [<args>...]] + + Enable/disable module or site creates/removes symlink in + /etc/raddb/{mods,sites}-enabled/ directory. If the module <name> + is provided by a separate freeradius-<name> package, then it + installs/uninstalls the package. Actions: - enable-default-mods Enable all default modules (i.e. create - symlinks in /etc/raddb/mods-enabled). - + enable-mod <name> Enable the named module. + enable-default-mods Enable all the default modules. + disable-mod <name> Disable the named module. + enable-site <name> Enable the named site. + disable-site <name> Disable the named site. EOF exit 2 ;; + enable-mod) + name=$2 + modlink="$MODS_ENABLED_DIR/$name" + + if [ -L "$modlink" ]; then + exit 0 + elif [ -f "$MODS_AVAILABLE_DIR/$name" ]; then + ln -sv ../mods-available/$name "$MODS_ENABLED_DIR/$name" + elif apk info -q "freeradius-$name" >/dev/null; then + apk add "freeradius-$name" + else + die 3 "module '$name' is not available!" + fi + ;; + disable-mod) + name=$2 + modlink="$MODS_ENABLED_DIR/$name" + + if [ -L "$modlink" ] && + pkgname=$(apk info -q --who-owns "$modlink" 2>/dev/null) && + [ "$pkgname" = "freeradius-$name" ]; + then + apk del "$pkgname" + elif [ -L "$modlink" ]; then + rm -v "$modlink" + elif [ -e "$modlink" ]; then + die 4 "$modlink is not a symlink!" + fi + ;; + enable-site) + name=$2 + sitelink="$SITES_ENABLED_DIR/$name" + + [ -L "$sitelink" ] && exit 0 + [ -f "$SITES_AVAILABLE_DIR/$name" ] || die 3 "site '$name' is not available!" + ln -sv ../sites-available/$name "$sitelink" + ;; + disable-site) + name=$2 + sitelink="$SITES_ENABLED_DIR/$name" + + if [ -L "$sitelink" ]; then + rm -v "$sitelink" + elif [ -e "$sitelink" ]; then + die 4 "$sitelink is not a symlink!" + fi + ;; enable-default-mods) - for mod in $DEFAULT_MODULES; do - ln -sv ../mods-available/$mod /etc/raddb/mods-enabled/$mod || true + for name in $DEFAULT_MODULES; do + [ -L "$MODS_ENABLED_DIR/$name" ] && continue + ln -sv ../mods-available/$name "$MODS_ENABLED_DIR/$name" || true done ;; + *) + die 2 "unknown action: $1" + ;; esac |