Commit Graph

22 Commits

Author SHA1 Message Date
benvin 2ba3e30bc3 Merge pull request 'Fail a bare invocation when stdout is not a terminal' (#4) from benvin/fix-invocation-guards into master
Reviewed-on: #4
2026-09-24 21:14:38 +10:00
unkin-agent d39ca1e3a6 Rewrap the isTerminal comment
ci/woodpecker/pr/build Pipeline was successful
ci/woodpecker/pr/integration Pipeline was successful
ci/woodpecker/pr/test Pipeline was successful
ci/woodpecker/pr/pre-commit Pipeline was successful
2026-09-22 23:49:34 +10:00
unkin-agent 0860da03c4 Document the untagged hermetic-env helper
ci/woodpecker/pr/build Pipeline was canceled
ci/woodpecker/pr/integration Pipeline was canceled
ci/woodpecker/pr/pre-commit Pipeline was canceled
ci/woodpecker/pr/test Pipeline was canceled
2026-09-22 23:49:06 +10:00
unkin-agent 173a82f29e Pin x/term v0.45.0 and x/sys v0.47.0
Newest pair still declaring go 1.25.0; v0.46.0/v0.48.0 declare
go 1.26.0 and break the golang:1.25 CI images.
2026-09-22 23:48:59 +10:00
unkin-agent ddd93a8b71 Assert the hermetic env replaces the ambient one, not extends it
The shape test passed on `return os.Environ()`; only a Vault-backed
test caught it. Move the helper and its test out from behind the
integration tag and reject any entry outside PATH/HOME/XDG_CONFIG_HOME.
2026-09-22 23:48:59 +10:00
unkin-agent 21990d9297 Pass an explicit empty argv so cobra cannot reach os.Args
A nil argv lets cobra fall back to os.Args[1:], which under
`go test -args foo` turns the bare-invocation cases into
`certmanager foo` and resolves /opt/certmanager/config.yaml. Assert
the bare-invocation error on stderr so the fallback cannot hide.

Puppet gives the child a temp file as fd 1, not a pipe; say so.
2026-09-22 23:48:59 +10:00
unkin-agent b0099991c0 Poison both config legs the hermetic env has to strip
ci/woodpecker/pr/build Pipeline was successful
ci/woodpecker/pr/integration Pipeline was successful
ci/woodpecker/pr/test Pipeline was successful
ci/woodpecker/pr/pre-commit Pipeline was successful
2026-09-22 23:29:32 +10:00
unkin-agent c6c3f6a092 Pin the invocation gate against every kind of stdout 2026-09-22 23:29:32 +10:00
unkin-agent 30eee88d95 Detect a terminal with an ioctl, not a character-device stat
/dev/null is a character device, and so is the /dev/null the Go runtime
reopens onto a closed fd 1, so a bare invocation printed help and exited
zero for both -- the two shapes a machine caller is most likely to hand
the binary.
2026-09-22 23:29:32 +10:00
unkin-agent 5a7fea56e2 Document the interactive seam in AGENTS.md
ci/woodpecker/pr/build Pipeline was successful
ci/woodpecker/pr/test Pipeline was successful
ci/woodpecker/pr/integration Pipeline was successful
ci/woodpecker/pr/pre-commit Pipeline was successful
2026-09-22 22:58:52 +10:00
unkin-agent 4ff55f052a Fail a bare invocation when stdout is not a terminal
ci/woodpecker/pr/build Pipeline was successful
ci/woodpecker/pr/test Pipeline was successful
ci/woodpecker/pr/integration Pipeline was successful
ci/woodpecker/pr/pre-commit Pipeline failed
Puppet's generate() reads stdout through a pipe with combine: true, so help
text on a zero exit lands in the catalog. Help now requires an interactive
stdout; a piped one exits non-zero with nothing on stdout.

- gate the no-args help path on an isTerminal(stdout) check
- reject an explicitly empty --config instead of resolving it
- ignore a relative XDG_CONFIG_HOME, per the XDG spec
- give the integration subprocess a hermetic HOME/XDG_CONFIG_HOME
- pass []string{} to run(), so cobra cannot fall back to os.Args
2026-09-22 22:50:05 +10:00
benvin f7c8ca5fba Merge pull request 'Resolve the config path; print help on a bare invocation' (#3) from benvin/legacy-invocation into master
Reviewed-on: #3
2026-09-22 22:41:09 +10:00
unkin-agent 6042499e25 Resolve the config path; print help on a bare invocation
ci/woodpecker/pr/build Pipeline was successful
ci/woodpecker/pr/integration Pipeline was successful
ci/woodpecker/pr/test Pipeline was successful
ci/woodpecker/pr/pre-commit Pipeline was successful
Fall back to $XDG_CONFIG_HOME and $HOME/.config before the baked-in
/opt/certmanager/config.yaml, and stop failing when called with no args.
2026-09-22 22:34:51 +10:00
benvin 72337bf0bb Merge pull request 'Source the CA from /ca_chain, not from issuance' (#2) from benvin/ca-chain-endpoint into master
ci/woodpecker/tag/release Pipeline was successful
Reviewed-on: #2
v0.2.0
2026-09-19 14:36:34 +10:00
unkin-agent 4b2d020c86 Bound the unreachable-vault test to 200ms
ci/woodpecker/pr/integration Pipeline was successful
ci/woodpecker/pr/test Pipeline was successful
ci/woodpecker/pr/pre-commit Pipeline was successful
ci/woodpecker/pr/build Pipeline was successful
The default 30s Vault timeout outlasts the pre-commit hook's
go test -timeout 30s, so a slow dial fails the whole package.
2026-09-19 13:32:52 +10:00
unkin-agent b0aad96673 Source the CA from /ca_chain, not from issuance
ci/woodpecker/pr/build Pipeline was successful
ci/woodpecker/pr/integration Pipeline was successful
ci/woodpecker/pr/test Pipeline was successful
ci/woodpecker/pr/pre-commit Pipeline failed
Deriving ca_certificate from an issue response welds CA distribution to
per-node renewal, so a rotation takes ~90 days to reach the estate, and
issuing_ca is the intermediate alone, which strict path builders reject
as a CAfile.

- add a `ca` subcommand printing {mount}/ca_chain as PEM, unauthenticated
- drop ca_certificate from the issue document and its file output
- order full_chain leaf first
- require only vault.addr for the CA path via config.LoadCA
2026-09-19 13:27:47 +10:00
benvin ed05597056 Merge pull request 'Make certmanager a drop-in for the Python script' (#1) from benvin/drop-in-rewrite into master
ci/woodpecker/tag/release Pipeline was successful
Reviewed-on: #1
v0.1.0
2026-09-19 12:46:07 +10:00
unkin-agent 8330b32971 Run dev-mode Vault inside the integration step
ci/woodpecker/pr/build Pipeline was successful
ci/woodpecker/pr/test Pipeline was successful
ci/woodpecker/pr/integration Pipeline was successful
ci/woodpecker/pr/pre-commit Pipeline was successful
2026-09-19 12:40:04 +10:00
unkin-agent 35e4c58305 Keep test/integration buildable without the integration tag
ci/woodpecker/pr/integration Pipeline was canceled
ci/woodpecker/pr/build Pipeline was successful
ci/woodpecker/pr/test Pipeline was successful
ci/woodpecker/pr/pre-commit Pipeline was successful
2026-09-19 12:20:27 +10:00
unkin-agent 618e1414e4 Release via goreleaser; test against a real Vault
ci/woodpecker/pr/test Pipeline was successful
ci/woodpecker/pr/pre-commit Pipeline failed
ci/woodpecker/pr/integration Pipeline was canceled
ci/woodpecker/pr/build Pipeline was successful
Replace the nfpm script with .goreleaser.yaml as the single driver for the
RPM, the raw release binaries the compiler initContainer fetches, archives
and checksums. Add an end-to-end test that issues a certificate from a real
Vault dev server over approle.
2026-09-19 12:12:25 +10:00
unkin-agent b9633481a5 Make certmanager a drop-in for the Python script
ci/woodpecker/pr/build Pipeline was successful
ci/woodpecker/pr/test Pipeline was successful
ci/woodpecker/pr/pre-commit Pipeline was successful
Puppet calls /usr/local/bin/certmanager from generate() with combine: true, so
the CLI must take the common name positionally and keep stderr clean or the
catalog compile dies on a parsejson error.

- Flatten the CLI: drop the pki subcommand, add -a/-i/-e/-c/--json
- Emit ca_certificate so vault.pp stops writing undef to that file
- Read output_path from under vault:, where Puppet writes it
- Bound every Vault request with a timeout; exit non-zero on failure
- Gate TLS verification on vault.tls_skip_verify (default true)
- Restrict auth to approle and kubernetes, no fallback between them
- Remove the SSH half; add Woodpecker CI, nfpm RPM and completions
2026-09-19 10:34:01 +10:00
unkinben 00f5b4a246 initial commit: certmanager
migrate from python to golang
2026-03-24 19:38:24 +11:00