Documentation
¶
Index ¶
- Variables
- func AddKeyToSSHAgent(keyPath string) error
- func ClearDefaultBot() error
- func CreateDefaultUserConfigFile(keyPath string) error
- func GetDefaultBotAndTeam() (string, string, error)
- func GetDefaultSSHUser() (string, error)
- func GetKeybaseBinaryPath() string
- func InitLogging()
- func MakeDotSSH() error
- func SetDefaultBot(botName string) error
- func SetDefaultSSHUser(username string) error
- func SetKeybaseBinaryPath(path string) error
- type CLIArgument
- type Config
- type LocalConfigFile
- type ParsedCLIArgument
- type Requester
- func (r *Requester) GetSignedKey(botName string, request shared.SignatureRequest) (shared.SignatureResponse, error)
- func (r *Requester) LoadConfig(teamName string) (*Config, error)
- func (r *Requester) LoadConfigForBot(botName string) (Config, error)
- func (r *Requester) LoadConfigs() (configs []Config, botNames []string, err error)
Constants ¶
This section is empty.
Variables ¶
var AlternateSSHConfigFile = shared.ExpandPathWithTilde("~/.ssh/kssh-config")
Functions ¶
func AddKeyToSSHAgent ¶
Add the SSH key at the given location to the currently running SSH agent. Errors if there is no running ssh-agent.
func ClearDefaultBot ¶
func ClearDefaultBot() error
ClearDefaultBot clears the default bot and team.
func CreateDefaultUserConfigFile ¶
Create an SSH config file that inherits from the default SSH config file but sets a default SSH user
func GetDefaultBotAndTeam ¶
GetDefaultBotAndTeam gets the default bot and team for kssh from the local config file.
func GetDefaultSSHUser ¶
Get the default SSH user to use for kssh connections. Empty if no user is configured.
func GetKeybaseBinaryPath ¶
func GetKeybaseBinaryPath() string
func InitLogging ¶
func InitLogging()
func SetDefaultBot ¶
SetDefaultBot sets the default keybaseca bot and team to communicate with. If given a botName, will need to start a Keybase bot to find and load all configs from KV store, in order to find the team associated with the given botName.
func SetDefaultSSHUser ¶
Set the default SSH user to use for kssh connections.
func SetKeybaseBinaryPath ¶
Set the default SSH user to use for kssh connections.
Types ¶
type CLIArgument ¶
type CLIArgument struct {
// The name of the flag eg "--foo"
Name string
// HasArgument:true if an argument comes after it (eg "--foo bar") false if it is a boolean flag (eg "--help")
HasArgument bool
// Preserve:true if you wish to preserve this argument into the list of remaining arguments even if found
// eg if your command takes in a `-v` flag and the subcommand also takes in a `-v` flag
// incompatible with HasArgument: true but only because that has not been built
Preserve bool
}
type Config ¶
type Config struct {
TeamName string `json:"teamname"`
ChannelName string `json:"channelname"`
BotName string `json:"botname"`
}
Config is provided by the keybaseca server and lives in the KV store. It is used to share configuration information about how kssh should communicate with the keybaseca chat bot.
type LocalConfigFile ¶
type LocalConfigFile struct {
DefaultBotName string `json:"default_bot"`
DefaultBotTeam string `json:"default_team"`
DefaultSSHUser string `json:"default_ssh_user"`
KeybaseBinPath string `json:"keybase_binary"`
}
A LocalConfigFile is a file that lives on the FS of the computer running kssh. By default (and for most users), this file is not used.
If a user of kssh is in in multiple teams that are running the CA bot they can configure a default bot to communicate with. Note that we store the team in here (even though it wasn't specified by the user) so that we can avoid doing a call to `LoadConfigs` if a default is set. This is controlled via `kssh --set-default-bot foo`.
If a user of kssh wishes to configure a default ssh user to use (see README.md for a description of why this may be useful) this is also stored in the local config file. This is controlled via `kssh --set-default-user foo`.
type ParsedCLIArgument ¶
type ParsedCLIArgument struct {
// The CLIArgument that was found and parsed
Argument CLIArgument
// The value associated with it if HasArgument:true. Otherwise an empty string.
Value string
}
func ParseArgs ¶
func ParseArgs(args []string, cliArguments []CLIArgument) ([]string, []ParsedCLIArgument, error)
ParseArgs parses os.Args for use with kssh. This is handwritten rather than using go's flag library (or any other CLI argument parsing library) since we want to have custom arguments and access any other remaining arguments. See this Github discussion for a longer discussion of why this is implemented this way: https://github.com/keybase/bot-sshca/pull/3#discussion_r302740696
Returns: a list of the remaining unparsed arguments, a list of the parsed arguments, error
type Requester ¶
type Requester struct {
// contains filtered or unexported fields
}
func NewRequester ¶
NewRequester creates a new Requester with a Keybase chat API
func (*Requester) GetSignedKey ¶
func (r *Requester) GetSignedKey(botName string, request shared.SignatureRequest) (shared.SignatureResponse, error)
Get a signed SSH key from interacting with the CA chatbot
func (*Requester) LoadConfig ¶
LoadConfig loads the kssh config for the given teamName. Will return a nil Config if no config was found for the teamName (and no error occurred)
func (*Requester) LoadConfigForBot ¶
LoadConfigForBot gets the Config associated with the given botName. Will need to find and load all configs from KV store.