From nobody@FreeBSD.org  Wed May 31 14:53:23 2006
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 657CB16B03A
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 31 May 2006 14:53:23 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [216.136.204.117])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 2AFA243D55
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 31 May 2006 14:53:12 +0000 (GMT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.13.1/8.13.1) with ESMTP id k4VErCEW069810
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 31 May 2006 14:53:12 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.13.1/8.13.1/Submit) id k4VErBls069809;
	Wed, 31 May 2006 14:53:11 GMT
	(envelope-from nobody)
Message-Id: <200605311453.k4VErBls069809@www.freebsd.org>
Date: Wed, 31 May 2006 14:53:11 GMT
From: Dmitry Andrianov <dimas@dataart.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: pf needs a way of matching on decapsulated IPSEC packets
X-Send-Pr-Version: www-2.3

>Number:         98219
>Category:       kern
>Synopsis:       [pf] pf needs a way of matching on decapsulated IPSEC packets
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    thompsa
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Wed May 31 15:00:36 GMT 2006
>Closed-Date:    Mon Jul 24 23:46:19 GMT 2006
>Last-Modified:  Mon Jul 24 23:46:19 GMT 2006
>Originator:     Dmitry Andrianov
>Release:        6.0
>Organization:
>Environment:
FreeBSD 6.0-RELEASE #0
>Description:
It seems there is no way to distinguis ordinary packet arrived from the wire from the one decapsulated from IPSEC ESP packet. When kernel is build with IPSEC_FILTERGIF, decapsulated packet appears arriving on the same interface on which original ESP packet arrived.

Normally you have to enable ESP packets:

  pass in quick on fxp0 proto esp from $vpn_peer to fxp0:any

But to avoid dropping decapsulated packets by firewall, you also need

  pass in quick on fxp0 from $vpn_remote_net to $local_net

But this rule will also allow any packet with spoofed IPs pretending to be from vpn_net to local_net to be accepted and processed.
>How-To-Repeat:

>Fix:

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->freebsd-pf 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Wed May 31 16:06:45 UTC 2006 
Responsible-Changed-Why:  
Over to maintainer(s). 

http://www.freebsd.org/cgi/query-pr.cgi?pr=98219 
State-Changed-From-To: open->analyzed 
State-Changed-By: mlaier 
State-Changed-When: Fri Jun 2 07:51:47 UTC 2006 
State-Changed-Why:  
The solution for this is the enc(4) interface from OpenBSD.  There are 
ongoing porting efforts. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=98219 
Responsible-Changed-From-To: freebsd-pf->thompsa 
Responsible-Changed-By: thompsa 
Responsible-Changed-When: Fri Jun 2 10:48:13 UTC 2006 
Responsible-Changed-Why:  
I have a working if_enc patch, grab this PR. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=98219 
State-Changed-From-To: analyzed->patched 
State-Changed-By: thompsa 
State-Changed-When: Mon Jun 26 23:05:35 UTC 2006 
State-Changed-Why:  
if_enc has been committed to HEAD, awaiting MFC. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=98219 
State-Changed-From-To: patched->closed 
State-Changed-By: thompsa 
State-Changed-When: Mon Jul 24 23:45:53 UTC 2006 
State-Changed-Why:  
MFC complete, thanks for the PR! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=98219 
>Unformatted:
