跳到主內容

Graylog 設定 SMTP 服務

GraylogSMTP 在網頁上是無法設定的,所以只能在 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]
#transport_email_socket_connection_timeout = 10s
#transport_email_socket_timeout = 10s
將上面的註解移掉

# Email transport
# 啟用郵件服務
transport_email_enabled = true
# 設定 smtp 連線位置
transport_email_hostname = mail 伺服器連線位置
# 設定 port 
transport_email_port = 587
# 啟用使用者登入機制
transport_email_use_auth = true
# smtp 登入帳號
transport_email_auth_username = [email protected]
# smtp 登入密碼
transport_email_auth_password = secret
# mail 主旨
transport_email_subject_prefix = [graylog]
# mail 發送信箱
transport_email_from_email = [email protected]
transport_email_socket_connection_timeout = 10s
transport_email_socket_timeout = 10s

# 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

# Use SMTP over SSL (SMTPS), see https://en.wikipedia.org/wiki/SMTPS
# This is deprecated on most SMTP services!
#transport_email_use_ssl = false

# 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主機



參考相關網站