config:authelia-npm
Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| config:authelia-npm [2026/03/09 12:39] – created Wuff | config:authelia-npm [2026/03/09 13:29] (current) – Wuff | ||
|---|---|---|---|
| Line 9: | Line 9: | ||
| The examples use simple local yaml file for authelia users and local file for notifications (used for 2FA setup) and local sqlite database. Any complex SSO, Redis, LDAP, mysql/ | The examples use simple local yaml file for authelia users and local file for notifications (used for 2FA setup) and local sqlite database. Any complex SSO, Redis, LDAP, mysql/ | ||
| + | |||
| + | ===== Docker setup ===== | ||
| <code yaml docker-npm.yml> | <code yaml docker-npm.yml> | ||
| Line 64: | Line 66: | ||
| </ | </ | ||
| + | Create the data directories: | ||
| < | < | ||
| mkdir -p / | mkdir -p / | ||
| - | mkdir -p /opt/npm | + | mkdir -p /opt/npm/ |
| </ | </ | ||
| + | |||
| + | |||
| + | ===== Authelia Configuration ===== | ||
| <code yaml / | <code yaml / | ||
| Line 859: | Line 865: | ||
| ## Path to the SQLite3 Database. | ## Path to the SQLite3 Database. | ||
| path: '/ | path: '/ | ||
| - | |||
| - | ## | ||
| - | ## MySQL / MariaDB (Storage Provider) | ||
| - | ## | ||
| - | # mysql: | ||
| - | ## The address of the MySQL server to connect to in the address common syntax. | ||
| - | ## Format: [< | ||
| - | ## Square brackets indicate optional portions of the format. Scheme must be ' | ||
| - | ## The default scheme is ' | ||
| - | # address: ' | ||
| - | |||
| - | ## The database name to use. | ||
| - | # database: ' | ||
| - | |||
| - | ## The username used for SQL authentication. | ||
| - | # username: ' | ||
| - | |||
| - | ## The password used for SQL authentication. | ||
| - | ## Can also be set using a secret: https:// | ||
| - | # password: ' | ||
| - | |||
| - | ## The connection timeout in the duration common syntax. | ||
| - | # timeout: '5 seconds' | ||
| - | |||
| - | ## MySQL TLS settings. Configuring this requires TLS. | ||
| - | # tls: | ||
| - | ## The server subject name to check the servers certificate against during the validation process. | ||
| - | ## This option is not required if the certificate has a SAN which matches the address options hostname. | ||
| - | # server_name: | ||
| - | |||
| - | ## Skip verifying the server certificate entirely. In preference to setting this we strongly recommend you add the | ||
| - | ## certificate or the certificate of the authority signing the certificate to the certificates directory which is | ||
| - | ## defined by the `certificates_directory` option at the top of the configuration. | ||
| - | ## It's important to note the public key should be added to the directory, not the private key. | ||
| - | ## This option is strongly discouraged but may be useful in some self-signed situations where validation is not | ||
| - | ## important to the administrator. | ||
| - | # skip_verify: | ||
| - | |||
| - | ## Minimum TLS version for the connection. | ||
| - | # minimum_version: | ||
| - | |||
| - | ## Maximum TLS version for the connection. | ||
| - | # maximum_version: | ||
| - | |||
| - | ## The certificate chain used with the private_key if the server requests TLS Client Authentication | ||
| - | ## i.e. Mutual TLS. | ||
| - | # certificate_chain: | ||
| - | # -----BEGIN CERTIFICATE----- | ||
| - | # ... | ||
| - | # -----END CERTIFICATE----- | ||
| - | # -----BEGIN CERTIFICATE----- | ||
| - | # ... | ||
| - | # -----END CERTIFICATE----- | ||
| - | |||
| - | ## The private key used with the certificate_chain if the server requests TLS Client Authentication | ||
| - | ## i.e. Mutual TLS. | ||
| - | # private_key: | ||
| - | # -----BEGIN PRIVATE KEY----- | ||
| - | # ... | ||
| - | # -----END PRIVATE KEY----- | ||
| - | |||
| - | ## | ||
| - | ## PostgreSQL (Storage Provider) | ||
| - | ## | ||
| - | # postgres: | ||
| - | ## The address of the PostgreSQL server to connect to in the address common syntax. | ||
| - | ## Format: [< | ||
| - | ## Square brackets indicate optional portions of the format. Scheme must be ' | ||
| - | ## The default scheme is ' | ||
| - | # address: ' | ||
| - | |||
| - | ## List of additional server instance configurations to fallback to when the primary instance is not available. | ||
| - | # servers: | ||
| - | # - | ||
| - | ## The Address of this individual instance. | ||
| - | # address: ' | ||
| - | |||
| - | ## The TLS configuration for this individual instance. | ||
| - | # tls: | ||
| - | # server_name: | ||
| - | # skip_verify: | ||
| - | # minimum_version: | ||
| - | # maximum_version: | ||
| - | # certificate_chain: | ||
| - | # -----BEGIN CERTIFICATE----- | ||
| - | # ... | ||
| - | # -----END CERTIFICATE----- | ||
| - | # -----BEGIN CERTIFICATE----- | ||
| - | # ... | ||
| - | # -----END CERTIFICATE----- | ||
| - | # private_key: | ||
| - | # -----BEGIN PRIVATE KEY----- | ||
| - | # ... | ||
| - | # -----END PRIVATE KEY----- | ||
| - | |||
| - | ## The database name to use. | ||
| - | # database: ' | ||
| - | |||
| - | ## The schema name to use. | ||
| - | # schema: ' | ||
| - | |||
| - | ## The username used for SQL authentication. | ||
| - | # username: ' | ||
| - | |||
| - | ## The password used for SQL authentication. | ||
| - | ## Can also be set using a secret: https:// | ||
| - | # password: ' | ||
| - | |||
| - | ## The connection timeout in the duration common syntax. | ||
| - | # timeout: '5 seconds' | ||
| - | |||
| - | ## PostgreSQL TLS settings. Configuring this requires TLS. | ||
| - | # tls: | ||
| - | ## The server subject name to check the servers certificate against during the validation process. | ||
| - | ## This option is not required if the certificate has a SAN which matches the address options hostname. | ||
| - | # server_name: | ||
| - | |||
| - | ## Skip verifying the server certificate entirely. In preference to setting this we strongly recommend you add the | ||
| - | ## certificate or the certificate of the authority signing the certificate to the certificates directory which is | ||
| - | ## defined by the `certificates_directory` option at the top of the configuration. | ||
| - | ## It's important to note the public key should be added to the directory, not the private key. | ||
| - | ## This option is strongly discouraged but may be useful in some self-signed situations where validation is not | ||
| - | ## important to the administrator. | ||
| - | # skip_verify: | ||
| - | |||
| - | ## Minimum TLS version for the connection. | ||
| - | # minimum_version: | ||
| - | |||
| - | ## Maximum TLS version for the connection. | ||
| - | # maximum_version: | ||
| - | |||
| - | ## The certificate chain used with the private_key if the server requests TLS Client Authentication | ||
| - | ## i.e. Mutual TLS. | ||
| - | # certificate_chain: | ||
| - | # -----BEGIN CERTIFICATE----- | ||
| - | # ... | ||
| - | # -----END CERTIFICATE----- | ||
| - | # -----BEGIN CERTIFICATE----- | ||
| - | # ... | ||
| - | # -----END CERTIFICATE----- | ||
| - | |||
| - | ## The private key used with the certificate_chain if the server requests TLS Client Authentication | ||
| - | ## i.e. Mutual TLS. | ||
| - | # private_key: | ||
| - | # -----BEGIN PRIVATE KEY----- | ||
| - | # ... | ||
| - | # -----END PRIVATE KEY----- | ||
| ## | ## | ||
| Line 1509: | Line 1368: | ||
| </ | </ | ||
| + | |||
| + | ===== Authelia password file ===== | ||
| + | |||
| + | For the user passwords, go to https:// | ||
| + | |||
| + | {{.: | ||
| + | |||
| + | Enter your password into the "Plain Text Input" | ||
| + | |||
| + | Click the gear in " | ||
| + | |||
| + | Be sure to have " | ||
| + | |||
| + | Other settings: | ||
| + | |||
| + | Parallelism: | ||
| + | Memory Cost: 65536 | ||
| + | Iterations: 3 | ||
| + | Hash Length: 32 | ||
| + | |||
| + | Click " | ||
| + | |||
| + | Copy the string that starts with $argon2id into the associated user password in the users_database.yml | ||
| <code yaml / | <code yaml / | ||
| Line 1529: | Line 1411: | ||
| </ | </ | ||
| + | ===== Docker startup ===== | ||
| + | Start the docker containers: | ||
| + | |||
| + | < | ||
| + | docker compose -f docker-npm.yaml up -d | ||
| + | docker compose -f docker-authelia.yaml up -d | ||
| + | </ | ||
| + | |||
| + | |||
| + | ===== NPM GUI Configuration ===== | ||
| + | |||
| + | The default NPM GUI is internally accessible on http:// | ||
| + | |||
| + | Go to Hosts -> Proxy Hosts | ||
| + | {{.: | ||
| + | |||
| + | Set up the first subdomain ' | ||
| + | {{.: | ||
| + | On the SSL Certificate tab, set it to ' | ||
| + | {{.: | ||
| + | Click save. | ||
| + | |||
| + | |||
| + | Then proceed with the first real subdomain. This example is for audiobookshelf on port 13378 | ||
| + | {{.: | ||
| + | Request a new ssl certificate as in the auth subdomain. | ||
| + | To use Authelia for the main authentication, | ||
| + | {{.: | ||
| + | |||
| + | Advanced nginx config for Authelia authentication. Internal IP/port needs to be entered as well as the error page. This example points to 192.168.1.2: | ||
| + | < | ||
| + | location / { | ||
| + | auth_request /authelia; | ||
| + | auth_request_set $target_url $scheme:// | ||
| + | auth_request_set $user $upstream_http_remote_user; | ||
| + | auth_request_set $groups $upstream_http_remote_groups; | ||
| + | error_page 401 =302 https:// | ||
| + | |||
| + | proxy_pass http:// | ||
| + | client_body_buffer_size 128k; | ||
| + | proxy_next_upstream error timeout invalid_header http_500 http_502 http_503; | ||
| + | send_timeout 5m; | ||
| + | proxy_read_timeout 360; | ||
| + | proxy_send_timeout 360; | ||
| + | proxy_connect_timeout 360; | ||
| + | |||
| + | proxy_set_header Host $host; | ||
| + | proxy_set_header X-Real-IP $remote_addr; | ||
| + | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
| + | proxy_set_header X-Forwarded-Proto $scheme; | ||
| + | proxy_set_header X-Forwarded-Host $http_host; | ||
| + | proxy_set_header X-Forwarded-Uri $request_uri; | ||
| + | proxy_set_header X-Forwarded-Ssl on; | ||
| + | proxy_redirect http:// $scheme://; | ||
| + | proxy_http_version 1.1; | ||
| + | proxy_set_header Connection ""; | ||
| + | proxy_cache_bypass $cookie_session; | ||
| + | proxy_no_cache $cookie_session; | ||
| + | proxy_buffers 64 256k; | ||
| + | |||
| + | set_real_ip_from 10.0.0.0/8; | ||
| + | set_real_ip_from 172.0.0.0/ | ||
| + | set_real_ip_from 192.168.0.0/ | ||
| + | set_real_ip_from fc00::/7; | ||
| + | real_ip_header X-Forwarded-For; | ||
| + | real_ip_recursive on; | ||
| + | } | ||
| + | |||
| + | location /authelia { | ||
| + | internal; | ||
| + | proxy_pass http:// | ||
| + | proxy_set_header Host $http_host; | ||
| + | proxy_set_header X-Original-URL $scheme:// | ||
| + | proxy_set_header X-Real-IP $remote_addr; | ||
| + | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
| + | proxy_set_header X-Forwarded-Proto $scheme; | ||
| + | proxy_set_header Content-Length ""; | ||
| + | proxy_pass_request_body off; | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | Click save. | ||
| + | |||
| + | Repeat for all other subdomains as required. | ||
| + | |||
| + | ===== Authelia login ===== | ||
| + | |||
| + | Going to https:// | ||
| + | |||
| + | This configuration enables 2FA by default, so logging in to any of the services will prompt 2FA setup. The auth code will be stored in / | ||
| + | {{.: | ||
| + | By default, authentication is valid for 1 hour or 30 days when the remember me is checked on login. This can be changed in the authelia configuration.yml | ||
config/authelia-npm.1773059960.txt.gz · Last modified: by Wuff