Documentation ¶
Index ¶
- Variables
- func AskPassword() string
- func AskPasswordStartDecrypt(timeout time.Duration, configFile string)
- func AskUsername() string
- func ConnectEncServer(name string) (*rpc.RequestProcessorClient, error)
- func ConvertMap(in interface{}) interface{}
- func Decode(in, out interface{})
- func DecryptUserConfig(file string)
- func DefaultAsk(prompt string) string
- func DefaultAskPasswordWithPrompt(prompt string) string
- func InsecureAllowed() bool
- func MustConnectEncServer(file string) *rpc.RequestProcessorClient
- func ReadUserConfig(file string)
- func StartDecrypt(password string, timeout time.Duration, configFile string)
- func ValidateInsecureURL(url string)
- func WriteConfig(cfgFile string, cfg Configuration) error
- func WriteUserConfig(cfgFile string) error
- type Configuration
- type Profile
- type Remote
Constants ¶
This section is empty.
Variables ¶
var Ask = DefaultAsk
Ask prompts a string, asks, and returns what user entered
var AskPasswordWithPrompt = DefaultAskPasswordWithPrompt
AskPasswordWithPrompt prints a prompt and gets password
var DefaultEncTimeout = 10 * time.Minute
DefaultEncTimeout is 10 minutes, the default idle timeout for the took decrypt agent
var UserCfgFile string
Functions ¶
func AskPassword ¶ added in v1.6.0
func AskPassword() string
AskPassword asks "Password" and reads the password
func AskPasswordStartDecrypt ¶ added in v1.6.0
AskPasswordStartDecrypt asks password and starts the decrypt server with the given timout
func AskUsername ¶ added in v1.6.0
func AskUsername() string
AskUsername asks "user name" and reads input
func ConnectEncServer ¶ added in v1.6.0
func ConnectEncServer(name string) (*rpc.RequestProcessorClient, error)
ConnectEncServer attempts to connect the decryption agent
func ConvertMap ¶ added in v1.6.0
func ConvertMap(in interface{}) interface{}
ConvertMap converts map[interface{}]interface{} into map[string]interface{}
func DecryptUserConfig ¶ added in v1.6.0
func DecryptUserConfig(file string)
DecryptUserConfig decrypts the user config if it is encrypted. After this call, Data and Configuration members of the configuration are set, and EData and ECfg are set to empty
func DefaultAsk ¶ added in v1.7.0
DefaultAsk asks something to the user and returns it. Panics on error
func DefaultAskPasswordWithPrompt ¶ added in v1.7.0
DefaultAskPasswordWithPrompt prompts, and asks password
func InsecureAllowed ¶ added in v1.6.0
func InsecureAllowed() bool
InsecureAllowed returns true if program path has -insecure in it.
func MustConnectEncServer ¶ added in v1.6.0
func MustConnectEncServer(file string) *rpc.RequestProcessorClient
MustConnectEncServer connects to decryption agent and exists if fails
func ReadUserConfig ¶
func ReadUserConfig(file string)
ReadUserConfig reads the user configuration file and sets UserCfg
func StartDecrypt ¶ added in v1.6.0
StartDecrypt starts another copy of took with decrypt x flag, and passes the password. Panics on fail
func ValidateInsecureURL ¶ added in v1.6.0
func ValidateInsecureURL(url string)
ValidateInsecureURL validates that a URL is https, or insecure URLs are allowd
func WriteConfig ¶
func WriteConfig(cfgFile string, cfg Configuration) error
WriteConfig writes configuration to the file
func WriteUserConfig ¶
WriteUserConfig writes the user config file
Types ¶
type Configuration ¶
type Configuration struct { AuthKey string `yaml:"key,omitempty"` Remotes map[string]Remote `yaml:"remotes,omitempty"` ServerProfiles map[string]Profile `yaml:"serverProfiles,omitempty"` }
Configuration declares the structure of the config file
var CommonCfg Configuration
CommonCfg is the common config from /etc/tool.yaml
var UserCfg Configuration
UserCfg is the user's config
func ReadCommonConfig ¶
func ReadCommonConfig() Configuration
ReadCommonConfig reads the common configuration file under /etc/took.yaml
func (Configuration) GetServerProfile ¶
func (c Configuration) GetServerProfile(name string) Profile
GetServerProfile returns a server profile by name. Returns empty profile if not found
type Profile ¶
type Profile struct { Type string `yaml:"type"` Configuration interface{} `yaml:"cfg,omitempty"` }
Profile is combines the type and the type-specific configuration of a server profile
func GetServerProfile ¶
GetServerProfile returns the server profile from user cfg. If there is none, then it returns the profile from common cfg. If common cfg does not have a profile, it'll return empty profile
type Remote ¶
type Remote struct { // Type is the auth protocol Type string `yaml:"type"` // Configuration is the prototocol specific configuration Configuration interface{} `yaml:"cfg,omitempty"` // Data contains the protocol specific token information Data interface{} `yaml:"data,omitempty"` // ECfg is the encrypted configuration. Only one of Configuration or Ecfg is nonempty ECfg string `yaml:"ecfg,omitempty"` // EData is the encrypted data. Only one of Data or EData is nonempty EData string `yaml:"edata,omitempty"` }
Remote defines a remote auth configuration