feat(rpc): mTLS between services from operator-issued certificates
Replace the service bearer tokens with [tls] ca_file and cert_dir. Caller identity comes from the verified certificate, not metadata. Without TLS, services listen and dial on loopback only. Task containers get only the CA and keep their grant.
This commit is contained in:
51 files changed
+746
-689
No files matched your search
@@ -77,11 +77,11 @@ func (e NATSEndpoint) ContainerToken() string {
|
||||
return e.Token
|
||||
}
|
||||
|
||||
// StateStoreEndpoint is the State Store target and token passed to agent
|
||||
// containers.
|
||||
// StateStoreEndpoint is the State Store target and the CA its certificate
|
||||
// chains to, both passed to agent containers.
|
||||
type StateStoreEndpoint struct {
|
||||
URL string
|
||||
Token string
|
||||
URL string
|
||||
CA []byte
|
||||
}
|
||||
|
||||
type Daemon struct {
|
||||
@@ -2263,6 +2263,9 @@ func (d *Daemon) containerEnv(task *workflow.Task, stateStoreToken string) []str
|
||||
// daemon's own.
|
||||
if d.ConnectedStateStore.URL != "" {
|
||||
env = append(env, "STATE_STORE_URL="+d.ConnectedStateStore.URL)
|
||||
if len(d.ConnectedStateStore.CA) > 0 {
|
||||
env = append(env, "STATE_STORE_CA="+string(d.ConnectedStateStore.CA))
|
||||
}
|
||||
if stateStoreToken != "" {
|
||||
env = append(env, "STATE_STORE_TOKEN="+stateStoreToken)
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ func (d *Daemon) runKitTask(ctx context.Context, task *workflow.Task, repo confi
|
||||
defer revokeCredential()
|
||||
env, err := kitrun.WorkerEnv(kitrun.Endpoints{
|
||||
NATS: d.ConnectedNATS.URL, NATSToken: d.ConnectedNATS.ContainerToken(),
|
||||
StateStore: d.ConnectedStateStore.URL, StateStoreToken: credential,
|
||||
StateStore: d.ConnectedStateStore.URL, StateStoreToken: credential, StateStoreCA: d.ConnectedStateStore.CA,
|
||||
}, os.Getuid(), os.Getgid())
|
||||
if err != nil {
|
||||
park("kit worker environment", err)
|
||||
|
||||
Reference in new issue
Block a user