mirror of
https://github.com/hashicorp/vault.git
synced 2026-06-13 10:56:26 -04:00
* Fix pkiexternalca feature bugs in vault agent * Add changelog * Add regression tests Co-authored-by: Zlaticanin <60530402+Zlaticanin@users.noreply.github.com>
This commit is contained in:
parent
3ef4f6125c
commit
2e6346b2f4
2 changed files with 8 additions and 8 deletions
3
changelog/_13613.txt
Normal file
3
changelog/_13613.txt
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
```release-note:bug
|
||||
agent/pkiexternalca: Fix token distribution to PKI system and HTTP-01 challenge server shutdown preventing certificate acquisition and retries
|
||||
```
|
||||
|
|
@ -864,13 +864,10 @@ func (c *AgentCommand) Run(args []string) int {
|
|||
cancelFunc()
|
||||
})
|
||||
|
||||
// ah.TemplateTokenCh is a buffered channel of size 1 — each token sent by
|
||||
// the auth handler is consumed by exactly one reader. When a PKI external CA
|
||||
// server is also running, both it and the template server need every token.
|
||||
// Without a fan-out, they race and one silently misses tokens, leaving the
|
||||
// template runner never started and templates never rendered.
|
||||
// The fan-out goroutine reads each token once and forwards it to a separate
|
||||
// channel for each consumer.
|
||||
// When a PKI external CA server is running, both it and the template server
|
||||
// need every token. The auth handler sends tokens to ah.PKIExternalCATokenCh
|
||||
// when PKI is configured. This fan-out goroutine reads each token once from
|
||||
// ah.PKIExternalCATokenCh and forwards it to separate channels for each consumer.
|
||||
templateTokenCh := ah.TemplateTokenCh
|
||||
var pkiTokenCh chan string
|
||||
if ps != nil {
|
||||
|
|
@ -881,7 +878,7 @@ func (c *AgentCommand) Run(args []string) int {
|
|||
select {
|
||||
case <-ctx.Done():
|
||||
return
|
||||
case token, ok := <-ah.TemplateTokenCh:
|
||||
case token, ok := <-ah.PKIExternalCATokenCh:
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue