Version: v0.3.0 Latest Latest

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

Go to latest
Published: Sep 8, 2022 License: Apache-2.0 Imports: 36 Imported by: 0




View Source
const (
	EtcdCaCrt              = "ca.crt"
	EtcdCaKey              = "ca.key"
	SnapshotFilenameBucket = "snapshot.db"
View Source
const (
	MasterSaKey     = "sa.key"
	MasterSaPub     = ""
	MasterFProxyCrt = "front-proxy-ca.crt"
	MasterFProxyKey = "front-proxy-ca.key"
	MasterCaKey     = "ca.key"
	MasterCaCrt     = "ca.crt"
View Source
const (
	JoinFile                 string        = ""
	BucketPath               string        = "join"
	LocalJoinFilePath        string        = "."
	DefaultJointTimeoutValue time.Duration = 30 * time.Minute
View Source
const (
	OpenVPNServerCert = "server.crt"
	OpenVPNServerKey  = "server.key"
	OpenVPNCaCert     = "ca.crt"
	OpenVPNCaKey      = "ca.key"
	OpenVPNCRL        = "ca.crl"
	OpenVPNTaKey      = "ta.key"
	OpenVPNPath       = "pki/vpn"
View Source
const (
	OpenVPNClientCert        = "client.crt"
	OpenVPNClientKey         = "client.key"
	OpenVPNClientCaCert      = "ca.crt"
	OpenVPNClientCaKey       = "ca.key"
	OpenVPNClientTaKey       = "ta.key"
	OpenVPNClientPath        = "pki/vpn-client"
	OpenVPNClientRevokedPath = "pki/vpn-client/revoked"
View Source
const (
	SSHUserSpecs                  = "ssh-users.yml"
	SSHBucketDir                  = "ssh"
	SSHAuthorizedKeysFileName     = "authorized_keys"
	SSHAuthorizedKeysTempFileName = "authorized_keys_tmp"
	SSHSudoerDir                  = "/etc/sudoers.d"


View Source
var (
	Cert = certutil.Config{
		CommonName:   "SIGHUP s.r.l. Server",
		Organization: []string{"SIGHUP s.r.l."},
		AltNames:     certutil.AltNames{DNSNames: []string{}, IPs: []net.IP{}},
		Usages:       []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth},
	CertConfig = pki.CertConfig{
		Config:             Cert,
		PublicKeyAlgorithm: 0,


func GetUidGid

func GetUidGid(username string) (uid, gid int)


type BackoffNode

type BackoffNode struct {
	OverWrite bool

type ClusterComponentData

type ClusterComponentData struct {

type ClusterConfig

type ClusterConfig struct {
	NodeName string        `mapstructure:"nodeName"`
	Etcd     EtcdConfig    `mapstructure:"etcd"`
	Master   MasterConfig  `mapstructure:"master"`
	Node     NodeConfig    `mapstructure:"node"`
	OpenVPN  OpenVPNConfig `mapstructure:"openvpn"`
	SSH      SSHConfig     `mapstructure:"sshkeys"`

ClusterConfig represents the configuration for the whole cluster

type Etcd

type Etcd struct {
	StopFlag bool

Etcd implements the ClusterComponent Interface

func (Etcd) Backup

func (e Etcd) Backup() error

func (Etcd) Configure

func (e Etcd) Configure(overwrite bool) error

func (Etcd) Init

func (e Etcd) Init() error

func (Etcd) Restore

func (e Etcd) Restore() error

type EtcdConfig

type EtcdConfig struct {
	DataDir             string `mapstructure:"dataDir"`
	CertDir             string `mapstructure:"certDir"`
	CaCertFilename      string `mapstructure:"caCertFilename"`
	CaKeyFilename       string `mapstructure:"caKeyFilename"`
	ClientCertFilename  string `mapstructure:"clientCertFilename"`
	InitialClusterToken string `mapstructure:"initialClusterToken"`
	SnapshotFile        string `mapstructure:"snapshotFile"`
	ClientKeyFilename   string `mapstructure:"clientKeyFilename"`
	Endpoint            string `mapstructure:"endpoint"`

EtcdConfig is used to backup/restore/configure etcd nodes

type HTTPAdapterSet

type HTTPAdapterSet struct {
	Name string
	Uri  string

type ListOutput added in v0.2.0

type ListOutput struct {
	User      string             `json:"user"`
	ValidFrom string             `json:"valid_from"`
	ValidTo   string             `json:"valid_to"`
	Expired   bool               `json:"expired"`
	Revoked   RevocationResponse `json:"revoke_info"`

type Master

type Master struct {

Master implements the ClusterComponent interface

func (Master) Configure

func (m Master) Configure(overwrite bool) error

Configure implements

func (Master) Init

func (m Master) Init() error

type MasterConfig

type MasterConfig struct {
	CertDir          string `mapstructure:"certDir"`
	CaCertFile       string `mapstructure:"caCertFilename"`
	CaKeyFile        string `mapstructure:"caKeyFilename"`
	SaPubFile        string `mapstructure:"saPubFilename"`
	SaKeyFile        string `mapstructure:"saKeyFilename"`
	ProxyCaCertFile  string `mapstructure:"proxyCaCertFilename"`
	ProxyKeyCertFile string `mapstructure:"proxyKeyCertFilename"`

MasterConfig is used to backup/restore/configure master nodes

type Node

type Node struct {

Node represent the object that reflects what nodes need (implements ClusterComponent)

func (Node) Configure

func (n Node) Configure(overwrite bool) error

Configure basically joins the nodes to the cluster

func (Node) Init

func (n Node) Init(s string) error

Init is for interface compliance, now is empty

type NodeConfig

type NodeConfig struct {
	CloudProvider string `mapstructure:"caKeyFilename"`
	// contains filtered or unexported fields

NodeConfig is used to backup/restore/configure worker nodes (backup and restore are not implemented right now)

type OpenVPN

type OpenVPN struct {

func (OpenVPN) Configure

func (o OpenVPN) Configure(overwrite bool) error

func (OpenVPN) Init

func (o OpenVPN) Init() error

type OpenVPNClient

type OpenVPNClient struct {

func (OpenVPNClient) CreateUser added in v0.1.0

func (o OpenVPNClient) CreateUser(clientName string) error

func (OpenVPNClient) ListUserCertificates added in v0.2.0

func (o OpenVPNClient) ListUserCertificates(output string) error

func (OpenVPNClient) RevokeUser added in v0.1.0

func (o OpenVPNClient) RevokeUser(clientName string) error

type OpenVPNConfig

type OpenVPNConfig struct {
	CertDir string   `mapstructure:"certDir"`
	Servers []string `mapstructure:"servers"`

type RevocationResponse added in v0.2.0

type RevocationResponse struct {
	Revoked    bool      `json:"revoked"`
	RevokeTime time.Time `json:"revoked_time"`

type SSHComponent

type SSHComponent struct {

func (SSHComponent) Configure

func (o SSHComponent) Configure(overwrite bool) error

Configure setup for each file entry the github configured ssh keys in the authorized_keys file

func (SSHComponent) Init

func (o SSHComponent) Init() error

type SSHConfig

type SSHConfig struct {
	User            string         `mapstructure:"user"`
	TempDir         string         `mapstructure:"tempDir"`
	LocalDirConfigs string         `mapstructure:"localDirConfigs"`
	Adapter         HTTPAdapterSet `mapstructure:"adapter"`

type SSHUsersFile

type SSHUsersFile struct {
	Users []UserSpec `yaml:"users"`

type SystemUser

type SystemUser struct {
	Name string
	Home string
	Gid  int
	Uid  int

type UserSpec

type UserSpec struct {
	Name   string `yaml:"name"`
	UserID string `yaml:"user_id"`

Jump to

Keyboard shortcuts

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