Skip to content

Commit

Permalink
Merge pull request #3879 from natali-rs1985/T5744-current
Browse files Browse the repository at this point in the history
op_mode: T5744: PKI import OpenVPN shared key includess unexpected BEGIN and END
  • Loading branch information
c-po authored Jul 27, 2024
2 parents 42a3be5 + bb64603 commit ba4198f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/op_mode/pki.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit ba4198f

Please sign in to comment.