fix(devops): wp-login ops-only gate + smoke for branded auth (BIT-26754)
Tests / writer-pipeline tests (push) Successful in 40s
Tests / bridge tests (push) Successful in 39s
Tests / frontend lib tests (push) Successful in 38s
Tests / writer-pipeline tests (pull_request) Successful in 47s
Tests / bridge tests (pull_request) Successful in 48s
Tests / frontend lib tests (pull_request) Successful in 49s
Tests / writer-pipeline tests (push) Successful in 40s
Tests / bridge tests (push) Successful in 39s
Tests / frontend lib tests (push) Successful in 38s
Tests / writer-pipeline tests (pull_request) Successful in 47s
Tests / bridge tests (pull_request) Successful in 48s
Tests / frontend lib tests (pull_request) Successful in 49s
- Nginx: add auth_basic gate on wp-login.php (ops htpasswd, BIT-26754) - deploy.sh: note htpasswd step 5 in post-deploy manual steps - smoke-andebol.sh: update /entrar+/registar checks to verify branded Astro 200 (no WordPress strings); add wp-login.php 401/403 gate check; add /api/homepage latest ≥24 density check (BIT-26752) Co-Authored-By: Paperclip <[email protected]>
This commit is contained in:
1 parent
2528e3fa0e
commit
f37d4f7318
3 files changed
+29
-10
No files matched your search
@@ -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;
|
||||
|
||||
@@ -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."
|
||||
@@ -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\|<title>Entrar' || fail "/entrar missing Andebol.net branded title"
|
||||
ok "GET /entrar → $_c (Astro branded, no WordPress)"
|
||||
|
||||
_final_registar="$(curl -fsS -o /dev/null -w '%{url_effective}' --max-time 25 -L -H "Host: $HOST_HEADER" "$BASE_URL/registar" 2>/dev/null || true)"
|
||||
[[ "$_final_registar" == *"wp-login"* ]] || fail "/registar final URL must contain wp-login; got: $_final_registar"
|
||||
ok "GET /registar → $_final_registar"
|
||||
_c="$(curl -fsS -o /dev/null -w '%{http_code}' --max-time 25 -H "Host: $HOST_HEADER" "$BASE_URL/registar" 2>/dev/null || true)"
|
||||
[[ "$_c" == "200" ]] || fail "GET $BASE_URL/registar expected 200 (Astro branded form), got $_c"
|
||||
ok "GET /registar → $_c"
|
||||
|
||||
# wp-login.php must NOT be publicly accessible (BIT-26754) — expect 401 (basic auth gate)
|
||||
_c="$(curl -so /dev/null -w '%{http_code}' --max-time 15 -H "Host: $HOST_HEADER" "$BASE_URL/wp-login.php" 2>/dev/null || true)"
|
||||
[[ "$_c" == "401" || "$_c" == "403" ]] || fail "GET $BASE_URL/wp-login.php expected 401/403 (ops gate), got $_c"
|
||||
ok "GET /wp-login.php → $_c (ops-only gate active)"
|
||||
|
||||
# Homepage density: at least 24 latest items in bridge payload (BIT-26752)
|
||||
_latest_count="$(curl -fsS --max-time 15 -H "Host: $HOST_HEADER" "$BASE_URL/api/homepage" 2>/dev/null \
|
||||
| python3 -c 'import sys,json; d=json.load(sys.stdin); print(len(d.get("latest",[])))' 2>/dev/null || echo 0)"
|
||||
[[ "$_latest_count" -ge 24 ]] || fail "Homepage /api/homepage latest count expected ≥24, got $_latest_count"
|
||||
ok "GET /api/homepage latest count → $_latest_count ≥ 24"
|
||||
|
||||
echo "All smokes passed for BASE_URL=$BASE_URL (host: $HOST_HEADER)"
|
||||
Reference in new issue
Block a user