Skip to content
This repository was archived by the owner on Sep 12, 2018. It is now read-only.

Commit 5ab86d7

Browse files
committed
If REGISTRY_TLS_VERIFY is set, but GUNICORN_OPTS is not, then serve via
a TLS endpoint instead of plain HTTP. This is done by setting GUNICORN_OPTS to some default value, expecting the following files to be present: * /ssl/ca.crt * /ssl/registry.cert * /ssl/registry.key Signed-off-by: Tibor Vass <[email protected]>
1 parent 14796be commit 5ab86d7

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

docker_registry/run.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import logging
1010
import os
1111
import sys
12+
import ssl
1213

1314
from .server import env
1415

@@ -84,7 +85,11 @@ def run_gunicorn():
8485
else:
8586
logger.warn('You asked we drop priviledges, but we are not root!')
8687

87-
args += env.source('GUNICORN_OPTS')
88+
gunicorn_opts = env.source('GUNICORN_OPTS')
89+
if len(gunicorn_opts) == 0 and len(env.source('REGISTRY_TLS_VERIFY')) > 0:
90+
gunicorn_opts = ['--certfile','/ssl/registry.cert','--keyfile','/ssl/registry.key','--ca-certs','/ssl/ca.crt','--ssl-version', ssl.PROTOCOL_TLSv1]
91+
92+
args += gunicorn_opts
8893
args.append('docker_registry.wsgi:application')
8994
# Stringify all args and call
9095
os.execl(*[str(v) for v in args])

0 commit comments

Comments
 (0)