Skip to content

Commit ec9c157

Browse files
committed
Fix SSH wrapper script to ensure password handling is correctly implemented and update ttyd installation to include sshpass
1 parent 58cd068 commit ec9c157

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

ssh_wrapper.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,13 @@ if [ -n "$port" ]; then
1010
ssh_options+=(-p $port)
1111
fi
1212

13+
password=$(jq -r .password $filename)
14+
if [ -n "$password" ]; then
15+
TMP_PASS=$(mktemp)
16+
echo "$password" > $TMP_PASS
17+
sshpass_command="sshpass -f $TMP_PASS"
18+
fi
19+
1320
key=$(jq -r .key $filename)
1421
if [ -n "$key" ]; then
1522
TMP_KEY=$(mktemp)
@@ -21,4 +28,4 @@ fi
2128

2229
destination=$(jq -r .destination $filename)
2330

24-
exec ssh -o ConnectTimeout=5 -o StrictHostKeyChecking=no "${ssh_options[@]}" "$destination"
31+
exec $sshpass_command ssh -o ConnectTimeout=5 -o StrictHostKeyChecking=no "${ssh_options[@]}" "$destination"

ttyd_wrapper.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
if ! command -v ttyd &> /dev/null; then
22
echo "ttyd not found, installing..."
33
sudo apt update
4-
sudo apt install -y ttyd
4+
sudo apt install -y ttyd sshpass
55
fi
66

77
if [ ! -x ssh_wrapper.sh ]; then

0 commit comments

Comments
 (0)