add keycloak-radius-plugin

This commit is contained in:
Thomas Legay 2023-07-18 15:58:26 +02:00
parent 2024db6dc6
commit 109d1a34f2
5 changed files with 95 additions and 7 deletions

View File

@ -84,6 +84,7 @@ debmaker_chroot() {
zdebmaker_inject zdebmaker_inject
debmaker_mount_proc_sys ${OPEN_FILE} ${MOUNT_PATH}/${APP}/ debmaker_mount_proc_sys ${OPEN_FILE} ${MOUNT_PATH}/${APP}/
sudo chroot ${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}/ debmaker_umount_proc_sys ${MOUNT_PATH}/${APP}/
} }

View File

@ -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;
```

View File

@ -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
}

View File

@ -0,0 +1,8 @@
Package: keycloak-radius-plugin
Version: %VERSION%
Section: contrib
Priority: optional
Architecture: all
Depends: keycloak
Maintainer: Thomas Legay <thomas@lgy.fr>
Description: keycloak radius plugin

View File

@ -1,11 +1,11 @@
#!/bin/bash #!/bin/bash
VERSION=19.0.1 VERSION=22.0.0
APP=keycloak APP=keycloak
DEPOT=https://github.com/keycloak/keycloak.git DEPOT=https://github.com/keycloak/keycloak.git
GIT_VERSION=${VERSION} GIT_VERSION=${VERSION}
DEB_VERSION=${VERSION}-$(date +%Y%m%d%H%M) DEB_VERSION=${VERSION}-$(date +%Y%m%d%H%M)
DEBIAN_VERSION_CODENAME=bullseye DEBIAN_VERSION_CODENAME=bookworm
IMAGE_SIZE=12 IMAGE_SIZE=12
PACKAGE_DEPENDENCY="default-jdk maven" PACKAGE_DEPENDENCY="default-jdk maven"
@ -23,19 +23,19 @@ build() {
makedeb(){ makedeb(){
PATH_DEB=/tmp/src/rootfs PATH_DEB=/tmp/src/rootfs
mkdir -p ${PATH_DEB}/etc/ mkdir -p ${PATH_DEB}/etc/
mkdir -p ${PATH_DEB}/usr/lib/keycloak mkdir -p ${PATH_DEB}/usr/lib/keycloak
mkdir -p ${PATH_DEB}/var/lib/ 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/conf ${PATH_DEB}/etc/keycloak
#mv ${PATH_DEB}/usr/lib/keycloak/data ${PATH_DEB}/var/lib/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 /etc/keycloak ${PATH_DEB}/usr/lib/keycloak/conf
ln -s /var/lib/keycloak ${PATH_DEB}/usr/lib/keycloak/data ln -s /var/lib/keycloak ${PATH_DEB}/usr/lib/keycloak/data
sed -i "s/%VERSION%/$DEB_VERSION/" ${PATH_DEB}/DEBIAN/control sed -i "s/%VERSION%/$DEB_VERSION/" ${PATH_DEB}/DEBIAN/control
fakeroot dpkg-deb -Z gzip --build ${PATH_DEB} /tmp/dist fakeroot dpkg-deb -Z gzip --build ${PATH_DEB} /tmp/dist
} }