ra

package
v0.0.0-...-a142011 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 18, 2024 License: Apache-2.0 Imports: 17 Imported by: 1

Documentation

Overview

Copyright Istio Authors

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

View Source
const (
	// ExtCAK8s : Integrate with external CA using k8s CSR API
	ExtCAK8s CaExternalType = "ISTIOD_RA_KUBERNETES_API"

	// DefaultExtCACertDir : Location of external CA certificate
	DefaultExtCACertDir string = "./etc/external-ca-cert"
)

Variables

This section is empty.

Functions

func ValidateCSR

func ValidateCSR(csrPEM []byte, subjectIDs []string) bool

ValidateCSR : Validate all SAN extensions in csrPEM match authenticated identities and verify additional CSR fields.

Types

type CaExternalType

type CaExternalType string

CaExternalType : Type of External CA integration

type IstioRAOptions

type IstioRAOptions struct {
	// ExternalCAType: Integration API type with external CA
	ExternalCAType CaExternalType
	// DefaultCertTTL: Default Certificate TTL
	DefaultCertTTL time.Duration
	// MaxCertTTL: Maximum Certificate TTL that can be requested
	MaxCertTTL time.Duration
	// CaCertFile : File containing PEM encoded CA root certificate of external CA
	CaCertFile string
	// CaSigner : To indicate custom CA Signer name when using external K8s CA
	CaSigner string
	// VerifyAppendCA : Whether to use caCertFile containing CA root cert to verify and append to signed cert-chain
	VerifyAppendCA bool
	// K8sClient : K8s API client
	K8sClient clientset.Interface
	// TrustDomain
	TrustDomain string
	// CertSignerDomain info
	CertSignerDomain string
}

IstioRAOptions : Configuration Options for the IstioRA

type KubernetesRA

type KubernetesRA struct {
	// contains filtered or unexported fields
}

KubernetesRA integrated with an external CA using Kubernetes CSR API

func NewKubernetesRA

func NewKubernetesRA(raOpts *IstioRAOptions) (*KubernetesRA, error)

NewKubernetesRA : Create a RA that interfaces with K8S CSR CA

func (*KubernetesRA) GetCAKeyCertBundle

func (r *KubernetesRA) GetCAKeyCertBundle() *util.KeyCertBundle

GetCAKeyCertBundle returns the KeyCertBundle for the CA.

func (*KubernetesRA) GetRootCertFromMeshConfig

func (r *KubernetesRA) GetRootCertFromMeshConfig(signerName string) ([]byte, error)

func (*KubernetesRA) SetCACertificatesFromMeshConfig

func (r *KubernetesRA) SetCACertificatesFromMeshConfig(caCertificates []*meshconfig.MeshConfig_CertificateData)

func (*KubernetesRA) Sign

func (r *KubernetesRA) Sign(csrPEM []byte, certOpts ca.CertOpts) ([]byte, error)

Sign takes a PEM-encoded CSR and cert opts, and returns a certificate signed by k8s CA.

func (*KubernetesRA) SignWithCertChain

func (r *KubernetesRA) SignWithCertChain(csrPEM []byte, certOpts ca.CertOpts) ([]string, error)

SignWithCertChain is similar to Sign but returns the leaf cert and the entire cert chain. root cert comes from two sources, order matters: 1. Specified in mesh config 2. Extract from the cert-chain signed by the CSR signer. If no root cert can be found from either of the two sources, error returned. There are several possible situations: 1. root cert is specified in mesh config and is empty in signed cert chain, in this case we verify the signed cert chain against the root cert from mesh config and append the root cert into the cert chain. 2. root cert is specified in mesh config and also can be extracted in signed cert chain, in this case we verify the signed cert chain against the root cert from mesh config and append it into the cert chain if the two root certs are different. This is typical when the returned cert chain only contains the intermediate CA. 3. root cert is not specified in mesh config but can be extracted in signed cert chain, in this case we verify the signed cert chain against the root cert and return the cert chain directly.

type RegistrationAuthority

type RegistrationAuthority interface {
	caserver.CertificateAuthority
	// SetCACertificatesFromMeshConfig sets the CACertificates using the ones from mesh config
	SetCACertificatesFromMeshConfig([]*meshconfig.MeshConfig_CertificateData)
	// GetRootCertFromMeshConfig returns the root cert for the specific signer in mesh config
	GetRootCertFromMeshConfig(signerName string) ([]byte, error)
}

RegistrationAuthority : Registration Authority interface.

func NewIstioRA

func NewIstioRA(opts *IstioRAOptions) (RegistrationAuthority, error)

NewIstioRA is a factory method that returns an RA that implements the RegistrationAuthority functionality. the caOptions defines the external provider

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL