<div dir="ltr">Thank you Paul!<br>Yesterday I could modify openstack-neutron-vpn-agent-2014.2.1-1.el7.centos.noarch&#39;s script and VPN just work :). I don&#39;t know much about python but I did my best. I&#39;m sure it can be improved. These are all the steps I did for enable VPNaaS on Openstack Juno con Centos 7 with libreswan-3.8-6.el7_0.x86_64 (I only can use &#39;official repos&#39;)<br><br>1.- Install necessary packages:<br><div># <span style="color:rgb(72,72,72);font-size:12px;background-color:rgb(250,250,250)">yum install openstack-neutron-vpn-agent libreswan -y</span></div><div><span style="color:rgb(72,72,72);font-size:12px;background-color:rgb(250,250,250)"><br></span></div><div><span style="color:rgb(72,72,72);font-size:12px;background-color:rgb(250,250,250)">2.- Enable vpnaas plugin in neutron</span></div><div><span style="color:rgb(72,72,72);font-size:12px;background-color:rgb(250,250,250)"># ca</span>t /etc/neutron/neutron.conf<br>...<br>service_plugins = router,vpnaas<br>...<br>service_provider=VPN:openswan:neutron.services.vpn.service_drivers.ipsec.IPsecVPNDriver:default<br>...<br><br>3.- Configure vpn plugin<br># cat /etc/neutron/vpn_agent.ini<br><br>[DEFAULT]<br># VPN-Agent configuration file<br># Note vpn-agent inherits l3-agent, so you can use configs on l3-agent also<br>##interface_driver = neutron.agent.linux.interface.OVSInterfaceDriver<br><br>[vpnagent]<br># vpn device drivers which vpn agent will use<br># If we want to use multiple drivers,  we need to define this option multiple times.<br>vpn_device_driver=neutron.services.vpn.device_drivers.ipsec.OpenSwanDriver<br># vpn_device_driver=neutron.services.vpn.device_drivers.cisco_ipsec.CiscoCsrIPsecDriver<br># vpn_device_driver=another_driver<br><br>[ipsec]<br># Status check interval<br>ipsec_status_check_interval=30</div><div><br></div><div><br></div><div>4.- Here we start with the dirt :)</div><div>4.1.- Add certutil command to vpnaas.filters, so it could be execute on neutron rootwarps </div># cat /usr/share/neutron/rootwrap/vpnaas.filters<br># neutron-rootwrap command filters for nodes on which neutron is<br># expected to control network<br>#<br># This file should be owned by (and only-writeable by) the root user<br><br># format seems to be<br># cmd-name: filter-name, raw-command, user, args<br><br>[Filters]<br><br>ip: IpFilter, ip, root<br>ip_exec: IpNetnsExecFilter, ip, root<br>openswan: CommandFilter, ipsec, root<br>libreswan: CommandFilter, certutil, root<div><br></div><div>4.2.- Edit ipsec.py, which execute &#39;ipsec and (now) certutils&#39; commands</div><div>4.2.1.- If nss db does not exist, it is created on /var/lib/neutron/ipsec/&lt;uuid&gt;/etc/ipsec.d</div><div>4.2.2.- In &#39;ipsec pluto&#39; execution:</div><div>4.2.2.1.- Remove &#39;--config&#39; option, keep ctlbase (Thanks Paul!)</div><div>4.2.2.2.- Change argument of &#39;--ipsecdir&#39; from /var/lib/neutron/ipsec/&lt;uuid&gt;/etc/ to /var/lib/neutron/ipsec/&lt;uuid&gt;/etc/ipsec.d<br></div><div>4.2.2.3.- Remove --use-netkey because it is the default option</div><div>4.2.3.- In &#39;ipsec addconn&#39; execution:<br>4.2.3.1.- Remove  &#39;--defaultroutenexthop&#39; because it is obsolete<br>The diff between original and modified file is:<br><br># diff  /usr/lib/python2.7/site-packages/neutron/services/vpn/device_drivers/ipsec.py /usr/lib/python2.7/site-packages/neutron/services/vpn/device_drivers/ipsec.py.original <br>97d96<br>&lt;     bcertutil = &quot;certutil&quot; <br>114,119d112<br>&lt;     NSS_FILES = [<br>&lt;         &#39;cert8.db&#39;,<br>&lt;         &#39;key3.db&#39;,<br>&lt;         &#39;secmod.db&#39;<br>&lt;     ]<br>&lt; <br>189,197d181<br>&lt;     def _ensure_nss(self, nss_files):<br>&lt;         if not os.path.isfile(nss_files):<br>&lt;             #start nss database<br>&lt;             self._execute([self.bcertutil,<br>&lt;                        &#39;-N&#39;,<br>&lt;                        &#39;--empty-password&#39;,<br>&lt;                        &#39;-d&#39;, self.ipsecd_dir,<br>&lt;                        ])<br>&lt; <br>199c183<br>&lt;         &quot;&quot;&quot;Create config directory and nss files if they does not exist.&quot;&quot;&quot; <br>---<br>&gt;         &quot;&quot;&quot;Create config directory if it does not exist.&quot;&quot;&quot; <br>204,206d187<br>&lt;         for nss_file in self.NSS_FILES:<br>&lt;             nss_path = os.path.join(self.ipsecd_dir, nss_file)<br>&lt;             self._ensure_nss(nss_path)<br>327,328d307<br>&lt;         self.ipsecd_dir = os.path.join(<br>&lt;             self.etc_dir, &#39;ipsec.d&#39;)<br>401c380,381<br>&lt;                        &#39;--ipsecdir&#39;, self.ipsecd_dir,<br>---<br>&gt;                        &#39;--ipsecdir&#39;, self.etc_dir,<br>&gt;                        &#39;--use-netkey&#39;,<br>412a393<br>&gt;                            &#39;--defaultroutenexthop&#39;, nexthop,<br><br></div><div><span style="color:rgb(72,72,72);font-size:12px;background-color:rgb(250,250,250)">4.3.- </span>Edit <span style="color:rgb(72,72,72);font-size:12px;background-color:rgb(250,250,250)">ipsec.conf.template</span>, which is used to generate /var/lib/neutron/ipsec/&lt;uid&gt;/ipsec.conf (necessary for ipsec addconn command)</div><div>Just comment obsolete options. The diff between original and modified file is:</div><div><br></div><div># diff /usr/lib/python2.7/site-packages/neutron/services/vpn/device_drivers/template/openswan/ipsec.conf.template /usr/lib/python2.7/site-packages/neutron/services/vpn/device_drivers/template/openswan/ipsec.conf.template.original <br>3c3<br>&lt;     # nat_traversal=yes<br>---<br>&gt;     nat_traversal=yes<br>7,8c7<br>&lt;     # keylife=60m<br>&lt;     salifetime=60m<br>---<br>&gt;     keylife=60m<br>20c19<br>&lt;     # leftnexthop=%defaultroute<br>---<br>&gt;     leftnexthop=%defaultroute<br>31c30<br>&lt;     # rightnexthop=%defaultroute<br>---<br>&gt;     rightnexthop=%defaultroute<br>63,64c62<br>&lt;     # lifetime={{ipsec_site_connection.ipsecpolicy.lifetime_value}}s<br>&lt;     salifetime={{ipsec_site_connection.ipsecpolicy.lifetime_value}}s<br>---<br>&gt;     lifetime={{ipsec_site_connection.ipsecpolicy.lifetime_value}}s</div><div><br></div><div>5.- Enable and start von-agent</div><div># systemctl enable neutron-vpn-agent<br># systemctl start neutron-vpn-agent</div><div><br></div><div><br></div><div>Hope it could be useful to someone. </div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature">Matías R. Cuenca del Rey</div></div>
<br><div class="gmail_quote">On Tue, Feb 3, 2015 at 12:49 AM, Paul Wouters <span dir="ltr">&lt;<a href="mailto:paul@nohats.ca" target="_blank">paul@nohats.ca</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Mon, 2 Feb 2015, Matias R. Cuenca del Rey wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hello,I&#39;m trying to run Openstack VPNaaS on Centos 7 with libreswan-3.8-6.el7_0.x86_64. VPNaaS&#39;s scripts are for openswan,<span class=""><br>
so there are some options that are different. I&#39;ve been working to adapt them, for example &#39;ipsec pluto&#39; didn&#39;t work<br>
because there weren&#39;t nssdb,<br>
Right now, I have running pluto, but I&#39;m not sure if it is running like I want. The command that I execute to start pluto<br>
is:<br>
</span></blockquote>
<br>
We put it a few fixes specifically for openstack and non-root ownership<br>
of files and dropping capabilities later on. Please use libreswan-3.12<br>
to ensure you haev all those fixes! You&#39;re mixing at least<br>
libreswan-3.9:<br>
<br>
* pluto: Drop CAP_DAC_OVERRIDE privs later to support non-root dirs [Paul]<span class=""><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
# ipsec pluto --ctlbase /var/lib/neutron/ipsec/<u></u>776a620a-9e26-436a-8efe-<u></u>0736ef38d2cc/var/run/pluto --ipsecdir<br>
/var/lib/neutron/ipsec/<u></u>776a620a-9e26-436a-8efe-<u></u>0736ef38d2cc/etc/ipsec.d --config<br>
/var/lib/neutron/ipsec/<u></u>776a620a-9e26-436a-8efe-<u></u>0736ef38d2cc/etc/ipsec.conf --uniqueids --nat_traversal --secretsfile<br>
/var/lib/neutron/ipsec/<u></u>776a620a-9e26-436a-8efe-<u></u>0736ef38d2cc/etc/ipsec.secrets --virtual_private<br>
%v4:<a href="http://192.168.1.0/24,%v4:192.168.88.0/24" target="_blank">192.168.1.0/24,%v4:192.<u></u>168.88.0/24</a><br>
<br>
Although I execute ipsec pluto with --config option, when I execute ipsec whack --status I read the default config file<br>
and directory:<br>
</blockquote>
<br></span>
The order matters. If you specify --config and then --ctlbase, the<br>
ctlbase will override the configuration. if you specify --ctlbase<br>
before --config, the config file version will get used.<span class=""><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Cannot open logfile &#39;(null)&#39;: Bad file descriptornss directory plutomain:<br>
/var/lib/neutron/ipsec/<u></u>776a620a-9e26-436a-8efe-<u></u>0736ef38d2cc/etc/ipsec.d<br>
</blockquote>
<br></span>
Those might be the caused by the capabilities fix.<br>
<br>
If this does not fix your issues, ping me on <a href="mailto:pwouters@redhat.com" target="_blank">pwouters@redhat.com</a> and<br>
I&#39;ll bring you in contact with our redhat/openstack guy that was part<br>
of fixing these issues.<span class="HOEnZb"><font color="#888888"><br>
<br>
Paul<br>
</font></span></blockquote></div><br></div>