134 lines
8.1 KiB
Markdown
134 lines
8.1 KiB
Markdown
# Secure Delivery and Rollback — Assignment 8
|
||
|
||
The application is adapted from the instructor's Startup Pricing Service
|
||
v1 in `Examples.zip`, `Examples/dosSecureDelivery/v1/`. The deployment
|
||
starters come from that bundle's `ansible/` directory. The task follows
|
||
Chapter 6 of instructor manual version 1.43.
|
||
|
||
`app/` contains the Flask/Gunicorn service, nine exact direct/transitive
|
||
dependencies, and a pinned Python 3.13 Alpine base digest for Linux/amd64.
|
||
The inventory selects The-Ocean's dedicated deploy account. The example
|
||
release record remains explicitly an example; real registry digests are
|
||
generated by Jenkins from reviewed source.
|
||
|
||
Current execution status, 15 November Eastern / 16 November UTC: PRs 24–27
|
||
are merged, preserving the separate v1/v2 commits. Real Jenkins test/secret
|
||
demonstrations blocked as intended. Builds 5 and 6 then completed both releases,
|
||
with zero-change staging reruns, passing gates and actual human production
|
||
approvals. PR 27 reviewed the successful records and fault/revert history.
|
||
Build 8 passed production rollback to v1; build 9 blocked the staging fault;
|
||
build 10 restored staging v2 with changed=0. Production is v1/total 30 and
|
||
staging v2/total 36, both healthy; production monitoring is live.
|
||
See [releases](evidence/releases-20261115.md) and
|
||
[completed recoveries](evidence/recovery-20261115.md), including interruption,
|
||
sampling limits and build 7's pre-deployment runner error. Final review/merge
|
||
and submission remain.
|
||
|
||
Run the tests from `app/` after installing its requirements into the selected
|
||
Linux test environment. The expected v1 result for three units is USD 30.
|
||
The reviewed v2 source/test change returns USD 36. PR 26 preserved the separate
|
||
v1 and v2 SHAs, selected explicitly by builds 5 and 6 and baked into each image.
|
||
|
||
Deployment work uses a dedicated trusted Jenkins agent, immutable images
|
||
in the existing Gitea registry, and separate Ansible-managed staging and
|
||
production Compose projects. The agent requires Docker build capability,
|
||
Python, Ansible, the Docker collection, and the selected security scanners.
|
||
Registry publication, staging deployment, approval, production promotion,
|
||
and both recovery exercises require dated execution evidence.
|
||
|
||
## Attribution and preparation record
|
||
|
||
On 14 November 2026 Vincent asked Codex to review the assignment and begin
|
||
preparation while he started Docker Desktop. Codex checked the repository's
|
||
AI requirements and usage guide, read Chapter 6 and the example sources,
|
||
verified remote main `8beefde`, and created branch
|
||
`codex/assignment8-secure-delivery`. It copied the v1 and Ansible starters
|
||
without changing their contents and checked Python syntax. This preparation
|
||
record will be consolidated into the manual's AI assistance log when the
|
||
assignment chapter is authored. The instructor retains authorship of the
|
||
starter application and playbook.
|
||
|
||
## Verified preparation, 14 November 2026
|
||
|
||
The existing two pricing tests, three new Flask tests and twelve release/control
|
||
tests passed. The deliberate wrong-price assertion failed as intended; the
|
||
synthetic secret fixture blocked its gate. Pip-audit passed for the nine locked
|
||
application dependencies. The full Trivy runtime-image gate reported no HIGH
|
||
or CRITICAL findings. Earlier failed scans remain in ignored local evidence;
|
||
no scanner exception was introduced. A non-root Gunicorn container passed
|
||
health, identity, pricing and invalid-input checks with a 64 MiB memory cap.
|
||
|
||
The droplet now has 2 GiB RAM and its original 25 GB plan disk. Vincent resized
|
||
it and installed package updates. The existing seven service containers and
|
||
their HTTPS routes were verified after maintenance.
|
||
|
||
The trusted node `ssw590-vince-delivery` now runs on The-Ocean, with one
|
||
exclusive executor and label `delivery-trusted`. Its name is retained from
|
||
the initial laptop installation. The laptop copy is stopped. The remote
|
||
agent uses private HTTP/WebSocket to `jenkins:8080`; its SSH configuration
|
||
routes the existing deployment inventory address through Docker's host gateway,
|
||
retaining `HostKeyAlias 147.182.178.136` and the pinned Jenkins known-hosts file.
|
||
No campus SSH connection is needed to run a delivery job from the browser.
|
||
[Agent prerequisite build 1](https://ci.yebilly.me/job/secure-delivery/job/agent-preflight/1/)
|
||
passed using the dedicated deploy key, pinned host key and root sudo. Its
|
||
non-secret tool inventory is versioned in `evidence/agent-preflight-1.txt`.
|
||
The `secure-delivery/pricing` job loads `delivery/Jenkinsfile` from protected
|
||
main and was enabled after PR 24 merged. Release credentials are scoped
|
||
to that Jenkins folder; the PR job does not bind them or the Docker socket.
|
||
|
||
The original inventory above is historical. [Remote prerequisite build 2](https://ci.yebilly.me/job/secure-delivery/job/agent-preflight/2/)
|
||
passed after migration; `evidence/agent-preflight-2.txt` records the tools and
|
||
target. A separate bounded capacity trial passed control/app tests, source and
|
||
dependency checks, a limited image build, image scan and temporary HTTP smoke.
|
||
It used a preparation snapshot, not a reviewed release, and published nothing.
|
||
|
||
The deployment account has root-only passwordless sudo: effective host
|
||
administration privileges, restricted to reviewed delivery code. Distinct
|
||
package-write and package-read tokens under `vsun1` are stored in Jenkins and
|
||
root's target Docker configuration respectively. No values are in Git.
|
||
Remote agent identity and workspace live in named Docker volumes outside Git.
|
||
The agent has administrative access to the same Docker host as Jenkins and
|
||
Gitea; a container is not a security boundary against malicious trusted jobs.
|
||
Use only reviewed delivery code. `agent/compose.droplet.yaml` caps the agent
|
||
at 512 MiB RAM / 768 MiB RAM+swap and 0.5 CPU; a dedicated pinned BuildKit
|
||
builder has 256 MiB / 384 MiB and 0.5 CPU. Builds select that builder explicitly.
|
||
Agent and builder restart unless stopped. `bootstrap/start-droplet-agent.sh`
|
||
is the root-operated installation/reconnect helper in
|
||
`/opt/ssw590-delivery-agent`; it detects the Docker socket group (987 on this host).
|
||
No public agent, Docker API or app port is added.
|
||
|
||
`bootstrap/start-agent.ps1` refuses to start the laptop copy by default.
|
||
For an intentional fallback, first stop the remote agent and builder, then use
|
||
`-AllowLaptopFallback`. Never connect both copies of the same node. Preserve
|
||
their volumes. The Gitea Actions manual-build runner subsequently moved to
|
||
The-Ocean too; see `../gitea/droplet-runner/README.md`. Neither active runner
|
||
now depends on Docker Desktop. Run manual builds and delivery releases sequentially.
|
||
See `RUNBOOKS.md`.
|
||
|
||
Ansible syntax, agent Compose configuration, and the installed Jenkins
|
||
controller's declarative parser checks passed. Those were preparation checks;
|
||
the subsequent assessed releases and both recovery cases are linked above.
|
||
|
||
## Remaining checkpoints
|
||
|
||
PRs 24–27 preserve the implementation, corrections, separate v1/v2 source
|
||
commits and recovery configuration history. The technical demonstrations are
|
||
complete. [Issue 28](https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/issues/28)
|
||
was created with Vincent's authorization during finalization, after execution;
|
||
the final evidence PR should close it following Billy's review. Vincent handles
|
||
commits, pushes and PDF submission. No further intentional failure is needed.
|
||
Main and live staging have the good template. Keep branch protection and
|
||
earlier services. Both names retain trusted HTTPS and redirects; the initial
|
||
TLS snapshot remains `evidence/https-20261115.md`.
|
||
Use `RUNBOOKS.md` for later authorized operations.
|
||
Keep Jenkins and the remote delivery node available. Production approval requires an authorized
|
||
human; an agent must not approve unattended.
|
||
|
||
`SECURITY.md` defines the gate policy. `bootstrap/` makes administrator setup
|
||
reviewable; its one-time script refuses to overwrite existing deployment state.
|
||
Raw local reports remain under ignored `build/evidence/assignment8-local/`.
|
||
The manual records actual outcomes, access instructions, limitations and AI
|
||
assistance. Raw assessed reports are in ignored
|
||
`build/evidence/assignment8-execution/` and Jenkins artifacts; non-secret
|
||
summaries, hashes and original observer CSVs are versioned under `evidence/`.
|