Example #1
0
// FromFile loads an AWSCredentialStore from the given file and decrypts it
func FromFile(filename string, pass *security.DatabasePassword) (*AWSCredentialStore, error) {
	enc, err := ioutil.ReadFile(filename)
	if err != nil {
		return nil, err
	}

	dec, err := pass.Decrypt(enc)
	if err != nil {
		return nil, err
	}

	t := &AWSCredentialStore{
		databasePassword: pass,
		storageFile:      filename,
	}
	err = yaml.Unmarshal(dec, t)
	return t, err
}
Example #2
0
func actionCmdUnlock(cmd *cobra.Command, args []string) {
	var pwd *security.DatabasePassword
	var err error

	if len(cfg.Password) > 0 {
		pwd = security.LoadDatabasePasswordFromInput(cfg.Password)
	} else {
		line, err := speakeasy.Ask("Password: "******"%s.lock", cfg.Database))
	if err != nil {
		log.Errorf("Unable to spawn lockagent: %s", err)
		return
	}

	fmt.Println("Database unlocked.")
}