From 8b42d2f9005aebe25b534a67112def59d1b85532 Mon Sep 17 00:00:00 2001
From: Adar Nimrod <nimrod@shore.co.il>
Date: Sat, 1 May 2021 01:12:47 +0300
Subject: [PATCH] Remove SMTP check on port 25.

Outbound traffic on port 25 is restricted by AWS. Removing the
restriction will raise the cost of the project.
---
 src/smtp.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/smtp.py b/src/smtp.py
index 3b0509b..b8947dd 100644
--- a/src/smtp.py
+++ b/src/smtp.py
@@ -23,7 +23,11 @@ def check_smtp(port):
 
 def handler(event, context):  # pylint: disable=unused-argument
     """Lambda event handler."""
-    for port in [25, 587]:
+    # Port 25 is blocked for Lambda functions. To remove the restriction, the
+    # functions need to execute inside a VPN with a NAT gateway. This will
+    # raise the cost. For now assume that if the submission port is working,
+    # the smtp port is working too (same gateway, same host, same processes).
+    for port in [587]:
         success, message = check_smtp(port)
         print(message)
         if not success:
-- 
GitLab