Hi guys,
I'm having few problems with my jail and pf setup. I would need to connect to my jail's ssh port from the internet with other port like 22222. I also have sshd running on my server but I use other ports for that. The network works fine with the jail, but I just cannot connect there from the web.
The alias interface for jail is in the internal interface rl0, because my internal network doesn't work when I put it to the nfe0 interface.
internet -> server (with jail 192.168.0.60) -> 192.168.0.1 -> home computers (192.168.0.100-105)
Here are my rc.conf and pf.conf regarding this setup:
I've gone through many threads on quite similar matters, but haven't solved this. Hopefully you can help, thank you.
I'm having few problems with my jail and pf setup. I would need to connect to my jail's ssh port from the internet with other port like 22222. I also have sshd running on my server but I use other ports for that. The network works fine with the jail, but I just cannot connect there from the web.
The alias interface for jail is in the internal interface rl0, because my internal network doesn't work when I put it to the nfe0 interface.
internet -> server (with jail 192.168.0.60) -> 192.168.0.1 -> home computers (192.168.0.100-105)
Here are my rc.conf and pf.conf regarding this setup:
Code:
gateway_enable="YES"
hostname="xxx"
ifconfig_nfe0="DHCP"
# inet / 27.07.2010
ifconfig_rl0="inet 192.168.0.1 netmask 255.255.255.0"
dhcpd_enable="YES"
dhcpd_ifaces="rl0"
sshd_enable="YES"
sshd_port="22"
pf_enable="YES"
pf_rules="/etc/pf.conf"
pf_flags=""
pflog_enable="YES"
pflog_logfile="/var/log/pf.log"
pflog_flags=""
noip_enable="YES"
jail_enable="YES"
jail_list="test"
jail_set_hostname_allow="NO"
sendmail_enable="NO"
ifconfig_rl0_alias0="inet 192.168.0.60 netmask 255.255.255.255"
jail_test_rootdir="/usr/jails/test"
jail_test_hostname="test.xxxxx.org"
jail_test_ip="192.168.0.60"
jail_test_exec_start="/bin/sh /etc/rc"
jail_test_devfs_enable="YES"
Code:
ext_if = "nfe0"
int_if = "rl0"
tcp_services = "{113, 21}"
icmp_types = "echoreq"
jail = "192.168.0.60"
main = "192.168.0.100"
xbox = "192.168.0.101"
allowssh = "{xxx xxx xxx}"
# xbox ports
x_udp = "{ 88, 3074 }"
x_tcp = "3074"
# tables
table <trusted> const { $main $xbox 192.168.0.0/24 }
table <badguys> persist file "/var/log/pf_badguys.log"
# options
set block-policy return
set loginterface $ext_if
set skip on lo
# scrub
scrub in all
# translation
# nat/rdr
no rdr on lo0 from any to any
# xbox
nat on $ext_if from $xbox to any -> ($ext_if:0) static-port
nat on $ext_if from !($ext_if) -> ($ext_if:0)
rdr-anchor "xbox"
no rdr
# jails
nat on $ext_if from $jail to any -> $ext_if
rdr on $ext_if proto tcp from any to any port 22222 -> $jail port 22
# ftp proxy
anchor "ftp-proxy/*"
# filter rules
block all
pass out quick keep state
antispoof quick for { lo $int_if }
pass in quick on $int_if from <trusted> to any keep state
block in log quick on $ext_if from <badguys> to any
pass in log quick on $ext_if inet proto tcp \
from any to ($ext_if) port $tcp_services \
flags S/SA keep state (max-src-conn-rate 3/60, overload <badguys> flush)
pass in log quick on $ext_if inet proto tcp \
from $allowssh to ($ext_if) port 22 \
flags S/SA keep state (max-src-conn-rate 3/60, overload <badguys> flush)
pass in inet proto icmp all icmp-type $icmp_types
Code:
$ ssh -p 22022 [email]xxxxx@xxxxxxx.org[/email]
ssh: connect to host xxxxxxx.org port 22022: Connection refused
I've gone through many threads on quite similar matters, but haven't solved this. Hopefully you can help, thank you.