security/tinc: list_ciphers.py parse issue on 20.7. closes https://github.com/opnsense/plugins/issues/1976

This commit is contained in:
Ad Schellevis
2020-08-13 19:35:50 +02:00
parent f6271bce9f
commit 2071e23a61
@@ -1,7 +1,7 @@
#!/usr/local/bin/python3
"""
Copyright (c) 2016-2019 Ad Schellevis <ad@opnsense.org>
Copyright (c) 2016-2020 Ad Schellevis <ad@opnsense.org>
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -28,19 +28,14 @@
--------------------------------------------------------------------------------------
list ciphers
"""
from subprocess import Popen, PIPE
import subprocess
import ujson
response = dict()
p = Popen(['/usr/bin/openssl','enc', '-help'],stdin=PIPE, stdout=PIPE, stderr=PIPE, bufsize=-1)
output, error = p.communicate()
cipher_section = False
for line in error.decode().split('\n'):
if line.find('Cipher Types') == 0:
cipher_section = True
continue
if cipher_section:
p = subprocess.run(['/usr/local/bin/openssl', 'enc', '-ciphers'], capture_output=True, text=True)
for line in p.stdout.split("\n"):
if not line.startswith('Supported'):
for item in line.split():
if len(item) > 1:
response[item[1:]] = item[1:]