truststore

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2024 License: MIT Imports: 25 Imported by: 0

Documentation

Overview

Package truststore manages local trust stores and certificates.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoSudo = errors.New(`"sudo" is not available`)

	ErrNoKeytool = errors.New("no java keytool")

	ErrNoCertutil = errors.New("no certutil tooling")
	ErrNoNSS      = errors.New("no NSS browser")
	ErrNoNSSDB    = errors.New("no NSS database")
	ErrUnknownNSS = errors.New("unknown NSS install") // untested

	ErrUnsupportedDistro = errors.New("unsupported Linux distrobution")
)
View Source
var MockCAs []*CA

Functions

func ResetMockCAs added in v0.1.0

func ResetMockCAs()

Types

type Audit added in v0.0.8

type Audit struct {
	Expected []*CA

	Stores []Store

	At time.Time

	SelectFn func(*CA) (bool, error)
}

func (*Audit) Perform added in v0.0.8

func (a *Audit) Perform() (*AuditInfo, error)

type AuditInfo added in v0.0.8

type AuditInfo struct {
	Valid, Missing, Rotate, Expired, PreValid, Extra []*CA
	// contains filtered or unexported fields
}

func (*AuditInfo) AllCAs added in v0.0.8

func (i *AuditInfo) AllCAs(states ...string) []*CA

func (*AuditInfo) IsPresent added in v0.0.8

func (i *AuditInfo) IsPresent(ca *CA, store Store) bool

type Brew added in v0.0.4

type Brew struct {
	RootDir string

	DataFS DataFS
	SysFS  CmdFS
	// contains filtered or unexported fields
}

func (*Brew) Check added in v0.0.4

func (s *Brew) Check() (bool, error)

func (*Brew) CheckCA added in v0.0.4

func (s *Brew) CheckCA(ca *CA) (bool, error)

func (*Brew) Description added in v0.0.8

func (s *Brew) Description() string

func (*Brew) InstallCA added in v0.0.4

func (s *Brew) InstallCA(ca *CA) (bool, error)

func (*Brew) ListCAs added in v0.0.8

func (s *Brew) ListCAs() ([]*CA, error)

func (*Brew) UninstallCA added in v0.0.8

func (s *Brew) UninstallCA(ca *CA) (bool, error)

type CA

type CA struct {
	*x509.Certificate

	FilePath   string
	NickName   string // only used by nss
	UniqueName string
}

func (*CA) Equal added in v0.0.8

func (c *CA) Equal(ca *CA) bool

func (*CA) WindowsThumbprint added in v0.0.29

func (c *CA) WindowsThumbprint() string

type CmdFS

type CmdFS interface {
	fs.StatFS

	Command(name string, arg ...string) *exec.Cmd
	Exec(cmd *exec.Cmd) ([]byte, error)
	SudoExec(cmd *exec.Cmd) ([]byte, error)
	LookPath(cmd string) (string, error)
}

type DataFS added in v0.0.4

type DataFS interface {
	fs.StatFS
	fs.ReadFileFS

	AppendToFile(name string, p []byte) error
	Rename(oldpath, newpath string) error
	Remove(name string) error
}

type Error

type Error struct {
	Op

	Fatal   error
	Warning error
}

func (Error) Error

func (e Error) Error() string

type FS added in v0.0.4

type FS interface {
	CmdFS
	DataFS
}

func RootFS

func RootFS() FS

type Java

type Java struct {
	HomeDir string

	JavaHomeDir string
	StorePass   string

	DataFS fs.StatFS
	SysFS  CmdFS
	// contains filtered or unexported fields
}

func (*Java) CheckCA

func (s *Java) CheckCA(ca *CA) (bool, error)

func (*Java) InstallCA

func (s *Java) InstallCA(ca *CA) (bool, error)

func (*Java) UninstallCA

func (s *Java) UninstallCA(ca *CA) (bool, error)

type Mock added in v0.0.8

type Mock struct{}

func (Mock) Check added in v0.0.8

func (Mock) Check() (bool, error)

func (Mock) CheckCA added in v0.0.8

func (Mock) CheckCA(ca *CA) (bool, error)

func (Mock) Description added in v0.0.8

func (Mock) Description() string

func (Mock) InstallCA added in v0.0.8

func (Mock) InstallCA(ca *CA) (bool, error)

func (Mock) ListCAs added in v0.0.8

func (Mock) ListCAs() ([]*CA, error)

func (Mock) UninstallCA added in v0.0.8

func (Mock) UninstallCA(ca *CA) (bool, error)

type NSS

type NSS struct {
	HomeDir string

	DataFS fs.StatFS
	SysFS  CmdFS
	// contains filtered or unexported fields
}

func (*NSS) Browsers

func (s *NSS) Browsers() string

func (*NSS) Check

func (s *NSS) Check() (bool, error)

func (*NSS) CheckCA

func (s *NSS) CheckCA(ca *CA) (installed bool, err error)

func (*NSS) Description added in v0.0.8

func (s *NSS) Description() string

func (*NSS) InstallCA

func (s *NSS) InstallCA(ca *CA) (installed bool, err error)

func (*NSS) ListCAs added in v0.0.8

func (s *NSS) ListCAs() ([]*CA, error)

func (*NSS) UninstallCA

func (s *NSS) UninstallCA(ca *CA) (bool, error)

type NSSError

type NSSError struct {
	Err error

	CertutilInstallHelp string
	NSSBrowsers         string
}

func (NSSError) Error

func (e NSSError) Error() string

type Op

type Op string
const (
	OpCheck     Op = "check"
	OpInstall   Op = "install"
	OpList      Op = "list"
	OpSudo      Op = "sudo"
	OpUninstall Op = "uninstall"
)

type Platform

type Platform struct {
	HomeDir string

	DataFS DataFS
	SysFS  CmdFS
	// contains filtered or unexported fields
}

func (*Platform) Check

func (s *Platform) Check() (bool, error)

func (*Platform) CheckCA added in v0.0.4

func (s *Platform) CheckCA(ca *CA) (installed bool, err error)

func (*Platform) Description added in v0.0.8

func (s *Platform) Description() string

func (*Platform) InstallCA

func (s *Platform) InstallCA(ca *CA) (installed bool, err error)

func (*Platform) ListCAs added in v0.0.8

func (s *Platform) ListCAs() (cas []*CA, err error)

func (*Platform) UninstallCA

func (s *Platform) UninstallCA(ca *CA) (uninstalled bool, err error)

type PlatformError

type PlatformError struct {
	Err error

	NSSBrowsers string
	RootCA      string
}

func (PlatformError) Error

func (e PlatformError) Error() string

type Store

type Store interface {
	Check() (bool, error)
	Description() string

	CheckCA(*CA) (bool, error)
	InstallCA(*CA) (bool, error)
	ListCAs() ([]*CA, error)
	UninstallCA(*CA) (bool, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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