Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 03 Jun 2009 10:13:04 +0200
From:      "=?ISO-8859-2?Q?Saj=F3_Zsolt_Attila?=" <sajozsattila@citromail.hu>
To:        FreeBSD questions <freebsd-questions@freebsd.org>
Subject:   Re: sshd in jail
Message-ID:  <20090603081304.28276.qmail@server14.citromail.hu>
In-Reply-To: <139b44430906030032o7bb798e1rcbcf80fc9b26e46@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Thank you the help, but it doesn't work yet.
I prefer the "rdr pass on $Ext inet proto tcp from any to any port 5859 -&g=
t; 10.0.0.40 port 22", but I tried all ways, but absolutely nothing's chang=
ed.=20

-- Eredeti =FCzenet --
Felad=F3: Valentin Bud &lt;valentin.bud@gmail.com&gt;
C=EDmzett: Saj=F3 Zsolt Attila&lt;sajozsattila@citromail.hu&gt;
Elk=FCldve: 09:33
T=E9ma: Re: sshd in jail

2009/6/3 Saj=F3 Zsolt Attila  luk1814.no-ip.org" command I get this error:

&gt; OpenSSH_5.1p1 FreeBSD-20080901, OpenSSL 0.9.8e 23 Feb 2007

&gt; debug1: Reading configuration data /etc/ssh/ssh_config

&gt; debug2: ssh_connect: needpriv 0

&gt; debug1: Connecting to luk1814.no-ip.org [84.3.27.205] port 5859.

&gt; debug1: connect to address 84.3.27.205 port 5859: Connection refused

&gt; ssh: connect to host luk1814.no-ip.org port 5859: Connection refused

&gt;

&gt;

&gt; The "pfctr -sn" command output's:

&gt; nat on vr0 inet from 10.0.0.20 to any -&gt; (vr0) round-robin

&gt; nat on vr0 inet from 10.0.0.40 to any -&gt; (vr0) round-robin

&gt; rdr on vr0 inet proto tcp from any to any port =3D 5859 -&gt; 10.0.0.4=
0 port

&gt; 22

&gt;

&gt;

&gt; My pf.conf:

&gt; Ext =3D "vr0" # output interface

&gt; Loop =3D "lo0" # Loopback interface

&gt; IntNet1=3D"10.0.0.20" # Jail 1

&gt; IntNet2=3D"10.0.0.40" # Jail 2 this is running the sshd

&gt; NoRoute =3D "{ 127.0.0.1/8, 192.168.0.0/16, 172.16.0.0/12, 10.0.0.0/8,

&gt; 255.255.255.255/32 }"

&gt; InServicesTCP =3D "{ ssh, http, https }"

&gt; OutServicesTCP =3D "{ http, https, whois, domain, ssh, ftp, ftp-data, =
nntp,

&gt; 1863, 8880 }"

&gt; OutServicesUDP =3D "{ ntp, domain }"

&gt; NowDeny =3D "{ 445, 67, 68 }"

&gt; X11 =3D "{ 6010, 5900}"

&gt; Timeserver =3D "{ 148.6.0.1 }"

&gt; CVSupServers =3D "{ 212.19.57.134 }"

&gt; CVSupPorts =3D "{ 5999 }"

&gt; DynDNSServer =3D "{ 63.208.196.94 }"

&gt; DynDNSPorts =3D "{ 8245 }"

&gt; scrub in on $Ext all

&gt; altq on $Ext priq bandwidth 100Kb queue { q_pri, q_def }

&gt; queue q_pri priority 7

&gt; queue q_def priority 1 priq(default)

&gt; nat on $Ext from $IntNet1 to any -&gt; ($Ext)

&gt; nat on $Ext from $IntNet2 to any -&gt; ($Ext)

&gt; rdr on $Ext proto tcp from any to any port 5859 -&gt; $IntNet2 port 22

&gt; block in quick on $Ext proto { tcp, udp} from any to any port $NowDeny

&gt; block out log on $Ext all

&gt; block in log on $Ext all

&gt; block return-rst out log on $Ext proto tcp all

&gt; block return-rst in log on $Ext proto tcp all

&gt; block return-icmp out log on $Ext proto udp all

&gt; block return-icmp in log on $Ext proto udp all

&gt; block in log quick on $Ext inet proto tcp from any to any flags FUP/FU=
P

&gt; block in log quick on $Ext inet proto tcp from any to any flags SF/SFR=
A

&gt; block in log quick on $Ext inet proto tcp from any to any flags /SFRA

&gt; block in log quick on $Ext from $NoRoute to any

&gt; block out log quick on $Ext from any to $NoRoute

&gt; block in quick on $Ext from any to 255.255.255.255

&gt; pass in quick on $Ext proto tcp from any to $IntNet2 port 8022 keep st=
ate







&gt;

&gt; pass in quick on $Loop all

&gt; pass out quick on $Loop all



This two could be changed to

'set skip on lo0' in the pf OPTIONS section.



&gt;

&gt; pass out quick on $Ext inet proto tcp from any to any port &gt; 1024 f=
lags

&gt; S/SA keep state

&gt; pass out quick on $Ext inet proto icmp all icmp-type 8 code 0 keep sta=
te

&gt; pass in log quick on $Ext inet proto icmp all icmp-type 8 code 0 keep =
state

&gt; pass in quick on $Ext inet proto tcp from any to any port $InServicesT=
CP

&gt; flags S/SA keep state

&gt; pass out quick on $Ext inet proto udp from any to any port $OutService=
sUDP

&gt; keep state

&gt; pass out quick on $Ext inet proto tcp from any to any port $OutService=
sTCP

&gt; flags S/SA modulate state

&gt; pass out quick on $Ext inet proto tcp from any to $CVSupServers port

&gt; $CVSupPorts flags S/SA modulate state

&gt; pass out quick on $Ext inet proto tcp from any to $Timeserver port tim=
e

&gt; flags S/SA modulate state

&gt; pass out quick on $Ext inet proto tcp from any to any port {

&gt; 6880&gt; pass in quick on $Ext inet proto tcp from any to any port 688=
0&gt; flags S/SAFR keep state

&gt; anchor passin

&gt;

&gt;

&gt; Somebody knows why doesn't work the rdr?

&gt;



You don't have a pass rule for the 5859 port. You can, however, accomplish

what you want in a couple of ways.



1. use the pass keyword in rdr

rdr *pass* on vr0 inet proto tcp from any to any port =3D 5859 -&gt; 10.0.0=
 .40

port 22



2. a separate pass in rule

pass in quick on $Ext inet proto tcp from any to any port 5859 flags S/SA

keep state.



3. simply add 5859 port to $InServicesTCP macro.



a great day,

v



&gt;

&gt;

&gt; _______________________________________________

&gt; freebsd-questions@freebsd.org mailing list

&gt; http://lists.freebsd.org/mailman/listinfo/freebsd-questions

&gt; To unsubscribe, send any mail to "

&gt; freebsd-questions-unsubscribe@freebsd.org"

&gt;







--=20

network warrior since 2005

_______________________________________________

freebsd-questions@freebsd.org mailing list

http://lists.freebsd.org/mailman/listinfo/freebsd-questions

To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org=
"







Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20090603081304.28276.qmail>