<div dir="ltr"><div><br></div><div>Hello,</div><div><br></div><div>I have a Libreswan server and client and get different XFRM policies on the client when the client's IP is statically set versus when it is dynamically set from the server with rightaddresspool. This is with VTI route-based encryption.</div><div><br></div><div># ipsec version<br>Linux Libreswan 4.5 (XFRM) on 4.18.0-372.40.1.el8_6.x86_64<br></div><div><br></div><div>(client/server configs below for static and dynamic client IPs)</div><div><br></div><div>When the client IP is statically set, I get the following xfrm policy on the client side. In this case everything works as expected. That is, static host routes directed at the VTI port cause traffic to be put on the tunnel.</div><div><br></div><div>$ sudo ip xfrm policy<br>src <a href="http://0.0.0.0/0">0.0.0.0/0</a> dst <a href="http://172.16.2.0/24">172.16.2.0/24</a> <br>        dir out priority 2097102 ptype main <br>        mark 0x5/0xffffffff <br>        tmpl src 172.16.1.10 dst 192.168.43.55<br>        proto esp reqid 16401 mode tunnel<br>src <a href="http://172.16.2.0/24">172.16.2.0/24</a> dst <a href="http://0.0.0.0/0">0.0.0.0/0</a> <br>        dir fwd priority 2097102 ptype main <br>        mark 0x5/0xffffffff <br>        tmpl src 192.168.43.55 dst 172.16.1.10<br>        proto esp reqid 16401 mode tunnel<br>src <a href="http://172.16.2.0/24">172.16.2.0/24</a> dst <a href="http://0.0.0.0/0">0.0.0.0/0</a> <br>        dir in priority 2097102 ptype main <br>        mark 0x5/0xffffffff <br>        tmpl src 192.168.43.55 dst 172.16.1.10<br>        proto esp reqid 16401 mode tunnel<br></div><div><br></div><div>But when the client IP is dynamically set from a server addresspool, I get the following xfrm policy on the client side:</div><div><br></div><div>$ sudo ip xfrm policy<br>src <a href="http://172.16.111.10/32">172.16.111.10/32</a> dst <a href="http://172.16.2.0/24">172.16.2.0/24</a> <br>        dir out priority 2080718 ptype main <br>        mark 0x5/0xffffffff <br>        tmpl src 172.16.1.10 dst 192.168.43.55<br>        proto esp reqid 16401 mode tunnel<br>src <a href="http://172.16.2.0/24">172.16.2.0/24</a> dst <a href="http://172.16.111.10/32">172.16.111.10/32</a> <br>        dir fwd priority 2080718 ptype main <br>        mark 0x5/0xffffffff <br>        tmpl src 192.168.43.55 dst 172.16.1.10<br>        proto esp reqid 16401 mode tunnel<br>src <a href="http://172.16.2.0/24">172.16.2.0/24</a> dst <a href="http://172.16.111.10/32">172.16.111.10/32</a> <br>        dir in priority 2080718 ptype main <br>        mark 0x5/0xffffffff <br>        tmpl src 192.168.43.55 dst 172.16.1.10<br>        proto esp reqid 16401 mode tunnel<br></div><div><br></div><div>Why do the policies get created differently? This is a problem for us, since not all packets are put on the tunnel, even though there is a static host route sending them to the VTI port. Is this a bug in this version or is there a way to configure Libreswan to not do this? I tried manually deleting the incorrect XFRM policies and creating them with '<a href="http://0.0.0.0/">0.0.0.0/</a>' as seen above, but that did not work.</div><div><br></div><div><br></div><div>Server config with address pool:</div><div>-------------------------------------------</div><div><br></div><div>conn <a href="http://vpnserver.dl110-05.xyz.com">vpnserver.dl110-05.xyz.com</a><br>    # right is remote(client), left is local(server)<br>    left=192.168.43.55<br>    leftid="O=XYZ,CN=<a href="http://vpnserver.dl110-05.xyz.com">vpnserver.dl110-05.xyz.com</a>"<br>    leftsubnet=<a href="http://172.16.2.55/24">172.16.2.55/24</a><br>    leftrsasigkey=%cert<br>    leftcert=<a href="http://vpnserver.dl110-05.xyz.com">vpnserver.dl110-05.xyz.com</a><br>    leftsendcert=always<br><br>    # Clients<br>    right=%any<br>    rightrsasigkey=%cert<br>    rightid=%fromcert<br>    rightca=%same<br>    rightsubnet=<a href="http://0.0.0.0/0">0.0.0.0/0</a></div><div>    rightaddresspool="172.16.111.10-172.16.111.99"<br><br>    # recommended dpd/liveness to cleanup vanished clients<br>    dpddelay=5<br>    dpdtimeout=30<br>    dpdaction=clear<br><br>    auto=add<br>    rekey=no<br>    ikelifetime=86400s<br>    salifetime=3600s<br>    ikev2=insist<br>    phase2=esp<br>    fragmentation=yes<br>    ike=aes256-sha1<br>    phase2alg=aes256-sha1<br></div><div><br></div><div>Client config with dynamic IP:</div><div>---------------------------------------</div><div><br></div><div>conn <a href="http://vpnclient.dl110-00.xyz.com">vpnclient.dl110-00.xyz.com</a><br>    right=192.168.43.55<br>    rightid="O=XYZ,CN=<a href="http://vpnserver.dl110-05.xyz.com">vpnserver.dl110-05.xyz.com</a>"<br>    rightsubnet=<a href="http://172.16.2.55/24">172.16.2.55/24</a><br>    rightrsasigkey=%cert<br><br>    left=172.16.1.10<br>    leftrsasigkey=%cert<br>    leftid="O=XYZ,CN=<a href="http://vpnclient.dl110-00.xyz.com">vpnclient.dl110-00.xyz.com</a>"<br>    leftcert=<a href="http://vpnclient.dl110-00.xyz.com">vpnclient.dl110-00.xyz.com</a><br>    leftupdown="/bin/<a href="http://ipsec_tunnel_tool_updown.xfrm.sh">ipsec_tunnel_tool_updown.xfrm.sh</a>"<br>    leftsubnet=<a href="http://0.0.0.0/0">0.0.0.0/0</a><br>    leftmodecfgclient=yes<br><br>    mark=5/0xffffffff<br>    vti-interface=vti01<br>    vti-routing=yes<br>    vti-shared=no<br><br>    dpddelay=5<br>    dpdtimeout=30<br>    dpdaction=restart<br><br>    rekey=yes<br>    auto=start<br>    ikelifetime=86400s<br>    salifetime=3600s<br>    phase2=esp<br>    fragmentation=yes<br>    ike=aes256-sha1<br>    phase2alg=aes256-sha1<br></div><div><br></div><div><br></div><div><div>Server config with static client IP:</div><div>--------------------------------------------</div><div><br></div><div>conn <a href="http://vpnserver.dl110-05.xyz.com">vpnserver.dl110-05.xyz.com</a><br>    left=192.168.43.55<br>    leftid="O=XYZ,CN=<a href="http://vpnserver.dl110-05.xyz.com">vpnserver.dl110-05.xyz.com</a>"<br>    leftsubnet=<a href="http://172.16.2.55/24">172.16.2.55/24</a><br>    leftrsasigkey=%cert<br>    leftcert=<a href="http://vpnserver.dl110-05.xyz.com">vpnserver.dl110-05.xyz.com</a><br>    leftsendcert=always<br><br>    # Clients<br>    right=%any<br>    rightrsasigkey=%cert<br>    rightid=%fromcert<br>    rightca=%same<br>    rightsubnet=<a href="http://0.0.0.0/0">0.0.0.0/0</a><br><br>    dpddelay=5<br>    dpdtimeout=30<br>    dpdaction=clear<br><br>    auto=add<br>    rekey=no<br>    ikelifetime=86400s<br>    salifetime=3600s<br>    ikev2=insist<br>    phase2=esp<br>    fragmentation=yes<br>    ike=aes256-sha1<br>    phase2alg=aes256-sha1<br></div><div><br></div><div><br></div><div>Client config with static IP:</div><div>---------------------------------------</div><div><br></div></div><div>conn <a href="http://vpnclient.dl110-00.xyz.com">vpnclient.dl110-00.xyz.com</a><br>    right=192.168.43.55<br>    rightid="O=XYZ,CN=<a href="http://vpnserver.dl110-05.xyz.com">vpnserver.dl110-05.xyz.com</a>"<br>    rightsubnet=<a href="http://172.16.2.55/24">172.16.2.55/24</a><br>    rightrsasigkey=%cert<br><br>    left=172.16.1.10<br>    leftrsasigkey=%cert<br>    leftid="O=XYZ,CN=<a href="http://vpnclient.dl110-00.xyz.com">vpnclient.dl110-00.xyz.com</a>"<br>    leftcert=<a href="http://vpnclient.dl110-00.xyz.com">vpnclient.dl110-00.xyz.com</a><br>    leftupdown="/bin/<a href="http://ipsec_tunnel_tool_updown.xfrm.sh">ipsec_tunnel_tool_updown.xfrm.sh</a>"<br>    leftsourceip=172.16.111.10<br>    leftsubnet=<a href="http://0.0.0.0/0">0.0.0.0/0</a><br>    leftvti=<a href="http://172.16.111.10/24">172.16.111.10/24</a><br><br>    mark=5/0xffffffff<br>    vti-interface=vti01<br>    vti-routing=yes<br>    vti-shared=no<br>    # The rest of the config is the same as the dynamic IP config<br></div><div><br></div><div><br></div><div>Regards,</div><br clear="all"><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><b>Brady Johnson</b><div>Principal Software Engineer</div><div><div>Telco Solutions & Enablement</div></div><div><a href="mailto:brady.johnson@redhat.com" target="_blank">brady.johnson@redhat.com</a><br></div><div><div><br></div><div></div></div></div></div></div></div>