Documentation ¶
Index ¶
- Constants
- Variables
- func ChangeUserPassword(saltMaster SaltMaster) (resp model.Response, err error)
- func CheckAuth(user string, pass string, r *http.Request) bool
- func CheckSignature(rawSign string, pubPem []byte, data []byte) bool
- func ClientDistributionHandler(w http.ResponseWriter, req *http.Request)
- func ClientHostnameDistributionHandler(w http.ResponseWriter, req *http.Request)
- func ClientHostnameHandler(w http.ResponseWriter, req *http.Request)
- func CreateUser(saltMaster SaltMaster, os *Os) (resp model.Response, err error)
- func DetermineBootstrapPort() int
- func DistributeFileUploadRequest(endpoint string, user string, pass string, targets []string, path string, ...) <-chan model.Response
- func DistributeRequest(clients []string, endpoint, user, pass string, requestBody RequestBody) <-chan model.Response
- func ExecCmd(executable string, args ...string) (outStr string, err error)
- func FileUploadDistributeHandler(w http.ResponseWriter, req *http.Request)
- func FileUploadHandler(w http.ResponseWriter, req *http.Request)
- func GetAuthUserPass(r *http.Request) (string, string)
- func HealthCheckHandler(w http.ResponseWriter, req *http.Request)
- func IsServiceRunning(service string) (bool, string)
- func LaunchService(service string) (model.Response, error)
- func NewCloudbreakBootstrapWeb()
- func RestartService(service string) (model.Response, error)
- func SaltActionDistributeRequestHandler(w http.ResponseWriter, req *http.Request)
- func SaltMinionKeyDistributionHandler(w http.ResponseWriter, req *http.Request)
- func SaltMinionKeyHandler(w http.ResponseWriter, req *http.Request)
- func SaltMinionRunRequestHandler(w http.ResponseWriter, req *http.Request)
- func SaltMinionStopRequestHandler(w http.ResponseWriter, req *http.Request)
- func SaltPillarDistributeRequestHandler(w http.ResponseWriter, req *http.Request)
- func SaltPillarRequestHandler(w http.ResponseWriter, req *http.Request)
- func SaltServerChangePasswordHandler(w http.ResponseWriter, req *http.Request)
- func SaltServerRunRequestHandler(w http.ResponseWriter, req *http.Request)
- func SaltServerStopRequestHandler(w http.ResponseWriter, req *http.Request)
- func ServerRequestHandler(w http.ResponseWriter, req *http.Request)
- func SetServiceState(service string, serviceAction string) (resp model.Response, err error)
- func StopService(service string) (model.Response, error)
- func Unzip(src, dest string) error
- type Authenticator
- type Clients
- type Cloud
- type Fingerprint
- type FingerprintsRequest
- type FingerprintsResponse
- type GrainConfig
- type InitSystem
- type Os
- type RequestBody
- type SaltActionRequest
- type SaltAuth
- type SaltMaster
- type SaltMinion
- type SaltPillar
- type SecurityConfig
- type Server
- type Servers
- type SignatureMethod
Constants ¶
View Source
const ( SIGNED SignatureMethod = iota OPEN SIGNATURE = "signature" SIGNED_CONTENT = "signed" )
View Source
const ( MinionKey = "/etc/salt/pki/minion/minion.pem" SaltLocation = "/opt/" )
View Source
const ( START_ACTION = "start" STOP_ACTION = "stop" RESTART_ACTION = "restart" )
View Source
const ( SALT_USER = "saltuser" SHADOW_FILE = "/etc/shadow" SHADOW_FILE_BACKUP = "/etc/shadow.backup" SHADOW_FILE_NEW = "/etc/shadow.new" SHADOW_FILE_PERMISSIONS = 0640 )
View Source
const ( UBUNTU = "Ubuntu" DEBIAN = "Debian" SUSE = "SUSE" SLES12 = "sles12" AMAZONLINUX_2 = "amazonlinux2" AZURE = "AZURE" )
View Source
const ( RootPath = "/saltboot" HealthEP = RootPath + "/health" ServerSaveEP = RootPath + "/server/save" ServerDistributeEP = RootPath + "/server/distribute" SaltActionDistributeEP = RootPath + "/salt/action/distribute" SaltMinionEp = RootPath + "/salt/minion" SaltMinionRunEP = SaltMinionEp + "/run" SaltMinionStopEP = SaltMinionEp + "/stop" SaltMinionKeyEP = SaltMinionEp + "/fingerprint" SaltMinionKeyDistributeEP = SaltMinionEp + "/fingerprint/distribute" SaltServerEp = RootPath + "/salt/server" SaltServerRunEP = SaltServerEp + "/run" SaltServerStopEP = SaltServerEp + "/stop" SaltServerChangePasswordEP = SaltServerEp + "/change-password" SaltPillarEP = RootPath + "/salt/server/pillar" SaltPillarDistributeEP = RootPath + "/salt/server/pillar/distribute" HostnameDistributeEP = RootPath + "/hostname/distribute" HostnameEP = RootPath + "/hostname" UploadEP = RootPath + "/file" FileDistributeEP = UploadEP + "/distribute" )
View Source
const EXAMPLE_DOMAIN = ".example.com"
View Source
const HOSTNAME_FILE = "/etc/hostname"
View Source
const HOSTS_FILE = "/etc/hosts"
View Source
const NETWORK_SYSCONFIG_FILE = "/etc/sysconfig/network"
View Source
const NETWORK_SYSCONFIG_FILE_SUSE = "/etc/sysconfig/network/config"
Variables ¶
View Source
var ( SYSTEM_D = InitSystem{ActionBin: "/bin/systemctl", StateBin: "/bin/systemctl", Start: START_ACTION, Stop: STOP_ACTION, Restart: RESTART_ACTION, Enable: "enable", Disable: "disable", CommandOrderASC: true} SYS_V_INIT = InitSystem{ActionBin: "/sbin/service", StateBin: "/sbin/chkconfig", Start: START_ACTION, Stop: STOP_ACTION, Restart: RESTART_ACTION, Enable: "on", Disable: "off", CommandOrderASC: false} )
View Source
var ( Version string BuildTime string )
Functions ¶
func ChangeUserPassword ¶ added in v0.13.6
func ChangeUserPassword(saltMaster SaltMaster) (resp model.Response, err error)
func ClientDistributionHandler ¶
func ClientDistributionHandler(w http.ResponseWriter, req *http.Request)
func ClientHostnameDistributionHandler ¶
func ClientHostnameDistributionHandler(w http.ResponseWriter, req *http.Request)
func ClientHostnameHandler ¶
func ClientHostnameHandler(w http.ResponseWriter, req *http.Request)
func CreateUser ¶
func CreateUser(saltMaster SaltMaster, os *Os) (resp model.Response, err error)
func DetermineBootstrapPort ¶
func DetermineBootstrapPort() int
func DistributeFileUploadRequest ¶ added in v0.11.0
func DistributeRequest ¶ added in v0.11.0
func DistributeRequest(clients []string, endpoint, user, pass string, requestBody RequestBody) <-chan model.Response
func FileUploadDistributeHandler ¶ added in v0.11.0
func FileUploadDistributeHandler(w http.ResponseWriter, req *http.Request)
func FileUploadHandler ¶
func FileUploadHandler(w http.ResponseWriter, req *http.Request)
func HealthCheckHandler ¶
func HealthCheckHandler(w http.ResponseWriter, req *http.Request)
func IsServiceRunning ¶ added in v0.11.1
func NewCloudbreakBootstrapWeb ¶
func NewCloudbreakBootstrapWeb()
func SaltActionDistributeRequestHandler ¶
func SaltActionDistributeRequestHandler(w http.ResponseWriter, req *http.Request)
func SaltMinionKeyDistributionHandler ¶ added in v0.13.2
func SaltMinionKeyDistributionHandler(w http.ResponseWriter, req *http.Request)
func SaltMinionKeyHandler ¶ added in v0.13.2
func SaltMinionKeyHandler(w http.ResponseWriter, req *http.Request)
func SaltMinionRunRequestHandler ¶
func SaltMinionRunRequestHandler(w http.ResponseWriter, req *http.Request)
func SaltMinionStopRequestHandler ¶
func SaltMinionStopRequestHandler(w http.ResponseWriter, req *http.Request)
func SaltPillarDistributeRequestHandler ¶ added in v0.11.0
func SaltPillarDistributeRequestHandler(w http.ResponseWriter, req *http.Request)
func SaltPillarRequestHandler ¶
func SaltPillarRequestHandler(w http.ResponseWriter, req *http.Request)
func SaltServerChangePasswordHandler ¶ added in v0.13.6
func SaltServerChangePasswordHandler(w http.ResponseWriter, req *http.Request)
func SaltServerRunRequestHandler ¶
func SaltServerRunRequestHandler(w http.ResponseWriter, req *http.Request)
func SaltServerStopRequestHandler ¶
func SaltServerStopRequestHandler(w http.ResponseWriter, req *http.Request)
func ServerRequestHandler ¶
func ServerRequestHandler(w http.ResponseWriter, req *http.Request)
func SetServiceState ¶
Types ¶
type Authenticator ¶
func (*Authenticator) Wrap ¶
func (a *Authenticator) Wrap(handler func(w http.ResponseWriter, req *http.Request), signatureMethod SignatureMethod) http.Handler
type Clients ¶
type Clients struct { Clients []string `json:"clients,omitempty"` Servers []Server `json:"servers,omitempty"` Path string `json:"path"` }
func (*Clients) DistributeAddress ¶
type Fingerprint ¶ added in v0.13.2
type Fingerprint struct { Fingerprint *string `json:"fingerprint"` ErrorText *string `json:"errorText"` StatusCode int `json:"statusCode"` Address string `json:"address"` }
func EncodeJson ¶ added in v0.13.2
func EncodeJson(k Fingerprint, w http.ResponseWriter) Fingerprint
func (Fingerprint) String ¶ added in v0.13.2
func (r Fingerprint) String() string
func (Fingerprint) WriteHttp ¶ added in v0.13.2
func (k Fingerprint) WriteHttp(w http.ResponseWriter) Fingerprint
type FingerprintsRequest ¶ added in v0.13.2
type FingerprintsRequest struct {
Minions []SaltMinion `json:"minions,omitempty"`
}
type FingerprintsResponse ¶ added in v0.13.2
type FingerprintsResponse struct { Fingerprints []Fingerprint `json:"fingerprints"` ErrorText *string `json:"errorText"` StatusCode int `json:"statusCode"` }
func EncodeResponseJson ¶ added in v0.13.2
func EncodeResponseJson(r FingerprintsResponse, w http.ResponseWriter) FingerprintsResponse
func (FingerprintsResponse) String ¶ added in v0.13.2
func (r FingerprintsResponse) String() string
func (FingerprintsResponse) WriteBadRequestHttp ¶ added in v0.13.2
func (r FingerprintsResponse) WriteBadRequestHttp(w http.ResponseWriter, err error) FingerprintsResponse
type GrainConfig ¶
type InitSystem ¶
type InitSystem struct { Start string Stop string Restart string Enable string Disable string ActionBin string StateBin string CommandOrderASC bool }
func GetInitSystem ¶
func GetInitSystem() (system InitSystem)
func (InitSystem) ActionCommand ¶
func (system InitSystem) ActionCommand(service string, action string) []string
func (InitSystem) Error ¶
func (system InitSystem) Error() string
func (InitSystem) StateCommand ¶
func (system InitSystem) StateCommand(service string, enable bool) []string
type RequestBody ¶ added in v0.13.2
type RequestBody struct { // plain request body PlainPayload []byte // signature key Signature string // request body signed with Signature SignedPayload string }
func GetSignedRequestBody ¶ added in v0.13.2
func GetSignedRequestBody(r *http.Request) RequestBody
type SaltActionRequest ¶
type SaltActionRequest struct { Master SaltMaster `json:"master,omitempty"` Masters []SaltMaster `json:"masters,omitempty"` Minions []SaltMinion `json:"minions,omitempty"` Action string `json:"action"` Cloud *Cloud `json:"cloud"` OS *Os `json:"os"` }
func (SaltActionRequest) String ¶
func (r SaltActionRequest) String() string
type SaltMaster ¶
type SaltMaster struct { Address string `json:"address"` Auth SaltAuth `json:"auth,omitempty"` Hostname *string `json:"hostName,omitempty"` Domain string `json:"domain,omitempty"` }
func (SaltMaster) AsByteArray ¶
func (saltMaster SaltMaster) AsByteArray() []byte
type SaltMinion ¶
type SaltMinion struct { Address string `json:"address"` Roles []string `json:"roles,omitempty"` Server string `json:"server,omitempty"` Servers []string `json:"servers,omitempty"` HostGroup string `json:"hostGroup,omitempty"` Hostname *string `json:"hostName,omitempty"` Domain string `json:"domain,omitempty"` RestartNeeded *bool `json:"restartNeeded,omitempty"` }
func (SaltMinion) AsByteArray ¶
func (saltMinion SaltMinion) AsByteArray() []byte
func (SaltMinion) IsRestartNeeded ¶ added in v0.13.4
func (saltMinion SaltMinion) IsRestartNeeded() bool
type SaltPillar ¶
type SaltPillar struct { Path string `json:"path"` Json map[string]interface{} `json:"json"` Targets []string `json:"targets"` }
func (SaltPillar) WritePillar ¶
func (pillar SaltPillar) WritePillar() (outStr string, err error)
type SecurityConfig ¶
type SecurityConfig struct { Username string `json:"username" yaml:"username"` Password string `json:"password" yaml:"password"` SignVerifyKey string `json:"signKey" yaml:"signKey"` }
func DetermineSecurityDetails ¶
func DetermineSecurityDetails(getEnv func(key string) string, securityConfig func() string) (*SecurityConfig, error)
type Servers ¶
func (*Servers) WriteToFile ¶
type SignatureMethod ¶
type SignatureMethod int
Source Files ¶
Click to show internal directories.
Click to hide internal directories.