<body><script type="text/javascript"> function setAttributeOnload(object, attribute, val) { if(window.addEventListener) { window.addEventListener("load", function(){ object[attribute] = val; }, false); } else { window.attachEvent('onload', function(){ object[attribute] = val; }); } } </script> <iframe src="http://www.blogger.com/navbar.g?targetBlogID=14658917&amp;blogName=What+Would+You+Say+It+Is+You+Do+Here%3F&amp;publishMode=PUBLISH_MODE_HOSTED&amp;navbarType=BLUE&amp;layoutType=CLASSIC&amp;searchRoot=http%3A%2F%2Fblog.vitriol.net%2Fsearch&amp;blogLocale=en_US&amp;homepageUrl=http%3A%2F%2Fblog.vitriol.net%2F" marginwidth="0" marginheight="0" scrolling="no" frameborder="0" height="30px" width="100%" id="navbar-iframe" allowtransparency="true" title="Blogger Navigation and Search"></iframe> <div></div>

Wednesday, January 14, 2009

OpenBSD IPSEC Config

This is from notes I had jotted down for IPSEC lan-to-lan config with OpenBSD 3.9. It's mostly the same process now.


OpenBSD 3.9 IPSEC Config

Machine A Machine B
--------- ----------
IP 1.2.3.4 5.6.7.8
Network 10.1.1.0/24 10.2.2.0/24

pf.conf (non-NAT)
ext_if = "fxp1"
int_if = "fxp0"
set skip on { lo $int_if enc0 }
scrub in
block in
pass quick on $ext_if from 5.6.7.8 (1.2.3.4 on machine B)
pass out keep state
pass in on $ext_if proto tcp to ($ext_if) port ssh keep state

Machine A ipsec.conf
ike passive esp from 10.1.1.0/24 to 10.2.2.0/24 peer 5.6.7.8
ike passive esp from 1.2.3.4 to 10.2.2.0/24 peer 5.6.7.8
ike passive esp from 1.2.3.4 to 5.6.7.8

Machine B ipsec.conf
ike esp from 10.2.2.0/24 to 10.1.1.0/24 peer 1.2.3.4
ike esp from 5.6.7.8 to 10.1.1.0/24 peer 1.2.3.4
ike esp from 5.6.7.8 to 1.2.3.4

Copy keys:

Machine A: copy from firewall B /etc/isakmpd/local.pub to
/etc/isakmpd/pubkeys/ipv4/5.6.7.8
Machine B: copy from firewall A /etc/isakmpd/local.pub to
/etc/isakmpd/pubkeys/ipv4/1.2.3.4

Start IPSEC:
isakmpd -K
ipsecctl -f /etc/ipsec.conf

enable IP forwarding in /etc/sysctl.conf:
net.inet.ip.forwarding = 1