aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--conf/config.sample.yml7
-rw-r--r--src/c_exec.go6
-rw-r--r--src/c_hardflip.go2
-rw-r--r--src/c_init.go3
-rw-r--r--src/c_parse.go6
5 files changed, 20 insertions, 4 deletions
diff --git a/conf/config.sample.yml b/conf/config.sample.yml
index 6d713d7..d4c27c7 100644
--- a/conf/config.sample.yml
+++ b/conf/config.sample.yml
@@ -4,6 +4,13 @@ icons: true
# keeps going after a successful login
loop: true
+# gnupg public key id used for encrypting/decrypting passwords.
+# if not set, passwords will be disabled. session programs will most likely
+# prompt you then.
+# set it to 'plain' for saving passwords in plain text (not recommended
+# but still)
+gpg: plain
+
# displays the percentage in the bottom right
percent: false
diff --git a/src/c_exec.go b/src/c_exec.go
index 129ff89..145d1f0 100644
--- a/src/c_exec.go
+++ b/src/c_exec.go
@@ -84,8 +84,12 @@ func c_format_ssh_jump(host *HostNode) string {
}
func c_format_ssh(host *HostNode) []string {
- cmd_fmt := []string{"ssh"}
+ cmd_fmt := []string{}
+ if len(host.Pass) > 0 {
+ cmd_fmt = append(cmd_fmt, "sshpass", "-p", host.Pass)
+ }
+ cmd_fmt = append(cmd_fmt, "ssh")
if len(host.Priv) > 0 {
cmd_fmt = append(cmd_fmt, "-i", host.Priv)
}
diff --git a/src/c_hardflip.go b/src/c_hardflip.go
index fa6dfb4..fc6ca69 100644
--- a/src/c_hardflip.go
+++ b/src/c_hardflip.go
@@ -64,6 +64,6 @@ type HardData struct {
func main() {
data_dir := c_get_data_dir(nil)
- opts := HardOpts{true, true, false, ""}
+ opts := HardOpts{true, true, "plain", false, ""}
i_ui(data_dir, opts)
}
diff --git a/src/c_init.go b/src/c_init.go
index 5c9f115..8981099 100644
--- a/src/c_init.go
+++ b/src/c_init.go
@@ -59,6 +59,7 @@ import (
type HardOpts struct {
Icon bool
Loop bool
+ GPG string
Perc bool
Term string
}
@@ -89,7 +90,7 @@ func c_recurse_data_dir(dir, root string, opts HardOpts,
c_recurse_data_dir(dir + filename + "/", root, opts, ldirs,
file.Name(), &dir_node, depth + 1, ui, load_err)
} else if filepath.Ext(filename) == ".yml" {
- host_node, err := c_read_yaml_file(root + dir + filename, ui)
+ host_node, err := c_read_yaml_file(root + dir + filename, opts, ui)
if err != nil {
*load_err = append(*load_err, err)
} else if host_node != nil {
diff --git a/src/c_parse.go b/src/c_parse.go
index faa8223..3a58558 100644
--- a/src/c_parse.go
+++ b/src/c_parse.go
@@ -58,7 +58,8 @@ import (
"gopkg.in/yaml.v3"
)
-func c_read_yaml_file(file string, ui *HardUI) (*HostNode, error) {
+func c_read_yaml_file(file string,
+ opts HardOpts, ui *HardUI) (*HostNode, error) {
var host HostNode
yaml_file, err := os.ReadFile(file)
@@ -68,6 +69,9 @@ func c_read_yaml_file(file string, ui *HardUI) (*HostNode, error) {
if err := yaml.Unmarshal(yaml_file, &host); err != nil {
return nil, err
}
+ if len(opts.GPG) == 0 {
+ host.Pass = ""
+ }
if len(host.Name) == 0 {
return nil, nil
}