在 Phabricator 配置郵件程序

在 Phabricator 配置郵件程序

使用 bitnami 映像進行全新安裝後,我按照指示設定郵件程序。

它看起來像這樣:

[
  {
    "key": "stmp-mailer",
    "type": "smtp",
    "options": {
      "host": "server",
      "user": "user" ,
      "port": 587,
      "password": "passwd",
      "protocol": "tls"
    }
  }
]

此後,如果我嘗試從測試應用程式發送郵件,我會收到以下訊息:

EXCEPTION: (RuntimeException) stream_socket_enable_crypto(): SSL operation failed with code 1. OpenSSL Error messages:
error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed at [<arcanist>/src/error/PhutilErrorHandler.php:263]
arcanist(head=stable, ref.stable=ac54d61d7af2), phabricator(head=stable, ref.stable=86ad69863930)

經過一番搜索後,我發現我可以告訴 Arcanist繞過證書。然而,我無法使用奧術師運行幾乎任何東西。一個樣品:

$  arc set-config https.blindly-trust-domains '["example.com"]'
[2020-12-14 18:48:55] EXCEPTION: (TypeError) Argument 1 passed to ArcanistBlindlyTrustHTTPEngineExtension::setDomains() must be of the type array, string given, called in /opt/bitnami/arcanist/scripts/arcanist.php on line 304 at [<arcanist>/src/configuration/ArcanistBlindlyTrustHTTPEngineExtension.php:10]
arcanist(head=stable, ref.stable=ac54d61d7af2)
  #0 ArcanistBlindlyTrustHTTPEngineExtension::setDomains(string) called at [<arcanist>/scripts/arcanist.php:304]

但如果我執行 get-config 也會發生同樣的情況

這種崩潰是正常現象還是任何配置錯誤?

奧術師版本:奧術師 ac54d61d7af20f5d65ba889974f23a86bfb6cd57(2020 年 10 月 19 日)

- 更新 -

運行以下命令:

openssl s_client -starttls smtp -connect MAIL_SERVER:587

產生幾個錯誤,隨後出現證書

erify error:num=20:unable to get local issuer certificate
verify return:1
depth=0 CN = XXX
verify error:num=21:unable to verify the first certificate

然後我嘗試將證書提取到 .pem 文件,然後使用 update-ca-certificates 添加它,這似乎有效。但我看不出有什麼差別。

答案1

嘗試測試各個組件。您可以直接使用 openssl 來排除 arcanist 是問題的根源:

openssl s_client -starttls smtp -connect example.com:587 -servername example.com

驗證目標 TLS 憑證是否已正確設定並從本機電腦進行驗證,然後檢查您的伺服器是否也可以驗證它。每個步驟的失敗都指向不同的問題。目標 SMTP 伺服器可能具有過期或無效的證書,或者您的伺服器可能缺少允許您驗證 SMTP 伺服器正在使用的根證書。

如果一切正常,您將在輸出中尋找以下內容:

Verify return code: 0 (ok)

如果兩個測試都顯示正常,那麼您可能必須開始向 arcanist 添加偵錯程式碼,看看它是否可能導致問題。

相關內容