fix(installer): add missing notifier section, create Authelia users_database.yml on fresh install
This commit is contained in:
parent
76c48ec399
commit
50648f9c43
1 changed files with 23 additions and 0 deletions
23
install.sh
23
install.sh
|
|
@ -330,6 +330,12 @@ storage:
|
||||||
encryption_key: "${STORAGE_KEY}"
|
encryption_key: "${STORAGE_KEY}"
|
||||||
local:
|
local:
|
||||||
path: "${AUTHELIA_DIR}/db.sqlite3"
|
path: "${AUTHELIA_DIR}/db.sqlite3"
|
||||||
|
notifier:
|
||||||
|
smtp:
|
||||||
|
address: "${SMTP_HOST}:${SMTP_PORT}"
|
||||||
|
username: "${SMTP_USER}"
|
||||||
|
password: "${SMTP_PASS}"
|
||||||
|
sender: "Authelia <${SMTP_USER}>"
|
||||||
access_control:
|
access_control:
|
||||||
default_policy: deny
|
default_policy: deny
|
||||||
rules:
|
rules:
|
||||||
|
|
@ -371,6 +377,23 @@ $(echo "$OIDC_KEY" | sed 's/^/ /')
|
||||||
AUTHEOF
|
AUTHEOF
|
||||||
chmod 600 "$AUTHELIA_CONFIG"
|
chmod 600 "$AUTHELIA_CONFIG"
|
||||||
success "Authelia config written"
|
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)"
|
systemctl restart authelia 2>/dev/null && info "Authelia restarted" || info "Authelia not running (will start later)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue