Every machine makes its own keys before a service reads one #19
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Keel-Linux/inithooks!19
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/generate-host-keys"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
keel-core#8: every layer and all fourteen templates on mirror.keellinux.org carry the same SSH host keys, the same turnkey-ssl TLS key in
/etc/ssl/privateand, in lapp and postgresql, the same snakeoil key. A machine only got its own from10regen-sshkeysand15regen-sslcert; one where they did not run served a key anyone can download, and nothing said so. BRIEF section 5.3: every appliance gets its own host keys.Fix
keel-host-keys.service, ordered before sshd, Webmin, the web servers, PostgreSQL, postfix and the init fence, runsbin/keel-host-keyson every boot. It generates any SSH host key, TLS pair or snakeoil pair (where ssl-cert is installed) that is missing.shared-host-keys, measured from every layer and template on the mirror. That is what fixes machines already made from the published images. Replacements are logged at warning to the auth facility.15regen-sslcertrestarts Webmin too; it kept serving the previous key until a reboot.Evidence
tests/test-host-keys.bats, 20 tests, real ssh-keygen:bin/keel-host-keys64/64, shell total 99.65. 4 of 5 mutations turn it red; the survivor (dropping the ssh/tls kind comparison) is equivalent, since the two digest formats cannot collide.core.tar.zst: all three SSH host keys and the TLS key recognised and replaced.Deploying the three together
This is one of three pull requests for keel-core#8: Keel-Linux/inithooks (generate on the machine), Keel-Linux/common (remove from the build), Keel-Linux/buildtasks (refuse at export). Merging deploys nothing: the build host checkouts are updated by hand. The order that matters is deployment:
inithooks 2.3.6+keel6to the archive (attended, signing). Until then a layer without keys would boot with no TLS certificate until15regen-sslcert, which only restarts services already running./turnkey/fab-keel/commonand/turnkey/buildtasks-keelon the build host in the same sitting: the audit without the removals refuses every layer.keel-host-keysreplaces them on any machine made from one.