Ability to use a SSH Config File
See original GitHub issueDescribe the feature I would like to suggest a new subnet detection feature that dynamically chooses a hostname/IP to connect to based on which network the app is running from, configured for each connection.
e.g. if I’m on my home network and the app detects I’m on a specified subnet such as 192.168.0.x, I would like the app to connect to a local IP address. If I’m connecting from a network other than the specified one (ie roaming on my iPhone), it uses another hostname such as an external URL (my.homenet.com).
I can illustrate this based on a method I use with .ssh/config (which as it happens also uses another feature request - ProxyJump)
Match exec "/Users/user1/onsubnet 192.168.1." host raspi1
Hostname 192.168.1.100
Port 22
User pi
Match exec "/Users/user1/onsubnet --not 192.168.1." host raspi1
ProxyJump proxypi
Hostname 192.168.1.100
User pi
Port 22
Host proxypi
HostName my.homenet.com
Port 8700
User pi
The file /Users/user1/onsubnet is a script I found that helps determine your subnet on a Mac. I realise it couldn’t be used in the app like this, but I’m including it here in case it helps.
if [[ "$1" == "--help" ]] || [[ "$1" == "-h" ]] || [[ "$1" == "" ]] ; then
printf "Usage:\n\tonsubnet [ --not ] partial-ip-address\n\n"
printf "Example:\n\tonsubnet 10.10.\n\tonsubnet --not 192.168.0.\n\n"
printf "Note:\n\tThe partial-ip-address must match starting at the first\n"
printf "\tcharacter of the ip-address, therefore the first example\n"
printf "\tabove will match 10.10.10.1 but not 110.10.10.1\n"
exit 0
fi
on=0
off=1
if [[ "$1" == "--not" ]] ; then
shift
on=1
off=0
fi
regexp="^$(sed 's/\./\\./g' <<<"$1")"
if [[ "$(uname)" == "Darwin" ]] ; then
ifconfig | fgrep 'inet ' | fgrep -v 127.0.0. | cut -d ' ' -f 2 | egrep "$regexp" >/dev/null
else
hostname -I | tr -s " " "\012" | fgrep -v 127.0.0. | egrep "$regexp" >/dev/null
fi
if [[ $? == 0 ]]; then
exit $on
else
exit $off
fi
In the absence of this feature I could always specify the external URL, but I’m not sure if that would work with ProxyJump where a connection to an internal device would keep having to hop via my proxypi to its destination when I’m at home.
The other alternative would be to have two connections - one local and one remote. This would work fine, but it would be neater if I only needed to configure one host.
Hope this makes sense. Thanks.
Issue Analytics
- State:
- Created 2 years ago
- Comments:13 (7 by maintainers)
Top GitHub Comments
Hi @jarrah31 👋
Thank you so much for your strong feedback!
You’re right WebSSH needs to have the connections created in order to work as it. Yes import from the SSH Config could be a great addition!
Only one drawback : Hosts with wildcard “*” won’t be imported
I’m creating an issue to track import from SSH Config File : https://github.com/isontheline/pro.webssh.net/issues/792
When implemented it should check within the “Keys inside WebSSH Settings UI” and if the key name has not been found it should check if a file exists named by the “IdentifyFile” parameter.
oh well noted. (since I’m the IT I did not consider this… would be using two profiles then.)