Skip to content

Commit 992d83c

Browse files
committed
BUG: Generate missing openssl.cnf
Ensure distinguished_name is set when generating an ssl cert
1 parent a238993 commit 992d83c

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -67,3 +67,4 @@ dockerspawner.tar.gz
6767
*.orig
6868
.ipynb_checkpoints/
6969
.vscode/
70+
.pytest_cache/

base-notebook/jupyter_notebook_config.py

+11
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,17 @@
2626
pass
2727
else:
2828
raise
29+
30+
# Generate an openssl.cnf file to set the distinguished name
31+
cnf_file = os.path.join(os.getenv('CONDA_DIR', '/usr/lib'), 'ssl', 'openssl.cnf')
32+
if not os.path.isfile(cnf_file):
33+
with open(cnf_file, 'w') as fh:
34+
fh.write('''\
35+
[req]
36+
distinguished_name = req_distinguished_name
37+
[req_distinguished_name]
38+
''')
39+
2940
# Generate a certificate if one doesn't exist on disk
3041
subprocess.check_call(['openssl', 'req', '-new',
3142
'-newkey', 'rsa:2048',

0 commit comments

Comments
 (0)