pki

package
v0.0.0-...-5d142b5 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2016 License: MIT Imports: 19 Imported by: 0

Documentation

Overview

General notes on this package:

  1. Needs all non-PKI specific stuff removed
  2. Needs command related logging removed
  3. Ideally this package can be extracted from this project and made more generic

Index

Constants

This section is empty.

Variables

View Source
var CertificatePreamble = "-----BEGIN CERTIFICATE-----"
View Source
var KeyPreamble = "-----BEGIN RSA PRIVATE KEY-----"

Functions

func GenerateCACertificate

func GenerateCACertificate(certFile, keyFile, org string, bits int) error

GenerateCACertificate generates a new certificate authority from the specified org and bit size and stores the resulting certificate and key file in the arguments.

func GenerateCertificate

func GenerateCertificate(hosts []string, certFile, keyFile, caFile, caKeyFile, org string, bits int) error

GenerateCertificate generates a new certificate signed using the provided certificate authority files and stores the result in the certificate file and key provided. The provided host names are set to the appropriate certificate fields.

Types

type Config

type Config struct {
	ClientKeyPath  string
	ClientCertPath string
	ServerKeyPath  string
	ServerCertPath string
	CaKeyPath      string
	CaCertPath     string
	Insecure       bool
}

type Mirror

type Mirror struct {
	sync.Mutex
	ClientTlsConfig *tls.Config
	ServerTlsConfig *tls.Config
}
var MirrorConfig Mirror

func (*Mirror) SetClientTLSConfig

func (m *Mirror) SetClientTLSConfig(config *tls.Config)

func (*Mirror) SetServerTLSConfig

func (m *Mirror) SetServerTLSConfig(config *tls.Config)

type PKI

type PKI struct {
	Config *Config
}

func New

func New() (*PKI, error)

func NewWithConfig

func NewWithConfig(config *Config) (*PKI, error)

func (*PKI) CheckSetup

func (p *PKI) CheckSetup() error

Validate all components of the PKI infrastructure are properly configured

func (*PKI) GenerateClientCertificate

func (p *PKI) GenerateClientCertificate(hosts []string) (err error)

func (*PKI) GetClientTLSConfig

func (p *PKI) GetClientTLSConfig() (*tls.Config, error)

func (*PKI) GetServerTLSConfig

func (p *PKI) GetServerTLSConfig() (*tls.Config, error)

func (*PKI) ImportCA

func (p *PKI) ImportCA(name string, certPath string) error

func (*PKI) ImportClientCertAndKey

func (p *PKI) ImportClientCertAndKey(certPath string, keyPath string) error

Overrides the default client certificate with a new one

func (*PKI) OutputCACert

func (p *PKI) OutputCACert() (string, error)

func (*PKI) OutputCAKey

func (p *PKI) OutputCAKey() (string, error)

func (*PKI) OutputClientCert

func (p *PKI) OutputClientCert() (string, error)

func (*PKI) OutputClientKey

func (p *PKI) OutputClientKey() (string, error)

func (*PKI) RemovePKI

func (p *PKI) RemovePKI() error

func (*PKI) SetupPKI

func (p *PKI) SetupPKI(caHost string) error

Sets up the PKI infrastructure for client / server communications This involves creating directories, CAs, and client/server certs

Jump to

Keyboard shortcuts

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