From owner-freebsd-pf@freebsd.org Wed Jan 22 14:04:13 2020 Return-Path: Delivered-To: freebsd-pf@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8C7821F153D for ; Wed, 22 Jan 2020 14:04:13 +0000 (UTC) (envelope-from SRS0=mEKQ=3L=quip.cz=000.fbsd@elsa.codelab.cz) Received: from elsa.codelab.cz (elsa.codelab.cz [94.124.105.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 482nFm5rlDz44hf for ; Wed, 22 Jan 2020 14:04:12 +0000 (UTC) (envelope-from SRS0=mEKQ=3L=quip.cz=000.fbsd@elsa.codelab.cz) Received: from elsa.codelab.cz (localhost [127.0.0.1]) by elsa.codelab.cz (Postfix) with ESMTP id 27AEC28416; Wed, 22 Jan 2020 15:04:11 +0100 (CET) Received: from illbsd.quip.test (ip-62-24-92-232.net.upcbroadband.cz [62.24.92.232]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by elsa.codelab.cz (Postfix) with ESMTPSA id F0FA528428; Wed, 22 Jan 2020 15:04:09 +0100 (CET) Subject: Re: automatic tables / self statement in pf.conf To: mike tancsa , "freebsd-pf@freebsd.org" References: <5a989609-3366-bcc0-3e6f-d0ad29046f61@sentex.net> <58a84a53-5efe-c753-2d12-a5b3c56afcaa@quip.cz> <43456d07-4c64-9e4e-a69e-3a64ebf08bf7@sentex.net> From: Miroslav Lachman <000.fbsd@quip.cz> Message-ID: Date: Wed, 22 Jan 2020 15:04:10 +0100 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Firefox/52.0 SeaMonkey/2.49.3 MIME-Version: 1.0 In-Reply-To: <43456d07-4c64-9e4e-a69e-3a64ebf08bf7@sentex.net> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 482nFm5rlDz44hf X-Spamd-Bar: ++++ Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=none (mx1.freebsd.org: domain of SRS0=mEKQ=3L=quip.cz=000.fbsd@elsa.codelab.cz has no SPF policy when checking 94.124.105.4) smtp.mailfrom=SRS0=mEKQ=3L=quip.cz=000.fbsd@elsa.codelab.cz X-Spamd-Result: default: False [4.06 / 15.00]; ARC_NA(0.00)[]; TO_DN_EQ_ADDR_SOME(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; IP_SCORE(0.87)[ip: (0.35), ipnet: 94.124.104.0/21(0.18), asn: 42000(3.71), country: CZ(0.09)]; MIME_GOOD(-0.10)[text/plain]; RCVD_TLS_LAST(0.00)[]; DMARC_NA(0.00)[quip.cz]; AUTH_NA(1.00)[]; NEURAL_SPAM_MEDIUM(1.00)[0.997,0]; RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCPT_COUNT_TWO(0.00)[2]; RCVD_IN_DNSWL_NONE(0.00)[4.105.124.94.list.dnswl.org : 127.0.10.0]; NEURAL_SPAM_LONG(1.00)[1.000,0]; R_SPF_NA(0.00)[]; FORGED_SENDER(0.30)[000.fbsd@quip.cz,SRS0=mEKQ=3L=quip.cz=000.fbsd@elsa.codelab.cz]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:42000, ipnet:94.124.104.0/21, country:CZ]; FROM_NEQ_ENVFROM(0.00)[000.fbsd@quip.cz,SRS0=mEKQ=3L=quip.cz=000.fbsd@elsa.codelab.cz]; MID_RHS_MATCH_FROM(0.00)[] X-BeenThere: freebsd-pf@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Technical discussion and general questions about packet filter \(pf\)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Jan 2020 14:04:13 -0000 mike tancsa wrote on 2020/01/22 14:39: > On 1/22/2020 5:13 AM, Miroslav Lachman wrote: >> mike tancsa wrote on 2020/01/20 15:37: >>> Also, is there a better way to monitor pf rule changes ?  I dont see >>> any mention in FreeBSD audit ? >> >> Monitoring of PF rules is kind of hard and not just because of >> automatic tables. (automatic tables are created by optimizer not only >> for self rules, optimizer can be disabled by -o none) >> > Thanks for these tips!  The other thing I would like to monitor is just > if someone does something like pfctl -f > /tmp/bad.rules;do_bad_things;pfctl -f /etc/pf.conf.  Ideally, an audit > event log would be fired that rules have been re-loaded.  I think > TrustedBSD has such extensions > > https://wiki.freebsd.org/DiegoGiagio/Audit_Firewall_Events_from_Kernel My main purpose to monitor PF rules is to be notified when some configuration accident happened. Once in the past I was surprised by running machine for a week or two with empty rules. Or running with some modified (not saved in pf.conf) rules until reboot and then half a year later something broke after reboot. Now I am notified about all this events. I don't need audit right now but it is very interesting topic. TrustedBSD module looks interesting. Thank you for pointing me on it! Kind regards Miroslav Lachman