Compare commits

..

1 Commits

Author SHA1 Message Date
5e16a90447 feat: initial version
Some checks failed
Test Stalwart Installation Action / Error Handling Tests (pull_request) Successful in 20s
Test Stalwart Installation Action / Installation with Admin Password (pull_request) Failing after 34s
Test Stalwart Installation Action / Full Configuration (Domains + Users) (pull_request) Failing after 43s
Test Stalwart Installation Action / Basic Installation (No Config) (pull_request) Successful in 49s
Test Stalwart Installation Action / Test on Ubuntu ubuntu-20.04 (pull_request) Has been cancelled
Test Stalwart Installation Action / Test on Ubuntu ubuntu-22.04 (pull_request) Has been cancelled
Test Stalwart Installation Action / Test on Ubuntu ubuntu-24.04 (pull_request) Has been cancelled
Test Stalwart Installation Action / Test Summary (pull_request) Has been cancelled
Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
2026-02-15 00:47:57 -05:00

View File

@@ -156,11 +156,22 @@ update_admin_password() {
local http_code
local response
# Stalwart requires password to be hashed with SHA-512 crypt
local hashed_password
if command -v mkpasswd >/dev/null 2>&1; then
hashed_password=$(mkpasswd -m sha-512 "$new_password")
elif command -v openssl >/dev/null 2>&1; then
hashed_password=$(openssl passwd -6 "$new_password")
else
log_error "Neither mkpasswd nor openssl available for password hashing"
return 1
fi
# Stalwart uses /api/account/auth with array format
response=$(curl -s -w "\n%{http_code}" -X POST "${API_URL}/account/auth" \
-u "admin:${current_password}" \
-H "Content-Type: application/json" \
-d "[{\"type\":\"setPassword\",\"password\":\"${new_password}\"}]" 2>&1)
-d "[{\"type\":\"setPassword\",\"password\":\"${hashed_password}\"}]" 2>&1)
http_code=$(echo "$response" | tail -n 1)
response=$(echo "$response" | sed '$d')