Re: Simple block of inbound ssh with exceptions

Kenneth Gober <[email protected]> Mon, 4 Dec 2017 08:41:25 -0500
Newsgroups gmane.os.openbsd.pf
Message-ID <CANHrbpd2JOLvHPCsd8UYfiRi4YNweZnTW5C0tYLuhJ29ah0k=w@mail.gmail.com>
On Sun, Dec 3, 2017 at 11:17 PM, Rolf Loudon <[email protected]> wrote:
> I’m both new to pf and struggling with what I thought was a simple idea.
> This is on a laptop, not a firewall per se.  I want to (a) allow incoming
> ssh connections for a small list of addresses, and (b) block other inbound
> ssh.  No outbound restrictions at all.

It's unclear whether you want to block other inbound traffic besides
ssh.  I am going to assume that you do.

# allow ssh from specific hosts
table <mytable> { 192.168.10.13, 192.168.10.14, 192.168.100.1 }
pass in quick proto tcp from <mytable> port ssh

# if you want to allow incoming ping requests uncomment next line
# pass in quick proto icmp icmp-type echoreq

# all other inbound blocked
# "quick" rules above will never get here
block in log all

# no outbound restrictions
pass out all