From patchwork Tue Jun 19 04:32:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Erik Kapfer X-Patchwork-Id: 1826 Return-Path: Received: from mail01.ipfire.org (unknown [172.28.1.200]) by web02.i.ipfire.org (Postfix) with ESMTP id EB1346095C for ; Mon, 18 Jun 2018 20:32:11 +0200 (CEST) Received: from mail01.i.ipfire.org (localhost [127.0.0.1]) by mail01.ipfire.org (Postfix) with ESMTP id 7180010FC5E0; Mon, 18 Jun 2018 19:32:11 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=201801; t=1529346731; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references:list-id: list-unsubscribe:list-subscribe:list-post; bh=SijkWdS1/3V4ID5n1C9aM8e18TZA9cMQxu7GJaHZNj4=; b=kbEbajx7/1JNmmGN4TL2/2AkBSjSwgc5ECP0m8UDX+tUNhbw/cdvb/78z16b377TlAgZIy YtXoSNV4uf8VppijPWNUzPgzAQKbUWAHf2dh1oYUcHhrsefI9OlSYXvs6v/rCr9J2iws7u /JaWnkv17xDA2xjuoCmS0xLez97UHC7/fjXtxrE9Nyo+94RZHuj3u6YkWPKAZHNz0baAD7 k9OOA4nYXZRbXnOCy6LifR+pba8NR+3dr5hbDo/eFPHq8ABiNe6zfpvpxLr/3ETJQHqoD/ ZyEYKr5F9KVRoaxIHxJQ9iFtiAvZ6qXtfH0DER52TNYCFV8dUz8mVcAZYRtzng== Received: from localhost.localdomain (i59F4AD79.versanet.de [89.244.173.121]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client did not present a certificate) by mail01.ipfire.org (Postfix) with ESMTPSA id DF2F2108B897; Mon, 18 Jun 2018 19:32:08 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=201801; t=1529346729; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=SijkWdS1/3V4ID5n1C9aM8e18TZA9cMQxu7GJaHZNj4=; b=ipk/3K22fmiJjYv3p2vX3FkifungiYBbAPgwgdO/6y4CNKQZCsus69fMmNbCfCM6ARTrF0 U2M9aksJzXF6NZGIdET7RgkSTK09jAkhR2BD3kdbgaFeBtH4LGVP07pdnEbEmDdGc1mqG4 tSRAcdxdpbAkRkDBN4CQgb9ePhgUplaxbelJS9/OfiUq22lCL2yDzvs3FJ8RcKdHWmpZK+ nJzMud2tWSvPstlf1tZwnSmd8Vk7YIEv8doOFhr1x12R87lAAnJldxbHPPbYykc5UilkwP SgdG/2asWQ2vtzNdvsNZpp7rwiVFc8gK7lA+08NMmaqABegmXfvhPPR2/PvfrA== From: Erik Kapfer To: development@lists.ipfire.org Subject: [PATCH] Squid: Exclude remote OpenVPN-N2N subnet from transparent proxy Date: Mon, 18 Jun 2018 20:32:07 +0200 Message-Id: <1529346727-14526-1-git-send-email-erik.kapfer@ipfire.org> X-Mailer: git-send-email 2.7.4 Authentication-Results: mail01.ipfire.org; auth=pass smtp.auth=ummeegge smtp.mailfrom=erik.kapfer@ipfire.org X-Spamd-Result: default: False [-2.10 / 11.00]; FROM_EQ_ENVFROM(0.00)[]; RCVD_TLS_ALL(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; TO_DN_SOME(0.00)[]; BAYES_HAM(-3.00)[100.00%]; ARC_NA(0.00)[]; RCPT_COUNT_TWO(0.00)[2]; MIME_GOOD(-0.10)[text/plain]; DKIM_SIGNED(0.00)[]; MID_CONTAINS_FROM(1.00)[]; RCVD_COUNT_ZERO(0.00)[0]; ASN(0.00)[asn:8881, ipnet:89.244.160.0/20, country:DE]; FROM_HAS_DN(0.00)[] X-Spam-Status: No, score=-2.10 X-Rspamd-Server: mail01.i.ipfire.org X-BeenThere: development@lists.ipfire.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: IPFire development talk List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: development-bounces@lists.ipfire.org Sender: "Development" Patch is from bug #11614 With the please to deliver it for further review to the dev mailinglist. Signed-off-by: Erik Kapfer --- src/initscripts/system/squid | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/initscripts/system/squid b/src/initscripts/system/squid index 7255c0a..267a416 100644 --- a/src/initscripts/system/squid +++ b/src/initscripts/system/squid @@ -37,6 +37,17 @@ transparent() { iptables -t nat -A SQUID -i $1 -p tcp -d `echo "$LINE" | awk -F, '{ print $13 }'` --dport 80 -j RETURN done < $FILE + FILE=/var/ipfire/ovpn/ovpnconfig + + while read LINE; do + let COUNT=$COUNT+1 + CONN_TYPE=`echo "$LINE" | awk -F, '{ print $5 }'` + if [ "$CONN_TYPE" != "net" ]; then + continue + fi + iptables -t nat -A SQUID -i $1 -p tcp -d `echo "$LINE" | awk -F, '{ print $13 }'` --dport 80 -j RETURN + done < $FILE + if [ "$RED_TYPE" == "STATIC" ]; then iptables -t nat -A SQUID -i $1 -p tcp -d $RED_NETADDRESS/$RED_NETMASK --dport 80 -j RETURN fi