summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Cady <d@jerkface.net>2022-10-09 16:43:33 -0400
committerAndrew Cady <d@jerkface.net>2022-10-09 16:43:33 -0400
commite7010e7c2c4edf6fac17656487d9b23e31f6d2bc (patch)
tree0e574fb8674a9e2b2997a6a9e3a9806535a0f46d
parentfe05915a8b7cb7c0496118dd3ca10bddb891c15a (diff)
toxish: files in ~/.ssh/config.d/ must end in .confHEADmaster
-rwxr-xr-xscripts/toxish11
1 files changed, 6 insertions, 5 deletions
diff --git a/scripts/toxish b/scripts/toxish
index a59671a..d55e8fd 100755
--- a/scripts/toxish
+++ b/scripts/toxish
@@ -67,15 +67,15 @@ function main
67function ssh_config_fragment 67function ssh_config_fragment
68{ 68{
69 cat <<EOF 69 cat <<EOF
70Host $name
71# Cryptographic trust comes from Hostname, which is a Tox key hash. 70# Cryptographic trust comes from Hostname, which is a Tox key hash.
72# 71#
73# We know we're talking to someone who has this key hash because Tox crypto 72# We know we're talking to someone who has this key hash because Tox's
74# verifies. 73# cryptography verifies that.
75# 74#
76# Thus we can safely disable StrictHostKeyChecking, and we can use this as a 75# Thus we can safely disable StrictHostKeyChecking, and we can use this as a
77# secure channel to obtain and save SSH public keys for the remote server. 76# secure channel to obtain and save SSH public keys for the remote server.
78 77
78Host $name
79StrictHostKeyChecking=no 79StrictHostKeyChecking=no
80Hostname=$toxid 80Hostname=$toxid
81ProxyCommand=tuntox -C ~/.tuntox/persist -i %h -W localhost:%p 81ProxyCommand=tuntox -C ~/.tuntox/persist -i %h -W localhost:%p
@@ -98,7 +98,8 @@ function tokssh_add
98 fi 98 fi
99 mkdir -p ~/.ssh/config.d 99 mkdir -p ~/.ssh/config.d
100 mkdir -p ~/.tuntox/persist 100 mkdir -p ~/.tuntox/persist
101 grep -q '^Include config\.d/\*' ~/.ssh/config || sed -i -e '1i Include config.d/*' ~/.ssh/config 101 line='Include config.d/*.conf'
102 grep -qF "$LINE" ~/.ssh/config || sed -i -e "1i $LINE" ~/.ssh/config
102 if grep -q "^Host $name" ~/.ssh/config 103 if grep -q "^Host $name" ~/.ssh/config
103 then 104 then
104 if [ "$exists_ok" ] 105 if [ "$exists_ok" ]
@@ -109,7 +110,7 @@ function tokssh_add
109 exit 1 110 exit 1
110 fi 111 fi
111 fi 112 fi
112 out=~/.ssh/config.d/$name 113 out=~/.ssh/config.d/$name.conf
113 if [ -e "$out" ] 114 if [ -e "$out" ]
114 then 115 then
115 if [ "$exists_ok" ] 116 if [ "$exists_ok" ]