From 7b6175ab372dcee0e3ff5aff6257619350a4574f Mon Sep 17 00:00:00 2001 From: Priit Laes Date: Sat, 3 Feb 2018 14:33:45 +0200 Subject: [PATCH] api.utils.firewall: Drop click usage and remove unneeded imports --- certidude/api/utils/firewall.py | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/certidude/api/utils/firewall.py b/certidude/api/utils/firewall.py index 6a16d49..d714b68 100644 --- a/certidude/api/utils/firewall.py +++ b/certidude/api/utils/firewall.py @@ -1,7 +1,6 @@ import falcon import logging -import click from asn1crypto import pem, x509 logger = logging.getLogger("api") @@ -10,8 +9,6 @@ def whitelist_subnets(subnets): """ Validate source IP address of API call against subnet list """ - import falcon - def wrapper(func): def wrapped(self, req, resp, *args, **kwargs): # Check for administration subnet whitelist @@ -30,8 +27,6 @@ def whitelist_subnets(subnets): return wrapper def whitelist_content_types(*content_types): - import falcon - def wrapper(func): def wrapped(self, req, resp, *args, **kwargs): for content_type in content_types: @@ -58,7 +53,7 @@ def whitelist_subject(func): header, _, der_bytes = pem.unarmor(buf.replace("\t", "").encode("ascii")) origin_cert = x509.Certificate.load(der_bytes) if origin_cert.native == cert.native: - click.echo("Subject authenticated using certificates") + logger.debug("Subject authenticated using certificates") return func(self, req, resp, cn, *args, **kwargs) # For backwards compatibility check source IP address @@ -73,4 +68,3 @@ def whitelist_subject(func): else: return func(self, req, resp, cn, *args, **kwargs) return wrapped -