Documentation ¶
Overview ¶
Package tls defines and generates the tls assets based on its dependencies.
Index ¶
- Constants
- func CSRToPem(cert *x509.CertificateRequest) []byte
- func CertToPem(cert *x509.Certificate) []byte
- func GenerateCert(caKey *rsa.PrivateKey, caCert *x509.Certificate, cfg *CertCfg) (*rsa.PrivateKey, *x509.Certificate, error)
- func GenerateRootCA(key *rsa.PrivateKey, cfg *CertCfg) (*x509.Certificate, error)
- func GenerateRootCertKey(cfg *CertCfg) (*rsa.PrivateKey, *x509.Certificate, error)
- func GenerateSignedCert(cfg *CertCfg, csr *x509.CertificateRequest, key *rsa.PrivateKey, ...) (*x509.Certificate, error)
- func PemToCertificate(data []byte) (*x509.Certificate, error)
- func PemToPrivateKey(data []byte) (*rsa.PrivateKey, error)
- func PrivateKey() (*rsa.PrivateKey, error)
- func PrivateKeyToPem(key *rsa.PrivateKey) []byte
- func PublicKeyToPem(key *rsa.PublicKey) ([]byte, error)
- func SelfSignedCACert(cfg *CertCfg, key *rsa.PrivateKey) (*x509.Certificate, error)
- func SignedCertificate(cfg *CertCfg, csr *x509.CertificateRequest, key *rsa.PrivateKey, ...) (*x509.Certificate, error)
- type APIServerCertKey
- type APIServerProxyCertKey
- type AdminCertKey
- type AggregatorCA
- type AppendParentChoice
- type CertCfg
- type CertKey
- type CertKeyInterface
- type ClusterAPIServerCertKey
- type EtcdCA
- type EtcdClientCertKey
- type IngressCertKey
- type KeyPair
- type KeyPairInterface
- type KubeCA
- type KubeletCertKey
- type MCSCertKey
- type OpenshiftAPIServerCertKey
- type RootCA
- type ServiceAccountKeyPair
- type ServiceServingCA
Constants ¶
const ( // ValidityTenYears sets the validity of a cert to 10 years. ValidityTenYears = time.Hour * 24 * 365 * 10 // ValidityThirtyMinutes sets the validity of a cert to 30 minutes. // This is for the kubelet bootstrap. ValidityThirtyMinutes = time.Minute * 30 )
Variables ¶
This section is empty.
Functions ¶
func CSRToPem ¶
func CSRToPem(cert *x509.CertificateRequest) []byte
CSRToPem converts an x509.CertificateRequest to a pem string
func CertToPem ¶
func CertToPem(cert *x509.Certificate) []byte
CertToPem converts an x509.Certificate object to a pem string
func GenerateCert ¶
func GenerateCert(caKey *rsa.PrivateKey, caCert *x509.Certificate, cfg *CertCfg) (*rsa.PrivateKey, *x509.Certificate, error)
GenerateCert creates a key, csr & a signed cert This is useful for apiserver and openshift-apiser cert which will be authenticated by the kubeconfig using root-ca.
func GenerateRootCA ¶
func GenerateRootCA(key *rsa.PrivateKey, cfg *CertCfg) (*x509.Certificate, error)
GenerateRootCA creates and returns the root CA
func GenerateRootCertKey ¶
func GenerateRootCertKey(cfg *CertCfg) (*rsa.PrivateKey, *x509.Certificate, error)
GenerateRootCertKey generates a root key/cert pair.
func GenerateSignedCert ¶
func GenerateSignedCert(cfg *CertCfg, csr *x509.CertificateRequest, key *rsa.PrivateKey, caKey *rsa.PrivateKey, caCert *x509.Certificate) (*x509.Certificate, error)
GenerateSignedCert generates a signed certificate.
func PemToCertificate ¶
func PemToCertificate(data []byte) (*x509.Certificate, error)
PemToCertificate converts a data block to x509.Certificate.
func PemToPrivateKey ¶
func PemToPrivateKey(data []byte) (*rsa.PrivateKey, error)
PemToPrivateKey converts a data block to rsa.PrivateKey.
func PrivateKey ¶
func PrivateKey() (*rsa.PrivateKey, error)
PrivateKey generates an RSA Private key and returns the value
func PrivateKeyToPem ¶
func PrivateKeyToPem(key *rsa.PrivateKey) []byte
PrivateKeyToPem converts an rsa.PrivateKey object to pem string
func PublicKeyToPem ¶
PublicKeyToPem converts an rsa.PublicKey object to pem string
func SelfSignedCACert ¶
func SelfSignedCACert(cfg *CertCfg, key *rsa.PrivateKey) (*x509.Certificate, error)
SelfSignedCACert Creates a self signed CA certificate
func SignedCertificate ¶
func SignedCertificate( cfg *CertCfg, csr *x509.CertificateRequest, key *rsa.PrivateKey, caCert *x509.Certificate, caKey *rsa.PrivateKey, ) (*x509.Certificate, error)
SignedCertificate creates a new X.509 certificate based on a template.
Types ¶
type APIServerCertKey ¶ added in v0.2.0
type APIServerCertKey struct {
CertKey
}
APIServerCertKey is the asset that generates the API server key/cert pair.
func (*APIServerCertKey) Dependencies ¶ added in v0.2.0
func (a *APIServerCertKey) Dependencies() []asset.Asset
Dependencies returns the dependency of the the cert/key pair, which includes the parent CA, and install config if it depends on the install config for DNS names, etc.
func (*APIServerCertKey) Generate ¶ added in v0.2.0
func (a *APIServerCertKey) Generate(dependencies asset.Parents) error
Generate generates the cert/key pair based on its dependencies.
func (*APIServerCertKey) Name ¶ added in v0.2.0
func (a *APIServerCertKey) Name() string
Name returns the human-friendly name of the asset.
type APIServerProxyCertKey ¶ added in v0.2.0
type APIServerProxyCertKey struct {
CertKey
}
APIServerProxyCertKey is the asset that generates the API server proxy key/cert pair.
func (*APIServerProxyCertKey) Dependencies ¶ added in v0.2.0
func (a *APIServerProxyCertKey) Dependencies() []asset.Asset
Dependencies returns the dependency of the the cert/key pair, which includes the parent CA, and install config if it depends on the install config for DNS names, etc.
func (*APIServerProxyCertKey) Generate ¶ added in v0.2.0
func (a *APIServerProxyCertKey) Generate(dependencies asset.Parents) error
Generate generates the cert/key pair based on its dependencies.
func (*APIServerProxyCertKey) Name ¶ added in v0.2.0
func (a *APIServerProxyCertKey) Name() string
Name returns the human-friendly name of the asset.
type AdminCertKey ¶ added in v0.2.0
type AdminCertKey struct {
CertKey
}
AdminCertKey is the asset that generates the admin key/cert pair.
func (*AdminCertKey) Dependencies ¶ added in v0.2.0
func (a *AdminCertKey) Dependencies() []asset.Asset
Dependencies returns the dependency of the the cert/key pair, which includes the parent CA, and install config if it depends on the install config for DNS names, etc.
func (*AdminCertKey) Generate ¶ added in v0.2.0
func (a *AdminCertKey) Generate(dependencies asset.Parents) error
Generate generates the cert/key pair based on its dependencies.
func (*AdminCertKey) Name ¶ added in v0.2.0
func (a *AdminCertKey) Name() string
Name returns the human-friendly name of the asset.
type AggregatorCA ¶ added in v0.2.0
type AggregatorCA struct {
CertKey
}
AggregatorCA is the asset that generates the aggregator-ca key/cert pair.
func (*AggregatorCA) Dependencies ¶ added in v0.2.0
func (a *AggregatorCA) Dependencies() []asset.Asset
Dependencies returns the dependency of the the cert/key pair, which includes the parent CA, and install config if it depends on the install config for DNS names, etc.
func (*AggregatorCA) Generate ¶ added in v0.2.0
func (a *AggregatorCA) Generate(dependencies asset.Parents) error
Generate generates the cert/key pair based on its dependencies.
func (*AggregatorCA) Name ¶ added in v0.2.0
func (a *AggregatorCA) Name() string
Name returns the human-friendly name of the asset.
type AppendParentChoice ¶ added in v0.2.0
type AppendParentChoice bool
AppendParentChoice dictates whether the parent's cert is to be added to the cert.
const ( // AppendParent indicates that the parent's cert should be added. AppendParent AppendParentChoice = true // DoNotAppendParent indicates that the parent's cert should not be added. DoNotAppendParent AppendParentChoice = false )
type CertCfg ¶
type CertCfg struct { DNSNames []string ExtKeyUsages []x509.ExtKeyUsage IPAddresses []net.IP KeyUsages x509.KeyUsage Subject pkix.Name Validity time.Duration IsCA bool }
CertCfg contains all needed fields to configure a new certificate
type CertKey ¶
CertKey contains the private key and the cert that's signed by the parent CA.
func (*CertKey) Generate ¶
func (c *CertKey) Generate( cfg *CertCfg, parentCA CertKeyInterface, filenameBase string, appendParent AppendParentChoice, ) error
Generate generates a cert/key pair signed by the specified parent CA.
type CertKeyInterface ¶ added in v0.2.0
type CertKeyInterface interface { // Cert returns the certificate. Cert() []byte // Key returns the private key. Key() []byte }
CertKeyInterface contains a private key and the associated cert.
type ClusterAPIServerCertKey ¶ added in v0.2.0
type ClusterAPIServerCertKey struct {
CertKey
}
ClusterAPIServerCertKey is the asset that generates the cluster API server key/cert pair.
func (*ClusterAPIServerCertKey) Dependencies ¶ added in v0.2.0
func (a *ClusterAPIServerCertKey) Dependencies() []asset.Asset
Dependencies returns the dependency of the the cert/key pair, which includes the parent CA, and install config if it depends on the install config for DNS names, etc.
func (*ClusterAPIServerCertKey) Generate ¶ added in v0.2.0
func (a *ClusterAPIServerCertKey) Generate(dependencies asset.Parents) error
Generate generates the cert/key pair based on its dependencies.
func (*ClusterAPIServerCertKey) Name ¶ added in v0.2.0
func (a *ClusterAPIServerCertKey) Name() string
Name returns the human-friendly name of the asset.
type EtcdCA ¶ added in v0.2.0
type EtcdCA struct {
CertKey
}
EtcdCA is the asset that generates the etcd-ca key/cert pair.
func (*EtcdCA) Dependencies ¶ added in v0.2.0
Dependencies returns the dependency of the the cert/key pair, which includes the parent CA, and install config if it depends on the install config for DNS names, etc.
type EtcdClientCertKey ¶ added in v0.2.0
type EtcdClientCertKey struct {
CertKey
}
EtcdClientCertKey is the asset that generates the etcd client key/cert pair.
func (*EtcdClientCertKey) Dependencies ¶ added in v0.2.0
func (a *EtcdClientCertKey) Dependencies() []asset.Asset
Dependencies returns the dependency of the the cert/key pair, which includes the parent CA, and install config if it depends on the install config for DNS names, etc.
func (*EtcdClientCertKey) Generate ¶ added in v0.2.0
func (a *EtcdClientCertKey) Generate(dependencies asset.Parents) error
Generate generates the cert/key pair based on its dependencies.
func (*EtcdClientCertKey) Name ¶ added in v0.2.0
func (a *EtcdClientCertKey) Name() string
Name returns the human-friendly name of the asset.
type IngressCertKey ¶ added in v0.2.0
type IngressCertKey struct {
CertKey
}
IngressCertKey is the asset that generates the ingress key/cert pair.
func (*IngressCertKey) Dependencies ¶ added in v0.2.0
func (a *IngressCertKey) Dependencies() []asset.Asset
Dependencies returns the dependency of the the cert/key pair, which includes the parent CA, and install config if it depends on the install config for DNS names, etc.
func (*IngressCertKey) Generate ¶ added in v0.2.0
func (a *IngressCertKey) Generate(dependencies asset.Parents) error
Generate generates the cert/key pair based on its dependencies.
func (*IngressCertKey) Name ¶ added in v0.2.0
func (a *IngressCertKey) Name() string
Name returns the human-friendly name of the asset.
type KeyPair ¶
KeyPair contains a private key and a public key.
type KeyPairInterface ¶ added in v0.2.0
type KeyPairInterface interface { // Private returns the private key. Private() []byte // Public returns the public key. Public() []byte }
KeyPairInterface contains a private key and a public key.
type KubeCA ¶ added in v0.2.0
type KubeCA struct {
CertKey
}
KubeCA is the asset that generates the kube-ca key/cert pair.
func (*KubeCA) Dependencies ¶ added in v0.2.0
Dependencies returns the dependency of the the cert/key pair, which includes the parent CA, and install config if it depends on the install config for DNS names, etc.
type KubeletCertKey ¶ added in v0.2.0
type KubeletCertKey struct {
CertKey
}
KubeletCertKey is the asset that generates the kubelet key/cert pair.
func (*KubeletCertKey) Dependencies ¶ added in v0.2.0
func (a *KubeletCertKey) Dependencies() []asset.Asset
Dependencies returns the dependency of the the cert/key pair, which includes the parent CA, and install config if it depends on the install config for DNS names, etc.
func (*KubeletCertKey) Generate ¶ added in v0.2.0
func (a *KubeletCertKey) Generate(dependencies asset.Parents) error
Generate generates the cert/key pair based on its dependencies.
func (*KubeletCertKey) Name ¶ added in v0.2.0
func (a *KubeletCertKey) Name() string
Name returns the human-friendly name of the asset.
type MCSCertKey ¶ added in v0.2.0
type MCSCertKey struct {
CertKey
}
MCSCertKey is the asset that generates the MCS key/cert pair.
func (*MCSCertKey) Dependencies ¶ added in v0.2.0
func (a *MCSCertKey) Dependencies() []asset.Asset
Dependencies returns the dependency of the the cert/key pair, which includes the parent CA, and install config if it depends on the install config for DNS names, etc.
func (*MCSCertKey) Generate ¶ added in v0.2.0
func (a *MCSCertKey) Generate(dependencies asset.Parents) error
Generate generates the cert/key pair based on its dependencies.
func (*MCSCertKey) Name ¶ added in v0.2.0
func (a *MCSCertKey) Name() string
Name returns the human-friendly name of the asset.
type OpenshiftAPIServerCertKey ¶ added in v0.2.0
type OpenshiftAPIServerCertKey struct {
CertKey
}
OpenshiftAPIServerCertKey is the asset that generates the Openshift API server key/cert pair.
func (*OpenshiftAPIServerCertKey) Dependencies ¶ added in v0.2.0
func (a *OpenshiftAPIServerCertKey) Dependencies() []asset.Asset
Dependencies returns the dependency of the the cert/key pair, which includes the parent CA, and install config if it depends on the install config for DNS names, etc.
func (*OpenshiftAPIServerCertKey) Generate ¶ added in v0.2.0
func (a *OpenshiftAPIServerCertKey) Generate(dependencies asset.Parents) error
Generate generates the cert/key pair based on its dependencies.
func (*OpenshiftAPIServerCertKey) Name ¶ added in v0.2.0
func (a *OpenshiftAPIServerCertKey) Name() string
Name returns the human-friendly name of the asset.
type RootCA ¶
type RootCA struct {
CertKey
}
RootCA contains the private key and the cert that's self-signed as the root CA.
func (*RootCA) Dependencies ¶
Dependencies returns the dependency of the root-ca, which is empty.
type ServiceAccountKeyPair ¶ added in v0.2.0
type ServiceAccountKeyPair struct {
KeyPair
}
ServiceAccountKeyPair is the asset that generates the service-account public/private key pair.
func (*ServiceAccountKeyPair) Dependencies ¶ added in v0.2.0
func (a *ServiceAccountKeyPair) Dependencies() []asset.Asset
Dependencies returns the dependency of the the cert/key pair, which includes the parent CA, and install config if it depends on the install config for DNS names, etc.
func (*ServiceAccountKeyPair) Generate ¶ added in v0.2.0
func (a *ServiceAccountKeyPair) Generate(dependencies asset.Parents) error
Generate generates the cert/key pair based on its dependencies.
func (*ServiceAccountKeyPair) Name ¶ added in v0.2.0
func (a *ServiceAccountKeyPair) Name() string
Name returns the human-friendly name of the asset.
type ServiceServingCA ¶ added in v0.2.0
type ServiceServingCA struct {
CertKey
}
ServiceServingCA is the asset that generates the service-serving-ca key/cert pair.
func (*ServiceServingCA) Dependencies ¶ added in v0.2.0
func (a *ServiceServingCA) Dependencies() []asset.Asset
Dependencies returns the dependency of the the cert/key pair, which includes the parent CA, and install config if it depends on the install config for DNS names, etc.
func (*ServiceServingCA) Generate ¶ added in v0.2.0
func (a *ServiceServingCA) Generate(dependencies asset.Parents) error
Generate generates the cert/key pair based on its dependencies.
func (*ServiceServingCA) Name ¶ added in v0.2.0
func (a *ServiceServingCA) Name() string
Name returns the human-friendly name of the asset.
Source Files ¶
- admincertkey.go
- aggregatorca.go
- apiservercertkey.go
- apiserverproxycertkey.go
- certkey.go
- clusterapiservercertkey.go
- doc.go
- etcdca.go
- etcdclientcertkey.go
- helper.go
- ingresscertkey.go
- keypair.go
- kubeca.go
- kubeletcertkey.go
- mcscertkey.go
- openshiftapiservercertkey.go
- root.go
- serviceaccountkeypair.go
- serviceservingca.go
- tls.go
- utils.go