Questions tagged [pf]

pf is the OpenBSD Packet Filter, a feature-rich IP-layer firewall used on FreeBSD, NetBSD, and Mac OS X, as well as in the pfSense open-source firewall appliance software.

Filter by
Sorted by
Tagged with
1 vote
1 answer
335 views

Port forward DNS using pf

On OpenBSD, I can successfully & transparently forward ports 80 and 443 to services running on custom, unprivileged ports using the following /etc/pf.conf: tcp_pass = "{ 22 80 123 443 }" ...
neezer's user avatar
  • 810
0 votes
1 answer
569 views

PF firewall how to increase `max states per rule`

My firewall is hitting a problem related to max states per rule. # pfctl -vvsi Status: Enabled for 0 days 13:05:38 Debug: Urgent Hostid: 0x6556c6a9 Checksum: ...
Luman75's user avatar
  • 103
1 vote
1 answer
498 views

Simple OpenBSD NAT router not working

I'm toying around with using OpenBSD as a NAT router behind Starlink but efforts with the NAT are failing even in the simplest cases. I've probably simply been staring at it too long and need an ...
Brian M. Hunt's user avatar
1 vote
0 answers
64 views

Mysterious/Unknown IPs keep getting whitelisted by spamd

I have an OpenBSD 7.1 mail server running OpenSMTPD with spamd. I notice mysterious IP addresses in /var/log/maillog, such as: smtp connected address=162.142.125.222 host=scanner-25.ch1.censys-scanner....
Joe Blough's user avatar
5 votes
2 answers
701 views

Why add "keep state" to pf firewall rules

If pf is a stateful firewall and keeps state by default, why do so many rulesets explicitly mention keep state?
ahron's user avatar
  • 375
1 vote
1 answer
255 views

While using pf on FreeBSD, do I need to explicitly specify both the inet and inet6 parameters?

Suppose I have a rule like rdr on $ext_if inet proto tcp to port https -> $inf_if port $myhttps This is to redirect incoming TCP packets on the https port to a specific internal IP/port. This is ...
ahron's user avatar
  • 375
1 vote
1 answer
578 views

403 Page recieved when accessing OpenBSD httpd page

I am writing a static webpage on an OpenBSD vm (here called example.com), and when I access the server with it's domain name over http I get httpd's 403 page, when I use telnet example.com 80 I get ...
CyberianTraveler's user avatar
1 vote
0 answers
2k views

Redirecting traffic to a bridged ip and port using PF on MacOS

I am trying to redirect localhost traffic on specific port to bridged network ip I am using following echo " rdr pass inet proto tcp from any to any port 9300 -> 192.168.64.29 port 9300 rdr ...
MrPandav's user avatar
  • 111
0 votes
1 answer
208 views

FreeBSD: How can I tune the lifetime for TCP/UDP for in kernel NAT?

There used to be these sysctls in older versions of FreeBSD, viz: net.inet.ip.fw.dyn_ack_lifetime=3600 net.inet.ip.fw.dyn_udp_lifetime=15 now on FreeBSD 12 sysctl reports that these don't exist. How ...
pnadeau's user avatar
  • 143
1 vote
2 answers
725 views

FreeBSD 13 PF blocking jail traffic

After upgrading my FreeBSD system from 12.2 to 13.0-p3 PF is blocking all traffic to my jails. When disabling PF everything works fine (except from being unprotected ;)) I tried to figure out what ...
GTeley's user avatar
  • 21
0 votes
0 answers
181 views

PF Nat over OpenVPN Client

