Documentation
¶
Overview ¶
Package config loads the SSLKnife configuration file and resolves platform-specific default locations.
Index ¶
- Constants
- func DefaultConfigPath() (string, error)
- func DefaultDataDir() (string, error)
- func ExpandHome(p string) string
- func ParseDuration(s string) (time.Duration, error)
- type CTConfig
- type Config
- type DatabaseConfig
- type Duration
- type ExpiryConfig
- type RemoteConfig
- type ServerConfig
- type TLSConfig
Constants ¶
const ( EnvConfig = "SSLKNIFE_CONFIG" EnvDatabase = "SSLKNIFE_DATABASE" EnvDataDir = "SSLKNIFE_DATA_DIR" )
Environment variables that override file locations.
const ( EnvVaultRoleID = "SSLKNIFE_VAULT_ROLE_ID" EnvVaultSecretID = "SSLKNIFE_VAULT_SECRET_ID" )
Environment variables for the Vault remote's AppRole login.
const RemoteVault = "vault"
Remote types.
Variables ¶
This section is empty.
Functions ¶
func DefaultConfigPath ¶
DefaultConfigPath returns the platform config file location:
Linux: $XDG_CONFIG_HOME/sslknife/config.yaml (~/.config/...) macOS: ~/Library/Application Support/sslknife/config.yaml Windows: %AppData%\sslknife\config.yaml
func DefaultDataDir ¶
DefaultDataDir returns the platform data directory:
Linux: $XDG_DATA_HOME/sslknife (~/.local/share/sslknife) macOS: ~/Library/Application Support/sslknife Windows: %LocalAppData%\sslknife
func ExpandHome ¶
ExpandHome replaces a leading "~/" with the user's home directory.
Types ¶
type Config ¶
type Config struct {
Database DatabaseConfig `yaml:"database"`
TLS TLSConfig `yaml:"tls"`
CT CTConfig `yaml:"ct"`
Server ServerConfig `yaml:"server"`
Expiry ExpiryConfig `yaml:"expiry"`
Remote RemoteConfig `yaml:"remote"`
}
Config is the on-disk configuration. Secrets never belong here: the database password comes from the TTY, the OS keychain or the environment.
func Load ¶
Load reads path on top of the defaults. A missing file is not an error unless mustExist is set (the user passed --config explicitly).
type DatabaseConfig ¶
type DatabaseConfig struct {
Path string `yaml:"path"`
}
type Duration ¶
Duration is a time.Duration that also accepts day ("d") and week ("w") units, e.g. "30d" or "2w", in addition to Go duration syntax.
func (Duration) MarshalYAML ¶
MarshalYAML renders the duration in Go syntax.
type ExpiryConfig ¶
type RemoteConfig ¶
type RemoteConfig struct {
// Type is "" (no remote) or "vault".
Type string `yaml:"type"`
Address string `yaml:"address,omitempty"` // default $VAULT_ADDR
Namespace string `yaml:"namespace,omitempty"` // default $VAULT_NAMESPACE
CACert string `yaml:"ca_cert,omitempty"` // default $VAULT_CACERT
Mount string `yaml:"mount"` // KV version 2 mount
Path string `yaml:"path"` // prefix inside the mount
// AuthMethod is token, approle, userpass or ldap.
AuthMethod string `yaml:"auth_method"`
AuthMount string `yaml:"auth_mount,omitempty"` // default: the method name
Username string `yaml:"username,omitempty"` // userpass/ldap login
RoleID string `yaml:"role_id,omitempty"` // approle
SecretIDFile string `yaml:"secret_id_file,omitempty"`
TokenFile string `yaml:"token_file,omitempty"` // default ~/.vault-token
// TransitKey, when set, encrypts private keys with this Vault Transit
// key before they are stored in KV.
TransitKey string `yaml:"transit_key,omitempty"`
TransitMount string `yaml:"transit_mount,omitempty"` // default transit
// AutoSync syncs before and after every command that opens the vault.
AutoSync bool `yaml:"auto_sync"`
// Interval is how often `sslknife server` syncs.
Interval Duration `yaml:"interval"`
}
RemoteConfig shares the inventory between devices through HashiCorp Vault. Tokens and AppRole secret IDs never belong here: they come from $VAULT_TOKEN, the OS keychain (`sslknife remote login`), a token file or $SSLKNIFE_VAULT_SECRET_ID / secret_id_file.
func (RemoteConfig) Enabled ¶
func (r RemoteConfig) Enabled() bool
Enabled reports whether a remote is configured.