mirror of
https://github.com/dreamhunter2333/cloudflare_temp_email.git
synced 2026-05-07 04:52:50 +08:00
* feat: add STARTTLS support for SMTP proxy server Add smtp_tls_cert and smtp_tls_key environment variables to enable STARTTLS on the SMTP proxy server, matching existing IMAP TLS support. Closes #249 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * test: add E2E tests for SMTP/IMAP STARTTLS - Add smtp-proxy-tls service with self-signed certs in docker-compose - Add smtp-tls.spec.ts: SMTP STARTTLS send plain/HTML/auth tests - Add imap-tls.spec.ts: IMAP STARTTLS login/list/select/fetch tests - Register smtp-proxy project in playwright.config.ts - Wait for TLS proxy readiness in docker-entrypoint.sh Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: enforce auth over TLS when STARTTLS is configured - Set auth_require_tls conditionally based on tls_context presence - Disable insecure SSLv2/SSLv3 protocols in TLS context Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: replace cert-gen service with inline cert generation The cert-gen one-shot container was exiting immediately after generating certificates, triggering --abort-on-container-exit and stopping all services before tests could run. Replace with an entrypoint script in smtp-proxy-tls that generates the self-signed cert before starting the proxy server. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
43 lines
1.0 KiB
Python
43 lines
1.0 KiB
Python
import logging
|
|
from pydantic import field_validator
|
|
from pydantic_settings import BaseSettings, SettingsConfigDict
|
|
|
|
logging.basicConfig(
|
|
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
|
|
)
|
|
|
|
_logger = logging.getLogger(__name__)
|
|
_logger.setLevel(logging.INFO)
|
|
|
|
|
|
class Settings(BaseSettings):
|
|
proxy_url: str = "http://localhost:8787"
|
|
port: int = 8025
|
|
imap_port: int = 11143
|
|
basic_password: str = ""
|
|
smtp_tls_cert: str = ""
|
|
smtp_tls_key: str = ""
|
|
imap_tls_cert: str = ""
|
|
imap_tls_key: str = ""
|
|
imap_cache_size: int = 500
|
|
imap_http_timeout: float = 30.0
|
|
|
|
model_config = SettingsConfigDict(env_file=".env")
|
|
|
|
@field_validator("imap_cache_size")
|
|
@classmethod
|
|
def cache_size_positive(cls, v):
|
|
if v <= 0:
|
|
raise ValueError("imap_cache_size must be > 0")
|
|
return v
|
|
|
|
@field_validator("imap_http_timeout")
|
|
@classmethod
|
|
def timeout_positive(cls, v):
|
|
if v <= 0:
|
|
raise ValueError("imap_http_timeout must be > 0")
|
|
return v
|
|
|
|
|
|
settings = Settings()
|