I have FreeBSD 12.1-RELEASE router with 3 interfaces: LAN HOME(192.168.22.) LAN WORK(192.168.11.) WAN(1.2.3.4) My router connect to NordVPN over OpenVPN as a client (creates new TUN0 with address 10....
cr4shydlo's user avatar
0 votes
1 answer
598 views

How to specify an IP range representing "any IP" within a Pfsense alias?

I've restricted the source IP of many rules to some alias, say Trusted_Sources. Now, for some reason, I want to open all these rules to the world without manually modifying each individual rule. How ...
user2798081's user avatar
0 votes
1 answer
114 views

freebsd packet filter match last digit of IP address

On my freebsd system I want to use port forwarding to distribute incoming traffic, based on the last digit of the source IP. The following works on linux with iptables: iptables -t nat -A ...
memyself's user avatar
  • 345
0 votes
0 answers
107 views

How come that with these packet filter rules, this rule triggers?

I have (amongst others) these rules in my pf setup: block drop in log (user) proto udp from any to any port = 137 block drop in log (user) proto udp from any to any port = 138 block drop in log (user)...
gctwnl's user avatar
  • 173
0 votes
1 answer
1k views

Setting DSCP value on specific outgoing traffic in OS X with pf

I want to set DSCP value on specific traffic coming out of an OS X machine. I think the right way is to use pf, but I can't figure how to write the rule correctly. I've tried something like this but ...
Jérémie's user avatar
1 vote
0 answers
125 views

Share a VPN connection via a node in a LAN

I would like to share a VPN connection via a node in the same LAN. The scheme below shows my network system. LAN A: 10.44.247.0/24 |-* Router Aa: 10.44.247.1, ext XXX.XXX.XXX.XXX |-* Node Ab: 10....
Daehyun You's user avatar
1 vote
0 answers
445 views

I fail to configure Pf of OpenBSD gateway

I have an OpenBSD server that I want to use as a gateway. OBSD server has the following interfaces - em5 (130...** ext.IP with internet connectivity) em0 (internal IP - 172.16.0.0/17) My default ...
Aravindh Sathish's user avatar
2 votes
1 answer
312 views

Almost empty pf.conf still logs packets

I have an issue that my pf logs many packets that it's not supposed to log. I reproduced it with almost empty pf.conf: set skip on lo and it still logs some packets. I think that all those packets ...
vbezhenar's user avatar
  • 273
0 votes
1 answer
157 views

FreeBSD and pf - packet filtering based on OpenVPN usernames

I have an OpenVPN server which authenticates the users using an Active Directory server. I need to limit the bandwidth of each user based on their usernames, and I also want to be able to do some ...
Javad Kouhi's user avatar
0 votes
2 answers
2k views

PF blocking out Flags [FP.]

On a FreeBSD 12 server, I started to notice that pf is blocking out having Flags [FP.], the logs are flooded with something like this: 00:00:00.000004 rule 2/0(match): block out on bge0: 213.59.241....
nbari's user avatar
  • 568
0 votes
2 answers
681 views

FreeBSD-12.0 PF firewall default rule is blocking when more specific rule allowing is ignored

Our PF firewall contains this: . . . scrub in all fragment reassemble no-df max-mss 1440 ### em1 ipv4 = 123.12.3.234 nat log on $ext_if \ from $net_nat \ ...
James B. Byrne's user avatar
4 votes
1 answer
1k views

Changing PF rules on the fly to mitigate damage of DDoS (OpenBSD 6.4)

This is a two part question, really. Keep in mind that I am a developer not a system admin, but being the only employee in the company, I wear ALL the hats. I have deployed my server with two ...
Miguel's user avatar
  • 171
1 vote
1 answer
444 views

How to migrate Linux iptables scripts to OpenBSD/macOS pf

I am building a VPN server on macOS based on this instruction: https://www.digitalocean.com/community/tutorials/how-to-set-up-an-ikev2-vpn-server-with-strongswan-on-ubuntu-18-04-2, and stuck at ...
Daehyun You's user avatar
0 votes
2 answers
818 views

openbsd pf firewall - how can I tell what is being blocked?

I am in a dire situation. Our exchange server disks have failed. I can still use the application as the os disks are unaffected, and I need to do an emergency migration to office365. We have an ...
BeardyDrummer's user avatar
1 vote
0 answers
787 views

(Mac OS PF) Redirect outgoing UDP traffice to specific ip:port

I'm having some trouble getting my head around how PF works in Mac OS. I have been doing a lot of research on the topic but just cannot find the solution (although I can find many other very similar ...
logicallysynced's user avatar
2 votes
0 answers
359 views

pfctl not relaying SYN, ACK packet after NAT

I am trying to relay SSH connections from LAN hosts to hosts beyond VPN. Only one router host in the LAN has VPN connection to be reused by other hosts in LAN. Below is pfctl configuration on the ...
Oleg's user avatar
  • 21
2 votes
0 answers
728 views

Allowing Incoming Traffic over IPv6 with PF on FreeBSD

This is my current pf.conf on FreeBSD 11.1-RELEASE. It allows incoming connections from OpenVPN/UDP and SSH, as well as allows everything on the private/vpn networks (vtnet1 and tun0 respectively). ...
djsumdog's user avatar
  • 1,120
0 votes
1 answer
7k views

PF firewall on FreeBSD for allowing SSH and OpenVPN Traffic

I'm trying to create a simple ansible template for the packet filter on FreeBSD 11.1-RELEASE. I have vtnet0 (public), vtnet1 (private, 10.10 address) and tun0 (openvpn, fully working/tested from a ...
djsumdog's user avatar
  • 1,120
0 votes
1 answer
977 views

Putting all blocked ips into a table

I would like to block all the incoming traffic for a specific port and to put the source ips of these blocked packets into a table... I don't know about a pf.conf solution, I guess I would use another ...
Psyloh's user avatar
  • 11
0 votes
1 answer
91 views

SSH into a jail takes so long

I have only one ip address and so I get to my jail through NAT. SSH to the host is lightning-fast but SSH to the jail is awfully long... Like 20 seconds between ssh command and prompt for public key ...
Psyloh's user avatar
  • 11
0 votes
0 answers
67 views

Real meaning of "in" and "out" regarding a virtual network

I am confused, I thought I understand those basics but now I'm not quite sure any more... Considering that conf : cloned_interfaces="lo7" ifconfig_bce0="dhcp" ifconfig_bce0_alias0="inet 192.168.0.1/...
Psyloh's user avatar
  • 11
1 vote
1 answer
755 views

Why is there non-127.x.x.x traffic on my loopback device?

I've got an issue which caused me quite a bit of a headache and found the solution, but I cannot understand why the problem was happening in the first place. I've got an nginx reverse proxy which is ...
papiro's user avatar
  • 159
1 vote
1 answer
1k views

PF based gateway firewall for Openbsd 6.0

Currenly I am looking to create an OpenBSD 6.0 pf based gateway. Based on what I read in the pf manual pages and OpenBSD pf FAQ, and some examples on the internet, I was able to configure a firewall. ...
Baron van Neemweggen's user avatar
1 vote
1 answer
447 views

PF temporary reroute to different IP

I have a FreeBSD host that serves as an entry point to additional systems on an internal network. As such I have pf configured to redirect incoming traffic on certain ports (say, port 5000) to the ...
DCKing's user avatar
  • 113
2 votes
0 answers
813 views

Configuring PF to route between routing domains

I've got an OpenBSD 6.0 box running as a router / firewall. It's got three physical network connections and one GRE tunnel: em0: Internet (routing domain 0) em1: Internal LAN private IPs (routing ...
PeterM's user avatar
  • 123
1 vote
0 answers
398 views

pf on os x server 10.10 doesn't block addresses added to a table

I'm trying to understand the issue with pf on OS X 10.10 El Capitan. I have installed sshguard and try to make it work by adding table <sshguard> persist block in quick proto tcp from <...
Захар Joe's user avatar
1 vote
2 answers
2k views

Block DNS query using pfctl

I am trying to create rule to allow DNS queries (port 53) to only 8.8.8.8 server (Google DNS). DNS queries to all other servers should not succeed. I added the following lines to /etc/pf.conf file ...
sam's user avatar
  • 11
0 votes
2 answers
748 views

pf shortcuts for block quick

Looking at https://www.openbsd.org/faq/pf/shortcuts.html it's not clear to me if these are the same- block quick from <bruteforce> and- block in quick from <bruteforce> to any block out ...
hotkarl's user avatar
  • 165
2 votes
1 answer
3k views

All IPv6 traffic blocked by pf

The following pf.conf (FreeBSD 10.3) appears to be blocking all IPv6 traffic and I can't work out why. tcp_inbound = "{ ssh, domain, http, https }" tcp_outbound = "{ domain, http, https, imaps, smtps ...
Daphne Preston-Kendal's user avatar
0 votes
1 answer
1k views

Restrict client IP address on OpenVPN using TAP interface

I've set up an OpenVPN + PF setup on a FreeBSD 10.3 server. Clients to my VPN include administrators, which should have full access to the network and untrusted users who should ONLY be able to ...
Imanol Barba Sabariego's user avatar
3 votes
3 answers
19k views

Redirecting traffic to a specific address and port using PF on MacOS

I want to pentest a mobile application. To do so, I want to intercept all WiFi traffic and forward it to Burp, which runs in a VM. I enabled "Internet Sharing" on my Macbook so my phone now connects ...
Sjoerd's user avatar
  • 196
2 votes
1 answer
2k views

Can't access server on loopback address, only on private address

I am running a rails web app server bound to 0.0.0.0 on port 80 like so: sudo rails s --port=80 --bind=0.0.0.0 I can access it at my private address http://192.168.0.13/, normally I can access at ...
david_adler's user avatar
1 vote
0 answers
738 views

Need to restart PF under OSX till it gets effective

is anybody here familiar with the use of PF under OSX? I'm using PF in order to force all the traffic on my MacBook going thru a VPN. In order to do so, I'm using the following pf.conf: wifi=en0 ...
Norbert's user avatar
  • 231
0 votes
1 answer
3k views

DNS lookup to localhost gives network error

I am running a recursive DNS server on Unbound in a jail on FreeBSD with pf as a firewall. Running drill @xxx.xxx.xxx.xxx example.com (where xxx.xxx.xxx.xxx is the servers IP) on my local machine ...
Draon con Color's user avatar
1 vote
0 answers
910 views

Using PF under OSX but skipping local interface

I'm using PF under OSX to force the OS the make all external connections via a VPN to Ipredator. However, as soon as I start PF all local connections are blocked even though I thought I told PF to ...
Norbert's user avatar
  • 231
2 votes
2 answers
532 views

Layer 3 routing based on HTTP packet content

I'm running a HTTP proxy service and want to route traffic to various Layer 3 TUNs based on the contents of HTTP packets (e.g. HTTP headers). I'm using BSD and Linux to do this but it doesn't look ...
Joshua Griffiths's user avatar
2 votes
2 answers
2k views

Redirection of pfctl on OSX gets error

I want all my traffics are redirected to SOCKS proxy on 127.0.0.1:1080. I added the rule below to the end of /etc/pf.conf according to this tutorial: pass on en3 proto tcp from any to any rdr-to 127....
Douglas Su's user avatar
6 votes
0 answers
1k views

pfSense Internal Traffic Policy Based Routing

What is the current and correct way to apply policy based routing to pfSense internal traffic (originating from the firewall itself)? Creating a floating rule with the WAN interfaces selected, ...
Monstieur's user avatar
  • 546
1 vote
1 answer
10k views

traffic shaping on OSX 10.10 with pfctl and dnctl

I am trying to do traffic shaping (throttling) on Mac OS X 10.10 via pfctl and dnctl. I have implemented a simple test server and client with netcat (nc) and a synthetic random payload file to verify ...
Peter Lyons's user avatar
2 votes
1 answer
4k views

pfSense can't access https website

I have just installed pfSense on a PC Engines APU1D4 to evaluate as an alternative to a Soekris 5501 + OpenBSD based setup, I have a PPPoE WAN configuration. The pf rules, NAT and PPPoE ...
Phil's user avatar
  • 21