ejabberd STARTTLS 在連接埠 5222 上設置

ejabberd STARTTLS 在連接埠 5222 上設置

ejabberd/ecs我剛剛在 ubuntu 20.04 aws 實例上安裝並設定了 docker映像。

我有端口、域名和用戶設定和工作。

在主機(ubuntu)上,我使用 certbot 產生了 Let's Encrypt 證書,並將它們複製到 docker 容器上:

certfiles:               
  - /home/ejabberd/conf/fullchain.pem
  - /home/ejabberd/conf/privkey.pem  

ca_file: "/home/ejabberd/conf/fullchain.pem"

我想要求我的用戶僅使用安全連線。

我在文件中讀到我最好使用 STARTTLS 而不是 TLS。

問題是 ejabberd 似乎僅在設定 TLS 時才使用我的憑證。

當我這樣設定配置時:

listen:
  -
    port: 5222
    ip: "::"
    module: ejabberd_c2s
    max_stanza_size: 262144
    shaper: c2s_shaper
    access: c2s
    tls: true
...
  -                                                                      
    port: 5280                                                           
    ip: "::"                                                             
    module: ejabberd_http                                                
    tls: true                                             
    request_handlers:                                     
      "/admin": ejabberd_web_admin 

並重新加載配置bin/ejabbedctl reload_config,然後我可以https://example.com:5280/admin/使用 ssl 存取。

當我使用另一台機器測試憑證時openssl,它似乎有效,因為我得到以下資訊:

openssl s_client -connect example.com:5222
CONNECTED(00000005)
depth=2 O = Digital Signature Trust Co., CN = DST Root CA X3
verify return:1
depth=1 C = US, O = Let's Encrypt, CN = Let's Encrypt Authority X3
verify return:1
depth=0 CN = example.com
verify return:1
---
Certificate chain
 0 s:CN = example.com
   i:C = US, O = Let's Encrypt, CN = Let's Encrypt Authority X3
 1 s:C = US, O = Let's Encrypt, CN = Let's Encrypt Authority X3
   i:O = Digital Signature Trust Co., CN = DST Root CA X3
---
Server certificate
-----BEGIN CERTIFICATE-----
...

但是當我使用時,根據我的理解,我應該這樣做, starttls並且starttls_required

listen:
  -
    port: 5222
    ip: "::"
    module: ejabberd_c2s
    max_stanza_size: 262144
    shaper: c2s_shaper
    access: c2s
    starttls: true
    starttls_required: true

然後 ejabberd 似乎沒有在連接埠上使用安全連線5222

openssl s_client -connect example.com:5222
CONNECTED(00000005)
140324192997824:error:1408F10B:SSL routines:ssl3_get_record:wrong version number:../ssl/record/ssl3_record.c:332:
---
no peer certificate available
---
No client certificate CA names sent
---
SSL handshake has read 5 bytes and written 315 bytes
Verification: OK
---
New, (NONE), Cipher is (NONE)
Secure Renegotiation IS NOT supported
Compression: NONE
Expansion: NONE
No ALPN negotiated
Early data was not sent
Verify return code: 0 (ok)
---

知道我能做些什麼來解決這個問題嗎?

答案1

為了使連線安全,需要tls: true在監聽器中指定。例如,在下面的配置中,兩個連接埠5222具有5223相同的設置,但5223也包括tls: true.因此,您的openssl測試將檢測連接埠上的安全連接5223,但不會偵測到連接埠上的安全連接5222

  -
    port: 5222
    ip: "::"
    module: ejabberd_c2s
    max_stanza_size: 262144
    shaper: c2s_shaper
    access: c2s
    starttls_required: true
  -
    port: 5223
    ip: "::"
    tls: true
    module: ejabberd_c2s
    max_stanza_size: 262144
    shaper: c2s_shaper
    access: c2s
    starttls_required: true

順便說一句,如果仍然遇到問題,請嘗試更改ca_fileca_file: "/home/ejabberd/conf/cacert.pem"假設cacert.pem是由 ejabberd 安裝程式建立的文件,而不是您的 LE。

相關內容