summaryrefslogtreecommitdiff
path: root/src/op_mode/pki.py
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2024-07-27 17:49:07 +0200
committerGitHub <noreply@github.com>2024-07-27 17:49:07 +0200
commitba4198fc3cb80628ad38118f4dcc3bfe43181de1 (patch)
tree4d731a1a47a5acdb54d04eab66de885bd676b9aa /src/op_mode/pki.py
parent42a3be5b079f005115ce107935929ebb4a7139e0 (diff)
parentbb64603b41b51eb429304059d8457568b2588ee5 (diff)
downloadvyos-1x-ba4198fc3cb80628ad38118f4dcc3bfe43181de1.tar.gz
vyos-1x-ba4198fc3cb80628ad38118f4dcc3bfe43181de1.zip
Merge pull request #3879 from natali-rs1985/T5744-current
op_mode: T5744: PKI import OpenVPN shared key includess unexpected BEGIN and END
Diffstat (limited to 'src/op_mode/pki.py')
-rwxr-xr-xsrc/op_mode/pki.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/op_mode/pki.py b/src/op_mode/pki.py
index 9ce166c7d..84b080023 100755
--- a/src/op_mode/pki.py
+++ b/src/op_mode/pki.py
@@ -844,7 +844,8 @@ def import_openvpn_secret(name, path):
key_version = '1'
with open(path) as f:
- key_lines = f.read().split("\n")
+ key_lines = f.read().strip().split("\n")
+ key_lines = list(filter(lambda line: not line.strip().startswith('#'), key_lines)) # Remove commented lines
key_data = "".join(key_lines[1:-1]) # Remove wrapper tags and line endings
version_search = re.search(r'BEGIN OpenVPN Static key V(\d+)', key_lines[0]) # Future-proofing (hopefully)