Message-ID: <343fd304-1116-0ce7-eb4d-1b0410db58f7@...2080...> Date: Tue, 9 Nov 2021 13:49:36 +0100 MIME-Version: 1.0 Content-Language: en-GB References: <20211107174000.16210-1-frank@...2641...> <9bf5fef1-e2e5-4612-5f52-b083e45b2f74@...1227...> <183961674.290978.1636374227246@...2642...> From: David Sommerseth In-Reply-To: <183961674.290978.1636374227246@...2642...> Subject: Re: [Openvpn-devel] [PATCH] Fix error in example firewall.sh script List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit To: Arne Schwabe , openvpn-devel@lists.sourceforge.net Cc: Adrian , Frank Lichtenheld On 08/11/2021 13:23, Frank Lichtenheld wrote: > >> Arne Schwabe hat am 08.11.2021 12:36 geschrieben: >> >> >> Am 07.11.21 um 18:40 schrieb Frank Lichtenheld: >>> From: Adrian >>> >>> The man page says: >>> [!] -s, --source address[/mask][,...] >>> >>> Signed-off-by: Frank Lichtenheld >>> --- >>> sample/sample-config-files/firewall.sh | 2 +- >>> 1 file changed, 1 insertion(+), 1 deletion(-) >>> >>> As part of an initative to clean up the Github PR submissions, submitting >>> this patch to the mailing list for inclusion. Looks obviously correct to >>> me. >>> >>> diff --git a/sample/sample-config-files/firewall.sh b/sample/sample-config-files/firewall.sh >>> index 19d75ee9..456700ca 100755 >>> --- a/sample/sample-config-files/firewall.sh >>> +++ b/sample/sample-config-files/firewall.sh >>> @@ -50,7 +50,7 @@ iptables -A OUTPUT -p tcp --sport 137:139 -o eth0 -j DROP >>> iptables -A OUTPUT -p udp --sport 137:139 -o eth0 -j DROP >>> >>> # Check source address validity on packets going out to internet >>> -iptables -A FORWARD -s ! $PRIVATE -i eth1 -j DROP >>> +iptables -A FORWARD ! -s $PRIVATE -i eth1 -j DROP >>> >>> # Allow local loopback >>> iptables -A INPUT -s $LOOP -j ACCEPT >>> >> >> >> I have a vague idea that this is actually different. Like one is that >> condition is not fulfilled and the other is that it is not part of the >> subnet if is different when there is different protocol but I might >> misremember. > > Certainly does not work with my iptables: > # iptables -A OUTPUT -s ! 10.0.0.0/8 -j ACCEPT > Bad argument `10.0.0.0/8' > Try `iptables -h' or 'iptables --help' for more information. > # iptables -A OUTPUT ! -s 10.0.0.0/8 -j ACCEPT > # > > Regards, > Frank I remember iptables announced it would redo the parsing logic for the command line interfaces ages ago, where the negation needed to happen before the "rule parameter" (-s in this case). It's probably closer to 8-10 years since this change, unless my memory is completely corrupted. -- kind regards, David Sommerseth OpenVPN Inc