Documentation ¶
Index ¶
- Constants
- Variables
- func Contains(str string, a []string) bool
- func Date() string
- func Time() string
- type APIKey
- type Audit
- type CSR
- type Client
- type ClientCert
- type Group
- type Info
- type Job
- type JobStatus
- type Jobs
- type LDAP
- type Package
- type PackageClient
- type PackageList
- type Route
- type SendData
- type Stats
- type UpdatePackages
- type User
Constants ¶
const ( // PL package list PL = "pl" // AR autoremove AR = "ar" // Ping client Ping = "p" // Sign client Sign = "s" // Reboot client Reboot = "r" // JS job status JS = "j" // Del client Del = "d" // UU update upgrade UU = "uu" // UUR update upgrade reboot UUR = "uur" // UD update dist-upgrade UD = "ud" // UDR update dist-upgrade reboot UDR = "udr" // UUCP update upgrade chosen package UUCP = "uucp" // UUCPR update upgrade chosen package reboot UUCPR = "uucpr" )
Client actions
const ( // Login user logs in Login = "login" // Logout user logs out Logout = "logout" // Comment of client is changed Comment = "comment" // CreateGroup a new group is created CreateGroup = "created group " // ChangeGroup a group is changed ChangeGroup = "changed group " // DeleteGroup a group is deleted DeleteGroup = "deleted group " // CreateUser user is created CreateUser = "created user " // CHangeUser user is changed ChangeUser = "changed user " // DeleteUser user is deleted DeleteUser = "deleted user " )
Server actions
const ( // DefDataDir is the default running directory DefDataDir = "/var/lib/harkonn" // DefLogFile is the default log file DefLogFile = "/var/log/harkonn.log" // DefConfigFile is the default config file DefConfigFile = "/etc/harkonn/harkonn.json" // DefServerAddress is the default server listening address DefServerAddress = "0.0.0.0" // DefServerPort is the default server listening/connect port DefServerPort = "2600" // DefMaxClients defines the maximum client connections DefMaxClients = 100 // DefClientExecTimeout is the default client exec timeout in minutes DefClientExecTimeout = 20 // DefClientReconnect is the default client reconnect timeout in seconds DefClientReconnect = 15 // DefClientInterval is the default client update interval in hours DefClientInterval = 1 // DefHTTPPort is the default HTTP(S) port DefHTTPPort = "443" // DefHTTPPoolSize is the default API client connection pool size DefHTTPPoolSize = 10 // DefHTTPCert is the default HTTP certificate file DefHTTPCert = "srv.pem" // DefHTTPKey is the default HTTP key file DefHTTPKey = "srv.key" // DefUnlockUser is the default user to unlock DefUnlockUser = "admin" // DBFile is the default file to store the database DBFile = "datastore" )
const BcryptCost = 13
BcryptCost defines the cost for bcrypt password hashing
Variables ¶
var ( // C is the globally shared config C config // Version is the globally shared version Version string )
var Actions = map[string]string{ Sign: "Sign Client Certificate", Del: "Deleted Client", AR: "Autoremove", PL: "Package List", Ping: "Ping Client", Reboot: "Reboot", UUCP: "Update Upgrade Chosen Software", UUCPR: "Update Upgrade Chosen Software Reboot", UU: "Update Upgrade", UUR: "Update Upgrade Reboot", UD: "Update Dist-Upgrade", UDR: "Update Dist-Upgrade Reboot", Login: "Login", Logout: "Logout", Comment: "Comment Changed", }
Actions represents a string map between constants and their description
Functions ¶
Types ¶
type Audit ¶
type Audit struct { Host string `json:"host"` User string `json:"user"` Action string `json:"action"` Executed string `json:"executed"` }
Audit json struct for api usage
type CSR ¶
type CSR struct { Host string `json:"host"` Address string `json:"address,omitempty"` Fingerprint string `json:"fingerprint,omitempty"` Raw []byte `json:"raw,omitempty"` C chan ClientCert `json:"-"` Err chan error `json:"-"` }
CSR represents a pending Certificate Signing Request
type Client ¶
type Client struct { Host string `json:"host"` Dist string `json:"dist"` Version string `json:"version"` IP string `json:"ip"` Updates bool `json:"updates"` LastUpdate string `json:"last_update"` Connected bool `json:"connected"` Member bool `json:"member"` Arch string `json:"arch"` CPU string `json:"cpu"` RAM int `json:"ram"` Comment string `json:"comment"` Packages []Package `json:"packages"` Jobs []Job `json:"jobs,omitempty"` Serial string `json:"-"` }
Client json struct for api usage
type ClientCert ¶
ClientCert represents the signed client certificate
type Group ¶
type Group struct { Name string `json:"name"` UMembers []string `json:"umembers"` CMembers []string `json:"cmembers"` }
Group json struct for api usage
type Jobs ¶
Jobs represents the job handling struct
type LDAP ¶
type LDAP struct { Address string Port string TLS bool BindDN string BindPassword string UserDN string UserFilter string }
LDAP is the LDAP configuration struct
type Package ¶
type Package struct { Name string `json:"name"` Version string `json:"version"` NewVersion string `json:"new_version"` }
Package json struct for api usage
type PackageClient ¶
PackageClient represents a client with specific package
type PackageList ¶
type PackageList struct { Name string `json:"name"` Versions []string `json:"versions"` Clients int `json:"clients"` VerMap map[string]struct{} `json:"-"` }
PackageList represents a package with version and the number of affected clients
type Route ¶
type Route struct { Path string Handler http.HandlerFunc Methods []string }
Route represents a http route
type SendData ¶
type SendData struct { Type string `json:"type"` Host string `json:"host"` Delay int `json:"delay,omitempty"` Packages []string `json:"packages,omitempty"` Timeout chan bool `json:"-"` }
SendData for communication between api and worker
type Stats ¶
type Stats struct { Goroutines int `json:"goroutines"` Alloc float64 `json:"alloc"` Sys float64 `json:"sys"` Clients int `json:"clients"` ClientsConn int `json:"clients_conn"` Version string `json:"version"` GoVersion string `json:"go_version"` }
Stats json struct for api usage
type UpdatePackages ¶
UpdatePackages represents a client hostname and a package list
type User ¶
type User struct { User string `json:"user"` Password string `json:"password,omitempty"` LastLogin string `json:"last_login,omitempty"` Type string `json:"type,omitempty"` Enabled bool `json:"enabled,omitempty"` Admin bool `json:"admin,omitempty"` Locked int `json:"locked,omitempty"` Member bool `json:"member,omitempty"` }
User json struct for api usage