From owner-freebsd-questions@freebsd.org Wed Jun 29 11:33:35 2016 Return-Path: Delivered-To: freebsd-questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E55F8B85AF6 for ; Wed, 29 Jun 2016 11:33:35 +0000 (UTC) (envelope-from carlopmart@gmail.com) Received: from mail-wm0-x229.google.com (mail-wm0-x229.google.com [IPv6:2a00:1450:400c:c09::229]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 721142CFE for ; Wed, 29 Jun 2016 11:33:35 +0000 (UTC) (envelope-from carlopmart@gmail.com) Received: by mail-wm0-x229.google.com with SMTP id f126so177162748wma.1 for ; Wed, 29 Jun 2016 04:33:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=LnhULU4VGEnifHBEnKiolwK3+revompn+XXFz+548hU=; b=MCNe9i8Qcskb3AedDQL2MTMJQDg+ogJxixX0UtFSTZ7CDCqQUc1e7DGwpID7MGBazk +6a/Tzo4PzsIf57NJzCVrBMsxqTXX3ajMxDfbum6Wifbega2bRhpwtkULc/gH6s9kPxT Fm66QYRQtP0s8H9LCqHGLDvM+n6bPfxbOSpKoefiEVkoUsAUjpsifC4vhZKwvrAXS3Ie Q6CluBVLW6ZkmKBz8ZnoZM4eujErA8A2fNfZcqabjCFPuvjbIokl+0ogR0kVcVAPjelY pA5IAaYmBX4/GB8xdPqyqOpDJuurXxqFL497IHlRw2REPccMwTJxvKOS/33dNzudGGyq EH3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=LnhULU4VGEnifHBEnKiolwK3+revompn+XXFz+548hU=; b=V+GjK1eWdMInBao3b1P/Tv/NYwAawpD+Awi/vKj+pISVUc5fNrrHDpGnxiCJ0O+R9L ogligrH3/J1GJep418t7qD4WLfQIseaQPXS3NhfbiS5Ymp1YFbvInXVgOHHzlRYKNIui MEgLbN91EOf1Qnft4wlWHlMxnz6ztSlqKl74wrpP+IFg9AU4aWwinrieBNXMIrOwi1aI iU8CZpUxW5JfrSE4E0oyB1Z3nUBpZlCzCBlIntKTaELb5B/0eyc+w4a+BPLLF1BUEvoH tPTsQWguWP8va2giikWQ4mAKcw6n5rBearptTbaaoHNzPKtz4rsoC7A8KkbbRQYM8+zb LO5w== X-Gm-Message-State: ALyK8tLaL4Zg4MavCCw0ydV9NNun25gfW10shIkrxNMm/q5JTI/YfMZQC8FEDXS8/cQ3ZQ== X-Received: by 10.28.134.199 with SMTP id i190mr21973917wmd.26.1467200013321; Wed, 29 Jun 2016 04:33:33 -0700 (PDT) Received: from beagle.bcn.sia.es (132.red-79-154-242.dynamicip.rima-tde.net. [79.154.242.132]) by smtp.gmail.com with ESMTPSA id f196sm5210667wmg.15.2016.06.29.04.33.32 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 29 Jun 2016 04:33:32 -0700 (PDT) Date: Wed, 29 Jun 2016 11:33:24 +0000 From: "C. L. Martinez" To: freebsd-questions@freebsd.org Subject: Re: Problems with pf rules for intercept squid proxy Message-ID: <20160629113324.GA10436@beagle.bcn.sia.es> References: <20160628130759.GA13226@beagle.bcn.sia.es> <2822287D-FE6F-4A4B-995A-639B696911DF@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: <2822287D-FE6F-4A4B-995A-639B696911DF@FreeBSD.org> User-Agent: Mutt/1.6.0 (2016-04-01) X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jun 2016 11:33:36 -0000 On Tue 28.Jun'16 at 19:37:37 +0200, Kristof Provost wrote: >=20 >=20 > On 28 Jun 2016, at 15:07, C. L. Martinez wrote: > > I have some problems with my pf rules on a FreeBSD 10.3 host that acts > > as a squid intercept proxy. My actual pf rules are: > >=20 > > rdr pass on $vpnif proto tcp from $int_network to any port http -> lo0 > > port 5144 > > rdr pass on $vpnif proto tcp from $int_network to any port https -> lo0 > > port 5145 > >=20 > > At first stage it seems that these rules works, but don't. Traffic is > > redirected to squid, but squid denies all connections: > >=20 > > 1467111934.502 1 172.22.55.1 TCP_DENIED/403 4221 GET > > http://www.osnews.com/ - HIER_NONE/- text/html > >=20 > > Using same squid.conf's file under an OpenBSD test machine, squid works > > without problems. For this reason, I don't think there is some problem > > with my squid's config. The only difference between this OpenBSD host > > and FreeBSD are the pf rules. > >=20 > You may have a different squid version, or they may be patched differentl= y. > Your redirect rules are working, as demonstrated by the fact that squid g= ets > a request, and replies to it. >=20 > Note that pf does not change your HTTP payload, it only affects TCP. In > other words: if Squid sees the connection (and it does) it=E2=80=99s a Sq= uid > problem. >=20 > Also note that you=E2=80=99re redirecting on FreeBSD, but using divert-to= on > OpenBSD. > This may be triggering different behaviour from Squid. The man page says > that with divert-to: >=20 > The packets will not be modified, so getsockname(2) on the socket will > return > the original destination address of the packet. >=20 > That might be affecting an ACL in Squid. >=20 > Regards, > Kristof Thanks Kristof. I am using squid installed from pkg under a FreeBSD 10.3, f= ully updated: Squid Cache: Version 3.5.19 Service Name: squid configure options: '--with-default-user=3Dsquid' '--bindir=3D/usr/local/sb= in' '--sbindir=3D/usr/local/sbin' '--datadir=3D/usr/local/etc/squid' '--lib= execdir=3D/usr/local/libexec/squid' '--localstatedir=3D/var' '--sysconfdir= =3D/usr/local/etc/squid' '--with-logdir=3D/var/log/squid' '--with-pidfile= =3D/var/run/squid/squid.pid' '--with-swapdir=3D/var/squid/cache' '--without= -gnutls' '--enable-auth' '--enable-build-info' '--enable-loadable-modules' = '--enable-removal-policies=3Dlru heap' '--disable-epoll' '--disable-linux-n= etfilter' '--disable-linux-tproxy' '--disable-translation' '--disable-arch-= native' '--enable-eui' '--enable-cache-digests' '--enable-delay-pools' '--d= isable-ecap' '--disable-esi' '--enable-follow-x-forwarded-for' '--enable-ht= cp' '--enable-icap-client' '--enable-icmp' '--enable-ident-lookups' '--enab= le-ipv6' '--enable-kqueue' '--with-large-files' '--enable-http-violations' = '--without-nettle' '--enable-snmp' '--enable-ssl' '--with-openssl=3D/usr' '= LIBOPENSSL_CFLAGS=3D-I/usr/include' 'LIBOPENSSL_LIBS=3D-lcrypto -lssl' '--e= nable-ssl-crtd' '--disable-stacktraces' '--enable-ipf-transparent' '--enabl= e-ipfw-transparent' '--enable-pf-transparent' '--with-nat-devpf' '--enable-= forw-via-db' '--enable-wccp' '--enable-wccpv2' '--with-heimdal-krb5=3D/usr'= 'CFLAGS=3D-I/usr/include -O2 -pipe -fstack-protector -fno-strict-aliasing= ' 'LDFLAGS=3D-L/usr/lib -pthread -fstack-protector' 'LIBS=3D-lkrb5 -lgssa= pi -lgssapi_krb5 ' 'KRB5CONFIG=3D/usr/bin/krb5-config' '--enable-auth-basic= =3DDB SMB_LM MSNT-multi-domain NCSA PAM POP3 RADIUS fake getpwnam NIS' '--e= nable-auth-digest=3Dfile' '--enable-external-acl-helpers=3Dfile_userip time= _quota unix_group' '--enable-auth-negotiate=3Dkerberos wrapper' '--enable-a= uth-ntlm=3Dfake smb_lm' '--enable-storeio=3Daufs diskd rock ufs' '--enable-= disk-io=3DDiskThreads DiskDaemon AIO Blocking IpcIo Mmapped' '--enable-log-= daemon-helpers=3Dfile' '--enable-url-rewrite-helpers=3Dfake' '--enable-stor= eid-rewrite-helpers=3Dfile' '--prefix=3D/usr/local' '--mandir=3D/usr/local/= man' '--infodir=3D/usr/local/info/' '--build=3Damd64-portbld-freebsd10.1' '= build_alias=3Damd64-portbld-freebsd10.1' 'CC=3Dcc' 'CPPFLAGS=3D' 'CXX=3Dc++= ' 'CXXFLAGS=3D-O2 -pipe -fstack-protector -fno-strict-aliasing ' 'CPP=3Dcpp= ' --enable-ltdl-convenience According to this options, intercept is enabled ... Then, I don't understa= nd why it doesn't works ... --=20 Greetings, C. L. Martinez