<div dir="ltr">Hi Phil, All<div>I tried to look for some details how to implement a route based VPN and I've created the following configuration</div><div><br></div><div>First, I've created the following script which will be called by the VPN at the start/end of the connection </div><div>As a test, I tried to route only 172.217.19.69 (it's one of the google addresses)</div><div>[/etc/<a href="http://ipsec.script.sh">ipsec.script.sh</a>]</div><div><br></div><div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">#!/bin/bash<br>set -o nounset<br>set -o errexit<br>VTI_IF="vti${PLUTO_UNIQUEID}"<br>case "${PLUTO_VERB}" in<br>    up-client)<br>        ip tunnel add "${VTI_IF}" local "${PLUTO_ME}" remote "${PLUTO_PEER}" mode vti \<br>            okey "${PLUTO_MARK_OUT%%/*}" ikey "${PLUTO_MARK_IN%%/*}"<br>        ip link set "${VTI_IF}" up<br>        ip addr add ${PLUTO_MY_SOURCEIP} dev "${VTI_IF}"<br>        ip route add <a href="http://172.217.19.68/32">172.217.19.68/32</a> dev "${VTI_IF}"<br>        sysctl -w "net.ipv4.conf.${VTI_IF}.disable_policy=1"<br>        ;;<br>    down-client)<br>        ip tunnel del "${VTI_IF}"<br>        ;;<br>esac</blockquote></div><div class="gmail_extra"><br></div><div class="gmail_extra">and the IPSec configuration [etc/ipsec.conf]</div><div class="gmail_extra"><br></div><div class="gmail_extra"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">conn hide-nl<br>       keyexchange=ike<br>       dpdaction=clear<br>       dpddelay=300s<br>       eap_identity=gprintemps<br>       leftupdown=/usr/local/sbin/ipsec-notify.sh<br>       leftauth=eap-mschapv2<br>       left=%defaultroute<br>       leftsourceip=%config<br>       right=<a href="http://free-nl.hide.me">free-nl.hide.me</a><br>       rightauth=pubkey<br>       rightsubnet=<a href="http://0.0.0.0/0">0.0.0.0/0</a><br>       rightid=%any<br>       type=tunnel<br>       auto=route<br></blockquote><div><br></div><div>I started the VPN + the "hides-nl" connection</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">Routed Connections:<br>     hide-nl{1}:  ROUTED, TUNNEL, reqid 1<br>     hide-nl{1}:   <a href="http://10.211.55.15/32">10.211.55.15/32</a> === <a href="http://0.0.0.0/0">0.0.0.0/0</a><br>Security Associations (1 up, 0 connecting):<br>     hide-nl[1]: ESTABLISHED 20 minutes ago, 10.211.55.15[10.211.55.15]...95.211.101.198[C=MY, ST=Wilayah Persekutuan, L=Labuan, O=eVenture Limited, CN=*.<a href="http://hide.me">hide.me</a>]<br>     hide-nl{2}:  INSTALLED, TUNNEL, reqid 1, ESP in UDP SPIs: ca4900c6_i cd2bd533_o<br>     hide-nl{2}:   <a href="http://10.3.150.159/32">10.3.150.159/32</a> === <a href="http://0.0.0.0/0">0.0.0.0/0</a></blockquote><div><br></div><div>I'm not really sure the VPN is used when I call "curl 172.217.19.68"</div><div>Indeed, I don't see any trace of the "vtixx" interface.I'm sure.</div><div>Moreover, something seems strange in my ipsec.conf - Does it mean the filter is only done in the script and each time the interface is created?</div><div><br></div><div>Seems I need help and explanations/pointers...</div><div>Thanks / Best Regards,</div><div>Gilles</div></div><div class="gmail_extra"><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, May 17, 2018 at 3:16 PM, Phil Frost <span dir="ltr"><<a href="mailto:phil@postmates.com" target="_blank">phil@postmates.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr">One way to go would be configuring a route based VPN[1]. Then you can use all kinds of Linux routing tricks to get just that user's traffic over the VPN by directing it to the vti interface. For example you could launch that user's processes in a network namespace, or use the "owner" module of iptables to match traffic from processes run as that user and mangle them to use the VPN.<div><br></div><div>  [1]: <a href="https://wiki.strongswan.org/projects/strongswan/wiki/RouteBasedVPN" target="_blank">https://wiki.strongswan.<wbr>org/projects/strongswan/wiki/<wbr>RouteBasedVPN</a></div></div><div class="gmail-HOEnZb"><div class="gmail-h5"><br><div class="gmail_quote"><div dir="ltr">On Thu, May 17, 2018 at 9:25 AM Gilles Printemps <<a href="mailto:gprintemps@gmail.com" target="_blank">gprintemps@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi,<div>Is there a way to force all the traffic from a specific linux user to be routed through the VPN? </div><div>I would like to use the split tunnelling but I don't understand how to configure Strongswan?</div><div><br></div><div>Thanks for your help / BR Gilles </div></div>
</blockquote></div>
</div></div></blockquote></div><br></div></div>