Graylog 設定 SMTP 服務
Graylog
的 SMTP
在網頁上是無法設定的,所以只能在 graylog
設定檔裡面做設定
設定方式
- 在
vim /etc/graylog/server/server.conf
設定檔裡面新增
# Email transport
#transport_email_enabled = false
#transport_email_hostname = mail.example.com
#transport_email_port = 587
#transport_email_use_auth = true
#transport_email_auth_username = [email protected]
#transport_email_auth_password = secret
#transport_email_subject_prefix = [graylog]
#transport_email_from_email = [email protected]
將上面的註解移掉
Email transport
transport_email_enabled = false
transport_email_hostname = mail.example.com
transport_email_port = 587
transport_email_use_auth = true
transport_email_auth_username = [email protected]
transport_email_auth_password = secret
transport_email_subject_prefix = [graylog]
transport_email_from_email = [email protected]
# Encryption settings
#
# ATTENTION:
# Using SMTP with STARTTLS *and* SMTPS at the same time is *not* possible.
# Use SMTP with STARTTLS, see https://en.wikipedia.org/wiki/Opportunistic_TLS
#transport_email_use_tls = true
transport_email_use_tls = true
在 3.0 之後這個設定方式是不能啟用的,不然 graylog 會有問題,所以只註解 graylog 目前只支援 STARTTLS 認證
# Use SMTP over SSL (SMTPS), see https://en.wikipedia.org/wiki/SMTPS
# This is deprecated on most SMTP services!
#transport_email_use_ssl = true
# Specify and uncomment this if you want to include links to the stream in your stream alert mails.
# This should define the fully qualified base url to your web interface exactly the same way as it is accessed by your users.
#transport_email_web_interface_url = https://graylog.example.com
transport_email_web_interface_url = http://192.168.1.43:9000
在郵件裡面附上網址
補充說明
- 檢查 mail 憑證問題
問題內容
The Graylog server encountered an error while trying to send an email. This is the detailed error message: org.apache.commons.mail.EmailException: Sending the email to the following server failed : mail.aaa.com:587 (javax.mail.MessagingException: Could not convert socket to TLS; nested exception is: javax.net.ssl.SSLHandshakeException: Remote host terminated the handshake)
可以先用以下指令查看看是什麼原因造成的
openssl s_client -starttls smtp -showcerts -connect mail主機:587 -servername mail主機