/** * Log level for security events */ export declare enum SecurityLogLevel { INFO = "info", WARN = "warn", ERROR = "error", CRITICAL = "critical" } /** * Security event types for categorization */ export declare enum SecurityEventType { AUTHENTICATION = "authentication", ACCESS_CONTROL = "access_control", EMAIL_VALIDATION = "email_validation", EMAIL_PROCESSING = "email_processing", EMAIL_FORWARDING = "email_forwarding", EMAIL_DELIVERY = "email_delivery", DKIM = "dkim", SPF = "spf", DMARC = "dmarc", RATE_LIMIT = "rate_limit", RATE_LIMITING = "rate_limiting", SPAM = "spam", MALWARE = "malware", CONNECTION = "connection", DATA_EXPOSURE = "data_exposure", CONFIGURATION = "configuration", IP_REPUTATION = "ip_reputation", REJECTED_CONNECTION = "rejected_connection" } /** * Security event interface */ export interface ISecurityEvent { timestamp: number; level: SecurityLogLevel; type: SecurityEventType; message: string; details?: any; ipAddress?: string; userId?: string; sessionId?: string; emailId?: string; domain?: string; action?: string; result?: string; success?: boolean; } /** * Security logger for enhanced security monitoring */ export declare class SecurityLogger { private static instance; private securityEvents; private maxEventHistory; private enableNotifications; private constructor(); /** * Get singleton instance */ static getInstance(options?: { maxEventHistory?: number; enableNotifications?: boolean; }): SecurityLogger; /** * Log a security event * @param event The security event to log */ logEvent(event: Omit): void; /** * Get recent security events * @param limit Maximum number of events to return * @param filter Filter for specific event types * @returns Recent security events */ getRecentEvents(limit?: number, filter?: { level?: SecurityLogLevel; type?: SecurityEventType; fromTimestamp?: number; toTimestamp?: number; }): ISecurityEvent[]; /** * Get events by security level * @param level The security level to filter by * @param limit Maximum number of events to return * @returns Security events matching the level */ getEventsByLevel(level: SecurityLogLevel, limit?: number): ISecurityEvent[]; /** * Get events by security type * @param type The event type to filter by * @param limit Maximum number of events to return * @returns Security events matching the type */ getEventsByType(type: SecurityEventType, limit?: number): ISecurityEvent[]; /** * Get security events for a specific IP address * @param ipAddress The IP address to filter by * @param limit Maximum number of events to return * @returns Security events for the IP address */ getEventsByIP(ipAddress: string, limit?: number): ISecurityEvent[]; /** * Get security events for a specific domain * @param domain The domain to filter by * @param limit Maximum number of events to return * @returns Security events for the domain */ getEventsByDomain(domain: string, limit?: number): ISecurityEvent[]; /** * Send a notification for critical security events * @param event The security event to notify about * @private */ private sendNotification; /** * Clear event history */ clearEvents(): void; /** * Get statistical summary of security events * @param timeWindow Optional time window in milliseconds * @returns Summary of security events */ getEventsSummary(timeWindow?: number): { total: number; byLevel: Record; byType: Record; topIPs: Array<{ ip: string; count: number; }>; topDomains: Array<{ domain: string; count: number; }>; }; }