#!/bin/bash # # Authelia Service PATH=$HOME/.docker/cli-plugins:/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin get_appvars config_authelia() { echo -ne "* Configuring authelia container.." if [ ! -d "/federated/apps/authelia" ]; then mkdir -p /federated/apps/authelia/data/config mkdir -p /federated/apps/authelia/data/secrets fi cat > /federated/apps/authelia/docker-compose.yml < /federated/apps/authelia/data/secrets/JWT_SECRET tr -cd '[:alnum:]' < /dev/urandom | fold -w "64" | head -n 1 > /federated/apps/authelia/data/secrets/SESSION_SECRET tr -cd '[:alnum:]' < /dev/urandom | fold -w "64" | head -n 1 > /federated/apps/authelia/data/secrets/STORAGE_ENCRYPTION_KEY echo "$LDAP_SECRET" > /federated/apps/authelia/data/secrets/AUTHENTICATION_BACKEND_LDAP_PASSWORD echo "$ADMINPASS" > /federated/apps/authelia/data/secrets/NOTIFIER_SMTP_PASSWORD openssl genrsa -out /federated/apps/authelia/data/secrets/private.pem 4096 2>/dev/null openssl rsa -in /federated/apps/authelia/data/secrets/private.pem -outform PEM -pubout -out /federated/apps/authelia/data/secrets/public.pem 2>/dev/null POWERDNS_CLIENT_SECRET=$(create_password); POWERDNS_CLIENT_SECRET_HASH=$(docker run --rm authelia/authelia:latest authelia crypto hash generate pbkdf2 --password $POWERDNS_CLIENT_SECRET 2>/dev/null | awk '{ print $2 }') [[ -d "/federated/apps/pdnsmysql/data/var/lib/mysql/pdnsadmin" ]] && POWERDNS_DB="pdnsadmin" || POWERDNS_DB="pdns" cat > /federated/apps/authelia/.env < /federated/apps/authelia/data/config/configuration.yml < /federated/apps/authelia/data/config/idproviders.yml < /dev/null" "7" docker exec pdns pdnsutil add-record $DOMAIN authelia A 86400 $EXTERNALIP &> /dev/null [ $? -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" "$EXTERNALIP" # Stop and start pdnsadmin for internal dns externalhosts to work /federated/bin/stop pdnsadmin &> /dev/null [ $? -ne 0 ] && fail "Couldn't stop pdnsadmin" /federated/bin/start pdnsadmin &> /dev/null [ $? -ne 0 ] && fail "Couldn't start pdnsadmin" echo -ne "done.\n" } email_authelia() { echo -ne "* Sending email to customer.." cat > /federated/apps/mail/data/root/certs/mailfile <

Authelia (SSO) is now installed on $DOMAIN, Your Federated Computer Single Sign On

Dear Customer,
We’re excited to introduce your new Single Sign-On (SSO) for Federated Core.

Your Single Sign On is called Authelia. With Authelia, a single login grants you seamless access to multiple Federated applications.
Authelia provides single sign-on (SSO) access to the following Federated applications:
Nextcloud, Element/Matrix, Bookstack, Jitsi, Gitea, RoundCube (Web Mail), EspoCRM, PowerDNS, and WordPress

How to use Authelia
• Click on any application in your Federated Dashboard and login by clicking, “Login with Authelia”
• Look for a pop up that will be labeled “https://authelia.YOUR.DOMAIN”
• Enter your panel user@domain.com and password, then click, “Sign In”
• That’s It! You can now access all of the Applications listed above.

IMPORTANT: When logging into Nextcloud through traditional login (Not Authelia) use only your 'user' and not 'user@domain.com'.

Using EspoCRM or Gitea?
These applications need extra configuration to work with SSO.
Reply to support@federated.computer, and we’ll send you step-by-step instructions to set up SSO for them.

As always, We are here to make the process simple and straightforward. Reply now if you have any questions about Authelia and we will respond promptly.
Thank you for choosing Federated Computer. We’re committed to improving your experience every step of the way.

Best regards,
Federated Computer Support Team
EOF # Send out e-mail from mail container with details docker exec mail bash -c "mail -r admin@$DOMAIN -a \"Content-type: text/html\" -s \"Authelia (SSO) is now installed on $DOMAIN\" $EMAIL < /root/certs/mailfile" rm /federated/apps/mail/data/root/certs/mailfile echo -ne "done.\n" } uninstall_authelia() { echo -ne "* Uninstalling authelia container.." # First stop the service cd /federated/apps/authelia && docker compose -f docker-compose.yml -p authelia down &> /dev/null # Delete the entries in the settings table [[ -d "/federated/apps/pdnsmysql/data/var/lib/mysql/pdnsadmin" ]] && POWERDNS_DB="pdnsadmin" || POWERDNS_DB="pdns" docker exec pdnsmysql mariadb -uroot -p$MYSQL_ROOTPASSWORD $POWERDNS_DB -e "delete from setting where name like '%oidc_oauth%';" # Delete the app directory rm -rf /federated/apps/authelia # Delete the image docker image rm authelia/authelia:$IMAGE_VERSION &> /dev/null # Delete the DNS record docker exec pdns pdnsutil delete-rrset $DOMAIN authelia A echo -ne "done.\n" }