From e66e302cea1e562ac5030c3855d6e14fb0b64243 Mon Sep 17 00:00:00 2001 From: Patrick Spek Date: Thu, 26 May 2022 20:59:41 +0200 Subject: Alter the configuration used for ssh --- CHANGELOG.md | 5 +++-- lib/subcommands/ssh.bash | 14 +++++--------- share/doc/bashtard.1.scd | 2 +- 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3342642..cbe97d4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,8 +24,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed -- The `ssh` subcommand should now only check for `ssh.host`, and show an appropriate - warning if one is not set for a node. +- The `ssh` subcommand's configuration has been nested under `bashtard`, e.g. + `ssh.host` is now `bashtard.ssh.host`. It should also be correctly using this + value for establishing the SSH connection. - `svc_enable()` now checks for the `rc.d` file to exist before running `grep` on it. - `pkg_*()` functions no longer _require_ a `pkg.*` value to be defined. If one diff --git a/lib/subcommands/ssh.bash b/lib/subcommands/ssh.bash index bc3fb9b..563aa73 100644 --- a/lib/subcommands/ssh.bash +++ b/lib/subcommands/ssh.bash @@ -6,10 +6,6 @@ subcommand() { - local ssh - - ssh="$(config "app.ssh")" - if [[ ! -d "$BASHTARD_ETCDIR/hosts.d" ]] then crit "$BASHTARD_NAME/ssh" "Could not find hosts file at $BASHTARD_ETCDIR/hosts.d" @@ -23,18 +19,18 @@ subcommand() local user local host - user="$(config_for "$node" "ssh.user" "root")" - host="$(config_for "$node" "ssh.host" "$(config_for "$node" "vpn.ipv4")")" + user="$(config_for "$node" "bashtard.ssh.user" "$USER")" + host="$(config_for "$node" "bashtard.ssh.host" "$(config_for "$node" "vpn.ipv4")")" if [[ -z "$host" ]] then - crit "ssh" "ssh.host is not configured for $node" + crit "$BASHTARD_NAME/ssh" "bashtard.ssh.host is not configured for $node" continue fi - notice "ssh" "$user@$node ($host) > $*" + notice "$BASHTARD_NAME/ssh" "$user@$node ($host) > $*" - $ssh "$user@$host" "$@" + ssh "$user@$host" "$@" unset user unset host diff --git a/share/doc/bashtard.1.scd b/share/doc/bashtard.1.scd index 23822bf..4158169 100644 --- a/share/doc/bashtard.1.scd +++ b/share/doc/bashtard.1.scd @@ -60,7 +60,7 @@ package management interface accross all their machines. ## ssh Run a given command over SSH to all configured nodes. Every node needs to have -*ssh.host* configured for this to work. +*bashtard.ssh.host* configured for this to work. ## sync -- cgit v1.1