SSH url sheme customization

57 views
Skip to first unread message

Claude Brassel

unread,
Mar 2, 2022, 5:34:30 AM3/2/22
to iterm2-discuss
Hi all,

I'm using most of the time the Mac OS open command to launch my sessions, example :

open "ssh://user@remote:port" with works great.

But I need to integrate a WALLIX Bastion in the middle of the chain, when I'm connecting I'm using the ssh like this :

ssh -l destination_user@destination_host:SSH:bastion_user bastion_address

Which works great, but I don't find a way to integrate the ssh syntax into the url scheme I have always some errors :
open "ssh://destination_user@destination_host:SSH:bastion_user@bastion_address:22"
No application knows how to open URL ssh://destination_user@destination_host:SSH:bastion_user@bastion_address:22 (Error Domain=NSOSStatusErrorDomain Code=-10814 "kLSApplicationNotFoundErr: E.g. no application claims the file" UserInfo={_LSLine=1489, _LSFunction=runEvaluator}).


Any idea how it can be handled ?

Regard's
Claude

Richard Mitchell

unread,
Mar 2, 2022, 6:08:24 AM3/2/22
to iterm2-discuss
Yes.  Add entries to your .ssh/config with something like:

Host destination_host        # essentially a nickname
Hostname name                  # hostname or IP bastion will use to location it
User   username                  # username you use to login on destination
ProxyCommand ssh bastion -W  %h:%p



You may want to create a similar entry for bastion, but without ProxyCommand

To use, just:

ssh destination_host

and all of the tunneling just happens.

Claude Brassel

unread,
Mar 2, 2022, 10:20:45 AM3/2/22
to iterm2-discuss
Hi,
thank you for the help, but it seem's not to work with WALLIX Bastion :
.ssh/config :
----------------------
Host bastion
    AddKeysToAgent yes
    ForwardAgent yes
    User bastion_user

Host linux
        Hostname host_ip_address
        User remote_host_user

        ProxyCommand ssh bastion -W  %h:%p
---------------------

# ssh linux
Received disconnect from bastion port 22:11: Disconnection
Disconnected from bastion port 22
kex_exchange_identification: Connection closed by remote host
Connection closed by UNKNOWN port 65535

But In any case, using .ssh/config entry for every host is not the best way to handle this for me, if I can construct a functioning ssh:// url for iterm2 it will be more flexible, but adding some entry's for the bastion is ok.

Regard's
Claude
Reply all
Reply to author
Forward
0 new messages