fix(installer): add missing notifier section, create Authelia users_database.yml on fresh install

This commit is contained in:
Claus Lohmar 2026-06-14 15:43:26 +00:00
parent 76c48ec399
commit 50648f9c43

View file

@ -330,6 +330,12 @@ storage:
encryption_key: "${STORAGE_KEY}"
local:
path: "${AUTHELIA_DIR}/db.sqlite3"
notifier:
smtp:
address: "${SMTP_HOST}:${SMTP_PORT}"
username: "${SMTP_USER}"
password: "${SMTP_PASS}"
sender: "Authelia <${SMTP_USER}>"
access_control:
default_policy: deny
rules:
@ -371,6 +377,23 @@ $(echo "$OIDC_KEY" | sed 's/^/ /')
AUTHEOF
chmod 600 "$AUTHELIA_CONFIG"
success "Authelia config written"
# Create initial users_database.yml (needed for Authelia to start)
if [ ! -f "${AUTHELIA_DIR}/users_database.yml" ]; then
info "Creating initial users database..."
ADMIN_HASH=$("${AUTHELIA_DIR}/authelia" crypto hash generate --password "$(openssl rand -base64 16)" 2>/dev/null | awk '{print $NF}' || echo "\$argon2id\$v=19\$m=65536,t=3,p=4\$placeholder")
cat > "${AUTHELIA_DIR}/users_database.yml" << USERSDB
users:
placeholder:
displayname: "Setup Account"
password: "${ADMIN_HASH}"
email: "${ADMIN_EMAIL:-admin@local}"
groups: [admins]
USERSDB
chmod 600 "${AUTHELIA_DIR}/users_database.yml"
success "Users database created"
fi
systemctl restart authelia 2>/dev/null && info "Authelia restarted" || info "Authelia not running (will start later)"
fi