summaryrefslogtreecommitdiff
path: root/src/migration-scripts
diff options
context:
space:
mode:
authorOleksandr Kuchmystyi <o.kuchmystyi@vyos.io>2025-12-31 10:50:21 +0300
committerOleksandr Kuchmystyi <o.kuchmystyi@vyos.io>2026-01-12 16:44:32 +0300
commit61487b13da8dc270907633a3140bd0cc2aa0926a (patch)
tree967c8864116299c4a4d3307bc9666f54b2418761 /src/migration-scripts
parent7fea6b6dbbd786bf6a32c496fc70ca9e9b5f8b1f (diff)
downloadvyos-1x-61487b13da8dc270907633a3140bd0cc2aa0926a.tar.gz
vyos-1x-61487b13da8dc270907633a3140bd0cc2aa0926a.zip
openvpn: T7633: Add support for 'data-ciphers-fallback' in site-to-site tunnels
- Introduced new CLI option 'data-ciphers-fallback' for OpenVPN interfaces (used as fallback cipher in site-to-site mode) - Adjust migration 1‑to‑2 to skip migrating 'cipher' for site‑to‑site interfaces
Diffstat (limited to 'src/migration-scripts')
-rw-r--r--src/migration-scripts/openvpn/1-to-26
-rw-r--r--src/migration-scripts/openvpn/4-to-538
2 files changed, 44 insertions, 0 deletions
diff --git a/src/migration-scripts/openvpn/1-to-2 b/src/migration-scripts/openvpn/1-to-2
index 83d6219d6..75360446c 100644
--- a/src/migration-scripts/openvpn/1-to-2
+++ b/src/migration-scripts/openvpn/1-to-2
@@ -25,11 +25,17 @@ def migrate(config: ConfigTree) -> None:
# Remove 'encryption cipher' and add this value to 'encryption ncp-ciphers'
# for server and client mode.
# Site-to-site mode still can use --cipher option
+ mode_path = ['interfaces', 'openvpn', i, 'mode']
cipher_path = ['interfaces', 'openvpn', i, 'encryption', 'cipher']
ncp_cipher_path = ['interfaces', 'openvpn', i, 'encryption', 'ncp-ciphers']
+
if config.exists(cipher_path):
if config.exists(['interfaces', 'openvpn', i, 'shared-secret-key']):
continue
+ # Only migrate if mode is not 'site-to-site'
+ if config.value_exists(mode_path, 'site-to-site'):
+ continue
+
cipher = config.return_value(cipher_path)
config.delete(cipher_path)
if cipher == 'none':
diff --git a/src/migration-scripts/openvpn/4-to-5 b/src/migration-scripts/openvpn/4-to-5
new file mode 100644
index 000000000..5c7ee833c
--- /dev/null
+++ b/src/migration-scripts/openvpn/4-to-5
@@ -0,0 +1,38 @@
+#!/usr/bin/env python3
+# Copyright VyOS maintainers and contributors <maintainers@vyos.io>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this library. If not, see <http://www.gnu.org/licenses/>.
+#
+# T7633: This migration converts legacy 'encryption cipher' directives into
+# 'encryption data-ciphers-fallback' for site-to-site mode tunnels.
+#
+# In modern OpenVPN (v2.6+), 'cipher' and 'data-ciphers' are not valid
+# in site-to-site mode.
+# The appropriate directive is now '--data-ciphers-fallback alg'.
+
+from vyos.configtree import ConfigTree
+
+def migrate(config: ConfigTree) -> None:
+ ovpn_intfs = config.list_nodes(['interfaces', 'openvpn'], path_must_exist=False)
+ for i in ovpn_intfs:
+ base_path = ['interfaces', 'openvpn', i]
+ mode_path = base_path + ['mode']
+ cipher_path = base_path + ['encryption', 'cipher']
+
+ # Only migrate if mode is explicitly 'site-to-site'
+ if config.value_exists(mode_path, 'site-to-site'):
+
+ # Rename 'encryption cipher' with 'encryption data-ciphers-fallback'
+ if config.exists(cipher_path):
+ config.rename(cipher_path, 'data-ciphers-fallback')