Documentation
¶
Index ¶
- Constants
- func CreatePassword(length int) (string, error)
- func EnsureBaseDir() error
- func EnsureBaseOrHostDir() error
- func EnsureHostDir() error
- func FetchPassword(length int, domain, user string) (string, error)
- func GenerateBcrypt(password string) (string, error)
- func GenerateDHParams(bits int) ([]byte, error)
- func GeneratePBKDF2(password string) (string, error)
- func GenerateSecret(key, mode string) (string, error)
- func GetRSAKeyPair(fqdn string) ([]byte, []byte, error)
- func GetSysAdmin() string
- func GetTimeZone() string
- type Basics
- type Secret
- type SecretList
Constants ¶
const ( BasicsName = "basics.json" DefaultTimeZone = "Europe/Berlin" DefaultCompany = "My Company" DefaultRegTTL = 3600 DefaultDMARC = "v=DMARC1; p=quarantine; pct=100; adkim=s; aspf=s" )
const (
DHParamsName = "dhparams.pem"
)
const (
SecretsName = "secrets.json"
)
Variables ¶
This section is empty.
Functions ¶
func CreatePassword ¶
func EnsureBaseDir ¶
func EnsureBaseDir() error
EnsureBaseDir ensures that the current working directory is located within the gd-tools base directory defined by GD_TOOLS_BASE.
This is used as a safety mechanism to prevent accidental execution outside the managed infrastructure tree.
func EnsureBaseOrHostDir ¶ added in v0.3.0
func EnsureBaseOrHostDir() error
EnsureBaseOrHostDir allows execution either from the gd-tools base directory (or any of its subdirectories) or from a host directory.
This is useful for commands like 'list' that can operate globally or on a single host.
func EnsureHostDir ¶ added in v0.3.0
func EnsureHostDir() error
EnsureHostDir ensures that the current working directory represents a gd-tools host directory.
A host directory is identified by the presence of a config.json file.
func GenerateBcrypt ¶
func GenerateDHParams ¶
GenerateDHParams generates dhparams.pem (2048+ bits) via openssl
func GeneratePBKDF2 ¶
func GenerateSecret ¶
func GetSysAdmin ¶
func GetSysAdmin() string
func GetTimeZone ¶
func GetTimeZone() string
Types ¶
type Basics ¶
type Basics struct {
Company string `json:"company"`
SysAdmin string `json:"sys_admin"`
TimeZone string `json:"time_zone"`
Language string `json:"language"`
Region string `json:"region"`
RegTTL int `json:"reg_ttl"`
HelpURL string `json:"help_url"`
DMARC string `json:"dmarc"`
}
func ReadBasics ¶
type SecretList ¶
type SecretList struct {
Secrets []Secret `json:"entries"`
}
func LoadSecrets ¶
func LoadSecrets() (*SecretList, error)
func (*SecretList) Get ¶
func (list *SecretList) Get(domain, user string) *Secret
func (*SecretList) Save ¶
func (list *SecretList) Save() error
func (*SecretList) Set ¶
func (list *SecretList) Set(domain, user, input, output string) error
func (*SecretList) SetMailUser ¶
func (list *SecretList) SetMailUser(address, password string) (string, string, error)