From owner-freebsd-ipfw@freebsd.org Mon Jul 25 14:29:06 2016 Return-Path: Delivered-To: freebsd-ipfw@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 C405BBA4D7B for ; Mon, 25 Jul 2016 14:29:06 +0000 (UTC) (envelope-from rj@cyclaero.com) Received: from mo6-p00-ob.smtp.rzone.de (mo6-p00-ob.smtp.rzone.de [IPv6:2a01:238:20a:202:5300::9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.smtp.rzone.de", Issuer "TeleSec ServerPass DE-2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6968D164E for ; Mon, 25 Jul 2016 14:29:06 +0000 (UTC) (envelope-from rj@cyclaero.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1469456942; l=967; s=domk; d=cyclaero.com; h=Mime-Version:To:Date:Subject:Content-Transfer-Encoding:Content-Type: From; bh=/wH+f/obFQzLKYzujk2Xn/TKYJ+a0z1fW/0lj6elFo8=; b=Hnd7fbfgIZaiakUkfsBKI36U/fvaarQxfvxRBTDSbhahFmL8u38Uq2GJy0jI/BFXtWs wzb0x99rS0jJn/7inn3/JgB3NrynjlLoPmUF7IGZJxgKGgKdqV1Wqfro49E5xvMbCpw2z Jd+f8ER4FT+8dsqDWNCt6fftja1a+uAjDgU= X-RZG-AUTH: :PmYkdlmrd/5oFO+v3d3wrWNKA6HwNiCiTtCELX2wAfChnSFe7Pbi4CZ28Nw= X-RZG-CLASS-ID: mo00 Received: from rolf.projectworld.net (bb02aae1.virtua.com.br [187.2.170.225]) by smtp.strato.de (RZmta 38.13 DYNA|AUTH) with ESMTPSA id j0b8ees6PET0LYJ (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (curve secp521r1 with 521 ECDH bits, eq. 15360 bits RSA)) (Client did not present a certificate) for ; Mon, 25 Jul 2016 16:29:00 +0200 (CEST) From: "Dr. Rolf Jansen" Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Subject: ipfw divert filter for IPv4 geo-blocking Message-Id: <61DFB3E2-6E34-4EEA-8AC6-70094CEACA72@cyclaero.com> Date: Mon, 25 Jul 2016 11:28:58 -0300 To: freebsd-ipfw@freebsd.org Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) X-Mailer: Apple Mail (2.3124) X-BeenThere: freebsd-ipfw@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: IPFW Technical Discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Jul 2016 14:29:06 -0000 I have written a ipfw divert filter daemon for IPv4 geo-blocking. It is = working flawlessly on two server installations since a week. Anyway, I am still in doubt whether I do the blocking in the correct = way. Once the filter receives a packet from the respective divert socket = it looks up the country code of the source IP in the IP-Ranges database, = and if the country code shall be allowed then it returns the unaltered = packet via said socket, otherwise, the filter does no further = processing, so the packet is effectively gone, lost, dropped, discarded, = or whatever would be the correct terminology. Is this the really the = correct way of denying a packet, or is it necessary to inform ipfw = somehow about the circumstances, so it can run a proper dropping = procedure? I uploaded the filter + accompanying tools to GitHub https://github.com/cyclaero/ipdb Many thnaks for any advices in advance. Best regards Rolf =20