fix: pin SSH host key via known_hosts instead of StrictHostKeyChecking=no (#161) #181

Merged
guettlibot merged 1 commits from issue-161-fix into main 2026-05-24 11:00:12 +00:00
guettlibot commented 2026-05-23 14:41:24 +00:00 (Migrated from codeberg.org)

Summary

  • Replaces StrictHostKeyChecking=no with a pinned SSH host key (known_hosts) across the entire deploy pipeline
  • Adds knownHosts *dagger.Secret parameter to Deployer(), DeployLinux(), DeployApk(), PublishWebsite(), BuildWebsite(), and GenerateBuildHistory() in ci/main.go
  • Mounts the SSH_KNOWN_HOSTS secret at /root/.ssh/known_hosts (mode 0644) in both the Deployer container and the GenerateBuildHistory container
  • Removes -o StrictHostKeyChecking=no from all ssh/scp/rsync calls in ci/main.go and scripts/generate_build_history.py
  • Updates Taskfile dagger tasks (deploy-linux, deploy-apk, publish-website) to require and pass SSH_KNOWN_HOSTS
  • Fixes non-Dagger Taskfile tasks to write SSH_KNOWN_HOSTS to ~/.ssh/known_hosts before SSH commands
  • Updates .forgejo/workflows/deploy.yml to pass SSH_KNOWN_HOSTS: ${{ secrets.SSH_KNOWN_HOSTS }}
  • Updates .github/workflows/ci.yml SSH setup step to populate known_hosts

Setup required

Run ssh-keyscan <deploy-host> on a trusted machine and store the output as a Codeberg secret named SSH_KNOWN_HOSTS.

Test plan

  • Verify StrictHostKeyChecking=no no longer appears anywhere in the codebase
  • Confirm SSH_KNOWN_HOSTS secret is added to Codeberg repository secrets before deploy workflow runs
  • Deploy job passes after secret is set

Closes #161

🤖 Generated with Claude Code

## Summary - Replaces `StrictHostKeyChecking=no` with a pinned SSH host key (`known_hosts`) across the entire deploy pipeline - Adds `knownHosts *dagger.Secret` parameter to `Deployer()`, `DeployLinux()`, `DeployApk()`, `PublishWebsite()`, `BuildWebsite()`, and `GenerateBuildHistory()` in `ci/main.go` - Mounts the `SSH_KNOWN_HOSTS` secret at `/root/.ssh/known_hosts` (mode 0644) in both the Deployer container and the GenerateBuildHistory container - Removes `-o StrictHostKeyChecking=no` from all `ssh`/`scp`/`rsync` calls in `ci/main.go` and `scripts/generate_build_history.py` - Updates Taskfile dagger tasks (`deploy-linux`, `deploy-apk`, `publish-website`) to require and pass `SSH_KNOWN_HOSTS` - Fixes non-Dagger Taskfile tasks to write `SSH_KNOWN_HOSTS` to `~/.ssh/known_hosts` before SSH commands - Updates `.forgejo/workflows/deploy.yml` to pass `SSH_KNOWN_HOSTS: ${{ secrets.SSH_KNOWN_HOSTS }}` - Updates `.github/workflows/ci.yml` SSH setup step to populate `known_hosts` ## Setup required Run `ssh-keyscan <deploy-host>` on a trusted machine and store the output as a Codeberg secret named `SSH_KNOWN_HOSTS`. ## Test plan - [ ] Verify `StrictHostKeyChecking=no` no longer appears anywhere in the codebase - [ ] Confirm `SSH_KNOWN_HOSTS` secret is added to Codeberg repository secrets before deploy workflow runs - [ ] Deploy job passes after secret is set Closes #161 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Sign in to join this conversation.