@serve.zone/dcrouter 2.12.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.dockerignore +1 -0
- package/.gitea/workflows/docker_nottags.yaml +71 -0
- package/.gitea/workflows/docker_tags.yaml +106 -0
- package/.vscode/launch.json +11 -0
- package/.vscode/settings.json +26 -0
- package/Dockerfile +46 -0
- package/changelog.md +247 -0
- package/cli.child.js +4 -0
- package/cli.child.ts +4 -0
- package/cli.js +4 -0
- package/cli.ts.js +5 -0
- package/dist_ts/00_commitinfo_data.d.ts +8 -0
- package/dist_ts/00_commitinfo_data.js +9 -0
- package/dist_ts/classes.dcrouter.d.ts +238 -0
- package/dist_ts/classes.dcrouter.js +1008 -0
- package/dist_ts/config/index.d.ts +1 -0
- package/dist_ts/config/index.js +3 -0
- package/dist_ts/config/validator.d.ts +104 -0
- package/dist_ts/config/validator.js +152 -0
- package/dist_ts/deliverability/classes.ipwarmupmanager.d.ts +253 -0
- package/dist_ts/deliverability/classes.ipwarmupmanager.js +639 -0
- package/dist_ts/deliverability/classes.senderreputationmonitor.d.ts +300 -0
- package/dist_ts/deliverability/classes.senderreputationmonitor.js +961 -0
- package/dist_ts/deliverability/index.d.ts +2 -0
- package/dist_ts/deliverability/index.js +3 -0
- package/dist_ts/errors/base.errors.d.ts +224 -0
- package/dist_ts/errors/base.errors.js +310 -0
- package/dist_ts/errors/email.errors.d.ts +175 -0
- package/dist_ts/errors/email.errors.js +265 -0
- package/dist_ts/errors/error-handler.d.ts +98 -0
- package/dist_ts/errors/error-handler.js +282 -0
- package/dist_ts/errors/error.codes.d.ts +115 -0
- package/dist_ts/errors/error.codes.js +136 -0
- package/dist_ts/errors/index.d.ts +56 -0
- package/dist_ts/errors/index.js +138 -0
- package/dist_ts/errors/mta.errors.d.ts +259 -0
- package/dist_ts/errors/mta.errors.js +472 -0
- package/dist_ts/errors/reputation.errors.d.ts +183 -0
- package/dist_ts/errors/reputation.errors.js +292 -0
- package/dist_ts/index.d.ts +4 -0
- package/dist_ts/index.js +6 -0
- package/dist_ts/logger.d.ts +17 -0
- package/dist_ts/logger.js +77 -0
- package/dist_ts/mail/core/classes.bouncemanager.d.ts +200 -0
- package/dist_ts/mail/core/classes.bouncemanager.js +778 -0
- package/dist_ts/mail/core/classes.email.d.ts +291 -0
- package/dist_ts/mail/core/classes.email.js +780 -0
- package/dist_ts/mail/core/classes.emailvalidator.d.ts +61 -0
- package/dist_ts/mail/core/classes.emailvalidator.js +182 -0
- package/dist_ts/mail/core/classes.templatemanager.d.ts +95 -0
- package/dist_ts/mail/core/classes.templatemanager.js +239 -0
- package/dist_ts/mail/core/index.d.ts +4 -0
- package/dist_ts/mail/core/index.js +6 -0
- package/dist_ts/mail/delivery/classes.delivery.queue.d.ts +163 -0
- package/dist_ts/mail/delivery/classes.delivery.queue.js +485 -0
- package/dist_ts/mail/delivery/classes.delivery.system.d.ts +186 -0
- package/dist_ts/mail/delivery/classes.delivery.system.js +846 -0
- package/dist_ts/mail/delivery/classes.emailsendjob.d.ts +84 -0
- package/dist_ts/mail/delivery/classes.emailsendjob.js +362 -0
- package/dist_ts/mail/delivery/classes.emailsignjob.d.ts +18 -0
- package/dist_ts/mail/delivery/classes.emailsignjob.js +44 -0
- package/dist_ts/mail/delivery/classes.mta.config.d.ts +22 -0
- package/dist_ts/mail/delivery/classes.mta.config.js +51 -0
- package/dist_ts/mail/delivery/classes.ratelimiter.d.ts +98 -0
- package/dist_ts/mail/delivery/classes.ratelimiter.js +205 -0
- package/dist_ts/mail/delivery/classes.smtp.client.legacy.d.ts +275 -0
- package/dist_ts/mail/delivery/classes.smtp.client.legacy.js +973 -0
- package/dist_ts/mail/delivery/classes.unified.rate.limiter.d.ts +200 -0
- package/dist_ts/mail/delivery/classes.unified.rate.limiter.js +817 -0
- package/dist_ts/mail/delivery/index.d.ts +12 -0
- package/dist_ts/mail/delivery/index.js +18 -0
- package/dist_ts/mail/delivery/interfaces.d.ts +243 -0
- package/dist_ts/mail/delivery/interfaces.js +17 -0
- package/dist_ts/mail/delivery/smtpclient/auth-handler.d.ts +43 -0
- package/dist_ts/mail/delivery/smtpclient/auth-handler.js +188 -0
- package/dist_ts/mail/delivery/smtpclient/command-handler.d.ts +67 -0
- package/dist_ts/mail/delivery/smtpclient/command-handler.js +276 -0
- package/dist_ts/mail/delivery/smtpclient/connection-manager.d.ts +48 -0
- package/dist_ts/mail/delivery/smtpclient/connection-manager.js +238 -0
- package/dist_ts/mail/delivery/smtpclient/constants.d.ts +129 -0
- package/dist_ts/mail/delivery/smtpclient/constants.js +135 -0
- package/dist_ts/mail/delivery/smtpclient/create-client.d.ts +22 -0
- package/dist_ts/mail/delivery/smtpclient/create-client.js +86 -0
- package/dist_ts/mail/delivery/smtpclient/error-handler.d.ts +28 -0
- package/dist_ts/mail/delivery/smtpclient/error-handler.js +110 -0
- package/dist_ts/mail/delivery/smtpclient/index.d.ts +16 -0
- package/dist_ts/mail/delivery/smtpclient/index.js +21 -0
- package/dist_ts/mail/delivery/smtpclient/interfaces.d.ts +183 -0
- package/dist_ts/mail/delivery/smtpclient/interfaces.js +19 -0
- package/dist_ts/mail/delivery/smtpclient/smtp-client.d.ts +58 -0
- package/dist_ts/mail/delivery/smtpclient/smtp-client.js +279 -0
- package/dist_ts/mail/delivery/smtpclient/tls-handler.d.ts +33 -0
- package/dist_ts/mail/delivery/smtpclient/tls-handler.js +202 -0
- package/dist_ts/mail/delivery/smtpclient/utils/helpers.d.ts +77 -0
- package/dist_ts/mail/delivery/smtpclient/utils/helpers.js +196 -0
- package/dist_ts/mail/delivery/smtpclient/utils/logging.d.ts +46 -0
- package/dist_ts/mail/delivery/smtpclient/utils/logging.js +153 -0
- package/dist_ts/mail/delivery/smtpclient/utils/validation.d.ts +38 -0
- package/dist_ts/mail/delivery/smtpclient/utils/validation.js +139 -0
- package/dist_ts/mail/delivery/smtpserver/certificate-utils.d.ts +45 -0
- package/dist_ts/mail/delivery/smtpserver/certificate-utils.js +345 -0
- package/dist_ts/mail/delivery/smtpserver/command-handler.d.ts +156 -0
- package/dist_ts/mail/delivery/smtpserver/command-handler.js +1159 -0
- package/dist_ts/mail/delivery/smtpserver/connection-manager.d.ts +159 -0
- package/dist_ts/mail/delivery/smtpserver/connection-manager.js +894 -0
- package/dist_ts/mail/delivery/smtpserver/constants.d.ts +130 -0
- package/dist_ts/mail/delivery/smtpserver/constants.js +162 -0
- package/dist_ts/mail/delivery/smtpserver/create-server.d.ts +14 -0
- package/dist_ts/mail/delivery/smtpserver/create-server.js +28 -0
- package/dist_ts/mail/delivery/smtpserver/data-handler.d.ts +123 -0
- package/dist_ts/mail/delivery/smtpserver/data-handler.js +1148 -0
- package/dist_ts/mail/delivery/smtpserver/index.d.ts +20 -0
- package/dist_ts/mail/delivery/smtpserver/index.js +27 -0
- package/dist_ts/mail/delivery/smtpserver/interfaces.d.ts +530 -0
- package/dist_ts/mail/delivery/smtpserver/interfaces.js +10 -0
- package/dist_ts/mail/delivery/smtpserver/secure-server.d.ts +15 -0
- package/dist_ts/mail/delivery/smtpserver/secure-server.js +79 -0
- package/dist_ts/mail/delivery/smtpserver/security-handler.d.ts +86 -0
- package/dist_ts/mail/delivery/smtpserver/security-handler.js +234 -0
- package/dist_ts/mail/delivery/smtpserver/session-manager.d.ts +140 -0
- package/dist_ts/mail/delivery/smtpserver/session-manager.js +469 -0
- package/dist_ts/mail/delivery/smtpserver/smtp-server.d.ts +137 -0
- package/dist_ts/mail/delivery/smtpserver/smtp-server.js +666 -0
- package/dist_ts/mail/delivery/smtpserver/starttls-handler.d.ts +21 -0
- package/dist_ts/mail/delivery/smtpserver/starttls-handler.js +207 -0
- package/dist_ts/mail/delivery/smtpserver/tls-handler.d.ts +66 -0
- package/dist_ts/mail/delivery/smtpserver/tls-handler.js +261 -0
- package/dist_ts/mail/delivery/smtpserver/utils/adaptive-logging.d.ts +117 -0
- package/dist_ts/mail/delivery/smtpserver/utils/adaptive-logging.js +411 -0
- package/dist_ts/mail/delivery/smtpserver/utils/helpers.d.ts +78 -0
- package/dist_ts/mail/delivery/smtpserver/utils/helpers.js +208 -0
- package/dist_ts/mail/delivery/smtpserver/utils/logging.d.ts +106 -0
- package/dist_ts/mail/delivery/smtpserver/utils/logging.js +181 -0
- package/dist_ts/mail/delivery/smtpserver/utils/validation.d.ts +69 -0
- package/dist_ts/mail/delivery/smtpserver/utils/validation.js +360 -0
- package/dist_ts/mail/index.d.ts +8 -0
- package/dist_ts/mail/index.js +13 -0
- package/dist_ts/mail/routing/classes.dns.manager.d.ts +65 -0
- package/dist_ts/mail/routing/classes.dns.manager.js +413 -0
- package/dist_ts/mail/routing/classes.dnsmanager.d.ts +165 -0
- package/dist_ts/mail/routing/classes.dnsmanager.js +430 -0
- package/dist_ts/mail/routing/classes.domain.registry.d.ts +54 -0
- package/dist_ts/mail/routing/classes.domain.registry.js +118 -0
- package/dist_ts/mail/routing/classes.email.config.d.ts +64 -0
- package/dist_ts/mail/routing/classes.email.config.js +2 -0
- package/dist_ts/mail/routing/classes.email.router.d.ts +171 -0
- package/dist_ts/mail/routing/classes.email.router.js +491 -0
- package/dist_ts/mail/routing/classes.unified.email.server.d.ts +426 -0
- package/dist_ts/mail/routing/classes.unified.email.server.js +1454 -0
- package/dist_ts/mail/routing/index.d.ts +5 -0
- package/dist_ts/mail/routing/index.js +7 -0
- package/dist_ts/mail/routing/interfaces.d.ts +187 -0
- package/dist_ts/mail/routing/interfaces.js +2 -0
- package/dist_ts/mail/security/classes.dkimcreator.d.ts +68 -0
- package/dist_ts/mail/security/classes.dkimcreator.js +346 -0
- package/dist_ts/mail/security/classes.dkimverifier.d.ts +46 -0
- package/dist_ts/mail/security/classes.dkimverifier.js +317 -0
- package/dist_ts/mail/security/classes.dmarcverifier.d.ts +123 -0
- package/dist_ts/mail/security/classes.dmarcverifier.js +365 -0
- package/dist_ts/mail/security/classes.spfverifier.d.ts +103 -0
- package/dist_ts/mail/security/classes.spfverifier.js +492 -0
- package/dist_ts/mail/security/index.d.ts +4 -0
- package/dist_ts/mail/security/index.js +6 -0
- package/dist_ts/opsserver/classes.opsserver.d.ts +14 -0
- package/dist_ts/opsserver/classes.opsserver.js +37 -0
- package/dist_ts/opsserver/index.d.ts +1 -0
- package/dist_ts/opsserver/index.js +2 -0
- package/dist_ts/paths.d.ts +14 -0
- package/dist_ts/paths.js +39 -0
- package/dist_ts/plugins.d.ts +43 -0
- package/dist_ts/plugins.js +50 -0
- package/dist_ts/security/classes.contentscanner.d.ts +160 -0
- package/dist_ts/security/classes.contentscanner.js +634 -0
- package/dist_ts/security/classes.ipreputationchecker.d.ts +150 -0
- package/dist_ts/security/classes.ipreputationchecker.js +508 -0
- package/dist_ts/security/classes.securitylogger.d.ts +140 -0
- package/dist_ts/security/classes.securitylogger.js +232 -0
- package/dist_ts/security/index.d.ts +3 -0
- package/dist_ts/security/index.js +4 -0
- package/dist_ts/sms/classes.smsservice.d.ts +15 -0
- package/dist_ts/sms/classes.smsservice.js +72 -0
- package/dist_ts/sms/config/sms.config.d.ts +93 -0
- package/dist_ts/sms/config/sms.config.js +2 -0
- package/dist_ts/sms/config/sms.schema.d.ts +5 -0
- package/dist_ts/sms/config/sms.schema.js +121 -0
- package/dist_ts/sms/index.d.ts +1 -0
- package/dist_ts/sms/index.js +2 -0
- package/dist_ts/storage/classes.storagemanager.d.ts +82 -0
- package/dist_ts/storage/classes.storagemanager.js +341 -0
- package/dist_ts/storage/index.d.ts +1 -0
- package/dist_ts/storage/index.js +3 -0
- package/dist_ts/ts/00_commitinfo_data.d.ts +8 -0
- package/dist_ts/ts/00_commitinfo_data.js +9 -0
- package/dist_ts/ts/classes.dcrouter.d.ts +238 -0
- package/dist_ts/ts/classes.dcrouter.js +1008 -0
- package/dist_ts/ts/config/index.d.ts +1 -0
- package/dist_ts/ts/config/index.js +3 -0
- package/dist_ts/ts/config/validator.d.ts +104 -0
- package/dist_ts/ts/config/validator.js +152 -0
- package/dist_ts/ts/deliverability/classes.ipwarmupmanager.d.ts +253 -0
- package/dist_ts/ts/deliverability/classes.ipwarmupmanager.js +639 -0
- package/dist_ts/ts/deliverability/classes.senderreputationmonitor.d.ts +300 -0
- package/dist_ts/ts/deliverability/classes.senderreputationmonitor.js +961 -0
- package/dist_ts/ts/deliverability/index.d.ts +2 -0
- package/dist_ts/ts/deliverability/index.js +3 -0
- package/dist_ts/ts/errors/base.errors.d.ts +224 -0
- package/dist_ts/ts/errors/base.errors.js +310 -0
- package/dist_ts/ts/errors/email.errors.d.ts +175 -0
- package/dist_ts/ts/errors/email.errors.js +265 -0
- package/dist_ts/ts/errors/error-handler.d.ts +98 -0
- package/dist_ts/ts/errors/error-handler.js +282 -0
- package/dist_ts/ts/errors/error.codes.d.ts +115 -0
- package/dist_ts/ts/errors/error.codes.js +136 -0
- package/dist_ts/ts/errors/index.d.ts +56 -0
- package/dist_ts/ts/errors/index.js +138 -0
- package/dist_ts/ts/errors/mta.errors.d.ts +259 -0
- package/dist_ts/ts/errors/mta.errors.js +472 -0
- package/dist_ts/ts/errors/reputation.errors.d.ts +183 -0
- package/dist_ts/ts/errors/reputation.errors.js +292 -0
- package/dist_ts/ts/index.d.ts +4 -0
- package/dist_ts/ts/index.js +6 -0
- package/dist_ts/ts/logger.d.ts +17 -0
- package/dist_ts/ts/logger.js +77 -0
- package/dist_ts/ts/mail/core/classes.bouncemanager.d.ts +200 -0
- package/dist_ts/ts/mail/core/classes.bouncemanager.js +778 -0
- package/dist_ts/ts/mail/core/classes.email.d.ts +291 -0
- package/dist_ts/ts/mail/core/classes.email.js +780 -0
- package/dist_ts/ts/mail/core/classes.emailvalidator.d.ts +61 -0
- package/dist_ts/ts/mail/core/classes.emailvalidator.js +182 -0
- package/dist_ts/ts/mail/core/classes.templatemanager.d.ts +95 -0
- package/dist_ts/ts/mail/core/classes.templatemanager.js +239 -0
- package/dist_ts/ts/mail/core/index.d.ts +4 -0
- package/dist_ts/ts/mail/core/index.js +6 -0
- package/dist_ts/ts/mail/delivery/classes.delivery.queue.d.ts +163 -0
- package/dist_ts/ts/mail/delivery/classes.delivery.queue.js +485 -0
- package/dist_ts/ts/mail/delivery/classes.delivery.system.d.ts +186 -0
- package/dist_ts/ts/mail/delivery/classes.delivery.system.js +846 -0
- package/dist_ts/ts/mail/delivery/classes.emailsendjob.d.ts +84 -0
- package/dist_ts/ts/mail/delivery/classes.emailsendjob.js +362 -0
- package/dist_ts/ts/mail/delivery/classes.emailsignjob.d.ts +18 -0
- package/dist_ts/ts/mail/delivery/classes.emailsignjob.js +44 -0
- package/dist_ts/ts/mail/delivery/classes.mta.config.d.ts +22 -0
- package/dist_ts/ts/mail/delivery/classes.mta.config.js +51 -0
- package/dist_ts/ts/mail/delivery/classes.ratelimiter.d.ts +98 -0
- package/dist_ts/ts/mail/delivery/classes.ratelimiter.js +205 -0
- package/dist_ts/ts/mail/delivery/classes.smtp.client.legacy.d.ts +275 -0
- package/dist_ts/ts/mail/delivery/classes.smtp.client.legacy.js +973 -0
- package/dist_ts/ts/mail/delivery/classes.unified.rate.limiter.d.ts +200 -0
- package/dist_ts/ts/mail/delivery/classes.unified.rate.limiter.js +817 -0
- package/dist_ts/ts/mail/delivery/index.d.ts +12 -0
- package/dist_ts/ts/mail/delivery/index.js +18 -0
- package/dist_ts/ts/mail/delivery/interfaces.d.ts +243 -0
- package/dist_ts/ts/mail/delivery/interfaces.js +17 -0
- package/dist_ts/ts/mail/delivery/smtpclient/auth-handler.d.ts +43 -0
- package/dist_ts/ts/mail/delivery/smtpclient/auth-handler.js +188 -0
- package/dist_ts/ts/mail/delivery/smtpclient/command-handler.d.ts +67 -0
- package/dist_ts/ts/mail/delivery/smtpclient/command-handler.js +276 -0
- package/dist_ts/ts/mail/delivery/smtpclient/connection-manager.d.ts +48 -0
- package/dist_ts/ts/mail/delivery/smtpclient/connection-manager.js +238 -0
- package/dist_ts/ts/mail/delivery/smtpclient/constants.d.ts +129 -0
- package/dist_ts/ts/mail/delivery/smtpclient/constants.js +135 -0
- package/dist_ts/ts/mail/delivery/smtpclient/create-client.d.ts +22 -0
- package/dist_ts/ts/mail/delivery/smtpclient/create-client.js +86 -0
- package/dist_ts/ts/mail/delivery/smtpclient/error-handler.d.ts +28 -0
- package/dist_ts/ts/mail/delivery/smtpclient/error-handler.js +110 -0
- package/dist_ts/ts/mail/delivery/smtpclient/index.d.ts +16 -0
- package/dist_ts/ts/mail/delivery/smtpclient/index.js +21 -0
- package/dist_ts/ts/mail/delivery/smtpclient/interfaces.d.ts +183 -0
- package/dist_ts/ts/mail/delivery/smtpclient/interfaces.js +19 -0
- package/dist_ts/ts/mail/delivery/smtpclient/smtp-client.d.ts +58 -0
- package/dist_ts/ts/mail/delivery/smtpclient/smtp-client.js +279 -0
- package/dist_ts/ts/mail/delivery/smtpclient/tls-handler.d.ts +33 -0
- package/dist_ts/ts/mail/delivery/smtpclient/tls-handler.js +202 -0
- package/dist_ts/ts/mail/delivery/smtpclient/utils/helpers.d.ts +77 -0
- package/dist_ts/ts/mail/delivery/smtpclient/utils/helpers.js +196 -0
- package/dist_ts/ts/mail/delivery/smtpclient/utils/logging.d.ts +46 -0
- package/dist_ts/ts/mail/delivery/smtpclient/utils/logging.js +153 -0
- package/dist_ts/ts/mail/delivery/smtpclient/utils/validation.d.ts +38 -0
- package/dist_ts/ts/mail/delivery/smtpclient/utils/validation.js +139 -0
- package/dist_ts/ts/mail/delivery/smtpserver/certificate-utils.d.ts +45 -0
- package/dist_ts/ts/mail/delivery/smtpserver/certificate-utils.js +345 -0
- package/dist_ts/ts/mail/delivery/smtpserver/command-handler.d.ts +156 -0
- package/dist_ts/ts/mail/delivery/smtpserver/command-handler.js +1159 -0
- package/dist_ts/ts/mail/delivery/smtpserver/connection-manager.d.ts +159 -0
- package/dist_ts/ts/mail/delivery/smtpserver/connection-manager.js +894 -0
- package/dist_ts/ts/mail/delivery/smtpserver/constants.d.ts +130 -0
- package/dist_ts/ts/mail/delivery/smtpserver/constants.js +162 -0
- package/dist_ts/ts/mail/delivery/smtpserver/create-server.d.ts +14 -0
- package/dist_ts/ts/mail/delivery/smtpserver/create-server.js +28 -0
- package/dist_ts/ts/mail/delivery/smtpserver/data-handler.d.ts +123 -0
- package/dist_ts/ts/mail/delivery/smtpserver/data-handler.js +1148 -0
- package/dist_ts/ts/mail/delivery/smtpserver/index.d.ts +20 -0
- package/dist_ts/ts/mail/delivery/smtpserver/index.js +27 -0
- package/dist_ts/ts/mail/delivery/smtpserver/interfaces.d.ts +530 -0
- package/dist_ts/ts/mail/delivery/smtpserver/interfaces.js +10 -0
- package/dist_ts/ts/mail/delivery/smtpserver/secure-server.d.ts +15 -0
- package/dist_ts/ts/mail/delivery/smtpserver/secure-server.js +79 -0
- package/dist_ts/ts/mail/delivery/smtpserver/security-handler.d.ts +86 -0
- package/dist_ts/ts/mail/delivery/smtpserver/security-handler.js +234 -0
- package/dist_ts/ts/mail/delivery/smtpserver/session-manager.d.ts +140 -0
- package/dist_ts/ts/mail/delivery/smtpserver/session-manager.js +469 -0
- package/dist_ts/ts/mail/delivery/smtpserver/smtp-server.d.ts +137 -0
- package/dist_ts/ts/mail/delivery/smtpserver/smtp-server.js +666 -0
- package/dist_ts/ts/mail/delivery/smtpserver/starttls-handler.d.ts +21 -0
- package/dist_ts/ts/mail/delivery/smtpserver/starttls-handler.js +207 -0
- package/dist_ts/ts/mail/delivery/smtpserver/tls-handler.d.ts +66 -0
- package/dist_ts/ts/mail/delivery/smtpserver/tls-handler.js +261 -0
- package/dist_ts/ts/mail/delivery/smtpserver/utils/adaptive-logging.d.ts +117 -0
- package/dist_ts/ts/mail/delivery/smtpserver/utils/adaptive-logging.js +411 -0
- package/dist_ts/ts/mail/delivery/smtpserver/utils/helpers.d.ts +78 -0
- package/dist_ts/ts/mail/delivery/smtpserver/utils/helpers.js +208 -0
- package/dist_ts/ts/mail/delivery/smtpserver/utils/logging.d.ts +106 -0
- package/dist_ts/ts/mail/delivery/smtpserver/utils/logging.js +181 -0
- package/dist_ts/ts/mail/delivery/smtpserver/utils/validation.d.ts +69 -0
- package/dist_ts/ts/mail/delivery/smtpserver/utils/validation.js +360 -0
- package/dist_ts/ts/mail/index.d.ts +8 -0
- package/dist_ts/ts/mail/index.js +13 -0
- package/dist_ts/ts/mail/routing/classes.dns.manager.d.ts +65 -0
- package/dist_ts/ts/mail/routing/classes.dns.manager.js +413 -0
- package/dist_ts/ts/mail/routing/classes.dnsmanager.d.ts +165 -0
- package/dist_ts/ts/mail/routing/classes.dnsmanager.js +430 -0
- package/dist_ts/ts/mail/routing/classes.domain.registry.d.ts +54 -0
- package/dist_ts/ts/mail/routing/classes.domain.registry.js +118 -0
- package/dist_ts/ts/mail/routing/classes.email.config.d.ts +64 -0
- package/dist_ts/ts/mail/routing/classes.email.config.js +2 -0
- package/dist_ts/ts/mail/routing/classes.email.router.d.ts +171 -0
- package/dist_ts/ts/mail/routing/classes.email.router.js +491 -0
- package/dist_ts/ts/mail/routing/classes.unified.email.server.d.ts +426 -0
- package/dist_ts/ts/mail/routing/classes.unified.email.server.js +1454 -0
- package/dist_ts/ts/mail/routing/index.d.ts +5 -0
- package/dist_ts/ts/mail/routing/index.js +7 -0
- package/dist_ts/ts/mail/routing/interfaces.d.ts +187 -0
- package/dist_ts/ts/mail/routing/interfaces.js +2 -0
- package/dist_ts/ts/mail/security/classes.dkimcreator.d.ts +68 -0
- package/dist_ts/ts/mail/security/classes.dkimcreator.js +346 -0
- package/dist_ts/ts/mail/security/classes.dkimverifier.d.ts +46 -0
- package/dist_ts/ts/mail/security/classes.dkimverifier.js +317 -0
- package/dist_ts/ts/mail/security/classes.dmarcverifier.d.ts +123 -0
- package/dist_ts/ts/mail/security/classes.dmarcverifier.js +365 -0
- package/dist_ts/ts/mail/security/classes.spfverifier.d.ts +103 -0
- package/dist_ts/ts/mail/security/classes.spfverifier.js +492 -0
- package/dist_ts/ts/mail/security/index.d.ts +4 -0
- package/dist_ts/ts/mail/security/index.js +6 -0
- package/dist_ts/ts/opsserver/classes.opsserver.d.ts +20 -0
- package/dist_ts/ts/opsserver/classes.opsserver.js +44 -0
- package/dist_ts/ts/opsserver/handlers/admin.handler.d.ts +31 -0
- package/dist_ts/ts/opsserver/handlers/admin.handler.js +177 -0
- package/dist_ts/ts/opsserver/handlers/config.handler.d.ts +10 -0
- package/dist_ts/ts/opsserver/handlers/config.handler.js +100 -0
- package/dist_ts/ts/opsserver/handlers/index.d.ts +5 -0
- package/dist_ts/ts/opsserver/handlers/index.js +6 -0
- package/dist_ts/ts/opsserver/handlers/logs.handler.d.ts +10 -0
- package/dist_ts/ts/opsserver/handlers/logs.handler.js +121 -0
- package/dist_ts/ts/opsserver/handlers/security.handler.d.ts +11 -0
- package/dist_ts/ts/opsserver/handlers/security.handler.js +118 -0
- package/dist_ts/ts/opsserver/handlers/stats.handler.d.ts +13 -0
- package/dist_ts/ts/opsserver/handlers/stats.handler.js +233 -0
- package/dist_ts/ts/opsserver/helpers/guards.d.ts +25 -0
- package/dist_ts/ts/opsserver/helpers/guards.js +41 -0
- package/dist_ts/ts/opsserver/index.d.ts +1 -0
- package/dist_ts/ts/opsserver/index.js +2 -0
- package/dist_ts/ts/paths.d.ts +14 -0
- package/dist_ts/ts/paths.js +39 -0
- package/dist_ts/ts/plugins.d.ts +46 -0
- package/dist_ts/ts/plugins.js +53 -0
- package/dist_ts/ts/security/classes.contentscanner.d.ts +160 -0
- package/dist_ts/ts/security/classes.contentscanner.js +634 -0
- package/dist_ts/ts/security/classes.ipreputationchecker.d.ts +150 -0
- package/dist_ts/ts/security/classes.ipreputationchecker.js +508 -0
- package/dist_ts/ts/security/classes.securitylogger.d.ts +140 -0
- package/dist_ts/ts/security/classes.securitylogger.js +232 -0
- package/dist_ts/ts/security/index.d.ts +3 -0
- package/dist_ts/ts/security/index.js +4 -0
- package/dist_ts/ts/sms/classes.smsservice.d.ts +15 -0
- package/dist_ts/ts/sms/classes.smsservice.js +72 -0
- package/dist_ts/ts/sms/config/sms.config.d.ts +93 -0
- package/dist_ts/ts/sms/config/sms.config.js +2 -0
- package/dist_ts/ts/sms/config/sms.schema.d.ts +5 -0
- package/dist_ts/ts/sms/config/sms.schema.js +121 -0
- package/dist_ts/ts/sms/index.d.ts +1 -0
- package/dist_ts/ts/sms/index.js +2 -0
- package/dist_ts/ts/storage/classes.storagemanager.d.ts +82 -0
- package/dist_ts/ts/storage/classes.storagemanager.js +341 -0
- package/dist_ts/ts/storage/index.d.ts +1 -0
- package/dist_ts/ts/storage/index.js +3 -0
- package/dist_ts/ts_interfaces/data/auth.d.ts +8 -0
- package/dist_ts/ts_interfaces/data/auth.js +2 -0
- package/dist_ts/ts_interfaces/data/index.d.ts +2 -0
- package/dist_ts/ts_interfaces/data/index.js +3 -0
- package/dist_ts/ts_interfaces/data/stats.d.ts +93 -0
- package/dist_ts/ts_interfaces/data/stats.js +2 -0
- package/dist_ts/ts_interfaces/index.d.ts +5 -0
- package/dist_ts/ts_interfaces/index.js +8 -0
- package/dist_ts/ts_interfaces/plugins.d.ts +2 -0
- package/dist_ts/ts_interfaces/plugins.js +4 -0
- package/dist_ts/ts_interfaces/requests/admin.d.ts +31 -0
- package/dist_ts/ts_interfaces/requests/admin.js +3 -0
- package/dist_ts/ts_interfaces/requests/config.d.ts +25 -0
- package/dist_ts/ts_interfaces/requests/config.js +3 -0
- package/dist_ts/ts_interfaces/requests/index.d.ts +4 -0
- package/dist_ts/ts_interfaces/requests/index.js +5 -0
- package/dist_ts/ts_interfaces/requests/logs.d.ts +34 -0
- package/dist_ts/ts_interfaces/requests/logs.js +4 -0
- package/dist_ts/ts_interfaces/requests/stats.d.ts +131 -0
- package/dist_ts/ts_interfaces/requests/stats.js +4 -0
- package/html/index.html +121 -0
- package/npmextra.json +45 -0
- package/package.json +83 -0
- package/readme.hints.md +906 -0
- package/readme.md +1253 -0
- package/readme.opsserver.md +351 -0
- package/test/helpers/server.loader.ts +347 -0
- package/test/helpers/smtp.client.ts +209 -0
- package/test/helpers/utils.ts +311 -0
- package/test/readme.md +443 -0
- package/test/suite/smtpclient_commands/test.ccmd-01.ehlo-helo-sending.ts +168 -0
- package/test/suite/smtpclient_commands/test.ccmd-02.mail-from-parameters.ts +277 -0
- package/test/suite/smtpclient_commands/test.ccmd-03.rcpt-to-multiple.ts +283 -0
- package/test/suite/smtpclient_commands/test.ccmd-04.data-transmission.ts +274 -0
- package/test/suite/smtpclient_commands/test.ccmd-05.auth-mechanisms.ts +306 -0
- package/test/suite/smtpclient_commands/test.ccmd-06.command-pipelining.ts +233 -0
- package/test/suite/smtpclient_commands/test.ccmd-07.response-parsing.ts +243 -0
- package/test/suite/smtpclient_commands/test.ccmd-08.rset-command.ts +333 -0
- package/test/suite/smtpclient_commands/test.ccmd-09.noop-command.ts +339 -0
- package/test/suite/smtpclient_commands/test.ccmd-10.vrfy-expn.ts +457 -0
- package/test/suite/smtpclient_commands/test.ccmd-11.help-command.ts +409 -0
- package/test/suite/smtpclient_connection/test.ccm-01.basic-tcp-connection.ts +150 -0
- package/test/suite/smtpclient_connection/test.ccm-02.tls-connection.ts +140 -0
- package/test/suite/smtpclient_connection/test.ccm-03.starttls-upgrade.ts +208 -0
- package/test/suite/smtpclient_connection/test.ccm-04.connection-pooling.ts +250 -0
- package/test/suite/smtpclient_connection/test.ccm-05.connection-reuse.ts +288 -0
- package/test/suite/smtpclient_connection/test.ccm-06.connection-timeout.ts +267 -0
- package/test/suite/smtpclient_connection/test.ccm-07.automatic-reconnection.ts +324 -0
- package/test/suite/smtpclient_connection/test.ccm-08.dns-resolution.ts +139 -0
- package/test/suite/smtpclient_connection/test.ccm-09.ipv6-dual-stack.ts +167 -0
- package/test/suite/smtpclient_connection/test.ccm-10.proxy-support.ts +305 -0
- package/test/suite/smtpclient_connection/test.ccm-11.keepalive.ts +299 -0
- package/test/suite/smtpclient_edge-cases/test.cedge-01.unusual-server-responses.ts +529 -0
- package/test/suite/smtpclient_edge-cases/test.cedge-02.malformed-commands.ts +438 -0
- package/test/suite/smtpclient_edge-cases/test.cedge-03.protocol-violations.ts +446 -0
- package/test/suite/smtpclient_edge-cases/test.cedge-04.resource-constraints.ts +530 -0
- package/test/suite/smtpclient_edge-cases/test.cedge-05.encoding-issues.ts +145 -0
- package/test/suite/smtpclient_edge-cases/test.cedge-06.large-headers.ts +180 -0
- package/test/suite/smtpclient_edge-cases/test.cedge-07.concurrent-operations.ts +204 -0
- package/test/suite/smtpclient_email-composition/test.cep-01.basic-headers.ts +245 -0
- package/test/suite/smtpclient_email-composition/test.cep-02.mime-multipart.ts +321 -0
- package/test/suite/smtpclient_email-composition/test.cep-03.attachment-encoding.ts +334 -0
- package/test/suite/smtpclient_email-composition/test.cep-04.bcc-handling.ts +187 -0
- package/test/suite/smtpclient_email-composition/test.cep-05.reply-to-return-path.ts +277 -0
- package/test/suite/smtpclient_email-composition/test.cep-06.utf8-international.ts +235 -0
- package/test/suite/smtpclient_email-composition/test.cep-07.html-inline-images.ts +489 -0
- package/test/suite/smtpclient_email-composition/test.cep-08.custom-headers.ts +293 -0
- package/test/suite/smtpclient_email-composition/test.cep-09.priority-importance.ts +314 -0
- package/test/suite/smtpclient_email-composition/test.cep-10.receipts-dsn.ts +411 -0
- package/test/suite/smtpclient_error-handling/test.cerr-01.4xx-errors.ts +232 -0
- package/test/suite/smtpclient_error-handling/test.cerr-02.5xx-errors.ts +309 -0
- package/test/suite/smtpclient_error-handling/test.cerr-03.network-failures.ts +299 -0
- package/test/suite/smtpclient_error-handling/test.cerr-04.greylisting-handling.ts +255 -0
- package/test/suite/smtpclient_error-handling/test.cerr-05.quota-exceeded.ts +273 -0
- package/test/suite/smtpclient_error-handling/test.cerr-06.invalid-recipients.ts +320 -0
- package/test/suite/smtpclient_error-handling/test.cerr-07.message-size-limits.ts +320 -0
- package/test/suite/smtpclient_error-handling/test.cerr-08.rate-limiting.ts +261 -0
- package/test/suite/smtpclient_error-handling/test.cerr-09.connection-pool-errors.ts +299 -0
- package/test/suite/smtpclient_error-handling/test.cerr-10.partial-failure.ts +373 -0
- package/test/suite/smtpclient_performance/test.cperf-01.bulk-sending.ts +332 -0
- package/test/suite/smtpclient_performance/test.cperf-02.message-throughput.ts +304 -0
- package/test/suite/smtpclient_performance/test.cperf-03.memory-usage.ts +332 -0
- package/test/suite/smtpclient_performance/test.cperf-04.cpu-utilization.ts +373 -0
- package/test/suite/smtpclient_performance/test.cperf-05.network-efficiency.ts +181 -0
- package/test/suite/smtpclient_performance/test.cperf-06.caching-strategies.ts +190 -0
- package/test/suite/smtpclient_performance/test.cperf-07.queue-management.ts +171 -0
- package/test/suite/smtpclient_performance/test.cperf-08.dns-caching.ts +50 -0
- package/test/suite/smtpclient_reliability/test.crel-01.reconnection-logic.ts +305 -0
- package/test/suite/smtpclient_reliability/test.crel-02.network-interruption.ts +207 -0
- package/test/suite/smtpclient_reliability/test.crel-03.queue-persistence.ts +469 -0
- package/test/suite/smtpclient_reliability/test.crel-04.crash-recovery.ts +520 -0
- package/test/suite/smtpclient_reliability/test.crel-05.memory-leaks.ts +503 -0
- package/test/suite/smtpclient_reliability/test.crel-06.concurrency-safety.ts +558 -0
- package/test/suite/smtpclient_reliability/test.crel-07.resource-cleanup.ts +52 -0
- package/test/suite/smtpclient_rfc-compliance/test.crfc-01.rfc5321-client.ts +283 -0
- package/test/suite/smtpclient_rfc-compliance/test.crfc-02.esmtp-compliance.ts +77 -0
- package/test/suite/smtpclient_rfc-compliance/test.crfc-03.command-syntax.ts +67 -0
- package/test/suite/smtpclient_rfc-compliance/test.crfc-04.response-codes.ts +54 -0
- package/test/suite/smtpclient_rfc-compliance/test.crfc-05.state-machine.ts +703 -0
- package/test/suite/smtpclient_rfc-compliance/test.crfc-06.protocol-negotiation.ts +688 -0
- package/test/suite/smtpclient_rfc-compliance/test.crfc-07.interoperability.ts +728 -0
- package/test/suite/smtpclient_rfc-compliance/test.crfc-08.smtp-extensions.ts +656 -0
- package/test/suite/smtpclient_security/test.csec-01.tls-verification.ts +88 -0
- package/test/suite/smtpclient_security/test.csec-02.oauth2-authentication.ts +132 -0
- package/test/suite/smtpclient_security/test.csec-03.dkim-signing.ts +138 -0
- package/test/suite/smtpclient_security/test.csec-04.spf-compliance.ts +163 -0
- package/test/suite/smtpclient_security/test.csec-05.dmarc-policy.ts +200 -0
- package/test/suite/smtpclient_security/test.csec-06.certificate-validation.ts +145 -0
- package/test/suite/smtpclient_security/test.csec-07.cipher-suites.ts +153 -0
- package/test/suite/smtpclient_security/test.csec-08.authentication-fallback.ts +154 -0
- package/test/suite/smtpclient_security/test.csec-09.relay-restrictions.ts +166 -0
- package/test/suite/smtpclient_security/test.csec-10.anti-spam-measures.ts +196 -0
- package/test/suite/smtpserver_commands/test.cmd-01.ehlo-command.ts +193 -0
- package/test/suite/smtpserver_commands/test.cmd-02.mail-from.ts +330 -0
- package/test/suite/smtpserver_commands/test.cmd-03.rcpt-to.ts +296 -0
- package/test/suite/smtpserver_commands/test.cmd-04.data-command.ts +395 -0
- package/test/suite/smtpserver_commands/test.cmd-05.noop-command.ts +320 -0
- package/test/suite/smtpserver_commands/test.cmd-06.rset-command.ts +399 -0
- package/test/suite/smtpserver_commands/test.cmd-07.vrfy-command.ts +391 -0
- package/test/suite/smtpserver_commands/test.cmd-08.expn-command.ts +450 -0
- package/test/suite/smtpserver_commands/test.cmd-09.size-extension.ts +465 -0
- package/test/suite/smtpserver_commands/test.cmd-10.help-command.ts +454 -0
- package/test/suite/smtpserver_commands/test.cmd-11.command-pipelining.ts +334 -0
- package/test/suite/smtpserver_commands/test.cmd-12.helo-command.ts +420 -0
- package/test/suite/smtpserver_commands/test.cmd-13.quit-command.ts +384 -0
- package/test/suite/smtpserver_connection/test.cm-01.tls-connection.ts +61 -0
- package/test/suite/smtpserver_connection/test.cm-02.multiple-connections.ts +112 -0
- package/test/suite/smtpserver_connection/test.cm-03.connection-timeout.ts +134 -0
- package/test/suite/smtpserver_connection/test.cm-04.connection-limits.ts +374 -0
- package/test/suite/smtpserver_connection/test.cm-05.connection-rejection.ts +296 -0
- package/test/suite/smtpserver_connection/test.cm-06.starttls-upgrade.ts +468 -0
- package/test/suite/smtpserver_connection/test.cm-07.abrupt-disconnection.ts +321 -0
- package/test/suite/smtpserver_connection/test.cm-08.tls-versions.ts +361 -0
- package/test/suite/smtpserver_connection/test.cm-09.tls-ciphers.ts +556 -0
- package/test/suite/smtpserver_connection/test.cm-10.plain-connection.ts +293 -0
- package/test/suite/smtpserver_connection/test.cm-11.keepalive.ts +382 -0
- package/test/suite/smtpserver_edge-cases/test.edge-01.very-large-email.ts +239 -0
- package/test/suite/smtpserver_edge-cases/test.edge-02.very-small-email.ts +389 -0
- package/test/suite/smtpserver_edge-cases/test.edge-03.invalid-character-handling.ts +479 -0
- package/test/suite/smtpserver_edge-cases/test.edge-04.empty-commands.ts +430 -0
- package/test/suite/smtpserver_edge-cases/test.edge-05.extremely-long-lines.ts +425 -0
- package/test/suite/smtpserver_edge-cases/test.edge-06.extremely-long-headers.ts +404 -0
- package/test/suite/smtpserver_edge-cases/test.edge-07.unusual-mime-types.ts +333 -0
- package/test/suite/smtpserver_edge-cases/test.edge-08.nested-mime-structures.ts +379 -0
- package/test/suite/smtpserver_email-processing/test.ep-01.basic-email-sending.ts +338 -0
- package/test/suite/smtpserver_email-processing/test.ep-02.invalid-email-addresses.ts +315 -0
- package/test/suite/smtpserver_email-processing/test.ep-03.multiple-recipients.ts +493 -0
- package/test/suite/smtpserver_email-processing/test.ep-04.large-email.ts +528 -0
- package/test/suite/smtpserver_email-processing/test.ep-05.mime-handling.ts +515 -0
- package/test/suite/smtpserver_email-processing/test.ep-06.attachment-handling.ts +629 -0
- package/test/suite/smtpserver_email-processing/test.ep-07.special-character-handling.ts +462 -0
- package/test/suite/smtpserver_email-processing/test.ep-08.email-routing.ts +527 -0
- package/test/suite/smtpserver_email-processing/test.ep-09.delivery-status-notifications.ts +486 -0
- package/test/suite/smtpserver_error-handling/test.err-01.syntax-errors.ts +475 -0
- package/test/suite/smtpserver_error-handling/test.err-02.invalid-sequence.ts +450 -0
- package/test/suite/smtpserver_error-handling/test.err-03.temporary-failures.ts +453 -0
- package/test/suite/smtpserver_error-handling/test.err-04.permanent-failures.ts +325 -0
- package/test/suite/smtpserver_error-handling/test.err-05.resource-exhaustion.ts +302 -0
- package/test/suite/smtpserver_error-handling/test.err-06.malformed-mime.ts +374 -0
- package/test/suite/smtpserver_error-handling/test.err-07.exception-handling.ts +333 -0
- package/test/suite/smtpserver_error-handling/test.err-08.error-logging.ts +324 -0
- package/test/suite/smtpserver_performance/test.perf-01.throughput.ts +183 -0
- package/test/suite/smtpserver_performance/test.perf-02.concurrency.ts +388 -0
- package/test/suite/smtpserver_performance/test.perf-03.cpu-utilization.ts +245 -0
- package/test/suite/smtpserver_performance/test.perf-04.memory-usage.ts +238 -0
- package/test/suite/smtpserver_performance/test.perf-05.connection-processing-time.ts +363 -0
- package/test/suite/smtpserver_performance/test.perf-06.message-processing-time.ts +252 -0
- package/test/suite/smtpserver_performance/test.perf-07.resource-cleanup.ts +317 -0
- package/test/suite/smtpserver_reliability/test.rel-01.long-running-operation.ts +344 -0
- package/test/suite/smtpserver_reliability/test.rel-02.restart-recovery.ts +328 -0
- package/test/suite/smtpserver_reliability/test.rel-03.resource-leak-detection.ts +394 -0
- package/test/suite/smtpserver_reliability/test.rel-04.error-recovery.ts +401 -0
- package/test/suite/smtpserver_reliability/test.rel-05.dns-resolution-failure.ts +335 -0
- package/test/suite/smtpserver_reliability/test.rel-06.network-interruption.ts +410 -0
- package/test/suite/smtpserver_rfc-compliance/test.rfc-01.rfc5321-compliance.ts +382 -0
- package/test/suite/smtpserver_rfc-compliance/test.rfc-02.rfc5322-compliance.ts +428 -0
- package/test/suite/smtpserver_rfc-compliance/test.rfc-03.rfc7208-spf-compliance.ts +330 -0
- package/test/suite/smtpserver_rfc-compliance/test.rfc-04.rfc6376-dkim-compliance.ts +450 -0
- package/test/suite/smtpserver_rfc-compliance/test.rfc-05.rfc7489-dmarc-compliance.ts +408 -0
- package/test/suite/smtpserver_rfc-compliance/test.rfc-06.rfc8314-tls-compliance.ts +366 -0
- package/test/suite/smtpserver_rfc-compliance/test.rfc-07.rfc3461-dsn-compliance.ts +399 -0
- package/test/suite/smtpserver_security/test.sec-01.authentication.ts +218 -0
- package/test/suite/smtpserver_security/test.sec-02.authorization.ts +286 -0
- package/test/suite/smtpserver_security/test.sec-03.dkim-processing.ts +414 -0
- package/test/suite/smtpserver_security/test.sec-04.spf-checking.ts +280 -0
- package/test/suite/smtpserver_security/test.sec-05.dmarc-policy.ts +374 -0
- package/test/suite/smtpserver_security/test.sec-06.ip-reputation.ts +303 -0
- package/test/suite/smtpserver_security/test.sec-07.content-scanning.ts +409 -0
- package/test/suite/smtpserver_security/test.sec-08.rate-limiting.ts +324 -0
- package/test/suite/smtpserver_security/test.sec-09.tls-certificate-validation.ts +312 -0
- package/test/suite/smtpserver_security/test.sec-10.header-injection-prevention.ts +332 -0
- package/test/suite/smtpserver_security/test.sec-11.bounce-management.ts +363 -0
- package/test/test.base.ts +65 -0
- package/test/test.bouncemanager.ts +196 -0
- package/test/test.config.md +175 -0
- package/test/test.contentscanner.ts +265 -0
- package/test/test.dcrouter.email.ts +201 -0
- package/test/test.deliverability.ts +55 -0
- package/test/test.dns-manager-creation.ts +141 -0
- package/test/test.dns-mode-switching.ts +257 -0
- package/test/test.dns-server-config.ts +140 -0
- package/test/test.dns-socket-handler.ts +169 -0
- package/test/test.dns-validation.ts +283 -0
- package/test/test.email-socket-handler.ts +228 -0
- package/test/test.email.integration.ts +377 -0
- package/test/test.email.router.ts +283 -0
- package/test/test.emailauth.ts +195 -0
- package/test/test.errors.ts +408 -0
- package/test/test.integration.storage.ts +313 -0
- package/test/test.integration.ts +75 -0
- package/test/test.ipreputationchecker.ts +179 -0
- package/test/test.ipwarmupmanager.ts +323 -0
- package/test/test.jwt-auth.ts +130 -0
- package/test/test.minimal.ts +66 -0
- package/test/test.opsserver-api.ts +83 -0
- package/test/test.protected-endpoint.ts +115 -0
- package/test/test.rate-limiting-integration.ts +236 -0
- package/test/test.ratelimiter.ts +141 -0
- package/test/test.reputationmonitor.ts +262 -0
- package/test/test.smartmail.ts +248 -0
- package/test/test.smtp.client.compatibility.ts +154 -0
- package/test/test.smtp.client.ts +191 -0
- package/test/test.smtp.server.ts +180 -0
- package/test/test.socket-handler-integration.ts +240 -0
- package/test/test.socket-handler-unit.ts +198 -0
- package/test/test.storagemanager.ts +289 -0
- package/ts/00_commitinfo_data.ts +8 -0
- package/ts/classes.dcrouter.ts +1310 -0
- package/ts/config/index.ts +2 -0
- package/ts/config/validator.ts +266 -0
- package/ts/deliverability/classes.ipwarmupmanager.ts +896 -0
- package/ts/deliverability/classes.senderreputationmonitor.ts +1244 -0
- package/ts/deliverability/index.ts +13 -0
- package/ts/errors/base.errors.ts +525 -0
- package/ts/errors/email.errors.ts +383 -0
- package/ts/errors/error-handler.ts +412 -0
- package/ts/errors/error.codes.ts +165 -0
- package/ts/errors/index.ts +195 -0
- package/ts/errors/mta.errors.ts +681 -0
- package/ts/errors/reputation.errors.ts +422 -0
- package/ts/index.ts +7 -0
- package/ts/logger.ts +91 -0
- package/ts/mail/core/classes.bouncemanager.ts +965 -0
- package/ts/mail/core/classes.email.ts +941 -0
- package/ts/mail/core/classes.emailvalidator.ts +239 -0
- package/ts/mail/core/classes.templatemanager.ts +320 -0
- package/ts/mail/core/index.ts +5 -0
- package/ts/mail/delivery/classes.delivery.queue.ts +645 -0
- package/ts/mail/delivery/classes.delivery.system.ts +1089 -0
- package/ts/mail/delivery/classes.emailsendjob.ts +447 -0
- package/ts/mail/delivery/classes.emailsendjob.ts.backup +691 -0
- package/ts/mail/delivery/classes.emailsignjob.ts +67 -0
- package/ts/mail/delivery/classes.mta.config.ts +73 -0
- package/ts/mail/delivery/classes.ratelimiter.ts +281 -0
- package/ts/mail/delivery/classes.smtp.client.legacy.ts +1422 -0
- package/ts/mail/delivery/classes.unified.rate.limiter.ts +1053 -0
- package/ts/mail/delivery/index.ts +24 -0
- package/ts/mail/delivery/interfaces.ts +291 -0
- package/ts/mail/delivery/smtpclient/auth-handler.ts +232 -0
- package/ts/mail/delivery/smtpclient/command-handler.ts +343 -0
- package/ts/mail/delivery/smtpclient/connection-manager.ts +289 -0
- package/ts/mail/delivery/smtpclient/constants.ts +145 -0
- package/ts/mail/delivery/smtpclient/create-client.ts +94 -0
- package/ts/mail/delivery/smtpclient/error-handler.ts +141 -0
- package/ts/mail/delivery/smtpclient/index.ts +24 -0
- package/ts/mail/delivery/smtpclient/interfaces.ts +242 -0
- package/ts/mail/delivery/smtpclient/smtp-client.ts +357 -0
- package/ts/mail/delivery/smtpclient/tls-handler.ts +254 -0
- package/ts/mail/delivery/smtpclient/utils/helpers.ts +224 -0
- package/ts/mail/delivery/smtpclient/utils/logging.ts +212 -0
- package/ts/mail/delivery/smtpclient/utils/validation.ts +170 -0
- package/ts/mail/delivery/smtpserver/certificate-utils.ts +398 -0
- package/ts/mail/delivery/smtpserver/command-handler.ts +1340 -0
- package/ts/mail/delivery/smtpserver/connection-manager.ts +1045 -0
- package/ts/mail/delivery/smtpserver/constants.ts +181 -0
- package/ts/mail/delivery/smtpserver/create-server.ts +31 -0
- package/ts/mail/delivery/smtpserver/data-handler.ts +1283 -0
- package/ts/mail/delivery/smtpserver/index.ts +32 -0
- package/ts/mail/delivery/smtpserver/interfaces.ts +655 -0
- package/ts/mail/delivery/smtpserver/secure-server.ts +97 -0
- package/ts/mail/delivery/smtpserver/security-handler.ts +345 -0
- package/ts/mail/delivery/smtpserver/session-manager.ts +557 -0
- package/ts/mail/delivery/smtpserver/smtp-server.ts +804 -0
- package/ts/mail/delivery/smtpserver/starttls-handler.ts +262 -0
- package/ts/mail/delivery/smtpserver/tls-handler.ts +346 -0
- package/ts/mail/delivery/smtpserver/utils/adaptive-logging.ts +514 -0
- package/ts/mail/delivery/smtpserver/utils/helpers.ts +246 -0
- package/ts/mail/delivery/smtpserver/utils/logging.ts +246 -0
- package/ts/mail/delivery/smtpserver/utils/validation.ts +436 -0
- package/ts/mail/index.ts +19 -0
- package/ts/mail/routing/classes.dns.manager.ts +563 -0
- package/ts/mail/routing/classes.dnsmanager.ts +559 -0
- package/ts/mail/routing/classes.domain.registry.ts +139 -0
- package/ts/mail/routing/classes.email.config.ts +82 -0
- package/ts/mail/routing/classes.email.router.ts +575 -0
- package/ts/mail/routing/classes.unified.email.server.ts +1873 -0
- package/ts/mail/routing/index.ts +6 -0
- package/ts/mail/routing/interfaces.ts +202 -0
- package/ts/mail/security/classes.dkimcreator.ts +431 -0
- package/ts/mail/security/classes.dkimverifier.ts +382 -0
- package/ts/mail/security/classes.dmarcverifier.ts +478 -0
- package/ts/mail/security/classes.spfverifier.ts +606 -0
- package/ts/mail/security/index.ts +5 -0
- package/ts/opsserver/classes.opsserver.ts +65 -0
- package/ts/opsserver/handlers/admin.handler.ts +240 -0
- package/ts/opsserver/handlers/config.handler.ts +150 -0
- package/ts/opsserver/handlers/index.ts +5 -0
- package/ts/opsserver/handlers/logs.handler.ts +195 -0
- package/ts/opsserver/handlers/security.handler.ts +208 -0
- package/ts/opsserver/handlers/stats.handler.ts +344 -0
- package/ts/opsserver/helpers/guards.ts +56 -0
- package/ts/opsserver/index.ts +1 -0
- package/ts/paths.ts +48 -0
- package/ts/plugins.ts +94 -0
- package/ts/security/classes.contentscanner.ts +739 -0
- package/ts/security/classes.ipreputationchecker.ts +592 -0
- package/ts/security/classes.securitylogger.ts +299 -0
- package/ts/security/index.ts +21 -0
- package/ts/sms/classes.smsservice.ts +98 -0
- package/ts/sms/config/sms.config.ts +109 -0
- package/ts/sms/config/sms.schema.ts +122 -0
- package/ts/sms/index.ts +1 -0
- package/ts/storage/classes.storagemanager.ts +400 -0
- package/ts/storage/index.ts +2 -0
- package/ts/tspublish.json +3 -0
- package/ts_interfaces/data/auth.ts +8 -0
- package/ts_interfaces/data/index.ts +2 -0
- package/ts_interfaces/data/stats.ts +101 -0
- package/ts_interfaces/index.ts +9 -0
- package/ts_interfaces/plugins.ts +6 -0
- package/ts_interfaces/requests/admin.ts +46 -0
- package/ts_interfaces/requests/config.ts +35 -0
- package/ts_interfaces/requests/index.ts +4 -0
- package/ts_interfaces/requests/logs.ts +44 -0
- package/ts_interfaces/requests/stats.ts +162 -0
- package/ts_interfaces/tspublish.json +3 -0
- package/ts_web/00_commitinfo_data.ts +8 -0
- package/ts_web/appstate.ts +361 -0
- package/ts_web/elements/index.ts +7 -0
- package/ts_web/elements/ops-dashboard.ts +165 -0
- package/ts_web/elements/ops-view-config.ts +268 -0
- package/ts_web/elements/ops-view-logs.ts +207 -0
- package/ts_web/elements/ops-view-overview.ts +222 -0
- package/ts_web/elements/ops-view-security.ts +471 -0
- package/ts_web/elements/ops-view-stats.ts +299 -0
- package/ts_web/elements/shared/css.ts +10 -0
- package/ts_web/elements/shared/index.ts +2 -0
- package/ts_web/elements/shared/ops-sectionheading.ts +42 -0
- package/ts_web/index.ts +9 -0
- package/ts_web/plugins.ts +11 -0
- package/ts_web/tspublish.json +3 -0
- package/tsconfig.json +15 -0
|
@@ -0,0 +1,739 @@
|
|
|
1
|
+
import * as plugins from '../plugins.js';
|
|
2
|
+
import * as paths from '../paths.js';
|
|
3
|
+
import { logger } from '../logger.js';
|
|
4
|
+
import { Email } from '../mail/core/classes.email.js';
|
|
5
|
+
import type { IAttachment } from '../mail/core/classes.email.js';
|
|
6
|
+
import { SecurityLogger, SecurityLogLevel, SecurityEventType } from './classes.securitylogger.js';
|
|
7
|
+
import { LRUCache } from 'lru-cache';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Scan result information
|
|
11
|
+
*/
|
|
12
|
+
export interface IScanResult {
|
|
13
|
+
isClean: boolean; // Whether the content is clean (no threats detected)
|
|
14
|
+
threatType?: string; // Type of threat if detected
|
|
15
|
+
threatDetails?: string; // Details about the detected threat
|
|
16
|
+
threatScore: number; // 0 (clean) to 100 (definitely malicious)
|
|
17
|
+
scannedElements: string[]; // What was scanned (subject, body, attachments, etc.)
|
|
18
|
+
timestamp: number; // When this scan was performed
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Options for content scanner configuration
|
|
23
|
+
*/
|
|
24
|
+
export interface IContentScannerOptions {
|
|
25
|
+
maxCacheSize?: number; // Maximum number of entries to cache
|
|
26
|
+
cacheTTL?: number; // TTL for cache entries in ms
|
|
27
|
+
scanSubject?: boolean; // Whether to scan email subjects
|
|
28
|
+
scanBody?: boolean; // Whether to scan email bodies
|
|
29
|
+
scanAttachments?: boolean; // Whether to scan attachments
|
|
30
|
+
maxAttachmentSizeToScan?: number; // Max size of attachments to scan in bytes
|
|
31
|
+
scanAttachmentNames?: boolean; // Whether to scan attachment filenames
|
|
32
|
+
blockExecutables?: boolean; // Whether to block executable attachments
|
|
33
|
+
blockMacros?: boolean; // Whether to block documents with macros
|
|
34
|
+
customRules?: Array<{ // Custom scanning rules
|
|
35
|
+
pattern: string | RegExp; // Pattern to match
|
|
36
|
+
type: string; // Type of threat
|
|
37
|
+
score: number; // Threat score
|
|
38
|
+
description: string; // Description of the threat
|
|
39
|
+
}>;
|
|
40
|
+
minThreatScore?: number; // Minimum score to consider content as a threat
|
|
41
|
+
highThreatScore?: number; // Score above which content is considered high threat
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Threat categories
|
|
46
|
+
*/
|
|
47
|
+
export enum ThreatCategory {
|
|
48
|
+
SPAM = 'spam',
|
|
49
|
+
PHISHING = 'phishing',
|
|
50
|
+
MALWARE = 'malware',
|
|
51
|
+
EXECUTABLE = 'executable',
|
|
52
|
+
SUSPICIOUS_LINK = 'suspicious_link',
|
|
53
|
+
MALICIOUS_MACRO = 'malicious_macro',
|
|
54
|
+
XSS = 'xss',
|
|
55
|
+
SENSITIVE_DATA = 'sensitive_data',
|
|
56
|
+
BLACKLISTED_CONTENT = 'blacklisted_content',
|
|
57
|
+
CUSTOM_RULE = 'custom_rule'
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Content Scanner for detecting malicious email content
|
|
62
|
+
*/
|
|
63
|
+
export class ContentScanner {
|
|
64
|
+
private static instance: ContentScanner;
|
|
65
|
+
private scanCache: LRUCache<string, IScanResult>;
|
|
66
|
+
private options: Required<IContentScannerOptions>;
|
|
67
|
+
|
|
68
|
+
// Predefined patterns for common threats
|
|
69
|
+
private static readonly MALICIOUS_PATTERNS = {
|
|
70
|
+
// Phishing patterns
|
|
71
|
+
phishing: [
|
|
72
|
+
/(?:verify|confirm|update|login).*(?:account|password|details)/i,
|
|
73
|
+
/urgent.*(?:action|attention|required)/i,
|
|
74
|
+
/(?:paypal|apple|microsoft|amazon|google|bank).*(?:verify|confirm|suspend)/i,
|
|
75
|
+
/your.*(?:account).*(?:suspended|compromised|locked)/i,
|
|
76
|
+
/\b(?:password reset|security alert|security notice)\b/i
|
|
77
|
+
],
|
|
78
|
+
|
|
79
|
+
// Spam indicators
|
|
80
|
+
spam: [
|
|
81
|
+
/\b(?:viagra|cialis|enlargement|diet pill|lose weight fast|cheap meds)\b/i,
|
|
82
|
+
/\b(?:million dollars|lottery winner|prize claim|inheritance|rich widow)\b/i,
|
|
83
|
+
/\b(?:earn from home|make money fast|earn \$\d{3,}\/day)\b/i,
|
|
84
|
+
/\b(?:limited time offer|act now|exclusive deal|only \d+ left)\b/i,
|
|
85
|
+
/\b(?:forex|stock tip|investment opportunity|cryptocurrency|bitcoin)\b/i
|
|
86
|
+
],
|
|
87
|
+
|
|
88
|
+
// Malware indicators in text
|
|
89
|
+
malware: [
|
|
90
|
+
/(?:attached file|see attachment).*(?:invoice|receipt|statement|document)/i,
|
|
91
|
+
/open.*(?:the attached|this attachment)/i,
|
|
92
|
+
/(?:enable|allow).*(?:macros|content|editing)/i,
|
|
93
|
+
/download.*(?:attachment|file|document)/i,
|
|
94
|
+
/\b(?:ransomware protection|virus alert|malware detected)\b/i
|
|
95
|
+
],
|
|
96
|
+
|
|
97
|
+
// Suspicious links
|
|
98
|
+
suspiciousLinks: [
|
|
99
|
+
/https?:\/\/bit\.ly\//i,
|
|
100
|
+
/https?:\/\/goo\.gl\//i,
|
|
101
|
+
/https?:\/\/t\.co\//i,
|
|
102
|
+
/https?:\/\/tinyurl\.com\//i,
|
|
103
|
+
/https?:\/\/(?:\d{1,3}\.){3}\d{1,3}/i, // IP address URLs
|
|
104
|
+
/https?:\/\/.*\.(?:xyz|top|club|gq|cf)\//i, // Suspicious TLDs
|
|
105
|
+
/(?:login|account|signin|auth).*\.(?!gov|edu|com|org|net)\w+\.\w+/i, // Login pages on unusual domains
|
|
106
|
+
],
|
|
107
|
+
|
|
108
|
+
// XSS and script injection
|
|
109
|
+
scriptInjection: [
|
|
110
|
+
/<script.*>.*<\/script>/is,
|
|
111
|
+
/javascript:/i,
|
|
112
|
+
/on(?:click|load|mouse|error|focus|blur)=".*"/i,
|
|
113
|
+
/document\.(?:cookie|write|location)/i,
|
|
114
|
+
/eval\s*\(/i
|
|
115
|
+
],
|
|
116
|
+
|
|
117
|
+
// Sensitive data patterns
|
|
118
|
+
sensitiveData: [
|
|
119
|
+
/\b(?:\d{3}-\d{2}-\d{4}|\d{9})\b/, // SSN
|
|
120
|
+
/\b\d{13,16}\b/, // Credit card numbers
|
|
121
|
+
/\b(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{4})\b/ // Possible Base64
|
|
122
|
+
]
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
// Common executable extensions
|
|
126
|
+
private static readonly EXECUTABLE_EXTENSIONS = [
|
|
127
|
+
'.exe', '.dll', '.bat', '.cmd', '.msi', '.js', '.vbs', '.ps1',
|
|
128
|
+
'.sh', '.jar', '.py', '.com', '.scr', '.pif', '.hta', '.cpl',
|
|
129
|
+
'.reg', '.vba', '.lnk', '.wsf', '.msi', '.msp', '.mst'
|
|
130
|
+
];
|
|
131
|
+
|
|
132
|
+
// Document formats that may contain macros
|
|
133
|
+
private static readonly MACRO_DOCUMENT_EXTENSIONS = [
|
|
134
|
+
'.doc', '.docm', '.xls', '.xlsm', '.ppt', '.pptm', '.dotm', '.xlsb', '.ppam', '.potm'
|
|
135
|
+
];
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Default options for the content scanner
|
|
139
|
+
*/
|
|
140
|
+
private static readonly DEFAULT_OPTIONS: Required<IContentScannerOptions> = {
|
|
141
|
+
maxCacheSize: 10000,
|
|
142
|
+
cacheTTL: 24 * 60 * 60 * 1000, // 24 hours
|
|
143
|
+
scanSubject: true,
|
|
144
|
+
scanBody: true,
|
|
145
|
+
scanAttachments: true,
|
|
146
|
+
maxAttachmentSizeToScan: 10 * 1024 * 1024, // 10MB
|
|
147
|
+
scanAttachmentNames: true,
|
|
148
|
+
blockExecutables: true,
|
|
149
|
+
blockMacros: true,
|
|
150
|
+
customRules: [],
|
|
151
|
+
minThreatScore: 30, // Minimum score to consider content as a threat
|
|
152
|
+
highThreatScore: 70 // Score above which content is considered high threat
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Constructor for the ContentScanner
|
|
157
|
+
* @param options Configuration options
|
|
158
|
+
*/
|
|
159
|
+
constructor(options: IContentScannerOptions = {}) {
|
|
160
|
+
// Merge with default options
|
|
161
|
+
this.options = {
|
|
162
|
+
...ContentScanner.DEFAULT_OPTIONS,
|
|
163
|
+
...options
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
// Initialize cache
|
|
167
|
+
this.scanCache = new LRUCache<string, IScanResult>({
|
|
168
|
+
max: this.options.maxCacheSize,
|
|
169
|
+
ttl: this.options.cacheTTL,
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
logger.log('info', 'ContentScanner initialized');
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* Get the singleton instance of the scanner
|
|
177
|
+
* @param options Configuration options
|
|
178
|
+
* @returns Singleton scanner instance
|
|
179
|
+
*/
|
|
180
|
+
public static getInstance(options: IContentScannerOptions = {}): ContentScanner {
|
|
181
|
+
if (!ContentScanner.instance) {
|
|
182
|
+
ContentScanner.instance = new ContentScanner(options);
|
|
183
|
+
}
|
|
184
|
+
return ContentScanner.instance;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* Scan an email for malicious content
|
|
189
|
+
* @param email The email to scan
|
|
190
|
+
* @returns Scan result
|
|
191
|
+
*/
|
|
192
|
+
public async scanEmail(email: Email): Promise<IScanResult> {
|
|
193
|
+
try {
|
|
194
|
+
// Generate a cache key from the email
|
|
195
|
+
const cacheKey = this.generateCacheKey(email);
|
|
196
|
+
|
|
197
|
+
// Check cache first
|
|
198
|
+
const cachedResult = this.scanCache.get(cacheKey);
|
|
199
|
+
if (cachedResult) {
|
|
200
|
+
logger.log('info', `Using cached scan result for email ${email.getMessageId()}`);
|
|
201
|
+
return cachedResult;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
// Initialize scan result
|
|
205
|
+
const result: IScanResult = {
|
|
206
|
+
isClean: true,
|
|
207
|
+
threatScore: 0,
|
|
208
|
+
scannedElements: [],
|
|
209
|
+
timestamp: Date.now()
|
|
210
|
+
};
|
|
211
|
+
|
|
212
|
+
// List of scan promises
|
|
213
|
+
const scanPromises: Array<Promise<void>> = [];
|
|
214
|
+
|
|
215
|
+
// Scan subject
|
|
216
|
+
if (this.options.scanSubject && email.subject) {
|
|
217
|
+
scanPromises.push(this.scanSubject(email.subject, result));
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
// Scan body content
|
|
221
|
+
if (this.options.scanBody) {
|
|
222
|
+
if (email.text) {
|
|
223
|
+
scanPromises.push(this.scanTextContent(email.text, result));
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
if (email.html) {
|
|
227
|
+
scanPromises.push(this.scanHtmlContent(email.html, result));
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
// Scan attachments
|
|
232
|
+
if (this.options.scanAttachments && email.attachments && email.attachments.length > 0) {
|
|
233
|
+
for (const attachment of email.attachments) {
|
|
234
|
+
scanPromises.push(this.scanAttachment(attachment, result));
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
// Run all scans in parallel
|
|
239
|
+
await Promise.all(scanPromises);
|
|
240
|
+
|
|
241
|
+
// Determine if the email is clean based on threat score
|
|
242
|
+
result.isClean = result.threatScore < this.options.minThreatScore;
|
|
243
|
+
|
|
244
|
+
// Save to cache
|
|
245
|
+
this.scanCache.set(cacheKey, result);
|
|
246
|
+
|
|
247
|
+
// Log high threat findings
|
|
248
|
+
if (result.threatScore >= this.options.highThreatScore) {
|
|
249
|
+
this.logHighThreatFound(email, result);
|
|
250
|
+
} else if (!result.isClean) {
|
|
251
|
+
this.logThreatFound(email, result);
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
return result;
|
|
255
|
+
} catch (error) {
|
|
256
|
+
logger.log('error', `Error scanning email: ${error.message}`, {
|
|
257
|
+
messageId: email.getMessageId(),
|
|
258
|
+
error: error.stack
|
|
259
|
+
});
|
|
260
|
+
|
|
261
|
+
// Return a safe default with error indication
|
|
262
|
+
return {
|
|
263
|
+
isClean: true, // Let it pass if scanner fails (configure as desired)
|
|
264
|
+
threatScore: 0,
|
|
265
|
+
scannedElements: ['error'],
|
|
266
|
+
timestamp: Date.now(),
|
|
267
|
+
threatType: 'scan_error',
|
|
268
|
+
threatDetails: `Scan error: ${error.message}`
|
|
269
|
+
};
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
/**
|
|
274
|
+
* Generate a cache key from an email
|
|
275
|
+
* @param email The email to generate a key for
|
|
276
|
+
* @returns Cache key
|
|
277
|
+
*/
|
|
278
|
+
private generateCacheKey(email: Email): string {
|
|
279
|
+
// Use message ID if available
|
|
280
|
+
if (email.getMessageId()) {
|
|
281
|
+
return `email:${email.getMessageId()}`;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
// Fallback to a hash of key content
|
|
285
|
+
const contentToHash = [
|
|
286
|
+
email.from,
|
|
287
|
+
email.subject || '',
|
|
288
|
+
email.text?.substring(0, 1000) || '',
|
|
289
|
+
email.html?.substring(0, 1000) || '',
|
|
290
|
+
email.attachments?.length || 0
|
|
291
|
+
].join(':');
|
|
292
|
+
|
|
293
|
+
return `email:${plugins.crypto.createHash('sha256').update(contentToHash).digest('hex')}`;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
/**
|
|
297
|
+
* Scan email subject for threats
|
|
298
|
+
* @param subject The subject to scan
|
|
299
|
+
* @param result The scan result to update
|
|
300
|
+
*/
|
|
301
|
+
private async scanSubject(subject: string, result: IScanResult): Promise<void> {
|
|
302
|
+
result.scannedElements.push('subject');
|
|
303
|
+
|
|
304
|
+
// Check against phishing patterns
|
|
305
|
+
for (const pattern of ContentScanner.MALICIOUS_PATTERNS.phishing) {
|
|
306
|
+
if (pattern.test(subject)) {
|
|
307
|
+
result.threatScore += 25;
|
|
308
|
+
result.threatType = ThreatCategory.PHISHING;
|
|
309
|
+
result.threatDetails = `Subject contains potential phishing indicators: ${subject}`;
|
|
310
|
+
return;
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
// Check against spam patterns
|
|
315
|
+
for (const pattern of ContentScanner.MALICIOUS_PATTERNS.spam) {
|
|
316
|
+
if (pattern.test(subject)) {
|
|
317
|
+
result.threatScore += 15;
|
|
318
|
+
result.threatType = ThreatCategory.SPAM;
|
|
319
|
+
result.threatDetails = `Subject contains potential spam indicators: ${subject}`;
|
|
320
|
+
return;
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
// Check custom rules
|
|
325
|
+
for (const rule of this.options.customRules) {
|
|
326
|
+
const pattern = rule.pattern instanceof RegExp ? rule.pattern : new RegExp(rule.pattern, 'i');
|
|
327
|
+
if (pattern.test(subject)) {
|
|
328
|
+
result.threatScore += rule.score;
|
|
329
|
+
result.threatType = rule.type;
|
|
330
|
+
result.threatDetails = rule.description;
|
|
331
|
+
return;
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
/**
|
|
337
|
+
* Scan plain text content for threats
|
|
338
|
+
* @param text The text content to scan
|
|
339
|
+
* @param result The scan result to update
|
|
340
|
+
*/
|
|
341
|
+
private async scanTextContent(text: string, result: IScanResult): Promise<void> {
|
|
342
|
+
result.scannedElements.push('text');
|
|
343
|
+
|
|
344
|
+
// Check suspicious links
|
|
345
|
+
for (const pattern of ContentScanner.MALICIOUS_PATTERNS.suspiciousLinks) {
|
|
346
|
+
if (pattern.test(text)) {
|
|
347
|
+
result.threatScore += 20;
|
|
348
|
+
if (!result.threatType || result.threatScore > (result.threatType === ThreatCategory.SUSPICIOUS_LINK ? 0 : 20)) {
|
|
349
|
+
result.threatType = ThreatCategory.SUSPICIOUS_LINK;
|
|
350
|
+
result.threatDetails = `Text contains suspicious links`;
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
// Check phishing
|
|
356
|
+
for (const pattern of ContentScanner.MALICIOUS_PATTERNS.phishing) {
|
|
357
|
+
if (pattern.test(text)) {
|
|
358
|
+
result.threatScore += 25;
|
|
359
|
+
if (!result.threatType || result.threatScore > (result.threatType === ThreatCategory.PHISHING ? 0 : 25)) {
|
|
360
|
+
result.threatType = ThreatCategory.PHISHING;
|
|
361
|
+
result.threatDetails = `Text contains potential phishing indicators`;
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
// Check spam
|
|
367
|
+
for (const pattern of ContentScanner.MALICIOUS_PATTERNS.spam) {
|
|
368
|
+
if (pattern.test(text)) {
|
|
369
|
+
result.threatScore += 15;
|
|
370
|
+
if (!result.threatType || result.threatScore > (result.threatType === ThreatCategory.SPAM ? 0 : 15)) {
|
|
371
|
+
result.threatType = ThreatCategory.SPAM;
|
|
372
|
+
result.threatDetails = `Text contains potential spam indicators`;
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
// Check malware indicators
|
|
378
|
+
for (const pattern of ContentScanner.MALICIOUS_PATTERNS.malware) {
|
|
379
|
+
if (pattern.test(text)) {
|
|
380
|
+
result.threatScore += 30;
|
|
381
|
+
if (!result.threatType || result.threatScore > (result.threatType === ThreatCategory.MALWARE ? 0 : 30)) {
|
|
382
|
+
result.threatType = ThreatCategory.MALWARE;
|
|
383
|
+
result.threatDetails = `Text contains potential malware indicators`;
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
// Check sensitive data
|
|
389
|
+
for (const pattern of ContentScanner.MALICIOUS_PATTERNS.sensitiveData) {
|
|
390
|
+
if (pattern.test(text)) {
|
|
391
|
+
result.threatScore += 25;
|
|
392
|
+
if (!result.threatType || result.threatScore > (result.threatType === ThreatCategory.SENSITIVE_DATA ? 0 : 25)) {
|
|
393
|
+
result.threatType = ThreatCategory.SENSITIVE_DATA;
|
|
394
|
+
result.threatDetails = `Text contains potentially sensitive data patterns`;
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
// Check custom rules
|
|
400
|
+
for (const rule of this.options.customRules) {
|
|
401
|
+
const pattern = rule.pattern instanceof RegExp ? rule.pattern : new RegExp(rule.pattern, 'i');
|
|
402
|
+
if (pattern.test(text)) {
|
|
403
|
+
result.threatScore += rule.score;
|
|
404
|
+
if (!result.threatType || result.threatScore > 20) {
|
|
405
|
+
result.threatType = rule.type;
|
|
406
|
+
result.threatDetails = rule.description;
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
/**
|
|
413
|
+
* Scan HTML content for threats
|
|
414
|
+
* @param html The HTML content to scan
|
|
415
|
+
* @param result The scan result to update
|
|
416
|
+
*/
|
|
417
|
+
private async scanHtmlContent(html: string, result: IScanResult): Promise<void> {
|
|
418
|
+
result.scannedElements.push('html');
|
|
419
|
+
|
|
420
|
+
// Check for script injection
|
|
421
|
+
for (const pattern of ContentScanner.MALICIOUS_PATTERNS.scriptInjection) {
|
|
422
|
+
if (pattern.test(html)) {
|
|
423
|
+
result.threatScore += 40;
|
|
424
|
+
if (!result.threatType || result.threatType !== ThreatCategory.XSS) {
|
|
425
|
+
result.threatType = ThreatCategory.XSS;
|
|
426
|
+
result.threatDetails = `HTML contains potentially malicious script content`;
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
// Extract text content from HTML for further scanning
|
|
432
|
+
const textContent = this.extractTextFromHtml(html);
|
|
433
|
+
if (textContent) {
|
|
434
|
+
// We'll leverage the text scanning but not double-count threat score
|
|
435
|
+
const tempResult: IScanResult = {
|
|
436
|
+
isClean: true,
|
|
437
|
+
threatScore: 0,
|
|
438
|
+
scannedElements: [],
|
|
439
|
+
timestamp: Date.now()
|
|
440
|
+
};
|
|
441
|
+
|
|
442
|
+
await this.scanTextContent(textContent, tempResult);
|
|
443
|
+
|
|
444
|
+
// Only add additional threat types if they're more severe
|
|
445
|
+
if (tempResult.threatType && tempResult.threatScore > 0) {
|
|
446
|
+
// Add half of the text content score to avoid double counting
|
|
447
|
+
result.threatScore += Math.floor(tempResult.threatScore / 2);
|
|
448
|
+
|
|
449
|
+
// Adopt the threat type if more severe or no existing type
|
|
450
|
+
if (!result.threatType || tempResult.threatScore > result.threatScore) {
|
|
451
|
+
result.threatType = tempResult.threatType;
|
|
452
|
+
result.threatDetails = tempResult.threatDetails;
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
// Extract and check links from HTML
|
|
458
|
+
const links = this.extractLinksFromHtml(html);
|
|
459
|
+
if (links.length > 0) {
|
|
460
|
+
// Check for suspicious links
|
|
461
|
+
let suspiciousLinks = 0;
|
|
462
|
+
for (const link of links) {
|
|
463
|
+
for (const pattern of ContentScanner.MALICIOUS_PATTERNS.suspiciousLinks) {
|
|
464
|
+
if (pattern.test(link)) {
|
|
465
|
+
suspiciousLinks++;
|
|
466
|
+
break;
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
if (suspiciousLinks > 0) {
|
|
472
|
+
// Add score based on percentage of suspicious links
|
|
473
|
+
const suspiciousPercentage = (suspiciousLinks / links.length) * 100;
|
|
474
|
+
const additionalScore = Math.min(40, Math.floor(suspiciousPercentage / 2.5));
|
|
475
|
+
result.threatScore += additionalScore;
|
|
476
|
+
|
|
477
|
+
if (!result.threatType || additionalScore > 20) {
|
|
478
|
+
result.threatType = ThreatCategory.SUSPICIOUS_LINK;
|
|
479
|
+
result.threatDetails = `HTML contains ${suspiciousLinks} suspicious links out of ${links.length} total links`;
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
/**
|
|
486
|
+
* Scan an attachment for threats
|
|
487
|
+
* @param attachment The attachment to scan
|
|
488
|
+
* @param result The scan result to update
|
|
489
|
+
*/
|
|
490
|
+
private async scanAttachment(attachment: IAttachment, result: IScanResult): Promise<void> {
|
|
491
|
+
const filename = attachment.filename.toLowerCase();
|
|
492
|
+
result.scannedElements.push(`attachment:${filename}`);
|
|
493
|
+
|
|
494
|
+
// Skip large attachments if configured
|
|
495
|
+
if (attachment.content && attachment.content.length > this.options.maxAttachmentSizeToScan) {
|
|
496
|
+
logger.log('info', `Skipping scan of large attachment: ${filename} (${attachment.content.length} bytes)`);
|
|
497
|
+
return;
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
// Check filename for executable extensions
|
|
501
|
+
if (this.options.blockExecutables) {
|
|
502
|
+
for (const ext of ContentScanner.EXECUTABLE_EXTENSIONS) {
|
|
503
|
+
if (filename.endsWith(ext)) {
|
|
504
|
+
result.threatScore += 70; // High score for executable attachments
|
|
505
|
+
result.threatType = ThreatCategory.EXECUTABLE;
|
|
506
|
+
result.threatDetails = `Attachment has a potentially dangerous extension: ${filename}`;
|
|
507
|
+
return; // No need to scan contents if filename already flagged
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
// Check for Office documents with macros
|
|
513
|
+
if (this.options.blockMacros) {
|
|
514
|
+
for (const ext of ContentScanner.MACRO_DOCUMENT_EXTENSIONS) {
|
|
515
|
+
if (filename.endsWith(ext)) {
|
|
516
|
+
// For Office documents, check if they contain macros
|
|
517
|
+
// This is a simplified check - a real implementation would use specialized libraries
|
|
518
|
+
// to detect macros in Office documents
|
|
519
|
+
if (attachment.content && this.likelyContainsMacros(attachment)) {
|
|
520
|
+
result.threatScore += 60;
|
|
521
|
+
result.threatType = ThreatCategory.MALICIOUS_MACRO;
|
|
522
|
+
result.threatDetails = `Attachment appears to contain macros: ${filename}`;
|
|
523
|
+
return;
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
// Perform basic content analysis if we have content buffer
|
|
530
|
+
if (attachment.content) {
|
|
531
|
+
// Convert to string for scanning, with a limit to prevent memory issues
|
|
532
|
+
const textContent = this.extractTextFromBuffer(attachment.content);
|
|
533
|
+
|
|
534
|
+
if (textContent) {
|
|
535
|
+
// Scan for malicious patterns in attachment content
|
|
536
|
+
for (const category in ContentScanner.MALICIOUS_PATTERNS) {
|
|
537
|
+
const patterns = ContentScanner.MALICIOUS_PATTERNS[category];
|
|
538
|
+
for (const pattern of patterns) {
|
|
539
|
+
if (pattern.test(textContent)) {
|
|
540
|
+
result.threatScore += 30;
|
|
541
|
+
|
|
542
|
+
if (!result.threatType) {
|
|
543
|
+
result.threatType = this.mapCategoryToThreatType(category);
|
|
544
|
+
result.threatDetails = `Attachment content contains suspicious patterns: ${filename}`;
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
break;
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
// Check for PE headers (Windows executables)
|
|
554
|
+
if (attachment.content.length > 64 &&
|
|
555
|
+
attachment.content[0] === 0x4D &&
|
|
556
|
+
attachment.content[1] === 0x5A) { // 'MZ' header
|
|
557
|
+
result.threatScore += 80;
|
|
558
|
+
result.threatType = ThreatCategory.EXECUTABLE;
|
|
559
|
+
result.threatDetails = `Attachment contains executable code: ${filename}`;
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
/**
|
|
565
|
+
* Extract links from HTML content
|
|
566
|
+
* @param html HTML content
|
|
567
|
+
* @returns Array of extracted links
|
|
568
|
+
*/
|
|
569
|
+
private extractLinksFromHtml(html: string): string[] {
|
|
570
|
+
const links: string[] = [];
|
|
571
|
+
|
|
572
|
+
// Simple regex-based extraction - a real implementation might use a proper HTML parser
|
|
573
|
+
const matches = html.match(/href=["'](https?:\/\/[^"']+)["']/gi);
|
|
574
|
+
if (matches) {
|
|
575
|
+
for (const match of matches) {
|
|
576
|
+
const linkMatch = match.match(/href=["'](https?:\/\/[^"']+)["']/i);
|
|
577
|
+
if (linkMatch && linkMatch[1]) {
|
|
578
|
+
links.push(linkMatch[1]);
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
return links;
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
/**
|
|
587
|
+
* Extract plain text from HTML
|
|
588
|
+
* @param html HTML content
|
|
589
|
+
* @returns Extracted text
|
|
590
|
+
*/
|
|
591
|
+
private extractTextFromHtml(html: string): string {
|
|
592
|
+
// Remove HTML tags and decode entities - simplified version
|
|
593
|
+
return html
|
|
594
|
+
.replace(/<style[^>]*>.*?<\/style>/gs, '')
|
|
595
|
+
.replace(/<script[^>]*>.*?<\/script>/gs, '')
|
|
596
|
+
.replace(/<[^>]+>/g, ' ')
|
|
597
|
+
.replace(/ /g, ' ')
|
|
598
|
+
.replace(/</g, '<')
|
|
599
|
+
.replace(/>/g, '>')
|
|
600
|
+
.replace(/&/g, '&')
|
|
601
|
+
.replace(/"/g, '"')
|
|
602
|
+
.replace(/'/g, "'")
|
|
603
|
+
.replace(/\s+/g, ' ')
|
|
604
|
+
.trim();
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
/**
|
|
608
|
+
* Extract text from a binary buffer for scanning
|
|
609
|
+
* @param buffer Binary content
|
|
610
|
+
* @returns Extracted text (may be partial)
|
|
611
|
+
*/
|
|
612
|
+
private extractTextFromBuffer(buffer: Buffer): string {
|
|
613
|
+
try {
|
|
614
|
+
// Limit the amount we convert to avoid memory issues
|
|
615
|
+
const sampleSize = Math.min(buffer.length, 100 * 1024); // 100KB max sample
|
|
616
|
+
const sample = buffer.slice(0, sampleSize);
|
|
617
|
+
|
|
618
|
+
// Try to convert to string, filtering out non-printable chars
|
|
619
|
+
return sample.toString('utf8')
|
|
620
|
+
.replace(/[\x00-\x09\x0B-\x1F\x7F-\x9F]/g, '') // Remove control chars
|
|
621
|
+
.replace(/\uFFFD/g, ''); // Remove replacement char
|
|
622
|
+
} catch (error) {
|
|
623
|
+
logger.log('warn', `Error extracting text from buffer: ${error.message}`);
|
|
624
|
+
return '';
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
/**
|
|
629
|
+
* Check if an Office document likely contains macros
|
|
630
|
+
* This is a simplified check - real implementation would use specialized libraries
|
|
631
|
+
* @param attachment The attachment to check
|
|
632
|
+
* @returns Whether the file likely contains macros
|
|
633
|
+
*/
|
|
634
|
+
private likelyContainsMacros(attachment: IAttachment): boolean {
|
|
635
|
+
// Simple heuristic: look for VBA/macro related strings
|
|
636
|
+
// This is a simplified approach and not comprehensive
|
|
637
|
+
const content = this.extractTextFromBuffer(attachment.content);
|
|
638
|
+
const macroIndicators = [
|
|
639
|
+
/vbaProject\.bin/i,
|
|
640
|
+
/Microsoft VBA/i,
|
|
641
|
+
/\bVBA\b/,
|
|
642
|
+
/Auto_Open/i,
|
|
643
|
+
/AutoExec/i,
|
|
644
|
+
/DocumentOpen/i,
|
|
645
|
+
/AutoOpen/i,
|
|
646
|
+
/\bExecute\(/i,
|
|
647
|
+
/\bShell\(/i,
|
|
648
|
+
/\bCreateObject\(/i
|
|
649
|
+
];
|
|
650
|
+
|
|
651
|
+
for (const indicator of macroIndicators) {
|
|
652
|
+
if (indicator.test(content)) {
|
|
653
|
+
return true;
|
|
654
|
+
}
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
return false;
|
|
658
|
+
}
|
|
659
|
+
|
|
660
|
+
/**
|
|
661
|
+
* Map a pattern category to a threat type
|
|
662
|
+
* @param category The pattern category
|
|
663
|
+
* @returns The corresponding threat type
|
|
664
|
+
*/
|
|
665
|
+
private mapCategoryToThreatType(category: string): string {
|
|
666
|
+
switch (category) {
|
|
667
|
+
case 'phishing': return ThreatCategory.PHISHING;
|
|
668
|
+
case 'spam': return ThreatCategory.SPAM;
|
|
669
|
+
case 'malware': return ThreatCategory.MALWARE;
|
|
670
|
+
case 'suspiciousLinks': return ThreatCategory.SUSPICIOUS_LINK;
|
|
671
|
+
case 'scriptInjection': return ThreatCategory.XSS;
|
|
672
|
+
case 'sensitiveData': return ThreatCategory.SENSITIVE_DATA;
|
|
673
|
+
default: return ThreatCategory.BLACKLISTED_CONTENT;
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
/**
|
|
678
|
+
* Log a high threat finding to the security logger
|
|
679
|
+
* @param email The email containing the threat
|
|
680
|
+
* @param result The scan result
|
|
681
|
+
*/
|
|
682
|
+
private logHighThreatFound(email: Email, result: IScanResult): void {
|
|
683
|
+
SecurityLogger.getInstance().logEvent({
|
|
684
|
+
level: SecurityLogLevel.ERROR,
|
|
685
|
+
type: SecurityEventType.MALWARE,
|
|
686
|
+
message: `High threat content detected in email from ${email.from} to ${email.to.join(', ')}`,
|
|
687
|
+
details: {
|
|
688
|
+
messageId: email.getMessageId(),
|
|
689
|
+
threatType: result.threatType,
|
|
690
|
+
threatDetails: result.threatDetails,
|
|
691
|
+
threatScore: result.threatScore,
|
|
692
|
+
scannedElements: result.scannedElements,
|
|
693
|
+
subject: email.subject
|
|
694
|
+
},
|
|
695
|
+
success: false,
|
|
696
|
+
domain: email.getFromDomain()
|
|
697
|
+
});
|
|
698
|
+
}
|
|
699
|
+
|
|
700
|
+
/**
|
|
701
|
+
* Log a threat finding to the security logger
|
|
702
|
+
* @param email The email containing the threat
|
|
703
|
+
* @param result The scan result
|
|
704
|
+
*/
|
|
705
|
+
private logThreatFound(email: Email, result: IScanResult): void {
|
|
706
|
+
SecurityLogger.getInstance().logEvent({
|
|
707
|
+
level: SecurityLogLevel.WARN,
|
|
708
|
+
type: SecurityEventType.SPAM,
|
|
709
|
+
message: `Suspicious content detected in email from ${email.from} to ${email.to.join(', ')}`,
|
|
710
|
+
details: {
|
|
711
|
+
messageId: email.getMessageId(),
|
|
712
|
+
threatType: result.threatType,
|
|
713
|
+
threatDetails: result.threatDetails,
|
|
714
|
+
threatScore: result.threatScore,
|
|
715
|
+
scannedElements: result.scannedElements,
|
|
716
|
+
subject: email.subject
|
|
717
|
+
},
|
|
718
|
+
success: false,
|
|
719
|
+
domain: email.getFromDomain()
|
|
720
|
+
});
|
|
721
|
+
}
|
|
722
|
+
|
|
723
|
+
/**
|
|
724
|
+
* Get threat level description based on score
|
|
725
|
+
* @param score Threat score
|
|
726
|
+
* @returns Threat level description
|
|
727
|
+
*/
|
|
728
|
+
public static getThreatLevel(score: number): 'none' | 'low' | 'medium' | 'high' {
|
|
729
|
+
if (score < 20) {
|
|
730
|
+
return 'none';
|
|
731
|
+
} else if (score < 40) {
|
|
732
|
+
return 'low';
|
|
733
|
+
} else if (score < 70) {
|
|
734
|
+
return 'medium';
|
|
735
|
+
} else {
|
|
736
|
+
return 'high';
|
|
737
|
+
}
|
|
738
|
+
}
|
|
739
|
+
}
|