Authelia
Overview
Authelia is an open-source authentication and authorization server that provides single sign-on and multi-factor authentication through a login portal. Used as a forward-auth provider in front of nginx or Traefik, it protects your web applications with first-factor (password) and second-factor (TOTP, WebAuthn, Duo) authentication, access-control rules and brute-force regulation.
This SecureAnyCloud image installs Authelia 4.39.20 and runs it as a systemd service bound to loopback, behind an nginx reverse proxy on port 80. The database lives on a dedicated Azure data disk, and every VM generates its own unique secrets and admin user on first boot.
What you get:
- Authelia 4.39.20 (binary
/usr/bin/authelia) with a file user backend and SQLite storage - nginx on
:80as a reverse proxy to the loopback Authelia portal, with no extra authentication layer in front of it, because Authelia is the authentication - Per-VM secrets (JWT, session, storage encryption) and an argon2id-hashed admin user, generated on first boot
- A dedicated Azure data disk at
/var/lib/autheliafor the database and notifications authelia.serviceandnginx.serviceas enabled, active systemd units- 24/7 SecureAnyCloud support
Prerequisites
You need an active Azure subscription, an SSH key pair, and a VNet with a subnet in the target region.
Standard_B2ms (2 vCPU / 8 GiB RAM) is a good starting size.
Configure the network security group (NSG) to allow inbound 22/tcp from your management network and 80/tcp.
Authelia is domain-based. You need a DNS name and, for production, TLS termination in front of it.
Step 1 - Deploy from the Azure Marketplace
Sign in to the Azure Portal, choose Create a resource, search the Marketplace for Authelia by SecureAnyCloud, and select Create.
On the Basics tab, pick your subscription, resource group, region and size. Under Administrator account, choose SSH public key and paste your key. Under Inbound port rules, allow SSH (22) and HTTP (80).
Review the dedicated data disk on the Disks tab, then select Review + create and Create.
Step 2 - Deploy from the Azure CLI
# Accept the Marketplace terms once per subscription (required before the first CLI deploy)
az vm image terms accept --urn sac1647283583153:authelia-ubuntu-24-04:default:latest
az vm create \
--resource-group <your-rg> \
--name authelia \
--image sac1647283583153:authelia-ubuntu-24-04:default:latest \
--size Standard_B2ms \
--admin-username azureuser \
--ssh-key-values ~/.ssh/id_ed25519.pub \
--vnet-name <your-vnet> --subnet <your-subnet> \
--public-ip-sku Standard
az vm open-port --resource-group <your-rg> --name authelia --port 80 --priority 1010Step 3 - Connect to your VM
SSH in as azureuser using the public IP address of the VM:
ssh azureuser@<vm-public-ip>Step 4 - Confirm the services are running
Check that Authelia and nginx are active:
systemctl is-active authelia.service nginx.serviceBoth report active. On first boot, Authelia generates its secrets and an admin user.
Step 5 - Retrieve your admin password
Your VM generates a unique admin password on first boot and writes it to a root-only file. Read it with sudo:
sudo cat /root/authelia-credentials.txtThe file contains AUTHELIA_ADMIN_USER (admin) and AUTHELIA_ADMIN_PASSWORD. Store the password somewhere safe.
Step 6 - Set your domain (required)
Authelia is domain-based, and the image ships with the sample domain example.com. Edit /etc/authelia/configuration.yml and set your domain in session.cookies[].domain. Set session.cookies[].authelia_url to the public HTTPS URL of the portal, for example https://auth.yourdomain.com. Then restart Authelia:
sudo nano /etc/authelia/configuration.yml
sudo systemctl restart autheliaFor production, terminate TLS in front of Authelia, because the cookies require HTTPS. See Protecting your apps.
Step 7 - Open the login portal
Browse to your Authelia URL and sign in as admin with the password from Step 5.
The portal also offers a password reset flow and, once you enable it, second-factor registration (TOTP, WebAuthn).
Step 8 - Confirm the health endpoint
nginx serves an unauthenticated health endpoint for load balancers and probes. Query it:
curl -s http://localhost/healthThe endpoint returns ok.
Step 9 - Verify authentication from the command line
Authelia's first-factor API rejects a wrong password and accepts the per-VM admin password. Post the admin credentials to it:
curl -s -X POST -H 'Content-Type: application/json' -H 'Host: auth.example.com' -H 'X-Forwarded-Proto: https' -d '{"username":"admin","password":"<AUTHELIA_ADMIN_PASSWORD>","keepMeLoggedIn":false}' http://localhost/api/firstfactor; echoThe API returns {"status":"OK"}. Replace auth.example.com with your configured domain.
Step 10 - Confirm state lives on the dedicated disk
The Authelia database is stored on the dedicated Azure data disk, so it survives OS changes and can be resized independently. Confirm the mount:
findmnt /var/lib/autheliaThe mount is backed by a separate Azure data disk that is captured into the image and re-provisioned on every VM.
Protecting your apps
Authelia is a forward-auth provider. Put it behind your TLS-terminating reverse proxy (nginx or Traefik). Add an auth_request (nginx) or forwardAuth middleware (Traefik) that sends requests to Authelia's /api/authz/forward-auth endpoint.
Authelia then enforces your access_control rules. It redirects unauthenticated users to the portal and adds identity headers for your apps.
Add users to /etc/authelia/users_database.yml, hashing passwords with authelia crypto hash generate argon2. Enable TOTP or WebAuthn for second-factor protection.
Maintenance
- Users: edit
/etc/authelia/users_database.ymland hash passwords withauthelia crypto hash generate argon2. - Backups: snapshot the
/var/lib/autheliadata disk to back up the database. - Configuration: all settings are in
/etc/authelia/configuration.yml. Runsudo systemctl restart autheliaafter changes. - Upgrades: install a newer Authelia .deb package and restart the service.
- Security patches: unattended-upgrades stays enabled, so the OS continues to receive security updates automatically.
Support
SecureAnyCloud provides 24/7 expert support for this image. Email sales@secureanycloud.com.
Deploy on Azure
Launch Authelia on Ubuntu 24.04 LTS on Azure with 24/7 support from SecureAnyCloud.
View this image
Need Help?
Our support team is available 24/7.
sales@secureanycloud.com
Overview
Authelia is an open-source authentication and authorization server that provides single sign-on and multi-factor authentication for your web applications. It works alongside a reverse proxy. Instead of every application implementing its own login, the proxy forwards each request to Authelia, which enforces a per-resource access policy and presents a single, branded login portal with optional two-factor authentication.
This SecureAnyCloud image runs Authelia behind an nginx reverse proxy on Amazon EC2, with a unique administrator password generated for every instance.
What you get:
- The Authelia server binary at
/usr/local/bin/authelia, running as a dedicated unprivilegedautheliasystem account under a systemd service that starts it on boot and restarts it on failure - The file authentication backend (users in
/etc/authelia/users_database.yml, passwords argon2id-hashed), a local SQLite storage database and the filesystem notifier - A dedicated, independently resizable EBS data volume mounted at
/var/lib/authelia, holding all of the state above - Authelia bound to the loopback interface only (
127.0.0.1:9091), never exposed directly - An nginx reverse proxy that publishes the Authelia portal and runs the standard forward-authentication integration
- An administrator password generated on the first boot of every deployed instance, so two instances launched from the same Amazon Machine Image never share a password. It is written to
/root/authelia-credentials.txtwith mode 0600, so only the root user can read it
Demo domain and self-signed TLS
Authelia's session cookies require a real registrable domain, so an IP address cannot be used. Authelia 4.39 also requires a secure HTTPS scheme for its session URLs.
To work end to end out of the box with no DNS and no certificate authority, the image ships a self-contained demo domain, authelia.local. The demo protected application uses secure.authelia.local. nginx serves both over HTTPS with a self-signed certificate, and first boot maps both names to 127.0.0.1 in /etc/hosts on the instance.
The demo domain is a convenience for evaluation. For a real deployment, replace it with your own domain and replace the self-signed certificate with a real certificate, as described in Step 9 and Step 10 below.
Prerequisites
Before you deploy this image, you need:
- An Amazon Web Services account where you can launch EC2 instances
- IAM permissions to launch instances, create security groups and subscribe to AWS Marketplace products
- An EC2 key pair in the target Region for SSH access to the instance
- A VPC and subnet in the target Region, with a security group that allows inbound port 22 from your management network, and ports 80 and 443 from the networks that need to reach the portal
- The AWS CLI (version 2) installed locally, if you plan to deploy from the command line
Launch the instance from the AWS Marketplace
Sign in to the AWS Management Console, open the EC2 service, and select Launch instance. Under Application and OS Images, choose AWS Marketplace AMIs and search for Authelia. Select the SecureAnyCloud listing, choose Select, then choose Continue on the subscription summary.
Pick an instance type of t3.small or larger. Choose your EC2 key pair under Key pair (login). Under Network settings, select your VPC and subnet. Create or select a security group that opens port 22 from your management network and ports 80 and 443 for the portal. Leave the root volume at the default size or larger.
Select Launch instance. First-boot initialisation takes a few seconds after the instance state becomes Running and the status checks pass.
Launch the instance from the AWS CLI
The following command launches an instance from the SecureAnyCloud Authelia Marketplace AMI into an existing subnet and security group.
Replace <ami-id> with the AMI ID shown on the Marketplace listing and <key-name> with your EC2 key pair name. Replace <subnet-id> with your subnet ID and <security-group-id> with a security group that opens ports 22, 80 and 443 as described above.
aws ec2 run-instances \
--image-id <ami-id> \
--instance-type t3.small \
--key-name <key-name> \
--subnet-id <subnet-id> \
--security-group-ids <security-group-id> \
--tag-specifications 'ResourceType=instance,Tags=[{Key=Name,Value=authelia}]'When the instance reaches the Running state and its status checks pass, note its public IP address or DNS name. You can find both in the EC2 console or with aws ec2 describe-instances.
Connect to your instance
Connect over SSH with your key pair. The login user for the Ubuntu 24.04 variant is ubuntu.
ssh -i <key-name>.pem ubuntu@<public-ip>Retrieve the admin password
The Authelia administrator password is unique to your instance and was generated on first boot. Read it as root:
sudo cat /root/authelia-credentials.txtThe file lists the portal URL, the demo application URL, the admin user (admin) and the generated password. It also includes the one line to add to your workstation hosts file to reach the demo. Keep the password somewhere safe.
Confirm Authelia is running
Over SSH, confirm that the Authelia server and the nginx proxy are active:
sudo systemctl is-active authelia nginxBoth services report active:
active activeAuthelia binds to loopback only, so its health endpoint is reachable only from the instance, over plain HTTP on port 9091:
curl -s -o /dev/null -w 'HTTP %{http_code}\n' http://127.0.0.1:9091/api/healthHTTP 200Check the installed version:
authelia --versionauthelia version v4.39.20Reach the Authelia portal from your workstation
The appliance uses the self-contained demo domain authelia.local, so you must point the demo names at the instance from your own machine.
Add the following line to your workstation hosts file, for example /etc/hosts on Linux or macOS, or C:\Windows\System32\drivers\etc\hosts on Windows. Replace <instance-public-ip> with your instance's public IP address:
<instance-public-ip> authelia.local secure.authelia.localBrowse to the Authelia portal:
https://authelia.local/The demo certificate is self-signed, so your browser shows a certificate warning the first time. This is expected for the demo. Accept the warning to continue. You replace the certificate with a real one for production in Step 10.
The Authelia sign-in portal opens. Sign in as admin with the password from the credentials file.
See the forward-authentication flow
The image ships a demo protected application at https://secure.authelia.local/secure. Authelia guards it through the standard nginx forward-authentication integration.
When nginx receives a request for the protected resource, it issues an internal subrequest to Authelia's /api/authz/auth-request endpoint. If you are not authenticated, Authelia returns a redirect, and nginx sends your browser to the portal with the original URL preserved as the rd= return target. Once you have signed in, the same subrequest is approved and nginx serves the page.
Browse to the protected application:
https://secure.authelia.local/secureIf you are not yet signed in, you are redirected to the Authelia portal. After you sign in with the admin credentials, you are returned to the protected page. This confirms that Authelia authenticated and authorized the request.
Add users
Users live in the file authentication backend at /etc/authelia/users_database.yml, with argon2id-hashed passwords. Generate a hash for a new user's password with the Authelia CLI:
authelia crypto hash generate argon2 --password 'choose-a-strong-password'Copy the printed Digest: value. Add a new entry under users: in /etc/authelia/users_database.yml, for example:
users: alice: disabled: false displayname: 'Alice Smith' password: '<paste-the-argon2id-digest-here>' email: 'alice@example.com' groups: - 'users'Authelia watches the user database and picks up changes automatically. To be sure, you can also restart the service:
sudo systemctl restart autheliaProtect your own applications
To bring your own application under single sign-on, add it as a reverse-proxied site in nginx with the same auth_request block the demo uses (see /etc/nginx/sites-available/authelia).
Then add an access control rule for it in /etc/authelia/configuration.yml under access_control.rules. Each rule sets a policy of bypass, one_factor or two_factor per domain or path, for example:
access_control: default_policy: 'deny' rules: - domain: 'app.example.com' policy: 'one_factor'After editing, reload nginx and restart Authelia:
sudo systemctl reload nginx
sudo systemctl restart autheliaSet your own domain and a real certificate
For production, replace the demo domain and the self-signed certificate. Edit /etc/authelia/configuration.yml and set your own domain under session.cookies: the domain, authelia_url and default_redirection_url, all using https://. Add access_control rules for your applications.
Authelia requires the session URLs to use HTTPS, so you must serve the portal over TLS with a certificate for your domain.
The image generates a self-signed certificate at /etc/nginx/tls/authelia-selfsigned.crt and /etc/nginx/tls/authelia-selfsigned.key, and the nginx site references it. The bundled certificate covers the demo names:
sudo openssl x509 -in /etc/nginx/tls/authelia-selfsigned.crt -noout -subject -ext subjectAltNamesubject=CN = authelia.local X509v3 Subject Alternative Name: DNS:authelia.local, DNS:secure.authelia.localReplace it with a real certificate for your domain. The simplest approach is to obtain a certificate with Certbot for the public name you point at the instance. Then update the ssl_certificate and ssl_certificate_key paths in /etc/nginx/sites-available/authelia and reload nginx.
Alternatively, terminate TLS on an Application Load Balancer in front of the instance with an ACM certificate, and forward to nginx.
Restrict the security group so that ports 80 and 443 are reachable only from the networks that need the portal.
Locate the data volume
Authelia's identity state lives on a dedicated EBS volume mounted at /var/lib/authelia. It holds the SQLite storage database (db.sqlite3), the filesystem notifier output (notification.txt) and the per-instance generated secrets.
This keeps identity state off the operating system disk and lets you resize or snapshot it independently. Confirm the mount:
df -h /var/lib/autheliaFilesystem Size Used Avail Use% Mounted on /dev/nvme1n1 9.8G 312K 9.3G 1% /var/lib/autheliaTo grow the store, expand the EBS volume in the AWS console. Then grow the filesystem on the instance with sudo resize2fs on the underlying device.
Back up and maintain
Back up Authelia's identity state by snapshotting the /var/lib/authelia EBS volume. The snapshot captures the user database state, the SQLite store and the secrets.
Apply operating system security updates with sudo apt-get update && sudo apt-get upgrade, and reboot when a new kernel is installed. Authelia and nginx start automatically on boot.
Support
This image is published and supported by SecureAnyCloud. Support covers deployment, reverse proxy and forward-authentication configuration, access control rules, two-factor enrolment, LDAP or file user backends, SMTP notifications, TLS, and bringing your own applications under single sign-on. Contact SecureAnyCloud through the support channel listed on the AWS Marketplace listing.
All product and company names are trademarks or registered trademarks of their respective holders. Use of them does not imply any affiliation with or endorsement by them.
Deploy on AWS
Launch Authelia on AWS with 24/7 support from SecureAnyCloud.
View on Marketplace
Need Help?
Our support team is available 24/7.
sales@secureanycloud.com