[GH-ISSUE #384] Connect through Bastion using SSH config file #103

Closed
opened 2026-05-07 00:18:58 +02:00 by BreizhHardware · 4 comments

Originally created by @gotakasan on GitHub (Mar 29, 2023).
Original GitHub issue: https://github.com/ovh/the-bastion/issues/384

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 !

Originally created by @gotakasan on GitHub (Mar 29, 2023). Original GitHub issue: https://github.com/ovh/the-bastion/issues/384 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 !
Author
Owner

@speed47 commented on GitHub (Mar 31, 2023):

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?

<!-- gh-comment-id:1491809732 --> @speed47 commented on GitHub (Mar 31, 2023): 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?
Author
Owner

@gotakasan commented on GitHub (Apr 3, 2023):

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.

<!-- gh-comment-id:1494251197 --> @gotakasan commented on GitHub (Apr 3, 2023): 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.
Author
Owner

@gotakasan commented on GitHub (Apr 6, 2023):

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

<!-- gh-comment-id:1498786380 --> @gotakasan commented on GitHub (Apr 6, 2023): 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`
Author
Owner

@speed47 commented on GitHub (Apr 18, 2023):

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

<!-- gh-comment-id:1512565982 --> @speed47 commented on GitHub (Apr 18, 2023): I think I'll add this to the FAQ, thanks.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/the-bastion#103
No description provided.