config

package
v0.17.5 Latest Latest
Warning

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

Go to latest
Published: May 28, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const AppName = "serverless-ssh-ca"
View Source
const FriendlyAppName = "Serverless SSH CA Client"

Variables

View Source
var (
	ErrNoPrivateKey   = errors.New("no private key found")
	ErrNoCertificate  = errors.New("no certificate found")
	ErrNoRefreshToken = errors.New("no refresh token found")
)

Functions

func ConfigDirs

func ConfigDirs() (user, system string, err error)

func LogDir

func LogDir() (string, error)

Types

type ClientOIDCConfig

type ClientOIDCConfig struct {
	Issuer      string   `json:"issuer"`
	ClientID    string   `json:"client_id"`
	Scopes      []string `json:"scopes"`
	RedirectURL string   `json:"redirect_url"`
}

type Config

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

func LoadConfig

func LoadConfig(system, user string) (*Config, error)

func LoadUserConfigOnly

func LoadUserConfigOnly(name string) (*Config, error)

func (*Config) CerificateExpiry

func (c *Config) CerificateExpiry() time.Time

func (*Config) CertificateAuthority

func (c *Config) CertificateAuthority() ssh.PublicKey

CertificateAuthority returns the CA PublicKey

func (*Config) CertificateAuthorityURL

func (c *Config) CertificateAuthorityURL() string

func (*Config) CertificateValid

func (c *Config) CertificateValid() bool

func (*Config) GetCertificateBytes

func (c *Config) GetCertificateBytes() ([]byte, error)

func (*Config) GetPrivateKeyBytes

func (c *Config) GetPrivateKeyBytes() ([]byte, error)

GetPrivateKeyBytes returns a []byte slice that contains the users unencrypted SSH private key. It is up to the caller to ensure this is handled securely.

func (*Config) GetPublicKeyBytes

func (c *Config) GetPublicKeyBytes() ([]byte, error)

func (*Config) GetRefreshToken

func (c *Config) GetRefreshToken() (string, error)

func (*Config) HasCertificate

func (c *Config) HasCertificate() bool

func (*Config) HasPrivateKey

func (c *Config) HasPrivateKey() bool

func (*Config) Oidc

func (c *Config) Oidc() ClientOIDCConfig

func (*Config) Save

func (c *Config) Save() error

func (*Config) SetCertificateBytes

func (c *Config) SetCertificateBytes(pemBytes []byte) error

func (*Config) SetPrivateKeyBytes

func (c *Config) SetPrivateKeyBytes(pemBytes []byte) error

SetPrivateKeyBytes encrypts and persists the PEM private key []byte slice via Persistence

func (*Config) SetRefreshToken

func (c *Config) SetRefreshToken(token string) error

func (*Config) Signer

func (c *Config) Signer() (ssh.Signer, error)

Signer returns a ssh.Signer

func (*Config) System

func (c *Config) System() *SystemConfig

CertificateAuthority returns the CA PublicKey

type Persistence

type Persistence interface {
	Save(config UserConfig) error
}

type SystemConfig

type SystemConfig struct {
	Issuer                      string   `json:"issuer"`
	ClientID                    string   `json:"client_id"`
	Scopes                      []string `json:"scopes"`
	RedirectURL                 string   `json:"redirect_url"`
	CertificateAuthorityURL     string   `json:"ca_url"`
	TrustedCertificateAuthority string   `json:"trusted_ca"`
	// contains filtered or unexported fields
}

func (*SystemConfig) CertificateAuthority

func (c *SystemConfig) CertificateAuthority() ssh.PublicKey

type UserConfig

type UserConfig struct {
	Certificate  []byte `json:"certificate,omitempty"`
	RefreshToken []byte `json:"refresh_token,omitempty"`
	PrivateKey   []byte `json:"private_key,omitempty"`
}

type YamlPersistence

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

YamlPersistence handles persisting user config to disk as a YAML file

func (*YamlPersistence) Save

func (p *YamlPersistence) Save(c UserConfig) error

This saves the user part of the config

Jump to

Keyboard shortcuts

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