update
This commit is contained in:
@ -1,19 +1,229 @@
|
||||
import type { IBaseConfig, ITlsConfig, IQueueConfig, IRateLimitConfig, IMonitoringConfig } from './base.config.js';
|
||||
|
||||
/**
|
||||
* Email processing modes
|
||||
*/
|
||||
export type EmailProcessingMode = 'forward' | 'mta' | 'process';
|
||||
|
||||
/**
|
||||
* Domain rule for email routing
|
||||
*/
|
||||
export interface IDomainRule {
|
||||
/**
|
||||
* Pattern to match (e.g., "*@example.com")
|
||||
*/
|
||||
pattern: string;
|
||||
|
||||
/**
|
||||
* Processing mode
|
||||
*/
|
||||
mode: EmailProcessingMode;
|
||||
|
||||
/**
|
||||
* Target server for forwarding mode
|
||||
*/
|
||||
target?: {
|
||||
/**
|
||||
* Target server hostname or IP
|
||||
*/
|
||||
server: string;
|
||||
|
||||
/**
|
||||
* Target server port
|
||||
*/
|
||||
port?: number;
|
||||
|
||||
/**
|
||||
* Whether to use TLS for forwarding
|
||||
*/
|
||||
useTls?: boolean;
|
||||
};
|
||||
|
||||
/**
|
||||
* MTA options for mta mode
|
||||
*/
|
||||
mtaOptions?: {
|
||||
/**
|
||||
* Domain for MTA
|
||||
*/
|
||||
domain?: string;
|
||||
|
||||
/**
|
||||
* Whether to sign with DKIM
|
||||
*/
|
||||
dkimSign?: boolean;
|
||||
|
||||
/**
|
||||
* DKIM options
|
||||
*/
|
||||
dkimOptions?: {
|
||||
/**
|
||||
* Domain name for DKIM
|
||||
*/
|
||||
domainName: string;
|
||||
|
||||
/**
|
||||
* Key selector
|
||||
*/
|
||||
keySelector: string;
|
||||
|
||||
/**
|
||||
* Private key
|
||||
*/
|
||||
privateKey?: string;
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Whether to scan content in process mode
|
||||
*/
|
||||
contentScanning?: boolean;
|
||||
|
||||
/**
|
||||
* Content scanners to apply
|
||||
*/
|
||||
scanners?: Array<{
|
||||
/**
|
||||
* Scanner type
|
||||
*/
|
||||
type: 'spam' | 'virus' | 'attachment';
|
||||
|
||||
/**
|
||||
* Threshold for scanner
|
||||
*/
|
||||
threshold?: number;
|
||||
|
||||
/**
|
||||
* Action to take
|
||||
*/
|
||||
action: 'tag' | 'reject';
|
||||
|
||||
/**
|
||||
* Blocked file extensions for attachment scanner
|
||||
*/
|
||||
blockedExtensions?: string[];
|
||||
}>;
|
||||
|
||||
/**
|
||||
* Email transformations to apply
|
||||
*/
|
||||
transformations?: Array<{
|
||||
/**
|
||||
* Transformation type
|
||||
*/
|
||||
type: 'addHeader';
|
||||
|
||||
/**
|
||||
* Header name
|
||||
*/
|
||||
header?: string;
|
||||
|
||||
/**
|
||||
* Header value
|
||||
*/
|
||||
value?: string;
|
||||
}>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Email service configuration
|
||||
*/
|
||||
export interface IEmailConfig extends IBaseConfig {
|
||||
/**
|
||||
* Whether to use MTA for sending emails
|
||||
* Whether to enable email functionality
|
||||
*/
|
||||
useEmail?: boolean;
|
||||
|
||||
/**
|
||||
* Whether to use MTA service (legacy compatibility)
|
||||
*/
|
||||
useMta?: boolean;
|
||||
|
||||
/**
|
||||
* MTA configuration
|
||||
* MTA configuration (legacy compatibility)
|
||||
*/
|
||||
mtaConfig?: IMtaConfig;
|
||||
|
||||
/**
|
||||
* Whether the email server is behind SmartProxy (uses internal ports)
|
||||
*/
|
||||
behindSmartProxy?: boolean;
|
||||
|
||||
/**
|
||||
* Email server configuration for both sending and receiving
|
||||
*/
|
||||
serverConfig?: IEmailServerConfig;
|
||||
|
||||
/**
|
||||
* Email ports to listen on
|
||||
*/
|
||||
ports?: number[];
|
||||
|
||||
/**
|
||||
* Email server hostname
|
||||
*/
|
||||
hostname?: string;
|
||||
|
||||
/**
|
||||
* TLS configuration
|
||||
*/
|
||||
tls?: ITlsConfig;
|
||||
|
||||
/**
|
||||
* Domain routing rules
|
||||
*/
|
||||
domainRules?: IDomainRule[];
|
||||
|
||||
/**
|
||||
* Default processing mode for emails
|
||||
*/
|
||||
defaultMode?: EmailProcessingMode;
|
||||
|
||||
/**
|
||||
* Default server for forwarding
|
||||
*/
|
||||
defaultServer?: string;
|
||||
|
||||
/**
|
||||
* Default port for forwarding
|
||||
*/
|
||||
defaultPort?: number;
|
||||
|
||||
/**
|
||||
* Default TLS setting for forwarding
|
||||
*/
|
||||
defaultTls?: boolean;
|
||||
|
||||
/**
|
||||
* Maximum message size in bytes
|
||||
*/
|
||||
maxMessageSize?: number;
|
||||
|
||||
/**
|
||||
* Authentication settings
|
||||
*/
|
||||
auth?: {
|
||||
/**
|
||||
* Whether authentication is required
|
||||
*/
|
||||
required?: boolean;
|
||||
|
||||
/**
|
||||
* Supported authentication methods
|
||||
*/
|
||||
methods?: ('PLAIN' | 'LOGIN' | 'OAUTH2')[];
|
||||
|
||||
/**
|
||||
* User credentials
|
||||
*/
|
||||
users?: Array<{username: string, password: string}>;
|
||||
};
|
||||
|
||||
/**
|
||||
* Queue configuration
|
||||
*/
|
||||
queue?: IQueueConfig;
|
||||
|
||||
/**
|
||||
* Template configuration
|
||||
*/
|
||||
@ -263,4 +473,124 @@ export interface IMtaConfig {
|
||||
* Queue configuration
|
||||
*/
|
||||
queue?: IQueueConfig;
|
||||
}
|
||||
|
||||
/**
|
||||
* Email server configuration
|
||||
*/
|
||||
export interface IEmailServerConfig {
|
||||
/**
|
||||
* Server ports
|
||||
*/
|
||||
ports?: number[];
|
||||
|
||||
/**
|
||||
* Server hostname
|
||||
*/
|
||||
hostname?: string;
|
||||
|
||||
/**
|
||||
* TLS configuration
|
||||
*/
|
||||
tls?: ITlsConfig;
|
||||
|
||||
/**
|
||||
* Security settings
|
||||
*/
|
||||
security?: {
|
||||
/**
|
||||
* Whether to use DKIM signing
|
||||
*/
|
||||
useDkim?: boolean;
|
||||
|
||||
/**
|
||||
* Whether to verify inbound DKIM signatures
|
||||
*/
|
||||
verifyDkim?: boolean;
|
||||
|
||||
/**
|
||||
* Whether to verify SPF on inbound
|
||||
*/
|
||||
verifySpf?: boolean;
|
||||
|
||||
/**
|
||||
* Whether to verify DMARC on inbound
|
||||
*/
|
||||
verifyDmarc?: boolean;
|
||||
|
||||
/**
|
||||
* Whether to enforce DMARC policy
|
||||
*/
|
||||
enforceDmarc?: boolean;
|
||||
|
||||
/**
|
||||
* Whether to use TLS for outbound when available
|
||||
*/
|
||||
useTls?: boolean;
|
||||
|
||||
/**
|
||||
* Whether to require valid certificates
|
||||
*/
|
||||
requireValidCerts?: boolean;
|
||||
|
||||
/**
|
||||
* Log level for email security events
|
||||
*/
|
||||
securityLogLevel?: 'info' | 'warn' | 'error';
|
||||
|
||||
/**
|
||||
* Whether to check IP reputation for inbound emails
|
||||
*/
|
||||
checkIPReputation?: boolean;
|
||||
|
||||
/**
|
||||
* Whether to scan content for malicious payloads
|
||||
*/
|
||||
scanContent?: boolean;
|
||||
|
||||
/**
|
||||
* Action to take when malicious content is detected
|
||||
*/
|
||||
maliciousContentAction?: 'tag' | 'quarantine' | 'reject';
|
||||
|
||||
/**
|
||||
* Minimum threat score to trigger action
|
||||
*/
|
||||
threatScoreThreshold?: number;
|
||||
};
|
||||
|
||||
/**
|
||||
* Delivery settings
|
||||
*/
|
||||
delivery?: {
|
||||
/**
|
||||
* Concurrency settings
|
||||
*/
|
||||
concurrency?: number;
|
||||
|
||||
/**
|
||||
* Rate limiting configuration
|
||||
*/
|
||||
rateLimit?: IRateLimitConfig;
|
||||
|
||||
/**
|
||||
* Retry configuration
|
||||
*/
|
||||
retries?: {
|
||||
/**
|
||||
* Maximum retry attempts
|
||||
*/
|
||||
max?: number;
|
||||
|
||||
/**
|
||||
* Base delay between retries in milliseconds
|
||||
*/
|
||||
delay?: number;
|
||||
|
||||
/**
|
||||
* Whether to use exponential backoff
|
||||
*/
|
||||
useBackoff?: boolean;
|
||||
};
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user