diff --git a/deploy/nginx/newsproject.bitreport.pt.conf b/deploy/nginx/newsproject.bitreport.pt.conf index c22c3ef..21d5ac0 100644 --- a/deploy/nginx/newsproject.bitreport.pt.conf +++ b/deploy/nginx/newsproject.bitreport.pt.conf @@ -42,10 +42,12 @@ server { proxy_send_timeout 30s; } - # --- Public WordPress login surface (before restricted wp-* blocks) --- - # Same-origin cookies for the site hostname. With real_ip enabled, RFC1918-only rules below - # would 403 public users on wp-login. Core login UI needs css/js/images and wp-includes. + # WordPress login — ops-only gate (BIT-26754). + # Public auth goes through Astro /entrar and /registar; wp-login is reserved for admins. + # htpasswd at /etc/nginx/wp-ops.htpasswd — create once on the CT, never commit credentials. location = /wp-login.php { + auth_basic "Ops access only"; + auth_basic_user_file /etc/nginx/wp-ops.htpasswd; proxy_pass http://127.0.0.1:$news_wp_port; proxy_http_version 1.1; proxy_set_header Host $host; diff --git a/deploy/scripts/deploy.sh b/deploy/scripts/deploy.sh index 4ae0b50..25e1224 100755 --- a/deploy/scripts/deploy.sh +++ b/deploy/scripts/deploy.sh @@ -135,3 +135,6 @@ log " 1. IP 10.10.50.204 is static (BIT-24053: systemd-networkd + PVE config; M log " 2. Configure NPM proxy host: newsproject.bitreport.pt → http://10.10.50.204 (NPM proxy #20)" log " 3. Enable HTTPS in NPM (Let's Encrypt)" log " 4. Review $ENV_DIR/frontend.env and $ENV_DIR/bridge.env" +log " 5. Create /etc/nginx/wp-ops.htpasswd for ops-only wp-login gate (BIT-26754):" +log " htpasswd -c -B /etc/nginx/wp-ops.htpasswd wp-ops" +log " Save the password in the team vault. Never commit it to git." diff --git a/deploy/scripts/smoke-andebol.sh b/deploy/scripts/smoke-andebol.sh index c6aeb94..518089b 100755 --- a/deploy/scripts/smoke-andebol.sh +++ b/deploy/scripts/smoke-andebol.sh @@ -53,13 +53,27 @@ _c="$(code_for "$BASE_URL/wp-json/wp/v2/")" [[ "$_c" == "200" ]] || fail "GET $BASE_URL/wp-json/wp/v2/ expected 200, got $_c (WP andebol :8081)" ok "GET /wp-json/wp/v2/ → $_c" -# Auth redirects — /entrar and /registar must NOT land on / (BIT-22298) -_final_entrar="$(curl -fsS -o /dev/null -w '%{url_effective}' --max-time 25 -L -H "Host: $HOST_HEADER" "$BASE_URL/entrar" 2>/dev/null || true)" -[[ "$_final_entrar" == *"wp-login"* ]] || fail "/entrar final URL must contain wp-login; got: $_final_entrar" -ok "GET /entrar → $_final_entrar" +# Branded auth UI (BIT-26753) — /entrar and /registar must serve Astro 200, no WordPress chrome +_c="$(curl -fsS -o /dev/null -w '%{http_code}' --max-time 25 -H "Host: $HOST_HEADER" "$BASE_URL/entrar" 2>/dev/null || true)" +[[ "$_c" == "200" ]] || fail "GET $BASE_URL/entrar expected 200 (Astro branded form), got $_c" +_body_entrar="$(curl -fsS --max-time 15 -H "Host: $HOST_HEADER" "$BASE_URL/entrar" 2>/dev/null || true)" +echo "$_body_entrar" | grep -qi 'WordPress' && fail "/entrar must not contain 'WordPress' (WP chrome leaked)" +echo "$_body_entrar" | grep -qi 'Entrar.*Andebol\|Andebol.*Entrar\|