Passing last IP octet to a host alias and have it added to complete full proxycommand with ip address
0
votes
0
answers
41
views
I wish to have this all done in the ssh config file for a specific user. The site has hard-coded ip addresses into there various software and using the naming convention is not really an option.
Host bast.aws1.prod
HostName bastion.aws1.chaos.com
User chaos
Host *.aws1.prod
User chaos
Proxycommand ssh bast.aws1.prod -W 192.168.10.echo %h | cut -d. -f1
:%p
Host bast.aws2.prod
HostName bastion.aws2.chaos.com
User chaos
Host *.aws2.prod
User chaos
Proxycommand ssh bast.aws2.prod -W 192.168.12.echo %h | cut -d. -f1
:%p
So if I run the following command:
**ssh 169.aws2.prod** it should execute within the proxy command **"ssh bast.aws2.prod -W 192.168.12.169:22"**
but it executes **"ssh bast.aws2.prod -W 192.168.12.echo %h | cut -d. -f1:22"** instead.
***What is the best way to pass the last octet to the value within the proxycommand?***
Alternative ways are welcome.
Asked by Chaos
(1 rep)
May 17, 2024, 03:50 PM