Skip to content

Commit 604991b

Browse files
d-linkoDavid Linko
andauthored
removed SSL config not used by ANMS (#221)
* removed SSL config not used by ANMS * removed unused testing dir --------- Co-authored-by: David Linko <david.linko@jhuapl.edu>
1 parent b348cf2 commit 604991b

34 files changed

+1
-2975
lines changed

anms-core/anms/asgi/server.py

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -35,30 +35,7 @@
3535
def main() -> None:
3636
config = ConfigBuilder.get_config()
3737

38-
# SSL Settings
39-
should_start_with_ssl = (
40-
config['SERVER_SSL'] is True
41-
and config['SERVER_BEHIND_PROXY'] is False
42-
and isinstance(config['SERVER_SSL_CRT'], str)
43-
and isinstance(config['SERVER_SSL_KEY'], str)
44-
)
45-
# Preferred method is to use NGINX/reverse proxy with SSL Termination
46-
if should_start_with_ssl:
47-
ssl_context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER) # disable SSLv3
48-
ssl_context.options |= ssl.OP_NO_TLSv1 # disable TLSv1
49-
ssl_context.options |= ssl.OP_NO_TLSv1_1 # disable TLSv1.1
50-
ssl_crt_path = config['SERVER_SSL_CRT']
51-
ssl_key_path = config['SERVER_SSL_KEY']
52-
ssl_key_pass = config['SERVER_SSL_PWD']
53-
# https://github.com/encode/uvicorn/issues/806
54-
uvicorn.run(f"{__name__}:app", host=config['SERVER_BIND'], port=config['SERVER_PORT'],
55-
log_config=None, log_level=config['LOGGER_LEVEL'], access_log=False, # We use our own logger
56-
reload=config['DEBUG'],
57-
ssl_certfile=ssl_crt_path, ssl_keyfile=ssl_key_path, ssl_keyfile_password=ssl_key_pass,
58-
ssl_version=ssl_context.protocol, ssl_ciphers=":".join(map(lambda c: c["name"], ssl_context.get_ciphers())) # type: ignore
59-
)
60-
else:
61-
uvicorn.run(f"{__name__}:app", host=config['SERVER_BIND'], port=config['SERVER_PORT'],
38+
uvicorn.run(f"{__name__}:app", host=config['SERVER_BIND'], port=config['SERVER_PORT'],
6239
log_config=None, log_level=config['LOGGER_LEVEL'], access_log=False, # We use our own logger
6340
reload=config['DEBUG'])
6441

anms-core/anms/run_gunicorn.py

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -63,20 +63,6 @@ def load_config(self):
6363
self.cfg.set("proc_name", "anms")
6464
self.cfg.set("preload_app", False)
6565

66-
# SSL Settings
67-
should_start_with_ssl = (
68-
config['SERVER_SSL'] is True
69-
and config['SERVER_BEHIND_PROXY'] is False
70-
and isinstance(config['SERVER_SSL_CRT'], str)
71-
and isinstance(config['SERVER_SSL_KEY'], str)
72-
)
73-
if should_start_with_ssl:
74-
ssl_context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
75-
ssl_context.options |= ssl.OP_NO_TLSv1
76-
ssl_context.options |= ssl.OP_NO_TLSv1_1
77-
self.cfg.set("ssl_version", ssl_context.protocol)
78-
self.cfg.set("certfile", config['SERVER_SSL_CRT'])
79-
self.cfg.set("keyfile", config['SERVER_SSL_KEY'])
8066

8167
# App Secret Manager Help?
8268
if not config['APP_SECRET_KEY']:

anms-core/test/__init__.py

Lines changed: 0 additions & 23 deletions
This file was deleted.

anms-core/test/anms/__init__.py

Lines changed: 0 additions & 23 deletions
This file was deleted.

anms-core/test/anms/asgi/__init__.py

Lines changed: 0 additions & 23 deletions
This file was deleted.

anms-core/test/anms/asgi/test_helpers.py

Lines changed: 0 additions & 55 deletions
This file was deleted.

anms-core/test/anms/asgi/test_init.py

Lines changed: 0 additions & 66 deletions
This file was deleted.

anms-core/test/anms/asgi/test_server.py

Lines changed: 0 additions & 54 deletions
This file was deleted.

anms-core/test/anms/components/__init__.py

Lines changed: 0 additions & 23 deletions
This file was deleted.

anms-core/test/anms/components/core/__init__.py

Lines changed: 0 additions & 23 deletions
This file was deleted.

0 commit comments

Comments
 (0)