Skip to content

fix: keel-overlay-installer keeps private keys out of etckeeper's /etc/.git - #50

Merged
marcos-mendez merged 1 commit into
19.xfrom
fix/etckeeper-private-keys
Oct 9, 2026
Merged

marcos-mendez merged 1 commit into
19.xfrom
fix/etckeeper-private-keys

Conversation

@marcos-mendez

Copy link
Copy Markdown
Collaborator

Closes #49.

Change

keel-overlay-installer 0.2.0 ships /usr/lib/keel/overlays/installer/etckeeper-ignore. Its postinst runs the script at each configure:

  1. The script writes a list of paths into /etc/.gitignore, outside the section etckeeper manages. etckeeper's init, update-ignore and uninit keep the list, also when the first boot hook 92etckeeper makes the repository again.
  2. Where /etc/.git exists, the script removes the tracked files of the list from the index (git rm --cached). It commits that removal with the new .gitignore, and with no other change. The files stay on disk. The history is not rewritten.

Paths under /etc: wireguard/*.key, mysql/keel-tls/*.key, etcd/keel/*.key, keel/secrets/, ssl/private/, ssh/ssh_host_*_key, crowdsec/local_api_credentials.yaml, crowdsec/online_api_credentials.yaml, crowdsec/bouncers/*.yaml.local, anubis/keel.key, anubis/keel.key.*.

The changelog tells the operator to rotate each key that was tracked. keel has no command that rotates a key yet: keel makes each key once, and a renewal of a certificate keeps the key.

The package is the installer overlay because every Keel appliance has it through keel-core.

Test plan

  • tests/etckeeper-ignore.bats: 18 tests on a scratch git repository; 37 of 37 lines (kcov 43, Debian 13).
  • tests/coverage.sh 100 passes locally.
  • packages/build installer builds and lintian is clean.
  • CI job install: tests/overlay-install.bats installs etckeeper and tests the postinst with the real etckeeper (reinstall, uninit and init).

…c/.git

etckeeper committed wireguard/wg0.key at the keel installation and
mysql/keel-tls/server.key at a reinstallation (real nodes, keel 0.23.3).
A rotated key stays in the history.

keel-overlay-installer 0.2.0 ships
/usr/lib/keel/overlays/installer/etckeeper-ignore, and its postinst runs
it at each configure. The script writes a list of private key and secret
paths into /etc/.gitignore, outside the section etckeeper manages, so
etckeeper's init and uninit keep it. Where /etc/.git exists, it removes
the tracked files of the list from the index and commits that removal
with no other change. It does not rewrite the history: the changelog
tells the operator to rotate each key that was tracked.

tests/etckeeper-ignore.bats tests the script on a scratch git
repository (100 percent of its lines). tests/overlay-install.bats tests
the postinst with the real etckeeper in the CI job install, which now
installs etckeeper.

Closes #49
@marcos-mendez
marcos-mendez merged commit 35648b5 into 19.x Oct 9, 2026
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

etckeeper commits private keys (wg0.key, keel-tls/server.key) into /etc/.git

1 participant