hms_certs

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2022 License: MIT Imports: 17 Imported by: 10

Documentation

Index

Constants

View Source
const (
	CertDomainCabinet = "CERT_DOMAIN_CABINET"
	CertDomainChassis = "CERT_DOMAIN_CHASSIS"
	CertDomainBlade   = "CERT_DOMAIN_BLADE"
	CertDomainBMC     = "CERT_DOMAIN_BMC"

	VaultCAChainURI = "vault://pki_common/ca_chain"
)

Variables

View Source
var ConfigParams = Config{VaultKeyBase: vaultKeyBase,
	CertKeyBasePath:     certKeyBasePath,
	VaultPKIBase:        vaultPKIBase,
	PKIPath:             pkiPath,
	CAChainPath:         caChainPath,
	LogInsecureFailover: true,
}

Functions

func CAUpdateRegister

func CAUpdateRegister(uri string, cb func(string)) error

func CAUpdateUnregister

func CAUpdateUnregister(uri string) error

func CheckDomain

func CheckDomain(endpoints []string, domain string) (string, error)

func CreateCert

func CreateCert(endpoints []string, domain string, fqdn string,
	retData *VaultCertData) error

func CreateInsecureHTTPClient

func CreateInsecureHTTPClient(timeoutSecs int) (*retryablehttp.Client, error)

func CreateRetryableInsecureHTTPClient

func CreateRetryableInsecureHTTPClient(timeoutSecs int, maxRetryCount int,
	maxRetrySecs int) (*retryablehttp.Client, error)

func CreateRetryableSecureHTTPClient

func CreateRetryableSecureHTTPClient(caURI string, timeoutSecs int,
	maxRetryCount int, maxRetrySecs int) (*retryablehttp.Client, error)

func CreateSecureHTTPClient

func CreateSecureHTTPClient(timeoutSecs int, caURI string) (*retryablehttp.Client, error)

func DeleteCertData

func DeleteCertData(domainID string, force bool) error

func FetchCAChain

func FetchCAChain(uri string) (string, error)

func Init

func Init(loggerP *logrus.Logger)

func InitInstance

func InitInstance(loggerP *logrus.Logger, inst string)

func NewlineToTuple

func NewlineToTuple(pemStr string) string

func StoreCertData

func StoreCertData(domainID string, certData VaultCertData) error

func TupleToNewline

func TupleToNewline(pemStr string) string

Types

type CertInfo

type CertInfo struct {
	CAChain        []string `json:"ca_chain"`
	Certificate    string   `json:"certificate"`
	Expiration     int      `json:"expiration"`
	IssuingCA      string   `json:"issuing_ca"`
	PrivateKey     string   `json:"private_key"`
	PrivateKeyType string   `json:"private_key_type"`
	SerialNumber   string   `json:"serial_number"`
	FQDN           string   `json:"fqdn,omitempty"`
}

type CertStorage

type CertStorage struct {
	Cert string `json:"Cert"`
	Key  string `json:"Key"`
}

type Config

type Config struct {
	VaultKeyBase        string //Defaults to vaultKeyBase
	CertKeyBasePath     string //Defaults to certKeyBasePath
	VaultPKIBase        string //Defaults to vaultPKIBase
	PKIPath             string //Defaults to pkiPath
	CAChainPath         string //Defaults to caPath
	LogInsecureFailover bool   //Defaults to true
}

type HTTPClientPair

type HTTPClientPair struct {
	SecureClient   *retryablehttp.Client
	InsecureClient *retryablehttp.Client
	MaxRetryCount  int
	MaxRetryWait   int
	FailedOver     bool //true if most recent op failed over
}

func CreateHTTPClientPair

func CreateHTTPClientPair(caURI string, timeoutSecs int) (*HTTPClientPair, error)

func CreateRetryableHTTPClientPair

func CreateRetryableHTTPClientPair(caURI string, timeoutSecs int,
	maxRetryCount int, maxRetrySecs int) (*HTTPClientPair, error)

func (*HTTPClientPair) CloseIdleConnections

func (p *HTTPClientPair) CloseIdleConnections()

func (*HTTPClientPair) Do

func (p *HTTPClientPair) Do(req *http.Request) (*http.Response, error)

func (*HTTPClientPair) Get

func (p *HTTPClientPair) Get(url string) (*http.Response, error)

func (*HTTPClientPair) Head

func (p *HTTPClientPair) Head(url string) (*http.Response, error)

func (*HTTPClientPair) Post

func (p *HTTPClientPair) Post(url, contentType string, body io.Reader) (*http.Response, error)

func (*HTTPClientPair) PostForm

func (p *HTTPClientPair) PostForm(url string, data url.Values) (*http.Response, error)

type VaultCertData

type VaultCertData struct {
	RequestID     string   `json:"request_id"`
	LeaseID       string   `json:"lease_id"`
	Renewable     bool     `json:"renewable"`
	LeaseDuration int      `json:"lease_duration"`
	Data          CertInfo `json:"data"`
}

func FetchCertData

func FetchCertData(xname string, domain string) (VaultCertData, error)

Jump to

Keyboard shortcuts

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