fix: cert upload timeout, email validation, completion message

This commit is contained in:
Claus Lohmar 2026-07-07 18:21:44 +01:00
parent efaa917013
commit ea82a51307
2 changed files with 8 additions and 3 deletions

View file

@ -304,11 +304,11 @@ EOF
FQDN="${SUB}.${DOMAIN}"
CRT_FILE="$CERTS_DIR/${FQDN}.crt"
[ -f "$CRT_FILE" ] || continue
for TRY in 1 2 3 4 5; do
C=$(curl -s -c /tmp/zc.txt http://127.0.0.1:8000/login.html)
for TRY in 1 2 3; do
C=$(curl -s --max-time 5 -c /tmp/zc.txt http://127.0.0.1:8000/login.html 2>&1)
T=$(echo "$C" | grep 'zoraxy.csrf.Token' | sed 's/.*content="//;s/".*//')
[ -z "$T" ] && sleep 2 && continue
R=$(curl -s -b /tmp/zc.txt -X POST "http://127.0.0.1:8000/api/cert/upload?ktype=pub&domain=$FQDN" \
R=$(curl -s --max-time 5 -b /tmp/zc.txt -X POST "http://127.0.0.1:8000/api/cert/upload?ktype=pub&domain=$FQDN" \
-H "X-CSRF-Token: $T" --data-binary "@$CRT_FILE" 2>&1) || true
if echo "$R" | grep -qi '"success"\|"ok"\|^{}$'; then
echo " [OK] Cert registered: $FQDN"
@ -317,6 +317,7 @@ EOF
sleep 2
done
done
echo " [OK] Certificate registration complete"
# Write systemd service
echo "[*] Writing systemd service..."

View file

@ -28,6 +28,10 @@ read -p "TLS email (Let's Encrypt): " TLS_EMAIL
while [ -z "$TLS_EMAIL" ]; do
read -p "TLS email (required): " TLS_EMAIL
done
# Basic email validation (must contain @)
while echo "$TLS_EMAIL" | grep -qv '@'; do
read -p "Invalid email — must contain @: " TLS_EMAIL
done
read -p "Admin username: " ADMIN_USERNAME
while [ -z "$ADMIN_USERNAME" ]; do