From owner-freebsd-questions@freebsd.org Fri Nov 17 00:07:49 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 53E63DEE631 for ; Fri, 17 Nov 2017 00:07:49 +0000 (UTC) (envelope-from javocado@gmail.com) Received: from mail-vk0-x22f.google.com (mail-vk0-x22f.google.com [IPv6:2607:f8b0:400c:c05::22f]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1321F71D96 for ; Fri, 17 Nov 2017 00:07:49 +0000 (UTC) (envelope-from javocado@gmail.com) Received: by mail-vk0-x22f.google.com with SMTP id p80so719383vkd.10 for ; Thu, 16 Nov 2017 16:07:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=m/WcNSUpK+hIgYWK8tkwmIwVCceLmd2OHqFJJcQSH1A=; b=baqjKos1f+XY7Ll5hXyRuexyNljWl8ELV12Gl3SAoOrf3PCXvw8CMZb7RtDge/flVH btX7r18v8rALMO1i0yilR3icE7euoridGPDxPkdQiMvmOTFYQbZ+LgKV2cV9qp3LAed6 n1LO5FcpnKhw4WYvcyaKC98BObWXmWmvLXNlUwZ1uQh7QgrzKzk7lsH/Mv8IlOiO4DT7 gGRLMI3rMXQTFlNRvhKYkXcAsIE4LPSM4TdHTWLM7LMwjnN9mytp+LSrg/mTLwcTWr6b qtx6gszM6bAibNkIgjx0VIuCR2eU7RuXFT/qPwg4fnpw0aVhp/OB+X+Z+/z+4fYa315t TBVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=m/WcNSUpK+hIgYWK8tkwmIwVCceLmd2OHqFJJcQSH1A=; b=hHCfj6f+Mtl9XvBAwJzy8OPNAf265L3DtMFysVX3Jvav+hAwIwKzsiGStYV+zUG97l pRFlWulOKDR3XVAqdt4XsI/iszxZtzZR53bUbT2Fz4gSCEJzuFIkbCz9gjZNcDuWxDUf LayDAnwBDsZPnQOrIT1gmI4lNOggncn+yhRvPHB00JFnZXKwydwQ2cOEr/+w7srO5nPT YdzLYXcITsMHLMCBWpZD6rv+r9AyUkWzAzcHvDVx8j00GUpco+BmgSWUMkQ/mrxx3R5l /UpUwIlMAiq28q5jwjySXM462Yi9D8Uet37cCzvTCEcfdIP0sTc2kUka2giXOgRy7oqH jl8g== X-Gm-Message-State: AJaThX58yLaWOD3Oz2NCUYYMrTqyECW3tnMK8RfrNRwrCUt58H0KcUWa F8ZdtYvf5HtyPiNRetKWIiVwx+5ILECKUChY3K2DOg== X-Google-Smtp-Source: AGs4zMbIoBylErhWI6CNrs15nN/74ubV8qx0fRRPJE7kSKb+DxrUXBqnxzGWOLOQhf8rb995WLRmtYzcCOGcZ9RSGCE= X-Received: by 10.31.151.21 with SMTP id z21mr2724852vkd.44.1510877267934; Thu, 16 Nov 2017 16:07:47 -0800 (PST) MIME-Version: 1.0 Received: by 10.159.48.198 with HTTP; Thu, 16 Nov 2017 16:07:47 -0800 (PST) In-Reply-To: References: From: javocado Date: Thu, 16 Nov 2017 16:07:47 -0800 Message-ID: Subject: Re: IPFW: Why can I add port numbers to established and what does that do ? To: Tim Daneliuk Cc: freebsd-questions@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Nov 2017 00:07:49 -0000 I think you misunderstand what I am asking - you have explained why a "established" rule is needed in the ruleset. You are correct and it is something (an established rule) that I always use. What I am saying is: I just noticed that you can specify a port number in the established rule: allow tcp from any to any 22 established ... which I don't understand. In fact, I think it is a bug, but I am asking to make sure. It doesn't seem like specifying a port in the established rule makes any sense ... On Thu, Nov 16, 2017 at 12:01 PM, Tim Daneliuk wrote: > On 11/16/2017 01:29 PM, javocado wrote: > > Almost every single ipfw ruleset I create has this as the very first > rule: > > > > allow tcp from any to any established > > > > ... and I just noticed that ipfw allows me to specify a port on this > rule: > > > > allow tcp from any to any 22 established > > > > If I create a new connection to port 22, I need a rule to allow port 22 > > traffic out: > > > > allow tcp from any to any 22 > > > > ... but once that connection is established, doesn't the client begin > > talking to the server on an ephemeral port (not 22) that isn't > predictable ? > > > > Why would it ever make sense to specify a port on established ? > > If you are running your own sshd *server*, then you need rules that > allow all or some to connect *to* your machine. > > If you are running an ssh *client*, you need to first allow access *out* > via port 22 to get to the remote servers. Thereafter - as you suggest - > the server and client rendezvous and establish a permanent connection on > another port (and the server goes back to listening on 22). So, the > firewall has to permit access to the established session w/o knowing > which port will be used ahead of time. > > > > > > ------------------------------------------------------------ > ---------------- > Tim Daneliuk tundra@tundraware.com > PGP Key: http://www.tundraware.com/PGP/ > >