certificates

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2025 License: PostgreSQL Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Provide

func Provide(i *do.Injector)

Types

type CAStore

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

func NewCAStore

func NewCAStore(client *clientv3.Client, root string) *CAStore

func (*CAStore) Create

func (s *CAStore) Create(item *StoredCA) storage.PutOp[*StoredCA]

func (*CAStore) Get

func (s *CAStore) Get() storage.GetOp[*StoredCA]

func (*CAStore) Key

func (s *CAStore) Key() string

func (*CAStore) Update

func (s *CAStore) Update(item *StoredCA) storage.PutOp[*StoredCA]

type Principal

type Principal struct {
	ID      string
	KeyPEM  []byte
	CertPEM []byte
}

func StoredToPrincipal

func StoredToPrincipal(p *StoredPrincipal) (*Principal, error)

type PrincipalStore

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

func NewPrincipalStore

func NewPrincipalStore(client *clientv3.Client, root string) *PrincipalStore

func (*PrincipalStore) DeleteByKey

func (s *PrincipalStore) DeleteByKey(certificateID string) storage.DeleteOp

func (*PrincipalStore) ExistsByKey

func (s *PrincipalStore) ExistsByKey(certificateID string) storage.ExistsOp

func (*PrincipalStore) GetByKey

func (s *PrincipalStore) GetByKey(certificateID string) storage.GetOp[*StoredPrincipal]

func (*PrincipalStore) Key

func (s *PrincipalStore) Key(certificateID string) string

func (*PrincipalStore) Prefix

func (s *PrincipalStore) Prefix() string

func (*PrincipalStore) Put

type RootCA

type RootCA struct {
	Cert      *x509.Certificate
	Key       crypto.Signer
	JoinToken string
}

func CreateRootCA

func CreateRootCA() (*RootCA, error)

func StoredToRootCA

func StoredToRootCA(ca *StoredCA) (*RootCA, error)

func (*RootCA) CreateCertificate

func (ca *RootCA) CreateCertificate(commonName string, validFor time.Duration) ([]byte, []byte, error)

func (*RootCA) CreateSignedCertFromCSR

func (ca *RootCA) CreateSignedCertFromCSR(csrPEM []byte, validFor time.Duration) ([]byte, error)

func (*RootCA) Verify

func (ca *RootCA) Verify(certPEM []byte) error

type Service

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

func NewService

func NewService(store *Store) *Service

func (*Service) CACert

func (s *Service) CACert() []byte

func (*Service) EtcdServer

func (s *Service) EtcdServer(ctx context.Context, hostID, hostname string, dnsNames, ips []string) (*Principal, error)

func (*Service) HostEtcdUser

func (s *Service) HostEtcdUser(ctx context.Context, hostID string) (*Principal, error)

func (*Service) InstanceEtcdUser

func (s *Service) InstanceEtcdUser(ctx context.Context, instanceID string) (*Principal, error)

func (*Service) JoinToken

func (s *Service) JoinToken() string

func (*Service) PostgresServer

func (s *Service) PostgresServer(ctx context.Context, instanceID, hostname string, dnsNames, ips []string) (*Principal, error)

func (*Service) PostgresUser

func (s *Service) PostgresUser(ctx context.Context, instanceID, username string) (*Principal, error)

func (*Service) PostgresUserTLS

func (s *Service) PostgresUserTLS(ctx context.Context, instanceID, hostname, username string) (*tls.Config, error)

func (*Service) RemoveEtcdServer

func (s *Service) RemoveEtcdServer(ctx context.Context, hostID string) error

func (*Service) RemoveHostEtcdUser

func (s *Service) RemoveHostEtcdUser(ctx context.Context, hostID string) error

func (*Service) RemoveInstanceEtcdUser

func (s *Service) RemoveInstanceEtcdUser(ctx context.Context, instanceID string) error

func (*Service) RemovePostgresServer

func (s *Service) RemovePostgresServer(ctx context.Context, instanceID string) error

func (*Service) RemovePostgresUser

func (s *Service) RemovePostgresUser(ctx context.Context, instanceID, username string) error

func (*Service) Start

func (s *Service) Start(ctx context.Context) error

func (*Service) Verify

func (s *Service) Verify(certPEM []byte) error

type Store

type Store struct {
	CA        *CAStore
	Principal *PrincipalStore
	// contains filtered or unexported fields
}

func NewStore

func NewStore(client *clientv3.Client, root string) *Store

func (*Store) Txn

func (s *Store) Txn(ops ...storage.TxnOperation) storage.Txn

type StoredCA

type StoredCA struct {
	storage.StoredValue
	KeyPEM    string `json:"key_pem"`
	CertPEM   string `json:"cert_pem"`
	JoinToken string `json:"join_token"`
}

func RootCAToStored

func RootCAToStored(ca *RootCA) (*StoredCA, error)

type StoredPrincipal

type StoredPrincipal struct {
	storage.StoredValue
	ID      string `json:"id"`
	KeyPEM  string `json:"key_pem"`
	CertPEM string `json:"cert_pem"`
}

func PrincipalToStored

func PrincipalToStored(p *Principal) *StoredPrincipal

Jump to

Keyboard shortcuts

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