/** * SMTP Security Handler * Responsible for security aspects including IP reputation checking, * email validation, and authentication */ import * as plugins from '../../../plugins.js'; import type { ISmtpAuth } from './interfaces.js'; import type { ISecurityHandler, ISmtpServer } from './interfaces.js'; /** * Handles security aspects for SMTP server */ export declare class SecurityHandler implements ISecurityHandler { /** * Reference to the SMTP server instance */ private smtpServer; /** * IP reputation checker service */ private ipReputationService; /** * Simple in-memory IP denylist */ private ipDenylist; /** * Cleanup interval timer */ private cleanupInterval; /** * Creates a new security handler * @param smtpServer - SMTP server instance */ constructor(smtpServer: ISmtpServer); /** * Check IP reputation for a connection * @param socket - Client socket * @returns Promise that resolves to true if IP is allowed, false if blocked */ checkIpReputation(socket: plugins.net.Socket | plugins.tls.TLSSocket): Promise; /** * Validate an email address * @param email - Email address to validate * @returns Whether the email address is valid */ isValidEmail(email: string): boolean; /** * Validate authentication credentials * @param auth - Authentication credentials * @returns Promise that resolves to true if authenticated */ authenticate(auth: ISmtpAuth): Promise; /** * Log a security event * @param event - Event type * @param level - Log level * @param details - Event details */ logSecurityEvent(event: string, level: string, message: string, details: Record): void; /** * Add an IP to the denylist * @param ip - IP address * @param reason - Reason for denylisting * @param duration - Duration in milliseconds (optional, indefinite if not specified) */ private addToDenylist; /** * Check if an IP is denylisted * @param ip - IP address * @returns Whether the IP is denylisted */ private isIpDenylisted; /** * Get the reason an IP was denylisted * @param ip - IP address * @returns Reason for denylisting or undefined if not denylisted */ private getDenylistReason; /** * Clean expired denylist entries */ private cleanExpiredDenylistEntries; /** * Clean up resources */ destroy(): void; }