mirror of https://github.com/status-im/consul.git
Merge pull request #11314 from hashicorp/ap/auto-encrypt
This commit is contained in:
commit
e75e3dd05c
|
@ -216,7 +216,7 @@ func (ac *AutoConfig) generateCSR() (csr string, key string, err error) {
|
||||||
Host: unknownTrustDomain,
|
Host: unknownTrustDomain,
|
||||||
Datacenter: ac.config.Datacenter,
|
Datacenter: ac.config.Datacenter,
|
||||||
Agent: ac.config.NodeName,
|
Agent: ac.config.NodeName,
|
||||||
// TODO(rb)(partitions): populate the partition field from the agent config
|
Partition: ac.config.PartitionOrDefault(),
|
||||||
}
|
}
|
||||||
|
|
||||||
caConfig, err := ac.config.ConnectCAConfiguration()
|
caConfig, err := ac.config.ConnectCAConfiguration()
|
||||||
|
|
|
@ -2,7 +2,17 @@
|
||||||
|
|
||||||
package connect
|
package connect
|
||||||
|
|
||||||
import "fmt"
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/hashicorp/consul/agent/structs"
|
||||||
|
)
|
||||||
|
|
||||||
|
// GetEnterpriseMeta will synthesize an EnterpriseMeta struct from the SpiffeIDAgent.
|
||||||
|
// in OSS this just returns an empty (but never nil) struct pointer
|
||||||
|
func (id SpiffeIDAgent) GetEnterpriseMeta() *structs.EnterpriseMeta {
|
||||||
|
return &structs.EnterpriseMeta{}
|
||||||
|
}
|
||||||
|
|
||||||
func (id SpiffeIDAgent) uriPath() string {
|
func (id SpiffeIDAgent) uriPath() string {
|
||||||
return fmt.Sprintf("/agent/client/dc/%s/id/%s", id.Datacenter, id.Agent)
|
return fmt.Sprintf("/agent/client/dc/%s/id/%s", id.Datacenter, id.Agent)
|
||||||
|
|
|
@ -186,8 +186,7 @@ func (s *ConnectCA) Sign(
|
||||||
"we are %s", serviceID.Datacenter, s.srv.config.Datacenter)
|
"we are %s", serviceID.Datacenter, s.srv.config.Datacenter)
|
||||||
}
|
}
|
||||||
} else if isAgent {
|
} else if isAgent {
|
||||||
// TODO(partitions): support auto-config in different partitions
|
agentID.GetEnterpriseMeta().FillAuthzContext(&authzContext)
|
||||||
structs.DefaultEnterpriseMetaInDefaultPartition().FillAuthzContext(&authzContext)
|
|
||||||
if authz.NodeWrite(agentID.Agent, &authzContext) != acl.Allow {
|
if authz.NodeWrite(agentID.Agent, &authzContext) != acl.Allow {
|
||||||
return acl.ErrPermissionDenied
|
return acl.ErrPermissionDenied
|
||||||
}
|
}
|
||||||
|
|
|
@ -1438,8 +1438,7 @@ func (c *CAManager) SignCertificate(csr *x509.CertificateRequest, spiffeID conne
|
||||||
|
|
||||||
csr.URIs = uris
|
csr.URIs = uris
|
||||||
}
|
}
|
||||||
// TODO(partitions): support auto-config in different partitions
|
entMeta.Merge(agentID.GetEnterpriseMeta())
|
||||||
entMeta.Merge(structs.DefaultEnterpriseMetaInDefaultPartition())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
commonCfg, err := config.GetCommonConfig()
|
commonCfg, err := config.GetCommonConfig()
|
||||||
|
|
Loading…
Reference in New Issue