Changed add_authelia_config_to_dockercompose able to pass in second variable as ip

This commit is contained in:
root 2025-01-22 16:29:39 +00:00
parent fde50bcee7
commit d1797b8242
10 changed files with 11 additions and 19 deletions

View File

@ -208,8 +208,7 @@ start_authelia() {
[ $? -ne 0 ] && fail "Couldn't add dns record for authelia"
# If extra_hosts doesn't exist then insert extra_host configuration in pdnsadmin docker compose
add_authelia_config_to_dockercompose "pdnsadmin"
# [[ ! $(grep extra_hosts /federated/apps/pdnsadmin/docker-compose.yml 2>/dev/null) ]] && sed -i "/192.168.0.12/a \ extra_hosts:\n\ - \"authelia.$DOMAIN:$EXTERNALIP\"" /federated/apps/pdnsadmin/docker-compose.yml
add_authelia_config_to_dockercompose "pdnsadmin" "$EXTERNALIP"
# Stop and start pdnsadmin for internal dns externalhosts to work
/federated/bin/stop pdnsadmin &> /dev/null

View File

@ -13,7 +13,6 @@ config_bookstack() {
fi
cat > /federated/apps/bookstack/docker-compose.yml <<EOF
version: "3.7"
services:
bookstack:
image: lscr.io/linuxserver/bookstack:\${IMAGE_VERSION}
@ -246,7 +245,7 @@ OIDC_END_SESSION_ENDPOINT=https://authelia.$DOMAIN/logout?rd=https://dashboard.$
EOF
# Add in extra hosts config
add_authelia_config_to_dockercompose "bookstack"
add_authelia_config_to_dockercompose "bookstack" "$EXTERNALIP"
# Setup external_auth_id for each user in bookstack users table
BOOKSTACK_SECRET=$(cat /federated/apps/bookstack/.env | grep "DB_PASS" | awk -F= '{ print $2 }')

View File

@ -13,8 +13,6 @@ config_espocrm() {
fi
cat > /federated/apps/espocrm/docker-compose.yml <<EOF
version: '3.7'
services:
espocrm:
image: espocrm/espocrm:\${IMAGE_VERSION}
@ -263,7 +261,7 @@ EOF
sed -i "/authenticationMethod/a \ 'oidcScopes' => [\n\ 0 => 'profile',\n\ 1 => 'email',\n\ 2 => 'groups',\n\ 3 => 'openid'\n\ ]," /federated/apps/espocrm/data/var/www/html/data/config.php
# Add in extra_hosts to docker-compose
add_authelia_config_to_dockercompose "espocrm"
add_authelia_config_to_dockercompose "espocrm" "$EXTERNALIP"
# Set auth method to Oidc only
sed -i "s/ESPOCRM_CONFIG_AUTHENTICATION_METHOD=LDAP/#ESPOCRM_CONFIG_AUTHENTICATION_METHOD=LDAP/g" /federated/apps/espocrm/.env

View File

@ -1803,9 +1803,9 @@ run_finishtasks() {
add_authelia_config_to_dockercompose() {
if [[ ! $(grep authelia /federated/apps/$1/docker-compose.yml) ]]; then
if [[ $(grep extra_hosts /federated/apps/$1/docker-compose.yml) ]]; then
sed -i "/extra_hosts/a \ - \"authelia.$DOMAIN:$EXTERNALIP\"" /federated/apps/$1/docker-compose.yml
sed -i "/extra_hosts/a \ - \"authelia.$DOMAIN:$2\"" /federated/apps/$1/docker-compose.yml
else
sed -i "/restart: always/a \ extra_hosts:\n\ - \"authelia.$DOMAIN:$EXTERNALIP\"" /federated/apps/$1/docker-compose.yml
sed -i "/restart: always/a \ extra_hosts:\n\ - \"authelia.$DOMAIN:$2\"" /federated/apps/$1/docker-compose.yml
fi
fi
}

View File

@ -361,7 +361,7 @@ EOF
run_command "/federated/bin/start authelia"
# Add in extra hosts config
add_authelia_config_to_dockercompose "gitea"
add_authelia_config_to_dockercompose "gitea" "$EXTERNALIP"
run_command "/federated/bin/stop gitea"
run_command "/federated/bin/start gitea"

View File

@ -21,8 +21,6 @@ config_mail() {
fi
cat > /federated/apps/mail/docker-compose.yml <<EOF
version: '3.7'
services:
mail:
image: docker.io/mailserver/docker-mailserver:\${IMAGE_VERSION}

View File

@ -277,7 +277,7 @@ EOF
run_command "/federated/bin/stop authelia"
run_command "/federated/bin/start authelia"
add_authelia_config_to_dockercompose "matrix"
add_authelia_config_to_dockercompose "matrix" "$EXTERNALIP"
cat >> /federated/apps/matrix/data/matrix/homeserver.yaml <<EOF
oidc_providers:

View File

@ -321,7 +321,7 @@ cat >> /federated/apps/authelia/data/config/idproviders.yml <<EOF
token_endpoint_auth_method: 'client_secret_post'
EOF
add_authelia_config_to_dockercompose "nextcloud"
add_authelia_config_to_dockercompose "nextcloud" "$EXTERNALIP"
# Restart Authelia for changes to take the above configuration
run_command "/federated/bin/stop authelia"

View File

@ -170,8 +170,8 @@ EOF
run_command "/federated/bin/start authelia"
# Add in extra hosts config
add_authelia_config_to_dockercompose "roundcube"
add_authelia_config_to_dockercompose "mail"
add_authelia_config_to_dockercompose "roundcube" "$EXTERNALIP"
add_authelia_config_to_dockercompose "mail" "$EXTERNALIP"
sed -i "/?php/a \ \$config['oauth_provider'] = 'generic'; \n\
\$config['oauth_provider_name'] = 'Authelia'; \n\

View File

@ -16,8 +16,6 @@ config_wordpress() {
WORDPRESS_SECRET=$(create_password);
cat > /federated/apps/wordpress/docker-compose.yml <<EOF
version: "3.7"
services:
wordpress:
image: bitnami/wordpress:\${IMAGE_VERSION}
@ -238,7 +236,7 @@ EOF
run_command "/federated/bin/stop authelia"
run_command "/federated/bin/start authelia"
add_authelia_config_to_dockercompose "wordpress"
add_authelia_config_to_dockercompose "wordpress" "$EXTERNALIP"
sed -i "/Add any custom values/a \
define( 'OIDC_CLIENT_ID', 'wordpress' );\n\