Skip to content

Commit

Permalink
fix: fixed AWS connection
Browse files Browse the repository at this point in the history
  • Loading branch information
titanism committed Dec 16, 2024
1 parent 88aadc8 commit 4512adc
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions helpers/on-connect.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,22 +94,11 @@ async function onConnect(session, fn) {
throw err;
}

//
// TODO: we need to do this for all other cloud providers (e.g. via a maintained list)
// <https://github.com/MISP/misp-warninglists>
// <https://github.com/dalisoft/awesome-hosting?tab=readme-ov-file#web-services-platform>
//
// NOTE: due to high amount of connections from AWS spammers on IMAP/POP3 we are preventing connection abuse
//
const isAWS =
session.resolvedClientHostname &&
session.resolvedClientHostname.endsWith('.compute.amazonaws.com');

//
// check if the connecting remote IP address is allowlisted
//
session.isAllowlisted = false;
if (!isDenylisted && !isAWS) {
if (!isDenylisted) {
if (
session.resolvedClientHostname &&
session.resolvedRootClientHostname
Expand Down Expand Up @@ -198,7 +187,18 @@ async function onConnect(session, fn) {
// because AUTH is required for a user to access the SMTP server anyways
//

if (!session.isAllowlisted) return fn();
//
// TODO: we need to do this for all other cloud providers (e.g. via a maintained list)
// <https://github.com/MISP/misp-warninglists>
// <https://github.com/dalisoft/awesome-hosting?tab=readme-ov-file#web-services-platform>
//
// NOTE: due to high amount of connections from AWS spammers on IMAP/POP3 we are preventing connection abuse
//
const isAWS =
session.resolvedClientHostname &&
session.resolvedClientHostname.endsWith('.compute.amazonaws.com');

if (!session.isAllowlisted && !isAWS) return fn();

//
// NOTE: until onConnect is available for IMAP and POP3 servers
Expand Down

0 comments on commit 4512adc

Please sign in to comment.