ovh / the-bastion

Authentication, authorization, traceability and auditability for SSH accesses.
https://ovh.github.io/the-bastion/
Other
1.48k stars 88 forks source link

Connect through Bastion using SSH config file #384

Closed gotakasan closed 1 year ago

gotakasan commented 1 year ago

Hello !

Did you managed to use SSH config file to connect on remote server through Bastion ?

I tried to use ProxyCommand (before seeing on FAQ that I can't :/) but impossible.

Thanks for your help !

speed47 commented 1 year ago

Hello,

Do you mean that, if for example your alias to connect through your bastion is bssh, you would like to be able to type something like bssh myserver, were information about myserver would be given in your ~/.ssh/config file?

gotakasan commented 1 year ago

In fact, I wanted to connect with ssh command (and have word completion for servers given in my ~/.ssh/config file) through my Bastion. I want to deploy the solution on my infrastructure and I want it to be the more transparent possible for users.

gotakasan commented 1 year ago

I manage to do it :

Host BASTION_NAME
    Hostname BASTION_IP # OR DNS
    User BASTION_USER
    IdentityFile PUB_KEY # FOR THE BASTION
    Port BASTION_PORT
        ForwardAgent yes
Host SERVER
    Hostname BASTION_NAME
    RequestTTY yes
    RemoteCommand SERVER_USER@SERVER
    User BASTION_USER
    Port BASTION_PORT

So I just have to enter ssh SERVER and it will connect throught my bastion.

PS : The first block is not really used in second one. It just to connect to my bastion with ssh BASTION_NAME or to reuse it in Hostname BASTION_NAME

speed47 commented 1 year ago

I think I'll add this to the FAQ, thanks.