Skip to contentSkip to conversation

Adding listening ports

DISCUSSION Richard Plana 2 participants 2 messages Jul 29, 2003

lore
Share & tools
lore
#0 lore raw

Hi,

Because of (overly?) strict security policies at our company, one can only make TCP connections to ports 80 and 443. I was wondering if netfilter could be used to redirect packets destined for port 443 to the listening sshd daemon on port 22 on an external machine.

I tried "iptables -I RH-Lokkit-0-50-INPUT 5 -p tcp -m tcp --dport 443 --syn -j ACCEPT" (I'm using RedHat's default config) and "iptables -t nat -A PREROUTING -p tcp --dport 443 -j DNAT --to-destination 127.0.0.1:22" to do the actual routing, but that didn't seem to work:

$ ssh -p 443 localhost
ssh: connect to host localhost port 443: Connection refused

Suggestions would be appreciated.

Signature · 3 lines
*Richard Neal Plana, B.Sc., CCNA*
Lead Software Engineer
Zi Corp.
#1 lore raw

Hello...

You can also add "Port 443" to /etc/ssh/sshd_config or whatever your ssh config file is.

Greets
Sebastian.

Quoted 36 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Richard Plana
Sent: Tuesday, July 29, 2003 9:07 PM
To: [email protected]
Subject: Adding listening ports

Hi,

Because of (overly?) strict security policies at our company, one can only make TCP connections to ports 80 and 443. I was wondering if netfilter could be used to redirect packets destined for port 443 to the
listening sshd daemon on port 22 on an external machine.

I tried "iptables -I RH-Lokkit-0-50-INPUT 5 -p tcp -m tcp --dport 443
--syn -j ACCEPT" (I'm using RedHat's default config) and "iptables -t nat -A PREROUTING -p tcp --dport 443 -j DNAT --to-destination 127.0.0.1:22" to do the actual routing, but that didn't seem to work:

$ ssh -p 443 localhost
ssh: connect to host localhost port 443: Connection refused

Suggestions would be appreciated.

Signature · 3 lines
*Richard Neal Plana, B.Sc., CCNA*
Lead Software Engineer
Zi Corp.