diff --git a/secure-delivery/OPERATIONS_DRAFT.md b/secure-delivery/OPERATIONS_DRAFT.md new file mode 100644 index 0000000..037ac90 --- /dev/null +++ b/secure-delivery/OPERATIONS_DRAFT.md @@ -0,0 +1,18 @@ +# Secure delivery operations (draft) + +These procedures must be updated with verified hostnames, release records, commit links and actual roles before use. Never put passwords, tokens or private keys in release records or logs. + +## Release +1. Review source and configuration changes. Record source commit, configuration commit, base digest, locked dependencies, scan reports, build ID, resulting image digest and expected behavior. +2. Deploy that digest to staging with the reviewed Ansible configuration. Verify HTTPS health, version, full source commit and price for quantity three. Run the same playbook again and investigate any unexpected changes. +3. An authorized person reviews the digest, scan and staging results in Jenkins. Record their identity and decision. If rejected or timed out, stop. +4. Promote the same digest to production using its matching release record and verify the same checks. Record times and monitoring observations. + +## Failed staging deployment +Stop promotion. Preserve the failed build and checks. Restore the last reviewed template/configuration commit and its matching release record, rerun Ansible and verify HTTPS health, identity and business result. The playbook does not roll back automatically. Avoid changing shared Docker, proxy or monitoring services. + +## Production rollback +Record decision and start time. Restore the reviewed v1 deployment configuration and v1 production release record, then run Ansible. Verify health, v1 identity, original source commit and total 30. Record recovery time and observed interruption. This stateless demonstration does not prove a real database migration can be rolled back; use an expand-and-contract compatible migration for stateful services. + +## Cleanup after grading +Only when assessment and retention requirements permit, remove the two application projects, their routes, test DNS records and dedicated credentials. Preserve shared volumes, infrastructure and required evidence. Do not use compose down -v or system pruning. diff --git a/secure-delivery/WORK_LOG.md b/secure-delivery/WORK_LOG.md index d7df090..b7a87e4 100644 --- a/secure-delivery/WORK_LOG.md +++ b/secure-delivery/WORK_LOG.md @@ -37,3 +37,10 @@ ## Jenkins synthetic secret gate - Jenkins assignment8-secret-gate-demo #4 detected one generated disposable private key and failed with scanner exit 1; the job removed the fixture. Earlier attempts #1-3 failed due to transfer or job-script errors, not secret detections. Evidence: https://ci.myfileagent.tech/job/assignment8-secret-gate-demo/4/console . Prepared source-controlled security pipeline; it has not yet been run. + +## Jenkins security validation build #2 +- Jenkins assignment8-validation #2 checked out commit 28d13ef5b8757645bee640ca1dd9a8eea417ce18 on assignment8-trusted. Three unit tests, pip-audit, v1 application-source secret scan, Ansible syntax, image build and HIGH/CRITICAL image scan all passed; image JSON report was archived. Evidence: https://ci.myfileagent.tech/job/assignment8-validation/2/console . Agent briefly disconnected and reconnected during syntax check; build completed successfully. This was a test image, not a registry-published or deployed release. Secret scan currently covers v1 source, not the entire repository. +- Added .test-venv to Docker ignore after observing a 47 MB test environment in the build context; this change has not yet run in Jenkins. +- At inspection, staging.myfileagent.tech and app.myfileagent.tech did not resolve via the Droplet resolver. Existing Caddy routes serve Gitea, Jenkins and Grafana; no pricing routes added yet. + +- Expanded secret scan to the checked-out repository (excluding Git metadata, disposable test environment and generated reports); direct agent test returned zero findings and exit 0. This change still requires a Jenkins run after publication. diff --git a/secure-delivery/scan-secrets.sh b/secure-delivery/scan-secrets.sh index 68500d5..a74f827 100644 --- a/secure-delivery/scan-secrets.sh +++ b/secure-delivery/scan-secrets.sh @@ -2,8 +2,8 @@ set -eu scanner="a8-secret-${BUILD_NUMBER}" trap 'docker rm -f "$scanner" >/dev/null 2>&1 || true; rm -f secret-report.json' EXIT -docker create --name "$scanner" aquasec/trivy@sha256:1c78ed1ef824ab8bb05b04359d186e4c1229d0b3e67005faacb54a7d71974f73 fs --quiet --scanners secret --exit-code 1 --format json /v1 >/dev/null -tar -C secure-delivery --exclude=v1/.test-venv --exclude=v1/__pycache__ -cf - v1 | docker cp - "$scanner":/ +docker create --name "$scanner" aquasec/trivy@sha256:1c78ed1ef824ab8bb05b04359d186e4c1229d0b3e67005faacb54a7d71974f73 fs --quiet --scanners secret --exit-code 1 --format json /repo >/dev/null +tar --exclude=./.git --exclude=./secure-delivery/v1/.test-venv --exclude='*/__pycache__' --exclude=./reports --transform='s,^\.,repo,' -cf - . | docker cp - "$scanner":/ set +e docker start -a "$scanner" > secret-report.json result=$? diff --git a/secure-delivery/v1/.dockerignore b/secure-delivery/v1/.dockerignore index e1b2920..75832c6 100644 --- a/secure-delivery/v1/.dockerignore +++ b/secure-delivery/v1/.dockerignore @@ -2,3 +2,4 @@ __pycache__ .venv .git *.pyc +.test-venv