From owner-freebsd-questions@FreeBSD.ORG Sun Nov 23 20:01:56 2008 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 305E310656E5 for ; Sun, 23 Nov 2008 20:01:56 +0000 (UTC) (envelope-from cagri.ersen@gmail.com) Received: from yw-out-2324.google.com (yw-out-2324.google.com [74.125.46.28]) by mx1.freebsd.org (Postfix) with ESMTP id C83298FC0C for ; Sun, 23 Nov 2008 20:01:55 +0000 (UTC) (envelope-from cagri.ersen@gmail.com) Received: by yw-out-2324.google.com with SMTP id 9so704892ywe.13 for ; Sun, 23 Nov 2008 12:01:55 -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:to :subject:mime-version:content-type; bh=m9N1DJ+oWUuSP8EkMZy+ylaxbUwZ0i7HsFxvoql8R00=; b=pSN0ASvhDfrQ0iMDmZNXYV+pHkNUyVbIPUqyY54TxcLKZxhXib6Y6ZrBby1fBD2eSt Hszce01vKV6sWqo8TXsRoRV9JA2vHAPb/LyG4aIk2tWKW61V9llgJvv0ldn/fJxLcOm3 7fBcVfAYM0jAD/UQE25szkf9/78opVIV1w3Gg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:mime-version:content-type; b=dsr/Eg2yCY4AdzJGkKGXdVlBFiTF0uNXmzdjfnBoEpJLFBRplxUjuSbo3SzOsgeFi/ QLmPnkDNXHcY3Hrkh4ER4kTPWy4EQjxdC0V9WMwePhBPgc2kRYKRfW+pa9czUbam4eB5 dAjAKJc3Jyulixy0iTHvn2CUB97wP5QcMRniQ= Received: by 10.100.205.15 with SMTP id c15mr1211822ang.16.1227468609357; Sun, 23 Nov 2008 11:30:09 -0800 (PST) Received: by 10.100.139.8 with HTTP; Sun, 23 Nov 2008 11:30:09 -0800 (PST) Message-ID: <73a179920811231130k53387b55p2838f80b30fdc6cd@mail.gmail.com> Date: Sun, 23 Nov 2008 21:30:09 +0200 From: "Cagri Ersen" To: freebsd-questions@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Subject: Transparent Proxy with IPFW + Squid 2.7 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: Sun, 23 Nov 2008 20:01:56 -0000 Hi there, I want to configure a transparent proxy with IPFW and Squid. I enabled IPFW on a FreeBSD 7.0 and also install squid 2.7 this is content of my squid.conf: acl manager proto cache_object acl localhost src 127.0.0.1/32 acl to_localhost dst 127.0.0.0/8 acl all src all acl localnet src 192.168.12.0/24 acl SSL_ports port 443 acl Safe_ports port 80 # http acl Safe_ports port 21 # ftp acl Safe_ports port 443 # https acl Safe_ports port 70 # gopher acl Safe_ports port 210 # wais acl Safe_ports port 1025-65535 # unregistered ports acl Safe_ports port 280 # http-mgmt acl Safe_ports port 488 # gss-http acl Safe_ports port 591 # filemaker acl Safe_ports port 777 # multiling http acl CONNECT method CONNECT http_access allow manager localhost http_access deny manager http_access deny !Safe_ports http_access deny CONNECT !SSL_ports http_access allow localnet icp_access allow localnet icp_access deny all http_port 3128 transparent hierarchy_stoplist cgi-bin ? access_log /usr/local/squid/logs/access.log squid refresh_pattern ^ftp: 1440 20% 10080 refresh_pattern ^gopher: 1440 0% 1440 refresh_pattern (cgi-bin|\?) 0 0% 0 refresh_pattern . 0 20% 4320 icp_port 3130 coredump_dir /usr/local/squid/cache And this is base IPFW rules. $cmd 00500 fwd 127.0.0.1,3128 $log tcp from any to any 80 in recv $lanif $cmd 02000 allow $log all from any to any As you can see, all packages which is destination port 80 forwarding to the squid's port (3128). with this configuration everything seems work fine. however if i deny all traffic on the last rule and then open desired ports or connections one by one then squid isn't work. Sample base denying rule set like this: $cmd 00010 allow all from any to any via lo0 $cmd 00015 check-state $cmd 00020 allow tcp from any to any established . $cmd 00021 deny all from any to any frag in via $adslif $cmd 00025 allow all from me to any keep-state $cmd 00050 allow tcp from "table()" to any keep-state $cmd 00500 fwd 127.0.0.1,3128 $log tcp from any to any 80 in recv $lanif $cmd 00600 allow all from $lan to any 53 $cmd 00602 allow udp from any 53 to any out via $lanif $cmd 00603 allow udp from any 53 to any in via $adslif $cmd 01500 allow all from $lan to any 443,25,110 keep-state $cmd 02000 deny $log all from any to any As i said, if i run IPFW with this rules, my client doesn't surf on the internet. And also i didn't seen anything about denying on the ipfw log file. Also there is no activity on squid log files. I think forwarding rule didn't work with that conf. So please can somebody tell me what's wrong in this situation ? Thanks in advance for your help. -- Cagri Ersen