Skip to content

Commit

Permalink
BUG: Generate missing openssl.cnf
Browse files Browse the repository at this point in the history
Ensure distinguished_name is set when generating an ssl cert
  • Loading branch information
parente committed Feb 3, 2019
1 parent a238993 commit 992d83c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,4 @@ dockerspawner.tar.gz
*.orig
.ipynb_checkpoints/
.vscode/
.pytest_cache/
11 changes: 11 additions & 0 deletions base-notebook/jupyter_notebook_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,17 @@
pass
else:
raise

# Generate an openssl.cnf file to set the distinguished name
cnf_file = os.path.join(os.getenv('CONDA_DIR', '/usr/lib'), 'ssl', 'openssl.cnf')
if not os.path.isfile(cnf_file):
with open(cnf_file, 'w') as fh:
fh.write('''\
[req]
distinguished_name = req_distinguished_name
[req_distinguished_name]
''')

# Generate a certificate if one doesn't exist on disk
subprocess.check_call(['openssl', 'req', '-new',
'-newkey', 'rsa:2048',
Expand Down

0 comments on commit 992d83c

Please sign in to comment.