tokyoturnip
04-02-2006, 05:28
Can someone please verify if I have my iptables setup properly?
I am attempting to nat 443 to 22, so I can connect from work.
I followed the tutorial on the macsat site, as well as Oleg's custom firmware page. About the only that is differnet from the macsat tutorial is listening for 443 and sending it to 22. I then added in --syn based on Oleg's script.
I am saving to disk using flashfs and flashfs commit and flashfs enable so I know it is remaning through the reboot.
Attempting to connect using putty from a remote machine times out.
below is the /usr/local/sbin/post-firewall script.
#!/bin/sh
iptables -D INPUT -j DROP
iptables -A INPUT -p tcp --syn --dport 443 -j ACCEPT
iptables -t nat -A PREROUTING -i $1 -p tcp --dport 443 -j DNAT --to-destination $4:22
iptables -A INPUT -j DROP
below is iptable -L -vn -t nat output (I substitutied .xxx.xxx for my protection)
The xbox UpnP (3074) can be ignored.
[tokyoturnip@(none) root]$ iptables -L -vn -t nat
Chain PREROUTING (policy ACCEPT 106 packets, 10096 bytes)
pkts bytes target prot opt in out source destination
0 0 DNAT udp -- * * 0.0.0.0/0 68.50.xxx.xxx udp dpt:3074 to:192.168.1.21:3074
0 0 NETMAP udp -- * * 0.0.0.0/0 68.50.xxx.xxx udp spt:6112 192.168.1.0/24
3 144 DNAT tcp -- vlan1 * 0.0.0.0/0 0.0.0.0/0 tcp dpt:443 to:192.168.1.1:22
Chain POSTROUTING (policy ACCEPT 67 packets, 4064 bytes)
pkts bytes target prot opt in out source destination
0 0 NETMAP udp -- * * 192.168.1.0/24 0.0.0.0/0 udp dpt:6112 68.50.240.143/32
42 2735 MASQUERADE all -- * vlan1 !68.50.xxx.xxx 0.0.0.0/0
10 1184 MASQUERADE all -- * br0 192.168.1.0/24 192.168.1.0/24
Chain OUTPUT (policy ACCEPT 77 packets, 5248 bytes)
pkts bytes target prot opt in out source destination
Any help would be apprecited.
Since we are on the subject of SSH, where is the dropbear configuration file to deny root login access and force public key usage?
Thanks Oleg and many others on this forum
tokyoturnip
I am attempting to nat 443 to 22, so I can connect from work.
I followed the tutorial on the macsat site, as well as Oleg's custom firmware page. About the only that is differnet from the macsat tutorial is listening for 443 and sending it to 22. I then added in --syn based on Oleg's script.
I am saving to disk using flashfs and flashfs commit and flashfs enable so I know it is remaning through the reboot.
Attempting to connect using putty from a remote machine times out.
below is the /usr/local/sbin/post-firewall script.
#!/bin/sh
iptables -D INPUT -j DROP
iptables -A INPUT -p tcp --syn --dport 443 -j ACCEPT
iptables -t nat -A PREROUTING -i $1 -p tcp --dport 443 -j DNAT --to-destination $4:22
iptables -A INPUT -j DROP
below is iptable -L -vn -t nat output (I substitutied .xxx.xxx for my protection)
The xbox UpnP (3074) can be ignored.
[tokyoturnip@(none) root]$ iptables -L -vn -t nat
Chain PREROUTING (policy ACCEPT 106 packets, 10096 bytes)
pkts bytes target prot opt in out source destination
0 0 DNAT udp -- * * 0.0.0.0/0 68.50.xxx.xxx udp dpt:3074 to:192.168.1.21:3074
0 0 NETMAP udp -- * * 0.0.0.0/0 68.50.xxx.xxx udp spt:6112 192.168.1.0/24
3 144 DNAT tcp -- vlan1 * 0.0.0.0/0 0.0.0.0/0 tcp dpt:443 to:192.168.1.1:22
Chain POSTROUTING (policy ACCEPT 67 packets, 4064 bytes)
pkts bytes target prot opt in out source destination
0 0 NETMAP udp -- * * 192.168.1.0/24 0.0.0.0/0 udp dpt:6112 68.50.240.143/32
42 2735 MASQUERADE all -- * vlan1 !68.50.xxx.xxx 0.0.0.0/0
10 1184 MASQUERADE all -- * br0 192.168.1.0/24 192.168.1.0/24
Chain OUTPUT (policy ACCEPT 77 packets, 5248 bytes)
pkts bytes target prot opt in out source destination
Any help would be apprecited.
Since we are on the subject of SSH, where is the dropbear configuration file to deny root login access and force public key usage?
Thanks Oleg and many others on this forum
tokyoturnip