From 109d1a34f2b71443f1b1c107dd44b9bf18159d57 Mon Sep 17 00:00:00 2001 From: Thomas Legay Date: Tue, 18 Jul 2023 15:58:26 +0200 Subject: [PATCH] add keycloak-radius-plugin --- lib/function.sh | 1 + ressources/keycloak-radius-plugin/README.MD | 38 +++++++++++++++++ ressources/keycloak-radius-plugin/debmaker | 41 +++++++++++++++++++ .../rootfs/DEBIAN/control | 8 ++++ ressources/keycloak/debmaker | 14 +++---- 5 files changed, 95 insertions(+), 7 deletions(-) create mode 100644 ressources/keycloak-radius-plugin/README.MD create mode 100755 ressources/keycloak-radius-plugin/debmaker create mode 100644 ressources/keycloak-radius-plugin/rootfs/DEBIAN/control diff --git a/lib/function.sh b/lib/function.sh index cb16c0c..83175ae 100644 --- a/lib/function.sh +++ b/lib/function.sh @@ -84,6 +84,7 @@ debmaker_chroot() { zdebmaker_inject debmaker_mount_proc_sys ${OPEN_FILE} ${MOUNT_PATH}/${APP}/ sudo chroot ${MOUNT_PATH}/${APP}/ + find ${MOUNT_PATH}/${APP}/tmp/dist/ -name *.deb -exec cp -v {} dist/ \; debmaker_umount_proc_sys ${MOUNT_PATH}/${APP}/ } diff --git a/ressources/keycloak-radius-plugin/README.MD b/ressources/keycloak-radius-plugin/README.MD new file mode 100644 index 0000000..e9a346e --- /dev/null +++ b/ressources/keycloak-radius-plugin/README.MD @@ -0,0 +1,38 @@ +#### keycloak + +##### Information + +Site : https://www.keycloak.org/ + +Source : https://github.com/keycloak/keycloak + +##### Install + +```bash +apt install -y wget ca-certificates +wget -qO - https://deb.lgy.fr/install.sh | bash +apt-get update +apt install keycloak + +# edit /etc/default/keycloak +# edit /etc/keycloak/keycloak.conf + +systemctl enable --now keycloak +``` + +##### Configuration + +Create database sample on postgresql + +```SQL +CREATE USER keycloak WITH PASSWORD 'password'; + +CREATE DATABASE "keycloak" +WITH OWNER "keycloak" +ENCODING 'UTF8' +LC_COLLATE = 'fr_FR.UTF-8' +LC_CTYPE = 'fr_FR.UTF-8' +TEMPLATE template0; + +GRANT ALL privileges ON DATABASE keycloak TO keycloak; +``` diff --git a/ressources/keycloak-radius-plugin/debmaker b/ressources/keycloak-radius-plugin/debmaker new file mode 100755 index 0000000..edd0faf --- /dev/null +++ b/ressources/keycloak-radius-plugin/debmaker @@ -0,0 +1,41 @@ +#!/bin/bash + +VERSION=1.4.11-21.0.0 +APP=keycloak-radius-plugin +DEPOT=https://github.com/vzakharchenko/keycloak-radius-plugin.git +GIT_VERSION=v${VERSION} +DEB_VERSION=${VERSION}-$(date +%Y%m%d%H%M) +DEBIAN_VERSION_CODENAME=bookworm +IMAGE_SIZE=12 +PACKAGE_DEPENDENCY="default-jdk maven" + +main(){ + base_package_upgrade + install_package_dependency + get_git_source + build + makedeb +} + +build() { + cd /tmp/${APP}/keycloak-plugins + mvn clean install -DskipTestsuite -DskipExamples -DskipTests +} + +makedeb(){ + PATH_DEB=/tmp/src/rootfs + + mkdir -p ${PATH_DEB}/usr/lib/keycloak/providers + + cp /tmp/${APP}/keycloak-plugins/chillispot-radius-plugin/target/original-chillispot-radius-plugin-1.4.11.jar ${PATH_DEB}/usr/lib/keycloak/providers + cp /tmp/${APP}/keycloak-plugins/cisco-radius-plugin/target/original-cisco-radius-plugin-1.4.11.jar ${PATH_DEB}/usr/lib/keycloak/providers + cp /tmp/${APP}/keycloak-plugins/proxy-radius-plugin/target/original-proxy-radius-plugin-1.4.11.jar ${PATH_DEB}/usr/lib/keycloak/providers + cp /tmp/${APP}/keycloak-plugins/radius-disconnect-plugin/target/original-radius-disconnect-plugin-1.4.11.jar ${PATH_DEB}/usr/lib/keycloak/providers + cp /tmp/${APP}/keycloak-plugins/radius-plugin/target/original-radius-plugin-1.4.11.jar ${PATH_DEB}/usr/lib/keycloak/providers + cp /tmp/${APP}/keycloak-plugins/rad-sec-plugin/target/original-rad-sec-plugin-1.4.11.jar ${PATH_DEB}/usr/lib/keycloak/providers + cp /tmp/${APP}/keycloak-plugins/mikrotik-radius-plugin/target/original-mikrotik-radius-plugin-1.4.11.jar ${PATH_DEB}/usr/lib/keycloak/providers + cp /tmp/${APP}/keycloak-plugins/radius-theme/target/radius-theme-1.4.11.zip ${PATH_DEB}/usr/lib/keycloak/providers + + sed -i "s/%VERSION%/$DEB_VERSION/" ${PATH_DEB}/DEBIAN/control + fakeroot dpkg-deb -Z gzip --build ${PATH_DEB} /tmp/dist +} diff --git a/ressources/keycloak-radius-plugin/rootfs/DEBIAN/control b/ressources/keycloak-radius-plugin/rootfs/DEBIAN/control new file mode 100644 index 0000000..cde08fb --- /dev/null +++ b/ressources/keycloak-radius-plugin/rootfs/DEBIAN/control @@ -0,0 +1,8 @@ +Package: keycloak-radius-plugin +Version: %VERSION% +Section: contrib +Priority: optional +Architecture: all +Depends: keycloak +Maintainer: Thomas Legay +Description: keycloak radius plugin diff --git a/ressources/keycloak/debmaker b/ressources/keycloak/debmaker index 824ad5c..e69e96f 100755 --- a/ressources/keycloak/debmaker +++ b/ressources/keycloak/debmaker @@ -1,11 +1,11 @@ #!/bin/bash -VERSION=19.0.1 +VERSION=22.0.0 APP=keycloak DEPOT=https://github.com/keycloak/keycloak.git GIT_VERSION=${VERSION} DEB_VERSION=${VERSION}-$(date +%Y%m%d%H%M) -DEBIAN_VERSION_CODENAME=bullseye +DEBIAN_VERSION_CODENAME=bookworm IMAGE_SIZE=12 PACKAGE_DEPENDENCY="default-jdk maven" @@ -23,19 +23,19 @@ build() { makedeb(){ PATH_DEB=/tmp/src/rootfs - + mkdir -p ${PATH_DEB}/etc/ mkdir -p ${PATH_DEB}/usr/lib/keycloak mkdir -p ${PATH_DEB}/var/lib/ - - tar -zxf /tmp/${APP}/quarkus/dist/target/keycloak-19.0.1.tar.gz -C ${PATH_DEB}/usr/lib/keycloak --strip-components=1 + + tar -zxf /tmp/${APP}/quarkus/dist/target/keycloak-*tar.gz -C ${PATH_DEB}/usr/lib/keycloak --strip-components=1 mv ${PATH_DEB}/usr/lib/keycloak/conf ${PATH_DEB}/etc/keycloak #mv ${PATH_DEB}/usr/lib/keycloak/data ${PATH_DEB}/var/lib/keycloak - + ln -s /etc/keycloak ${PATH_DEB}/usr/lib/keycloak/conf ln -s /var/lib/keycloak ${PATH_DEB}/usr/lib/keycloak/data - + sed -i "s/%VERSION%/$DEB_VERSION/" ${PATH_DEB}/DEBIAN/control fakeroot dpkg-deb -Z gzip --build ${PATH_DEB} /tmp/dist }