From owner-freebsd-questions@freebsd.org Tue Mar 28 18:32:01 2017 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 2F0AFD22F2F for ; Tue, 28 Mar 2017 18:32:01 +0000 (UTC) (envelope-from ralf.mardorf@rocketmail.com) Received: from nm25-vm9.bullet.mail.ir2.yahoo.com (nm25-vm9.bullet.mail.ir2.yahoo.com [212.82.97.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8A6982B6 for ; Tue, 28 Mar 2017 18:31:59 +0000 (UTC) (envelope-from ralf.mardorf@rocketmail.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rocketmail.com; s=s2048; t=1490725777; bh=nYHIc7/SB9j+3GGwLILUh/AS8y3Zyj9jEySoJ7WhnJw=; h=Date:From:To:Subject:In-Reply-To:References:From:Subject; b=oCC2JhibJqz8UN35hi3qK+9J3XkOaDeO0QUvbcAD8NweEDYd42WAQPsiPnuAV/mBg24XwuECU/76SNj7YfqeTPCsANEKK2zT3VGKodDS2NzHicj0IsVb4enZYyH/zJrmtPIXXDTiozCMS01GPDz9Q4Kip3T3Evdaqwwontf3ELa5SE7eKnr931+XMow29NMuTVwtQ6pMUpU68WCwcCMSudhvjlfq4kRpirOe/EyVkjuWcwlm7NVLskspTYGI/lzKtGhguFd481SdZdnccaZPro1GiOZRuf2v8n8nXeZWwtmkhPLzx2fjmZuIEfxGBBrMi0OQSDV/+XKcZuXful1uDg== Received: from [212.82.98.53] by nm25.bullet.mail.ir2.yahoo.com with NNFMP; 28 Mar 2017 18:29:37 -0000 Received: from [46.228.39.102] by tm6.bullet.mail.ir2.yahoo.com with NNFMP; 28 Mar 2017 18:29:37 -0000 Received: from [127.0.0.1] by smtp139.mail.ir2.yahoo.com with NNFMP; 28 Mar 2017 18:29:37 -0000 X-Yahoo-Newman-Id: 128488.38436.bm@smtp139.mail.ir2.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: BDq_8UsVM1mPLZEIUAs8WFRAvLCarBshSLhddlmjrkMdzFb 3n_H5IzKXpDB.orH8LU.tWA7bk5PmuWvNoRh4a8XcOCNjwmgaQ9joQq_zq_9 3W0dMDQWIWe05raT9S4l8Ek9t4YozizpsY5iGwEc7UoykAN0eC47PxUkXhhv 3MGg9VNiZftKd3k1oD.RfMFBAmIh1x3uKV9T0HrhQp_a9DHc6qLRjIFSzbm4 crTBjYZo0_LZGfZVgsBUdg7cI5SSi1fHCDtuLd15bEJsxN557yWw6aLrOlMr _nvR0mNxG_i0LnHV7RJvpKDoDtwNg9.kcJisL.fIxWHcRsCl5ZO_OAD1rUb_ sqpY5R7DQUCUUbF473Q4TojgfsQjGPPPhyVObLxbIwhj4vlf1U3zvMr_T3yC XKcnaPjpTYzYPGxAOTd_alEsYDQg0XiJ.8eoJiDd4aKI1rtkPPT9d9tiaj6k SKEthOu.Ac2Pf2KDgbfxQOkzAwfN6qY4k78SaLpLyKGsiZNU0CWqYw2bNo_B X4wZOyF4AxS0nbIzXi4lr.NcyLEql7wOXYvsJxSuWktoBDgn9jGEAzTXdsFj uKDQXz7k6jXLBlhuVrBSIigsBQQ-- X-Yahoo-SMTP: BeMCPs2swBABTJ3kAeEiC_hE0mz8jRexLddJfD8pI2j32fOacjBmXg-- Date: Tue, 28 Mar 2017 20:29:36 +0200 From: Ralf Mardorf To: freebsd-questions@freebsd.org Subject: Re: Two pf questions Message-ID: <20170328202936.74ed1741@archlinux.localdomain> In-Reply-To: References: <20170327170941.59c84eec@archlinux.localdomain> <20170327171959.405bbfbb@archlinux.localdomain> <20170328111655.121ede18@archlinux.localdomain> <20170328111959.400d4761@archlinux.localdomain> <20170328113501.2a5ebf60@archlinux.localdomain> <20170328114541.0ca0d084@archlinux.localdomain> X-Mailer: Claws Mail 3.15.0-1-g9782061 (GTK+ 2.24.31; x86_64-unknown-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Mar 2017 18:32:01 -0000 Hi, while I won't add such an exit status loop as I mentioned by an earlier reply, I still would be careful with file names in /tmp and also consider to make the commands of a "command chain" conditional of the preceding commands. Instead of cp /etc/pf/bruteforce /tmp/foobar.txt pfctl -t bruteforce -T show >> /tmp/foobar.txt sort -u -n /tmp/foobar.txt > /etc/pf/bruteforce I would use something similar to tmp_suffix="-$$-$(mcookie)" cp /etc/pf/bruteforce /tmp/bruteforce$tmp_suffix && \ pfctl -t bruteforce -T show >> /tmp/bruteforce$tmp_suffix && \ sort -u -n /tmp/bruteforce$tmp_suffix > /etc/pf/bruteforce I wouldn't use $$ and $(mcookie) together, perhaps just $(mcookie) or $$ plus the date and time including seconds or something else unique or at least add "$(id -u)" to the PID. "-$$-$(mcookie)" is just an example, as "foobar.txt" was just an example, too. Regards, Ralf