chore: finalize lab7 security verification
CI / verify (pull_request) Failing after 3m27s

This commit is contained in:
2026-11-06 21:39:31 +03:00
parent 5ac64f51fa
commit 97a52eeee6
41 changed files with 759 additions and 150 deletions
+26 -10
View File
@@ -24,6 +24,9 @@ jobs:
LOKI_BIND_ADDRESS: 127.0.0.1:0
TEMPO_BIND_ADDRESS: 127.0.0.1:0
OPENBAO_BIND_ADDRESS: 127.0.0.1:0
BAO_ADDR: https://openbao:8200
DOCKER_WORKSPACE_MIRROR: "1"
CI_WORKSPACE: /tmp/mtusi2026lab7-${{ github.run_id }}
steps:
- name: Checkout exact commit
run: |
@@ -66,8 +69,16 @@ jobs:
- name: Prepare local stack
run: |
mkdir -p "$CI_WORKSPACE"
git archive HEAD | tar -x -C "$CI_WORKSPACE"
cd "$CI_WORKSPACE"
cp lab7.env.example .env
docker compose config --quiet
./infra/pki/bootstrap.sh
./scripts/openbao-seed.sh .env
./scripts/sync-docker-workspace.sh
docker compose up -d security-bootstrap openbao-permissions openbao
docker network connect "${COMPOSE_PROJECT_NAME}_secrets" "$HOSTNAME"
./scripts/bootstrap-local.sh .env
docker network connect "${COMPOSE_PROJECT_NAME}_application" "$HOSTNAME"
docker network connect "${COMPOSE_PROJECT_NAME}_data" "$HOSTNAME"
@@ -78,15 +89,15 @@ jobs:
- name: Integration checks
run: |
cd "$CI_WORKSPACE"
test "$(curl --noproxy '*' --cacert .runtime/security/internal-ca/ca.crt -s -o /dev/null -w '%{http_code}' "https://s3:9000/messenger-attachments")" = "403"
make test BASE_URL=https://nginx:8443 CA_FILE=.runtime/security/public-ca/ca.crt
make test-security BASE_URL=https://nginx:8443 CA_FILE=.runtime/security/public-ca/ca.crt
make test-tls-matrix ENV_FILE=.env
ENV_FILE=.env BASE_URL=https://nginx:8443 ./scripts/test-leaf-rotation.sh
docker compose --profile security run --rm dependency-tests
OPENBAO_ADDRESS=$(docker compose port openbao 8200)
ENV_FILE=.env BAO_ADDR="https://$OPENBAO_ADDRESS" BAO_CACERT="$PWD/.runtime/security/openbao/ca.crt" ./scripts/openbao-test-policy.sh
ENV_FILE=.env BAO_ADDR="https://$OPENBAO_ADDRESS" BAO_CACERT="$PWD/.runtime/security/openbao/ca.crt" ./scripts/test-openbao-lifecycle.sh
ENV_FILE=.env BAO_ADDR=https://openbao:8200 BAO_CACERT="$PWD/.runtime/security/openbao/ca.crt" ./scripts/openbao-test-policy.sh
ENV_FILE=.env BAO_ADDR=https://openbao:8200 BAO_CACERT="$PWD/.runtime/security/openbao/ca.crt" ./scripts/test-openbao-lifecycle.sh
make test-login-rate-limit BASE_URL=https://nginx:8443 CA_FILE=.runtime/security/public-ca/ca.crt
docker compose --profile tests run --rm --build tests
go run ./cmd/dependencycheck -base-url=https://nginx:8443 -ca-file=.runtime/security/public-ca/ca.crt
@@ -98,24 +109,29 @@ jobs:
make scan-security
ENV_FILE=.env CA_FILE=.runtime/security/public-ca/ca.crt PROMETHEUS_URL=http://prometheus:9090 TEMPO_URL=http://tempo:3200 LOKI_URL=http://loki:3100 make test-lab6-smoke BASE_URL=https://nginx:8443
- name: Container logs
if: failure()
run: if [ -f "$CI_WORKSPACE/.env" ]; then cd "$CI_WORKSPACE"; docker compose logs --no-color --tail=200; fi
- name: Upload security evidence
if: always()
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v3
env:
ACTIONS_RUNTIME_URL: https://gitea.privcloud.tech/api/actions_pipeline/
with:
name: lab7-security-${{ github.sha }}
path: |
evidence/lab7-*.json
evidence/runtime/security-scan
${{ env.CI_WORKSPACE }}/evidence/lab7-*.json
${{ env.CI_WORKSPACE }}/evidence/runtime/security-scan
if-no-files-found: warn
retention-days: 14
- name: Container logs
if: failure()
run: if [ -f .env ]; then docker compose logs --no-color --tail=200; fi
- name: Stop local stack
if: always()
run: |
test -d "$CI_WORKSPACE" || exit 0
cd "$CI_WORKSPACE"
docker network disconnect "${COMPOSE_PROJECT_NAME}_secrets" "$HOSTNAME" 2>/dev/null || true
docker network disconnect "${COMPOSE_PROJECT_NAME}_application" "$HOSTNAME" 2>/dev/null || true
docker network disconnect "${COMPOSE_PROJECT_NAME}_data" "$HOSTNAME" 2>/dev/null || true
docker network disconnect "${COMPOSE_PROJECT_NAME}_data_backend" "$HOSTNAME" 2>/dev/null || true
+18 -4
View File
@@ -31,6 +31,9 @@ jobs:
LOKI_BIND_ADDRESS: 127.0.0.1:0
TEMPO_BIND_ADDRESS: 127.0.0.1:0
OPENBAO_BIND_ADDRESS: 127.0.0.1:0
BAO_ADDR: https://openbao:8200
DOCKER_WORKSPACE_MIRROR: "1"
CI_WORKSPACE: /tmp/mtusi2026lab7-${{ github.run_id }}
API_IMAGE: gitea.privcloud.tech/${{ github.repository_owner }}/mtusi2026lab7-api:${{ github.sha }}
NGINX_IMAGE: gitea.privcloud.tech/${{ github.repository_owner }}/mtusi2026lab7-nginx:${{ github.sha }}
SWAGGER_IMAGE: gitea.privcloud.tech/${{ github.repository_owner }}/mtusi2026lab7-swagger:${{ github.sha }}
@@ -80,8 +83,16 @@ jobs:
- name: Prepare local stack
run: |
mkdir -p "$CI_WORKSPACE"
git archive HEAD | tar -x -C "$CI_WORKSPACE"
cd "$CI_WORKSPACE"
cp lab7.env.example .env
docker compose config --quiet
./infra/pki/bootstrap.sh
./scripts/openbao-seed.sh .env
./scripts/sync-docker-workspace.sh
docker compose up -d security-bootstrap openbao-permissions openbao
docker network connect "${COMPOSE_PROJECT_NAME}_secrets" "$HOSTNAME"
./scripts/bootstrap-local.sh .env
docker network connect "${COMPOSE_PROJECT_NAME}_application" "$HOSTNAME"
docker network connect "${COMPOSE_PROJECT_NAME}_data" "$HOSTNAME"
@@ -92,15 +103,15 @@ jobs:
- name: Integration checks
run: |
cd "$CI_WORKSPACE"
test "$(curl --noproxy '*' --cacert .runtime/security/internal-ca/ca.crt -s -o /dev/null -w '%{http_code}' "https://s3:9000/messenger-attachments")" = "403"
make test BASE_URL=https://nginx:8443 CA_FILE=.runtime/security/public-ca/ca.crt
make test-security BASE_URL=https://nginx:8443 CA_FILE=.runtime/security/public-ca/ca.crt
make test-tls-matrix ENV_FILE=.env
ENV_FILE=.env BASE_URL=https://nginx:8443 ./scripts/test-leaf-rotation.sh
docker compose --profile security run --rm dependency-tests
OPENBAO_ADDRESS=$(docker compose port openbao 8200)
ENV_FILE=.env BAO_ADDR="https://$OPENBAO_ADDRESS" BAO_CACERT="$PWD/.runtime/security/openbao/ca.crt" ./scripts/openbao-test-policy.sh
ENV_FILE=.env BAO_ADDR="https://$OPENBAO_ADDRESS" BAO_CACERT="$PWD/.runtime/security/openbao/ca.crt" ./scripts/test-openbao-lifecycle.sh
ENV_FILE=.env BAO_ADDR=https://openbao:8200 BAO_CACERT="$PWD/.runtime/security/openbao/ca.crt" ./scripts/openbao-test-policy.sh
ENV_FILE=.env BAO_ADDR=https://openbao:8200 BAO_CACERT="$PWD/.runtime/security/openbao/ca.crt" ./scripts/test-openbao-lifecycle.sh
make test-login-rate-limit BASE_URL=https://nginx:8443 CA_FILE=.runtime/security/public-ca/ca.crt
docker compose --profile tests run --rm --build tests
go run ./cmd/dependencycheck -base-url=https://nginx:8443 -ca-file=.runtime/security/public-ca/ca.crt
@@ -139,11 +150,14 @@ jobs:
- name: Container logs
if: failure()
run: if [ -f .env ]; then docker compose logs --no-color --tail=200; fi
run: if [ -f "$CI_WORKSPACE/.env" ]; then cd "$CI_WORKSPACE"; docker compose logs --no-color --tail=200; fi
- name: Stop local stack
if: always()
run: |
test -d "$CI_WORKSPACE" || exit 0
cd "$CI_WORKSPACE"
docker network disconnect "${COMPOSE_PROJECT_NAME}_secrets" "$HOSTNAME" 2>/dev/null || true
docker network disconnect "${COMPOSE_PROJECT_NAME}_application" "$HOSTNAME" 2>/dev/null || true
docker network disconnect "${COMPOSE_PROJECT_NAME}_data" "$HOSTNAME" 2>/dev/null || true
docker network disconnect "${COMPOSE_PROJECT_NAME}_data_backend" "$HOSTNAME" 2>/dev/null || true
+20 -3
View File
@@ -20,6 +20,9 @@ jobs:
LOKI_BIND_ADDRESS: 127.0.0.1:0
TEMPO_BIND_ADDRESS: 127.0.0.1:0
OPENBAO_BIND_ADDRESS: 127.0.0.1:0
BAO_ADDR: https://openbao:8200
DOCKER_WORKSPACE_MIRROR: "1"
CI_WORKSPACE: /tmp/mtusi2026lab7-${{ github.run_id }}
steps:
- name: Checkout exact commit
run: |
@@ -35,8 +38,16 @@ jobs:
- name: Prepare stack
run: |
mkdir -p "$CI_WORKSPACE"
git archive HEAD | tar -x -C "$CI_WORKSPACE"
cd "$CI_WORKSPACE"
cp lab7.env.example .env
docker compose config --quiet
./infra/pki/bootstrap.sh
./scripts/openbao-seed.sh .env
./scripts/sync-docker-workspace.sh
docker compose up -d security-bootstrap openbao-permissions openbao
docker network connect "${COMPOSE_PROJECT_NAME}_secrets" "$HOSTNAME"
./scripts/bootstrap-local.sh .env
docker network connect "${COMPOSE_PROJECT_NAME}_application" "$HOSTNAME"
docker network connect "${COMPOSE_PROJECT_NAME}_data" "$HOSTNAME"
@@ -47,6 +58,7 @@ jobs:
- name: Reproduce SLO incidents
run: |
cd "$CI_WORKSPACE"
ENV_FILE=.env \
BASE_URL=https://nginx:8443 \
CA_FILE=.runtime/security/public-ca/ca.crt \
@@ -58,20 +70,25 @@ jobs:
- name: Upload sanitized evidence
if: always()
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v3
env:
ACTIONS_RUNTIME_URL: https://gitea.privcloud.tech/api/actions_pipeline/
with:
name: lab6-incidents-${{ github.sha }}
path: evidence/runtime/ci
path: ${{ env.CI_WORKSPACE }}/evidence/runtime/ci
if-no-files-found: warn
retention-days: 14
- name: Container logs
if: failure()
run: docker compose logs --no-color --tail=200
run: if [ -f "$CI_WORKSPACE/.env" ]; then cd "$CI_WORKSPACE"; docker compose logs --no-color --tail=200; fi
- name: Stop local stack
if: always()
run: |
test -d "$CI_WORKSPACE" || exit 0
cd "$CI_WORKSPACE"
docker network disconnect "${COMPOSE_PROJECT_NAME}_secrets" "$HOSTNAME" 2>/dev/null || true
docker network disconnect "${COMPOSE_PROJECT_NAME}_application" "$HOSTNAME" 2>/dev/null || true
docker network disconnect "${COMPOSE_PROJECT_NAME}_data" "$HOSTNAME" 2>/dev/null || true
docker network disconnect "${COMPOSE_PROJECT_NAME}_data_backend" "$HOSTNAME" 2>/dev/null || true