mirror of
https://github.com/outbackdingo/patroni.git
synced 2026-08-25 14:53:37 +00:00
Fix openssl certificate generation in behave tests (#2672)
--addext -> -addext (doesn't work on macOS) set keyfile permissions to 600 (to avoid "private key file has group or world access")
This commit is contained in:
@@ -7,6 +7,7 @@ import psutil
|
||||
import re
|
||||
import shutil
|
||||
import signal
|
||||
import stat
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
@@ -1060,10 +1061,11 @@ def before_all(context):
|
||||
try:
|
||||
with open(os.devnull, 'w') as null:
|
||||
ret = subprocess.call(['openssl', 'req', '-nodes', '-new', '-x509', '-subj', '/CN=batman.patroni',
|
||||
'--addext', 'subjectAltName=IP:127.0.0.1', '-keyout', context.keyfile,
|
||||
'-addext', 'subjectAltName=IP:127.0.0.1', '-keyout', context.keyfile,
|
||||
'-out', context.certfile], stdout=null, stderr=null)
|
||||
if ret != 0:
|
||||
raise Exception
|
||||
os.chmod(context.keyfile, stat.S_IWRITE | stat.S_IREAD)
|
||||
except Exception:
|
||||
context.keyfile = context.certfile = None
|
||||
|
||||
|
||||
Reference in New Issue
Block a user