From b0e8cead184a1249090e068cfd1e39d07eef9575 Mon Sep 17 00:00:00 2001 From: Codex Date: Wed, 4 Nov 2026 20:42:16 +0000 Subject: [PATCH] Prepare target registry authentication --- .../Jenkinsfile.registry-read-setup | 19 +++++++++++++++++++ secure-delivery/WORK_LOG.md | 2 ++ 2 files changed, 21 insertions(+) create mode 100644 secure-delivery/Jenkinsfile.registry-read-setup diff --git a/secure-delivery/Jenkinsfile.registry-read-setup b/secure-delivery/Jenkinsfile.registry-read-setup new file mode 100644 index 0000000..e0ebc13 --- /dev/null +++ b/secure-delivery/Jenkinsfile.registry-read-setup @@ -0,0 +1,19 @@ +pipeline { + agent { label 'assignment8-trusted' } + options { skipDefaultCheckout(); timeout(time: 5, unit: 'MINUTES') } + stages { + stage('Checkout') { steps { checkout scm } } + stage('Authenticate target registry reader') { + steps { + withCredentials([sshUserPrivateKey(credentialsId: 'assignment8-deploy-ssh', keyFileVariable: 'DEPLOY_KEY', usernameVariable: 'DEPLOY_USER'), usernamePassword(credentialsId: 'assignment8-registry-read', usernameVariable: 'REG_USER', passwordVariable: 'REG_TOKEN')]) { + sh '''#!/bin/sh +set +x +set -eu +case "$REG_USER" in *[!a-zA-Z0-9_.-]*|'') echo 'Invalid registry username' >&2; exit 1;; esac +printf '%s' "$REG_TOKEN" | ssh -o BatchMode=yes -o StrictHostKeyChecking=yes -o UserKnownHostsFile="$WORKSPACE/secure-delivery/ansible/known_hosts" -i "$DEPLOY_KEY" "$DEPLOY_USER@172.20.0.1" "sudo -n docker login myfileagent.tech --username $REG_USER --password-stdin" +''' + } + } + } + } +} diff --git a/secure-delivery/WORK_LOG.md b/secure-delivery/WORK_LOG.md index 5c47edd..280f7e9 100644 --- a/secure-delivery/WORK_LOG.md +++ b/secure-delivery/WORK_LOG.md @@ -66,3 +66,5 @@ ## Proxy preparation - Validated and reloaded existing Caddy configuration with staging.myfileagent.tech -> pricing-staging:8000 and app.myfileagent.tech -> pricing-production:8000. Saved previous configuration at /home/codex/myfileagent-gitea/Caddyfile.before-assignment8. Gitea, Jenkins and Grafana HTTPS login routes returned 200 with certificate validation. New staging and app HTTPS endpoints returned 502 with certificate validation successful, expected before app containers exist. One initial staging DNS lookup timed out; retry reached HTTPS. - Jenkinsfile.release.draft is untested and not enabled. It requires reviewed source on protected main, package publication rights, target registry authentication, scan and deployment validation before operational use. + +- Prepared Jenkinsfile.registry-read-setup to configure root Docker registry authentication using a separate read-only Jenkins credential over pinned SSH. Draft only; not run. Root Docker configuration will hold authentication material and must be protected and removed after assessment.