From owner-freebsd-questions@freebsd.org Wed Jun 29 14:00:42 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 C3AFDB82D88 for ; Wed, 29 Jun 2016 14:00:42 +0000 (UTC) (envelope-from kraduk@gmail.com) Received: from mail-wm0-x236.google.com (mail-wm0-x236.google.com [IPv6:2a00:1450:400c:c09::236]) (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 4A0FE254F for ; Wed, 29 Jun 2016 14:00:42 +0000 (UTC) (envelope-from kraduk@gmail.com) Received: by mail-wm0-x236.google.com with SMTP id f126so182792601wma.1 for ; Wed, 29 Jun 2016 07:00:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=uoU0GZWXiywBV/IZ6Np2zWSBJcEr+aQOSCk11Niqqik=; b=tf76WE7YoKG9LFFrkYiwZfYUMfLg8zjHoZNE/C4vlpTmoBzSsGektzakpAJSjLy5OH xYQpxYgYrXB331XV+GQS9K14afsu5buCQUnSv6QUySuht0PyfOnxJKIO9q3Uhdz5YHYz +7+R/qzH0ACeHJXSRdn7j4rNiHWLBCn8E8Ai2COfsfrihLqN6Q+xFxoKV6JUV2WG6vom gLSuX9GF7ATEkToFFBi8K630TBrwmBIEkvfd9ZvnWNTVQom8KMobrphP9ETMSmI2rXRv l8q+2VyJMUupg8p2n4Nh5RGvCUCCRCs4hNbBASc4jkeaZ3LB3NpjBw1qoe7sBfudtJFb ClLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=uoU0GZWXiywBV/IZ6Np2zWSBJcEr+aQOSCk11Niqqik=; b=U54acFT6vdqEjGTXPATehwVicym8yZkrIi90kjsgK7Nt2j1xFOXelJIz2NMVVjgvwS JgsXLmDCDWYr5yLu1/NoW3wxQZX0eTLX3D4270upjvXDRPOl5acUFlDiw6yC7mpZtZoo wPFD0xNrUi7xrFhrpkyOYSiONhMQu9VQxBW/MTL0HGZAyW8TJqgKRjee4o05Gi6fUcuk pY7KI9xtB7Q6Hx+SCjq9vfr2xYyg9h1gCII8Yxju3XdO7A8mVrCCPgE/8lO4AOlQK26u xEiMVFGvV6fkFEZA/iSnYOTUVunGX8O9yLMwpXWLU9IIkH2z0z/JRkhYrfl16kipB/Ma AXZQ== X-Gm-Message-State: ALyK8tKeBLjCj8TSVydtZHhbMVt/SnLaCqWcXN/kRg+9YU7SAuH/Cra/aNr3/9r2tG+NYAmctVivySRNK6TGIA== X-Received: by 10.194.38.4 with SMTP id c4mr8725717wjk.20.1467208840603; Wed, 29 Jun 2016 07:00:40 -0700 (PDT) MIME-Version: 1.0 Received: by 10.28.88.206 with HTTP; Wed, 29 Jun 2016 07:00:39 -0700 (PDT) In-Reply-To: <20160629135530.GA14559@beagle.bcn.sia.es> References: <20160628130759.GA13226@beagle.bcn.sia.es> <2822287D-FE6F-4A4B-995A-639B696911DF@FreeBSD.org> <20160629113324.GA10436@beagle.bcn.sia.es> <20160629131951.GA12552@beagle.bcn.sia.es> <20160629135530.GA14559@beagle.bcn.sia.es> From: krad Date: Wed, 29 Jun 2016 15:00:39 +0100 Message-ID: Subject: Re: Problems with pf rules for intercept squid proxy To: "C. L. Martinez" Cc: FreeBSD Questions Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.22 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 14:00:42 -0000 the setup does fundamentally work as i'm using it, so you must be missing something, probably in your squid config. On 29 June 2016 at 14:55, C. L. Martinez wrote: > Thanks Krad. And the answer for your questions is: yes. I have restarted > FreeBSD hosts after devfs change, my squid's config uses sslbump (it is t= he > same squid.conf file that I use in other OpenBSD host that works as > intercept proxy without problems)... My laptop has squid's cert installed > and acls are configured ... > > But nothing: it doesn't works. > > > On Wed 29.Jun'16 at 14:35:02 +0100, krad wrote: > > Also make sure you have opened the squid acl to you local network > > > > On 29 June 2016 at 14:33, krad wrote: > > > > > oh also if you are redirecting https you will need to setup squid to = do > > > ssl bump and install certs on all your clients. As you havent supplie= d > your > > > squid.conf its difficult to know if thats correct. > > > > > > On 29 June 2016 at 14:32, krad wrote: > > > > > >> you need to as squid needs read write access to the /dev/pf to work = in > > >> intercept mode. As long as you dont have any other users in the squi= d > group > > >> you are good. Did you restart devfs or reboot? > > >> > > >> > > >> On 29 June 2016 at 14:20, C. L. Martinez > wrote: > > >> > > >>> Yep, is it not too dangerous to assign 0770 to /dev/pf?? > > >>> > > >>> Anyway, I have tried, but with same error: traffic is denied by > squid ... > > >>> > > >>> > > >>> On Wed 29.Jun'16 at 13:39:46 +0100, krad wrote: > > >>> > have you got these lines in your /etc/devfs.conf file > > >>> > > > >>> > > > >>> > own pf root:squid > > >>> > perm pf 0770 > > >>> > > > >>> > you also need lines like this in the squid.conf > > >>> > > > >>> > http_port 192.168.1.1:3128 intercept > > >>> > > > >>> > > > >>> > > > >>> > On 29 June 2016 at 12:33, C. L. Martinez > wrote: > > >>> > > > >>> > > On Tue 28.Jun'16 at 19:37:37 +0200, Kristof Provost wrote: > > >>> > > > > > >>> > > > > > >>> > > > On 28 Jun 2016, at 15:07, C. L. Martinez wrote: > > >>> > > > > I have some problems with my pf rules on a FreeBSD 10.3 ho= st > > >>> that acts > > >>> > > > > as a squid intercept proxy. My actual pf rules are: > > >>> > > > > > > >>> > > > > 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 > > >>> > > > > > > >>> > > > > At first stage it seems that these rules works, but don't. > > >>> Traffic is > > >>> > > > > redirected to squid, but squid denies all connections: > > >>> > > > > > > >>> > > > > 1467111934.502 1 172.22.55.1 TCP_DENIED/403 4221 GET > > >>> > > > > http://www.osnews.com/ - HIER_NONE/- text/html > > >>> > > > > > > >>> > > > > 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. > > >>> > > > > > > >>> > > > You may have a different squid version, or they may be patche= d > > >>> > > differently. > > >>> > > > Your redirect rules are working, as demonstrated by the fact > that > > >>> squid > > >>> > > gets > > >>> > > > a request, and replies to it. > > >>> > > > > > >>> > > > Note that pf does not change your HTTP payload, it only affec= ts > > >>> TCP. In > > >>> > > > other words: if Squid sees the connection (and it does) it=E2= =80=99s a > > >>> Squid > > >>> > > > problem. > > >>> > > > > > >>> > > > Also note that you=E2=80=99re redirecting on FreeBSD, but usi= ng > divert-to > > >>> on > > >>> > > > OpenBSD. > > >>> > > > This may be triggering different behaviour from Squid. The ma= n > > >>> page says > > >>> > > > that with divert-to: > > >>> > > > > > >>> > > > The packets will not be modified, so getsockname(2) on > the > > >>> socket > > >>> > > will > > >>> > > > return > > >>> > > > the original destination address of the packet. > > >>> > > > > > >>> > > > That might be affecting an ACL in Squid. > > >>> > > > > > >>> > > > Regards, > > >>> > > > Kristof > > >>> > > > > >>> > > Thanks Kristof. I am using squid installed from pkg under a > FreeBSD > > >>> 10.3, > > >>> > > fully updated: > > >>> > > > > >>> > > Squid Cache: Version 3.5.19 > > >>> > > Service Name: squid > > >>> > > configure options: '--with-default-user=3Dsquid' > > >>> '--bindir=3D/usr/local/sbin' > > >>> > > '--sbindir=3D/usr/local/sbin' '--datadir=3D/usr/local/etc/squid= ' > > >>> > > '--libexecdir=3D/usr/local/libexec/squid' '--localstatedir=3D/v= ar' > > >>> > > '--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 he= ap' > > >>> > > '--disable-epoll' '--disable-linux-netfilter' > > >>> '--disable-linux-tproxy' > > >>> > > '--disable-translation' '--disable-arch-native' '--enable-eui' > > >>> > > '--enable-cache-digests' '--enable-delay-pools' '--disable-ecap= ' > > >>> > > '--disable-esi' '--enable-follow-x-forwarded-for' '--enable-htc= p' > > >>> > > '--enable-icap-client' '--enable-icmp' '--enable-ident-lookups' > > >>> > > '--enable-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' '--enable-ssl-crtd' > > >>> > > '--disable-stacktraces' '--enable-ipf-transparent' > > >>> > > '--enable-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 -lgssapi -lgssapi_krb5 ' > > >>> > > 'KRB5CONFIG=3D/usr/bin/krb5-config' '--enable-auth-basic=3DDB S= MB_LM > > >>> > > MSNT-multi-domain NCSA PAM POP3 RADIUS fake getpwnam NIS' > > >>> > > '--enable-auth-digest=3Dfile' > > >>> '--enable-external-acl-helpers=3Dfile_userip > > >>> > > time_quota unix_group' '--enable-auth-negotiate=3Dkerberos wrap= per' > > >>> > > '--enable-auth-ntlm=3Dfake smb_lm' '--enable-storeio=3Daufs dis= kd > rock > > >>> ufs' > > >>> > > '--enable-disk-io=3DDiskThreads DiskDaemon AIO Blocking IpcIo > Mmapped' > > >>> > > '--enable-log-daemon-helpers=3Dfile' > > >>> '--enable-url-rewrite-helpers=3Dfake' > > >>> > > '--enable-storeid-rewrite-helpers=3Dfile' '--prefix=3D/usr/loca= l' > > >>> > > '--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 > > >>> > > understand why it doesn't works ... > > >>> > > > > >>> > > -- > > >>> > > Greetings, > > >>> > > C. L. Martinez > > >>> > > _______________________________________________ > > >>> > > freebsd-questions@freebsd.org mailing list > > >>> > > https://lists.freebsd.org/mailman/listinfo/freebsd-questions > > >>> > > To unsubscribe, send any mail to " > > >>> > > freebsd-questions-unsubscribe@freebsd.org" > > >>> > > > > >>> > > >>> -- > > >>> Greetings, > > >>> C. L. Martinez > > >>> _______________________________________________ > > >>> freebsd-questions@freebsd.org mailing list > > >>> https://lists.freebsd.org/mailman/listinfo/freebsd-questions > > >>> To unsubscribe, send any mail to " > > >>> freebsd-questions-unsubscribe@freebsd.org" > > >>> > > >> > > >> > > > > > -- > Greetings, > C. L. Martinez > _______________________________________________ > freebsd-questions@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to " > freebsd-questions-unsubscribe@freebsd.org"