Documentation ¶
Index ¶
- Variables
- func BoolVal(input string) bool
- func SetASSHBinaryPath(path string)
- type Config
- func (c *Config) GetGatewaySafe(name string) *Host
- func (c *Config) GetHost(name string) (*Host, error)
- func (c *Config) GetHostSafe(name string) *Host
- func (c *Config) IncludedFiles() []string
- func (c *Config) IsConfigOutdated(target string) (bool, error)
- func (c *Config) JsonString() ([]byte, error)
- func (c *Config) LoadConfig(source io.Reader) error
- func (c *Config) LoadFile(filename string) error
- func (c *Config) LoadFiles(pattern string) error
- func (c *Config) LoadKnownHosts() error
- func (c *Config) SaveNewKnownHost(target string)
- func (c *Config) SaveSSHConfig() error
- func (c *Config) String() string
- func (c *Config) WriteSSHConfigTo(w io.Writer) error
- type Host
- func (h *Host) AddKnownHost(target string)
- func (h *Host) ApplyDefaults(defaults *Host)
- func (h *Host) Clone() *Host
- func (h *Host) ExpandString(input string) string
- func (h *Host) Matches(needle string) bool
- func (h *Host) Name() string
- func (h *Host) Options() OptionsList
- func (h *Host) Prototype() string
- func (h *Host) String() string
- func (h *Host) WriteSSHConfigTo(w io.Writer) error
- type HostsList
- type HostsMap
- type Option
- type OptionsList
Constants ¶
This section is empty.
Variables ¶
var SSHBoolFlags = []string{"1", "2", "4", "6", "A", "a", "C", "f", "G", "g", "K", "k", "M", "N", "n", "q", "s", "T", "t", "V", "v", "X", "x", "Y", "y"}
SSHBoolFlags contains list of available SSH boolean options
var SSHFlags = []cli.Flag{}
SSHFlags is built at init(), it contains codegangsta/cli string & bool flags for SSH
var SSHStringFlags = []string{"b", "c", "D", "E", "e", "F", "I", "i", "L", "l", "m", "O", "o", "p", "Q", "R", "S", "W", "w"}
SSHStringFlags contains list of available SSH string options
Functions ¶
func SetASSHBinaryPath ¶
func SetASSHBinaryPath(path string)
SetASSHBinaryPath sets the default assh binary path this value may be overwritten in the assh.yml file using the asshbinarypath variable
Types ¶
type Config ¶
type Config struct { Hosts HostsMap `yaml:"hosts,omitempty,flow" json:"hosts"` Templates HostsMap `yaml:"templates,omitempty,flow" json:"templates"` Defaults Host `yaml:"defaults,omitempty,flow" json:"defaults,omitempty"` Includes []string `yaml:"includes,omitempty,flow" json:"includes,omitempty"` ASSHKnownHostFile string `yaml:"asshknownhostfile,omitempty,flow" json:"asshknownhostfile,omitempty"` ASSHBinaryPath string `yaml:"asshbinarypath,omitempty,flow" json:"asshbinarypath,omitempty"` // contains filtered or unexported fields }
Config contains a list of Hosts sections and a Defaults section representing a configuration file
func (*Config) GetGatewaySafe ¶
GetGatewaySafe returns gateway Host configuration, a gateway is like a Host, except, the host path is not resolved
func (*Config) GetHostSafe ¶
GetHostSafe won't fail, in case the host is not found, it will returns a virtual host matching the pattern
func (*Config) IncludedFiles ¶
IncludedFiles returns the list of the included files
func (*Config) IsConfigOutdated ¶
IsConfigOutdated returns true if .ssh/config needs to be rebuild. The reason may be: - assh.yml (or an included file) was updated recently - <target> matches a regex and was never seen before (not present in known-hosts file)
func (*Config) JsonString ¶
JsonString returns a string representing the JSON of a Config object
func (*Config) LoadConfig ¶
LoadConfig loads the content of an io.Reader source
func (*Config) LoadKnownHosts ¶
LoadKnownHosts loads known hosts list from disk
func (*Config) SaveNewKnownHost ¶
SaveNewKnownHost registers the target as a new known host and save the full known hosts list on disk
func (*Config) SaveSSHConfig ¶
SaveSSHConfig saves the configuration to ~/.ssh/config
type Host ¶
type Host struct { // ssh-config fields AddressFamily string `yaml:"addressfamily,omitempty,flow" json:"AddressFamily,omitempty"` AskPassGUI string `yaml:"askpassgui,omitempty,flow" json:"AskPassGUI,omitempty"` BatchMode string `yaml:"batchmode,omitempty,flow" json:"BatchMode,omitempty"` BindAddress string `yaml:"bindaddress,omitempty,flow" json:"BindAddress,omitempty"` CanonicalDomains string `yaml:"canonicaldomains,omitempty,flow" json:"CanonicalDomains,omitempty"` CanonicalizeFallbackLocal string `yaml:"canonicalizefallbacklocal,omitempty,flow" json:"CanonicalizeFallbackLocal,omitempty"` CanonicalizeHostname string `yaml:"canonicalizehostname,omitempty,flow" json:"CanonicalizeHostname,omitempty"` CanonicalizeMaxDots string `yaml:"canonicalizemaxDots,omitempty,flow" json:"CanonicalizeMaxDots,omitempty"` CanonicalizePermittedCNAMEs string `yaml:"canonicalizepermittedcnames,omitempty,flow" json:"CanonicalizePermittedCNAMEs,omitempty"` ChallengeResponseAuthentication string `yaml:"challengeresponseauthentication,omitempty,flow" json:"ChallengeResponseAuthentication,omitempty"` CheckHostIP string `yaml:"checkhostip,omitempty,flow" json:"CheckHostIP,omitempty"` Cipher string `yaml:"cipher,omitempty,flow" json:"Cipher,omitempty"` Ciphers string `yaml:"ciphers,omitempty,flow" json:"Ciphers,omitempty"` ClearAllForwardings string `yaml:"clearallforwardings,omitempty,flow" json:"ClearAllForwardings,omitempty"` Compression string `yaml:"compression,omitempty,flow" json:"Compression,omitempty"` CompressionLevel int `yaml:"compressionlevel,omitempty,flow" json:"CompressionLevel,omitempty"` ConnectionAttempts string `yaml:"connectionattempts,omitempty,flow" json:"ConnectionAttempts,omitempty"` ConnectTimeout int `yaml:"connecttimeout,omitempty,flow" json:"ConnectTimeout,omitempty"` ControlMaster string `yaml:"controlmaster,omitempty,flow" json:"ControlMaster,omitempty"` ControlPath string `yaml:"controlpath,omitempty,flow" json:"ControlPath,omitempty"` ControlPersist string `yaml:"controlpersist,omitempty,flow" json:"ControlPersist,omitempty"` DynamicForward string `yaml:"dynamicforward,omitempty,flow" json:"DynamicForward,omitempty"` EnableSSHKeysign string `yaml:"enablesshkeysign,omitempty,flow" json:"EnableSSHKeysign,omitempty"` EscapeChar string `yaml:"escapechar,omitempty,flow" json:"EscapeChar,omitempty"` ExitOnForwardFailure string `yaml:"exitonforwardfailure,omitempty,flow" json:"ExitOnForwardFailure,omitempty"` FingerprintHash string `yaml:"fingerprinthash,omitempty,flow" json:"FingerprintHash,omitempty"` ForwardAgent string `yaml:"forwardagent,omitempty,flow" json:"ForwardAgent,omitempty"` ForwardX11 string `yaml:"forwardx11,omitempty,flow" json:"ForwardX11,omitempty"` ForwardX11Timeout int `yaml:"forwardx11timeout,omitempty,flow" json:"ForwardX11Timeout,omitempty"` ForwardX11Trusted string `yaml:"forwardx11trusted,omitempty,flow" json:"ForwardX11Trusted,omitempty"` GatewayPorts string `yaml:"gatewayports,omitempty,flow" json:"GatewayPorts,omitempty"` GlobalKnownHostsFile string `yaml:"globalknownhostsfile,omitempty,flow" json:"GlobalKnownHostsFile,omitempty"` GSSAPIAuthentication string `yaml:"gssapiauthentication,omitempty,flow" json:"GSSAPIAuthentication,omitempty"` GSSAPIClientIdentity string `yaml:"gssapiclientidentity,omitempty,flow" json:"GSSAPIClientIdentity,omitempty"` GSSAPIDelegateCredentials string `yaml:"gssapidelegatecredentials,omitempty,flow" json:"GSSAPIDelegateCredentials,omitempty"` GSSAPIKeyExchange string `yaml:"gssapikeyexchange,omitempty,flow" json:"GSSAPIKeyExchange,omitempty"` GSSAPIRenewalForcesRekey string `yaml:"gssapirenewalforcesrekey,omitempty,flow" json:"GSSAPIRenewalForcesRekey,omitempty"` GSSAPIServerIdentity string `yaml:"gssapiserveridentity,omitempty,flow" json:"GSSAPIServerIdentity,omitempty"` GSSAPITrustDns string `yaml:"gssapitrustdns,omitempty,flow" json:"GSSAPITrustDns,omitempty"` HashKnownHosts string `yaml:"hashknownhosts,omitempty,flow" json:"HashKnownHosts,omitempty"` HostbasedAuthentication string `yaml:"hostbasedauthentication,omitempty,flow" json:"HostbasedAuthentication,omitempty"` HostbasedKeyTypes string `yaml:"hostbasedkeytypes,omitempty,flow" json:"HostbasedKeyTypes,omitempty"` HostKeyAlgorithms string `yaml:"hostkeyalgorithms,omitempty,flow" json:"HostKeyAlgorithms,omitempty"` HostKeyAlias string `yaml:"hostkeyalias,omitempty,flow" json:"HostKeyAlias,omitempty"` IdentitiesOnly string `yaml:"identitiesonly,omitempty,flow" json:"IdentitiesOnly,omitempty"` IdentityFile string `yaml:"identityfile,omitempty,flow" json:"IdentityFile,omitempty"` IgnoreUnknown string `yaml:"ignoreunknown,omitempty,flow" json:"IgnoreUnknown,omitempty"` IPQoS string `yaml:"ipqos,omitempty,flow" json:"IPQoS,omitempty"` KbdInteractiveAuthentication string `yaml:"kbdinteractiveauthentication,omitempty,flow" json:"KbdInteractiveAuthentication,omitempty"` KbdInteractiveDevices string `yaml:"kbdinteractivedevices,omitempty,flow" json:"KbdInteractiveDevices,omitempty"` KexAlgorithms string `yaml:"kexalgorithms,omitempty,flow" json:"KexAlgorithms,omitempty"` KeychainIntegration string `yaml:"keychainintegration,omitempty,flow" json:"KeychainIntegration,omitempty"` LocalCommand string `yaml:"localcommand,omitempty,flow" json:"LocalCommand,omitempty"` LocalForward string `yaml:"localforward,omitempty,flow" json:"LocalForward,omitempty"` LogLevel string `yaml:"loglevel,omitempty,flow" json:"LogLevel,omitempty"` MACs string `yaml:"macs,omitempty,flow" json:"MACs,omitempty"` Match string `yaml:"match,omitempty,flow" json:"Match,omitempty"` NoHostAuthenticationForLocalhost string `yaml:"nohostauthenticationforlocalhost,omitempty,flow" json:"NoHostAuthenticationForLocalhost,omitempty"` NumberOfPasswordPrompts string `yaml:"numberofpasswordprompts,omitempty,flow" json:"NumberOfPasswordPrompts,omitempty"` PasswordAuthentication string `yaml:"passwordauthentication,omitempty,flow" json:"PasswordAuthentication,omitempty"` PermitLocalCommand string `yaml:"permitlocalcommand,omitempty,flow" json:"PermitLocalCommand,omitempty"` PKCS11Provider string `yaml:"pkcs11provider,omitempty,flow" json:"PKCS11Provider,omitempty"` Port string `yaml:"port,omitempty,flow" json:"Port,omitempty"` PreferredAuthentications string `yaml:"preferredauthentications,omitempty,flow" json:"PreferredAuthentications,omitempty"` Protocol string `yaml:"protocol,omitempty,flow" json:"Protocol,omitempty"` ProxyUseFdpass string `yaml:"proxyusefdpass,omitempty,flow" json:"ProxyUseFdpass,omitempty"` PubkeyAuthentication string `yaml:"pubkeyauthentication,omitempty,flow" json:"PubkeyAuthentication,omitempty"` RekeyLimit string `yaml:"rekeylimit,omitempty,flow" json:"RekeyLimit,omitempty"` RemoteForward string `yaml:"remoteforward,omitempty,flow" json:"RemoteForward,omitempty"` RequestTTY string `yaml:"requesttty,omitempty,flow" json:"RequestTTY,omitempty"` RevokedHostKeys string `yaml:"revokedhostkeys,omitempty,flow" json:"RevokedHostKeys,omitempty"` RhostsRSAAuthentication string `yaml:"rhostsrsaauthentication,omitempty,flow" json:"RhostsRSAAuthentication,omitempty"` RSAAuthentication string `yaml:"rsaauthentication,omitempty,flow" json:"RSAAuthentication,omitempty"` SendEnv string `yaml:"sendenv,omitempty,flow" json:"SendEnv,omitempty"` ServerAliveCountMax int `yaml:"serveralivecountmax,omitempty,flow" json:"ServerAliveCountMax,omitempty"` ServerAliveInterval int `yaml:"serveraliveinterval,omitempty,flow" json:"ServerAliveInterval,omitempty"` StreamLocalBindMask string `yaml:"streamlocalbindmask,omitempty,flow" json:"StreamLocalBindMask,omitempty"` StreamLocalBindUnlink string `yaml:"streamlocalbindunlink,omitempty,flow" json:"StreamLocalBindUnlink,omitempty"` StrictHostKeyChecking string `yaml:"stricthostkeychecking,omitempty,flow" json:"StrictHostKeyChecking,omitempty"` TCPKeepAlive string `yaml:"tcpkeepalive,omitempty,flow" json:"TCPKeepAlive,omitempty"` Tunnel string `yaml:"tunnel,omitempty,flow" json:"Tunnel,omitempty"` TunnelDevice string `yaml:"tunneldevice,omitempty,flow" json:"TunnelDevice,omitempty"` UpdateHostKeys string `yaml:"updatehostkeys,omitempty,flow" json:"UpdateHostKeys,omitempty"` UsePrivilegedPort string `yaml:"useprivilegedport,omitempty,flow" json:"UsePrivilegedPort,omitempty"` User string `yaml:"user,omitempty,flow" json:"User,omitempty"` UserKnownHostsFile string `yaml:"userknownhostsfile,omitempty,flow" json:"UserKnownHostsFile,omitempty"` VerifyHostKeyDNS string `yaml:"verifyhostkeydns,omitempty,flow" json:"VerifyHostKeyDNS,omitempty"` VisualHostKey string `yaml:"visualhostkey,omitempty,flow" json:"VisualHostKey,omitempty"` XAuthLocation string `yaml:"xauthlocation,omitempty,flow" json:"XAuthLocation,omitempty"` // ssh-config fields with a different behavior HostName string `yaml:"hostname,omitempty,flow" json:"HostName,omitempty"` ProxyCommand string `yaml:"proxycommand,omitempty,flow" json:"ProxyCommand,omitempty"` // exposed assh fields Inherits []string `yaml:"inherits,omitempty,flow" json:"Inherits,omitempty"` Gateways []string `yaml:"gateways,omitempty,flow" json:"Gateways,omitempty"` ResolveNameservers []string `yaml:"resolvenameservers,omitempty,flow" json:"ResolveNameservers,omitempty"` ResolveCommand string `yaml:"resolvecommand,omitempty,flow" json:"ResolveCommand,omitempty"` NoControlMasterMkdir string `yaml:"nocontrolmastermkdir,omitempty,flow" json:"NoControlMasterMkdir,omitempty"` Aliases []string `yaml:"aliases,omitempty,flow" json:"Aliases,omitempty"` // contains filtered or unexported fields }
Host defines the configuration flags of a host
func (*Host) AddKnownHost ¶
AddKnownHost append target to the host' known hosts list
func (*Host) ApplyDefaults ¶
ApplyDefaults ensures a Host is valid by filling the missing fields with defaults
func (*Host) ExpandString ¶
type HostsMap ¶
HostsMap is a map of **Host).Name -> *Host
func (*HostsMap) SortedList ¶
SortedList returns a list of hosts sorted by their name
type OptionsList ¶
type OptionsList []Option
OptionsList is a list of options
func (*OptionsList) Remove ¶
func (ol *OptionsList) Remove(key string)
Remove removes an option from the list based on its key
func (*OptionsList) ToStringList ¶
func (ol *OptionsList) ToStringList() []string
ToStringList returns a list of string with the following format: `key=value`