SSH GatewayPorts setting only for particular port

Viewed 395

I'm trying to establish a reverse ssh tunnel with GatewayPorts set to no for all ports apart from a particular port (e.g 2222)

I have tried the following setting in sshd_config

Match LocalPort 2222
    GatewayPorts yes

I have verified the config using

sshd -T -C lport=2222 | grep -i 'gateway'
> gatewayports yes

sshd -T -C lport=3333 | grep -i 'gateway'
> gatewayports no

While ports other than 2222 get established with the expected setting, reverse tunnel using port 2222 still binds to localhost instead of 0.0.0.0

The ssh version I am using is

ssh -V
> OpenSSH_8.2p1 Ubuntu-4ubuntu0.3, OpenSSL 1.1.1f  31 Mar 2020

Any help regarding this will be much appreciated

Thanks in advance

0 Answers
Related