From owner-freebsd-questions@FreeBSD.ORG Tue Jan 19 10:31:43 2010 Return-Path: Delivered-To: questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C7B7B106566B for ; Tue, 19 Jan 2010 10:31:43 +0000 (UTC) (envelope-from hiyorin@gmail.com) Received: from mail-iw0-f177.google.com (mail-iw0-f177.google.com [209.85.223.177]) by mx1.freebsd.org (Postfix) with ESMTP id 8E47E8FC13 for ; Tue, 19 Jan 2010 10:31:43 +0000 (UTC) Received: by iwn7 with SMTP id 7so2716908iwn.7 for ; Tue, 19 Jan 2010 02:31:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:subject:content-type :content-transfer-encoding; bh=69IvlTnukvi+tel0SOhh4YBUrYTESUaYv7CpGaFJAy4=; b=jiAEBYdPfliz5DBGYqMVh1qdWGjy3nm3NLvMJJvtCMu7f68ub+IlsN5ttbkvYSofjC dKowJzkdF+fA1uEr7p3dLJGb7o4AfHE6kKAhGv9AGyYeEmqLSBQEzYIA4OvKMbrVBdYK OVoNW6GqbckBz19vcvA+LqAODaez8uYrjSBlo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; b=CRB886eJ/TbwoD2ODsvxJT4B8dO+1kamROJE8Ac7NCWy5hJU0ZHcyKAzj4pfYS6rDz uxkmv5Upzy+cWEIkjXiUpyBT3DbVWv4podBxqPZENjRH3oWA8WMWb+vdTrchHfeNcmeN vg4TMk7g4elOv5DjDuqvqFzThJN5fRfd0lAww= Received: by 10.231.153.69 with SMTP id j5mr765973ibw.33.1263897101356; Tue, 19 Jan 2010 02:31:41 -0800 (PST) Received: from ?10.130.10.181? ([202.82.159.125]) by mx.google.com with ESMTPS id 20sm274132iwn.5.2010.01.19.02.31.38 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 19 Jan 2010 02:31:40 -0800 (PST) Message-ID: <4B558A08.80501@gmail.com> Date: Tue, 19 Jan 2010 18:31:36 +0800 From: "C. C. Tang" User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.5) Gecko/20091204 Thunderbird/3.0 MIME-Version: 1.0 To: questions@freebsd.org Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Subject: pf + jail question. X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jan 2010 10:31:43 -0000 Hi all, May be this question is better to post on -pf or -jail but I really don't know where the problem is. So post here first. I have a FreeBSD-8.0-RELEASE-p2 box with two NICs acting as gateway using pf (with ftp-proxy enabled) in my home network configured as follow: LAN: 10.7.13.0/24 ( + tap0 10.7.14.0/24 for VPN) WAN: IP obtained from ISP. gateway: 10.7.13.254 When I played with jail, I found that fp didn't block the traffic that it should. For example, I have the following line in pf.conf: block quick proto tcp from any to any port 21 Then in the host(gateway): [host] ~> ftp ftp.mozilla.org ftp: connect: Operation not permitted In the jail: [jail1] ~> ftp ftp.mozilla.org Connected to dm-ftp01.mozilla.org. ...(welcome message) Other client on the LAN(Windows): C:\Users\test-user>ftp ftp.mozilla.org Connected to dm-ftp01.mozilla.org. Connection closed by remote host. The ftp-proxy log when windows client is connecting: #5 accepted connection from 10.7.13.1 #5 proxy cannot connect to server 63.245.208.138: Operation not permitted #5 ending session My jail's IP 10.7.13.99 which is within the subnet of LAN. Do anyone know where the problem is? It seems that the traffic from jail bypasses the pf filtering rules? The following is part of my pf.conf: =================================== ext_if="wan0" int_if="{ lan0 }" self="10.7.13.254" internal_net="{ 10.7.13.0/24, 10.7.14.0/24 }" scrub in nat pass on $ext_if from $internal_net to any -> ($ext_if) static-port # handling FTP nat-anchor "ftp-proxy/*" rdr-anchor "ftp-proxy/*" no rdr on $int_if proto tcp from $internal_net to $self port 21 rdr pass on $int_if proto tcp from $internal_net to any port 21 -> \ 127.0.0.1 port 8021 anchor "ftp-proxy/*" block quick proto tcp from any to any port 21 ============================ Thanks, C.C.