summaryrefslogtreecommitdiff
path: root/ipsec
Commit message (Collapse)AuthorAgeFilesLines
* ovs-monitor-ipsec: Allow custom options per tunnel.Andreas Karis2022-05-041-1/+16
| | | | | | | | | | | Tunnels in LibreSwan and OpenSwan allow for many options to be set on a per tunnel basis. Pass through any options starting with ipsec_ to the connection in the configuration file. Administrators are responsible for picking valid key/value pairs. Signed-off-by: Andreas Karis <ak.karis@gmail.com> Acked-by: Mike Pattrick <mkp@redhat.com> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
* ovs-monitor-ipsec: Add list-commands command.Mohammad Heib2022-03-071-1/+2
| | | | | | | | | | | | | Currently ovs-python unixctl implement the list-commands operation as 'help' command which doesn't match the ovs-appctl man page and that can confuse the end-users who want to check the supported operations of the ovs-monitor-ipsec. This patch adds a list-commands alias name to 'help' operation. Acked-by: Mike Pattrick <mkp@redhat.com> Signed-off-by: Mohammad Heib <mheib@redhat.com> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
* ipsec: StrongSwan report connection update failures to ovs logs.Mohammad Heib2022-03-041-1/+8
| | | | | | | | | | | | | | | Currently when the user adds an IPsec tunnel port to the ovs bridge the ovs-monitor-ipsec script will add this tunnel IPsec-related configuration to the appropriate file and submit a request to start the IPsec connection for this port and ignores the request output which can contain an error message. This patch captures the request output and prints the error message to the ovs logs. Acked-by: Mike Pattrick <mkp@redhat.com> Signed-off-by: Mohammad Heib <mheib@redhat.com> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
* ipsec: Libreswan report connection failures to ovs logs.Mohammad Heib2022-03-041-0/+5
| | | | | | | | | | | | | | Currently when the user adds an IPsec tunnel port to the ovs bridge the ovs-monitor-ipsec script will submit a request to start the IPsec connection for this port and ignores the request output which can contain an error message. This patch captures the request output and prints the error message to the ovs logs. Signed-off-by: Mohammad Heib <mheib@redhat.com> Acked-by: Mike Pattrick <mkp@redhat.com> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
* ovs-monitor-ipsec: Fix generated strongSwan ipsec.conf for IPv6.Antonin Bas2022-01-211-5/+5
| | | | | | | | | | | Setting the local address to 0.0.0.0 (v4 address) while setting the remote address to a v6 address results in an invalid configuration. See https://github.com/strongswan/strongswan/discussions/821 Signed-off-by: Antonin Bas <antonin.bas@gmail.com> Acked-by: Mike Pattrick <mkp@redhat.com> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
* ipsec: Update ordering of imports.Mark Gray2021-04-011-2/+2
| | | | | | | | Signed-off-by: Mark Gray <mark.d.gray@redhat.com> Acked-by: Flavio Leitner <fbl@sysclose.org> Acked-by: Aaron Conole <aconole@redhat.com> Acked-by: Eelco Chaudron <echaudro@redhat.com> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
* ipsec: Allow custom file locations.Mark Gray2021-04-011-23/+80
| | | | | | | | | | | | | | | "ovs_monitor_ipsec" assumes certain file locations for a number of Libreswan objects. This patch allows these locations to be configurable at startup in the Libreswan case. This additional flexibility enables system testing for OVS IPsec. Signed-off-by: Mark Gray <mark.d.gray@redhat.com> Acked-by: Flavio Leitner <fbl@sysclose.org> Acked-by: Aaron Conole <aconole@redhat.com> Acked-by: Eelco Chaudron <echaudro@redhat.com> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
* ipsec: Fix IPv6 default route support for Libreswan.Mark Gray2021-04-011-0/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | When configuring IPsec, "ovs-monitor-ipsec" honours the 'local_ip' option in the 'Interface' table by configuring the 'left' side of the Libreswan connection with 'local_ip'. If 'local_ip' is not specified, "ovs-monitor-ipsec" sets 'left' to '%defaultroute' which is interpreted as the IP address of the default gateway interface. However, when 'remote_ip' is an IPv6 address, Libreswan still interprets '%defaultroute' as the IPv4 address on the default gateway interface (see: https://github.com/libreswan/libreswan/issues/416) giving an "address family inconsistency" error. This patch resolves this issue by specifying the connection as IPv6 when the 'remote_ip' is IPv6 and 'local_ip' has not been set. Fixes: 22c5eafb6efa ("ipsec: reintroduce IPsec support for tunneling") Signed-off-by: Mark Gray <mark.d.gray@redhat.com> Acked-by: Flavio Leitner <fbl@sysclose.org> Acked-by: Aaron Conole <aconole@redhat.com> Acked-by: Eelco Chaudron <echaudro@redhat.com> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
* ovs-monitor-ipsec: Add option to not restart IKE daemon.Mark Gray2021-01-061-3/+8
| | | | | | | Signed-off-by: Mark Gray <mark.d.gray@redhat.com> Acked-by: Eelco Chaudron <echaudro@redhat.com> Acked-by: Flavio Leitner <fbl@sysclose.org> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
* ovs-monitor-ipsec: Allow exit of ipsec daemon maintaining state.Mark Gray2021-01-061-9/+21
| | | | | | | | | | | | | | When 'ovs-monitor-ipsec' exits, it clears all persistent state (i.e. active ipsec connections, /etc/ipsec.conf, certs/keys). In some use-cases, we may want to exit and maintain state so that ipsec connectivity is maintained. One example of this is during an upgrade. This will require the caller to clear this persistent state when appropriate (e.g. before 'ovs-monitor-ipsec') is restarted. Signed-off-by: Mark Gray <mark.d.gray@redhat.com> Acked-by: Eelco Chaudron <echaudro@redhat.com> Acked-by: Flavio Leitner <fbl@sysclose.org> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
* ovs-monitor-ipsec: Fix active connection regex.Mark Gray2021-01-051-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Connections are added to IPsec using a connection name that is determined from the OVS port name and the tunnel type. GRE connections take the form: <iface>-<ver> Other connections take the form: <iface>-in-<ver> <iface>-out-<ver> The regex '|' operator parses strings left to right looking for the first match that it can find. '.*' is also greedy. This causes incorrect interface names to be parsed from active connections as other tunnel types are parsed as type GRE. This gives unexpected "is outdated" warnings and the connection is torn down. For example, 'ovn-424242-in-1' will produce an incorrect interface name of 'ovn-424242-in' instead of 'ovn-424242'. There are a number of ways this could be resolved including a cleverer regular expression, or re.findall(). However, this approach was taken as it simplifies the code easing maintainability. Fixes: 22c5eafb6efa ("ipsec: reintroduce IPsec support for tunneling") Reported-at: https://bugzilla.redhat.com/show_bug.cgi?id=1908789 Signed-off-by: Mark Gray <mark.d.gray@redhat.com> Acked-by: Eelco Chaudron <echaudro@redhat.com> Acked-by: Flavio Leitner <fbl@sysclose.org> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
* ovs-monitor-ipsec: set correct 'leftcert' and 'rightcert' name.Mark Gray2021-01-051-4/+4
| | | | | | | | | | | | In Libreswan case, 'ovs-monitor-ipsec' incorrectly configures 'leftcert' and 'rightcert' names for self-signed certificates. This patch resolves that. Reported-at: https://bugzilla.redhat.com/show_bug.cgi?id=1906280 Signed-off-by: Mark Gray <mark.d.gray@redhat.com> Acked-by: Eelco Chaudron <echaudro@redhat.com> Acked-by: Flavio Leitner <fbl@sysclose.org> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
* ovs-monitor-ipsec: Add support for tunnel 'local_ip'.Mark Gray2021-01-051-3/+5
| | | | | | | | | | | | | | | | | | In the libreswan case, 'ovs-monitor-ipsec' sets 'left' to '%defaultroute' which will use the local address of the default route interface as the source IP address. In multihomed environments, this may not be correct if the user wants to specify what the source IP address is. In OVS, this can be set for tunnel ports using the 'local_ip' option. This patch also uses that option to populate the 'ipsec.conf' configuration. If the 'local_ip' option is not present, it will default to the previous behaviour of using '%defaultroute' Reported-at: https://bugzilla.redhat.com/show_bug.cgi?id=1906280 Signed-off-by: Mark Gray <mark.d.gray@redhat.com> Acked-by: Eelco Chaudron <echaudro@redhat.com> Acked-by: Flavio Leitner <fbl@sysclose.org> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
* ovs-monitor-ipsec: Fix _nss_clear_database() parse error.Mark Gray2021-01-051-1/+2
| | | | | | | | | | | | | | | | _nss_clear_database() runs `certutil` in order to get a list of certificates currently loaded in NSS. This fails with error: "ovs-monitor-ipsec | ERR | Failed to clear NSS database. startswith first arg must be bytes or a tuple of bytes, not str" Modify subprocess.Popen() to write in 'text' mode so that 'startwith' can correctly parse output. Signed-off-by: Mark Gray <mark.d.gray@redhat.com> Acked-by: Eelco Chaudron <echaudro@redhat.com> Acked-by: Flavio Leitner <fbl@sysclose.org> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
* ipsec: Fix Strongswan configuration syntax.Boleslaw Tokarski2020-09-161-4/+12
| | | | | | | | | | | | | | | | | | | | Strongswan seems to have .opt files in the source tree with the dotted option syntax. It seems that up until version 5.6, the syntax was also accepted by Strongswan. However, the .opt files are converted to .conf files during Strongswan build, and the dotted syntax is no longer accepted by Strongswan (tested on 5.8.2). The effect was that the ovs ipsec monitor fails to start Strongswan, since that complains with: /etc/strongswan.d/ovs.conf:4: syntax error, unexpected ., expecting : or '{' or '=' [.] This commit fixes the configuration file provided to Strongswan to .conf syntax. Signed-off-by: Boleslaw Tokarski <boleslaw.tokarski@jollamobile.com> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
* ovs-monitor-ipsec: Convert Python2 code to Python3.lzhecheng2020-08-171-11/+11
| | | | | | | | Submitted-at: https://github.com/openvswitch/ovs/pull/331 Reported-at: https://github.com/openvswitch/ovs-issues/issues/192 Fixes: 1ca0323e7c29 ("Require Python 3 and remove support for Python 2.") Signed-off-by: lzhecheng <lzhecheng@vmware.com> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
* Require Python 3 and remove support for Python 2.Ben Pfaff2019-09-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Python 2 reaches end-of-life on January 1, 2020, which is only a few months away. This means that OVS needs to stop depending on in the next release that should occur roughly that same time. Therefore, this commit removes all support for Python 2. It also makes Python 3 a mandatory build dependency. Some of the interesting consequences: - HAVE_PYTHON, HAVE_PYTHON2, and HAVE_PYTHON3 conditionals have been removed, since we now know that Python3 is available. - $PYTHON and $PYTHON2 are removed, and $PYTHON3 is always available. - Many tests for Python 2 support have been removed, and the ones that depended on Python 3 now run unconditionally. This allowed several macros in the testsuite to be removed, making the code clearer. This does make some of the changes to the testsuite files large due to indentation level changes. - #! lines for Python now use /usr/bin/python3 instead of /usr/bin/python. - Packaging depends on Python 3 packages. Acked-by: Numan Siddique <nusiddiq@redhat.com> Tested-by: Numan Siddique <nusiddiq@redhat.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* ipsec: Install ovs-monitor-ipsec in script directoryTimothy Redaelli2018-11-121-1/+1
| | | | | | | | | | | | | In commit d5cc46e3d185 ("ipsec: Use @PYTHON@ directly instead of "/usr/bin/env python"") ovs-monitor-ipsec is installed in bin directory, but it's supposed to be installed in script directory. This commit removes also the manual copy of "ovs-monitor-ipsec" in spec file since it's installed directly in "make install". Fixes: d5cc46e3d185 ("ipsec: Use @PYTHON@ directly instead of "/usr/bin/env python"") Signed-off-by: Timothy Redaelli <tredaelli@redhat.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* gitignore: Ignore ovs-monitor-ipsecTimothy Redaelli2018-11-121-0/+1
| | | | | | | | | | | | Commit d5cc46e3d185 ("ipsec: Use @PYTHON@ directly instead of "/usr/bin/env python"") introduced ovs-monitor-ipsec.in that generates ovs-monitor-ipsec. This commit adds ovs-monitor-ipsec to ipsec/.gitignore. Fixes: d5cc46e3d185 ("ipsec: Use @PYTHON@ directly instead of "/usr/bin/env python"") Signed-off-by: Timothy Redaelli <tredaelli@redhat.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* build: Clean up ovs-monitor-ipsec.Ilya Maximets2018-11-121-0/+1
| | | | | | | | | | | | | This fixes travis distcheck: ERROR: files left in build directory after distclean: ./ipsec/ovs-monitor-ipsec make[1]: *** [distcleancheck] Error 1 Acked-by: Timothy Redaelli <tredaelli@redhat.com> Fixes: d5cc46e3d185 ("ipsec: Use @PYTHON@ directly instead of "/usr/bin/env python"") Signed-off-by: Ilya Maximets <i.maximets@samsung.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* ipsec: Use @PYTHON@ directly instead of "/usr/bin/env python"Timothy Redaelli2018-11-102-4/+4
| | | | | | | | | | | | | | | | Using "/usr/bin/env" is against Fedora Packaging Guidelines [1]. Moreover, in this specific case, it also prevent "make rpm-fedora" to successfully complete on "Fedora Rawhide" since "#!/usr/bin/env python" must not be used anymore [2]. [1] https://fedoraproject.org/wiki/Packaging:Guidelines#Shebang_lines [2] https://fedoraproject.org/wiki/Changes/Make_ambiguous_python_shebangs_error CC: Qiuyu Xiao <qiuyu.xiao.qyx@gmail.com> Fixes: 22c5eafb6efa ("ipsec: reintroduce IPsec support for tunneling") Signed-off-by: Timothy Redaelli <tredaelli@redhat.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* ipsec: reintroduce IPsec support for tunnelingQiuyu Xiao2018-11-092-0/+1245
This patch reintroduces ovs-monitor-ipsec daemon that was previously removed by commit 2b02d770 ("openvswitch: Allow external IPsec tunnel management.") After this patch, there are no IPsec flavored tunnels anymore. IPsec is enabled by setting up the right values in: 1. OVSDB:Interface:options column; 2. OVSDB:Open_vSwitch:other_config column; 3. OpenFlow pipeline. GRE, VXLAN, GENEVE, and STT IPsec tunnels are supported. LibreSwan and StrongSwan IKE daemons are supported. User can choose pre-shared key, self-signed peer certificate, or CA-signed certificate as authentication methods. Signed-off-by: Qiuyu Xiao <qiuyu.xiao.qyx@gmail.com> Signed-off-by: Ansis Atteka <aatteka@ovn.org> Co-authored-by: Ansis Atteka <aatteka@ovn.org> Signed-off-by: Ben Pfaff <blp@ovn.org>