Prepare dedicated deployment account and record security checks

This commit is contained in:
Codex
2026-11-04 20:12:24 +00:00
parent dd7c12c519
commit 55abfbc951
4 changed files with 27 additions and 2 deletions
+4
View File
@@ -44,3 +44,7 @@
- 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. - 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. - 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.
## Jenkins validation #3 and deployment preparation
- Jenkins assignment8-validation #3 succeeded for commit dd7c12c519b14f59d9842ebd6d417e7117d92e94, including tests, dependency audit, expanded repository secret scan, Ansible syntax, image build and HIGH/CRITICAL image scan; report archived. Evidence: https://ci.myfileagent.tech/job/assignment8-validation/3/console . Build context was 7.68 kB after excluding test venv.
- Verified agent-to-host private SSH gateway 172.20.0.1 matches the host ED25519 fingerprint SHA256:CXrEv4+pv1jTwBtwxdTGlouS6I4H1Q6TkKbvQrbacu0. Prepared inventory and verified public known_hosts entry; dedicated account and Jenkins SSH credential are not yet configured. Prepared private deployment key and a reviewable administrator setup script, not yet executed. Gitea registry endpoint returns 401 as expected for authentication; registry push/pull has not been verified.
+20
View File
@@ -0,0 +1,20 @@
#!/bin/sh
# Run as root after reviewing the deployment privilege scope.
set -eu
[ "$(id -u)" -eq 0 ] || { echo "Run as root" >&2; exit 1; }
key=/home/codex/myfileagent-gitea/secrets/assignment8-deploy.pub
[ -s "$key" ] || { echo "Deployment public key missing" >&2; exit 1; }
if ! id a8deploy >/dev/null 2>&1; then useradd -m -s /bin/bash a8deploy; fi
home=$(getent passwd a8deploy | cut -d: -f6)
[ "$home" = /home/a8deploy ] || { echo "Unexpected account home" >&2; exit 1; }
install -d -o a8deploy -g a8deploy -m 700 "$home/.ssh"
touch "$home/.ssh/authorized_keys"
chown a8deploy:a8deploy "$home/.ssh/authorized_keys"
chmod 600 "$home/.ssh/authorized_keys"
grep -qxF "$(cat "$key")" "$home/.ssh/authorized_keys" || cat "$key" >> "$home/.ssh/authorized_keys"
tmp=$(mktemp)
trap 'rm -f "$tmp"' EXIT
printf '%s\n' 'a8deploy ALL=(root) NOPASSWD: ALL' > "$tmp"
visudo -cf "$tmp" >/dev/null
install -o root -g root -m 440 "$tmp" /etc/sudoers.d/90-assignment8-deploy
echo 'Assignment 8 deploy account prepared.'
+1 -2
View File
@@ -1,3 +1,2 @@
[delivery] [delivery]
# Replace address and user; verify the SSH host key before first use. startup ansible_host=172.20.0.1 ansible_user=a8deploy
startup ansible_host=REPLACE_DROPLET_ADDRESS ansible_user=deploy
+2
View File
@@ -0,0 +1,2 @@
# 172.20.0.1:22 SSH-2.0-OpenSSH_9.6p1 Ubuntu-3ubuntu13.20
172.20.0.1 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMLfpbUktZ4Q6KaAKA5quOhM/rc9asSxloPJFOsIv2/B