2018-03-17 04:20:54 +00:00
|
|
|
package structs
|
|
|
|
|
2018-03-20 04:00:01 +00:00
|
|
|
import (
|
|
|
|
"math/big"
|
|
|
|
)
|
|
|
|
|
2018-03-17 04:20:54 +00:00
|
|
|
// IndexedCARoots is the list of currently trusted CA Roots.
|
|
|
|
type IndexedCARoots struct {
|
|
|
|
// ActiveRootID is the ID of a root in Roots that is the active CA root.
|
|
|
|
// Other roots are still valid if they're in the Roots list but are in
|
|
|
|
// the process of being rotated out.
|
|
|
|
ActiveRootID string
|
|
|
|
|
|
|
|
// Roots is a list of root CA certs to trust.
|
|
|
|
Roots []*CARoot
|
|
|
|
|
2018-03-19 05:07:52 +00:00
|
|
|
// QueryMeta contains the meta sent via a header. We ignore for JSON
|
|
|
|
// so this whole structure can be returned.
|
|
|
|
QueryMeta `json:"-"`
|
2018-03-17 04:20:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// CARoot represents a root CA certificate that is trusted.
|
|
|
|
type CARoot struct {
|
|
|
|
// ID is a globally unique ID (UUID) representing this CA root.
|
|
|
|
ID string
|
|
|
|
|
|
|
|
// Name is a human-friendly name for this CA root. This value is
|
|
|
|
// opaque to Consul and is not used for anything internally.
|
|
|
|
Name string
|
|
|
|
|
|
|
|
// RootCert is the PEM-encoded public certificate.
|
|
|
|
RootCert string
|
|
|
|
|
|
|
|
// SigningCert is the PEM-encoded signing certificate and SigningKey
|
2018-03-19 21:36:17 +00:00
|
|
|
// is the PEM-encoded private key for the signing certificate. These
|
|
|
|
// may actually be empty if the CA plugin in use manages these for us.
|
2018-03-17 04:20:54 +00:00
|
|
|
SigningCert string
|
|
|
|
SigningKey string
|
|
|
|
|
2018-03-20 03:29:14 +00:00
|
|
|
// Active is true if this is the current active CA. This must only
|
|
|
|
// be true for exactly one CA. For any method that modifies roots in the
|
|
|
|
// state store, tests should be written to verify that multiple roots
|
|
|
|
// cannot be active.
|
|
|
|
Active bool
|
|
|
|
|
2018-03-17 04:20:54 +00:00
|
|
|
RaftIndex
|
|
|
|
}
|
|
|
|
|
|
|
|
// CARoots is a list of CARoot structures.
|
|
|
|
type CARoots []*CARoot
|
2018-03-19 21:36:17 +00:00
|
|
|
|
|
|
|
// CASignRequest is the request for signing a service certificate.
|
|
|
|
type CASignRequest struct {
|
|
|
|
// Datacenter is the target for this request.
|
|
|
|
Datacenter string
|
|
|
|
|
|
|
|
// CSR is the PEM-encoded CSR.
|
|
|
|
CSR string
|
|
|
|
|
|
|
|
// WriteRequest is a common struct containing ACL tokens and other
|
|
|
|
// write-related common elements for requests.
|
|
|
|
WriteRequest
|
|
|
|
}
|
|
|
|
|
|
|
|
// RequestDatacenter returns the datacenter for a given request.
|
|
|
|
func (q *CASignRequest) RequestDatacenter() string {
|
|
|
|
return q.Datacenter
|
|
|
|
}
|
2018-03-20 04:00:01 +00:00
|
|
|
|
|
|
|
// IssuedCert is a certificate that has been issued by a Connect CA.
|
|
|
|
type IssuedCert struct {
|
|
|
|
// SerialNumber is the unique serial number for this certificate.
|
|
|
|
SerialNumber *big.Int
|
|
|
|
|
|
|
|
// Cert is the PEM-encoded certificate. This should not be stored in the
|
|
|
|
// state store, but is present in the sign API response.
|
|
|
|
Cert string `json:",omitempty"`
|
|
|
|
}
|