959223c044
ci / changes (push) Successful in 3s
ci / tc_portal (push) Has been skipped
ci / tc_booking (push) Has been skipped
ci / tc_website (push) Has been skipped
ci / tc_operator (push) Has been skipped
ci / tc_platform_api (push) Has been skipped
ci / test_platform_api (push) Has been skipped
ci / build_portal (push) Has been skipped
ci / build_booking (push) Has been skipped
ci / build_operator (push) Has been skipped
ci / build_platform_api (push) Has been skipped
ci / build_zpush (push) Successful in 7s
ci / deploy (push) Successful in 26s
The replacement imap.config.php omitted constants the backend references unconditionally — SYSTEM_MIME_TYPES_MAPPING 500'd every authenticated request (backend construction, before login, so the unauthenticated 401 smoke tests never hit it). Define all remaining upstream constants with their defaults so the replacement file can never be narrower than the template it replaces.
77 lines
3.7 KiB
PHP
77 lines
3.7 KiB
PHP
<?php
|
|
// dezky replacement for Z-Push's backend/imap/config.php (applied at image
|
|
// build, see Dockerfile). Talks to Stalwart over the internal network —
|
|
// plaintext IMAP/submission on the container network is fine, TLS
|
|
// terminates at Traefik for the public endpoints.
|
|
|
|
define('IMAP_SERVER', getenv('IMAP_SERVER') ?: 'stalwart');
|
|
define('IMAP_PORT', (int) (getenv('IMAP_PORT') ?: 143));
|
|
// Dev talks plain IMAP on the docker network; prod host-Stalwart only
|
|
// exposes IMAPS :993, so zpush.yaml sets '/ssl/novalidate-cert' (the cert
|
|
// is for mail.dezky.eu, we connect via the cluster service name).
|
|
define('IMAP_OPTIONS', getenv('IMAP_OPTIONS') ?: '/notls/norsh');
|
|
define('IMAP_AUTOSEEN_ON_DELETE', false);
|
|
|
|
// Stalwart's auto-created special-use folders. Configured explicitly so
|
|
// Z-Push doesn't guess from localized names.
|
|
define('IMAP_FOLDER_CONFIGURED', true);
|
|
define('IMAP_FOLDER_PREFIX', '');
|
|
define('IMAP_FOLDER_PREFIX_IN_INBOX', false);
|
|
define('IMAP_FOLDER_INBOX', 'INBOX');
|
|
define('IMAP_FOLDER_SENT', 'Sent Items');
|
|
define('IMAP_FOLDER_DRAFT', 'Drafts');
|
|
define('IMAP_FOLDER_TRASH', 'Deleted Items');
|
|
define('IMAP_FOLDER_SPAM', 'Junk Mail');
|
|
define('IMAP_FOLDER_ARCHIVE', 'Archive');
|
|
|
|
define('IMAP_INLINE_FORWARD', true);
|
|
define('IMAP_EXCLUDED_FOLDERS', '');
|
|
// From-address comes from the authenticated login (full email).
|
|
define('IMAP_DEFAULTFROM', '');
|
|
|
|
// Outgoing mail: authenticated submission to Stalwart as the device's own
|
|
// user — the same Basic credentials the EAS client supplied. Prod uses
|
|
// implicit TLS (SMTP_SERVER gets an ssl:// prefix, port 465 — host-Stalwart
|
|
// has no plain :587); the verify flags are off because this is node-internal
|
|
// traffic against a cert issued for the public hostname.
|
|
define('IMAP_SMTP_METHOD', 'smtp');
|
|
global $imap_smtp_params;
|
|
$imap_smtp_params = array(
|
|
'host' => getenv('SMTP_SERVER') ?: (getenv('IMAP_SERVER') ?: 'stalwart'),
|
|
'port' => (int) (getenv('SMTP_PORT') ?: 587),
|
|
'auth' => true,
|
|
'username' => 'imap_username',
|
|
'password' => 'imap_password',
|
|
'verify_peer' => false,
|
|
'verify_peer_name' => false,
|
|
'allow_self_signed' => true,
|
|
);
|
|
|
|
// ── Upstream defaults below — DO NOT prune. ─────────────────────────────
|
|
// This file REPLACES the upstream template, and the backend references
|
|
// several of these unconditionally (a missing SYSTEM_MIME_TYPES_MAPPING
|
|
// 500'd every authenticated request on first deploy). Unused features
|
|
// (SQL/LDAP From lookup) still need their constants defined.
|
|
define('MAIL_MIMEPART_CRLF', "\r\n");
|
|
define('SYSTEM_MIME_TYPES_MAPPING', '/etc/mime.types');
|
|
define('IMAP_MEETING_USE_CALDAV', false);
|
|
define('IMAP_SEARCH_CHARSET', 'UTF-8');
|
|
define('IMAP_FROM_SQL_DSN', '');
|
|
define('IMAP_FROM_SQL_USER', '');
|
|
define('IMAP_FROM_SQL_PASSWORD', '');
|
|
define('IMAP_FROM_SQL_OPTIONS', serialize(array(PDO::ATTR_PERSISTENT => true)));
|
|
define('IMAP_FROM_SQL_QUERY', "select first_name, last_name, mail_address from users where mail_address = '#username@#domain'");
|
|
define('IMAP_FROM_SQL_FIELDS', serialize(array('first_name', 'last_name', 'mail_address')));
|
|
define('IMAP_FROM_SQL_EMAIL', '#mail_address');
|
|
define('IMAP_FROM_SQL_FROM', '#first_name #last_name <#mail_address>');
|
|
define('IMAP_FROM_SQL_FULLNAME', '#first_name #last_name');
|
|
define('IMAP_FROM_LDAP_SERVER_URI', 'ldap://127.0.0.1:389/');
|
|
define('IMAP_FROM_LDAP_USER', '');
|
|
define('IMAP_FROM_LDAP_PASSWORD', '');
|
|
define('IMAP_FROM_LDAP_BASE', '');
|
|
define('IMAP_FROM_LDAP_QUERY', '(mail=#username@#domain)');
|
|
define('IMAP_FROM_LDAP_FIELDS', serialize(array('givenname', 'sn', 'mail')));
|
|
define('IMAP_FROM_LDAP_EMAIL', '#mail');
|
|
define('IMAP_FROM_LDAP_FROM', '#givenname #sn <#mail>');
|
|
define('IMAP_FROM_LDAP_FULLNAME', '#givenname #sn');
|