مراية لـ
https://github.com/postalserver/postal.git
تم المزامنة 2026-03-04 23:04:08 +00:00
Compare commits
4 الالتزامات
| المؤلف | SHA1 | التاريخ | |
|---|---|---|---|
|
|
83fef0e8a0 | ||
|
|
0dc6824a8f | ||
|
|
6bace2c905 | ||
|
|
9f0697f194 |
10
CHANGELOG.md
10
CHANGELOG.md
@@ -2,6 +2,16 @@
|
|||||||
|
|
||||||
This file contains all the latest changes and updates to Postal.
|
This file contains all the latest changes and updates to Postal.
|
||||||
|
|
||||||
|
## 2.1.2
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
- support for AMQPS for rabbitmq connections ([9f0697](https://github.com/postalserver/postal/commit/9f0697f194209f5fae5e451ba8fb888413fe37fa))
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
- retry connections without SSL when SSL issue is encountered during smtp sending ([0dc682](https://github.com/postalserver/postal/commit/0dc6824a8f0315ea42b08f7e6812b821b62489c9))
|
||||||
|
|
||||||
## 2.1.1
|
## 2.1.1
|
||||||
|
|
||||||
### Features
|
### Features
|
||||||
|
|||||||
@@ -50,6 +50,10 @@ message_db:
|
|||||||
rabbitmq:
|
rabbitmq:
|
||||||
host: 127.0.0.1
|
host: 127.0.0.1
|
||||||
port: 5672
|
port: 5672
|
||||||
|
tls: false
|
||||||
|
verify_peer: true
|
||||||
|
tls_ca_certificates:
|
||||||
|
- /etc/ssl/certs/ca-certificates.crt
|
||||||
username: postal
|
username: postal
|
||||||
password:
|
password:
|
||||||
vhost: /postal
|
vhost: /postal
|
||||||
|
|||||||
@@ -16,6 +16,9 @@ module Postal
|
|||||||
conn = Bunny.new(
|
conn = Bunny.new(
|
||||||
:hosts => bunny_host,
|
:hosts => bunny_host,
|
||||||
:port => Postal.config.rabbitmq&.port || 5672,
|
:port => Postal.config.rabbitmq&.port || 5672,
|
||||||
|
:tls => Postal.config.rabbitmq&.tls || false,
|
||||||
|
:verify_peer => Postal.config.rabbitmq&.verify_peer || true,
|
||||||
|
:tls_ca_certificates => Postal.config.rabbitmq&.tls_ca_certificates || [ "/etc/ssl/certs/ca-certificates.crt" ],
|
||||||
:username => Postal.config.rabbitmq&.username || 'guest',
|
:username => Postal.config.rabbitmq&.username || 'guest',
|
||||||
:password => Postal.config.rabbitmq&.password || 'guest',
|
:password => Postal.config.rabbitmq&.password || 'guest',
|
||||||
:vhost => Postal.config.rabbitmq&.vhost || nil
|
:vhost => Postal.config.rabbitmq&.vhost || nil
|
||||||
|
|||||||
@@ -46,13 +46,16 @@ module Postal
|
|||||||
end
|
end
|
||||||
next
|
next
|
||||||
end
|
end
|
||||||
|
|
||||||
smtp_client = Net::SMTP.new(hostname, port)
|
smtp_client = Net::SMTP.new(hostname, port)
|
||||||
smtp_client.open_timeout = Postal.config.smtp_client.open_timeout
|
smtp_client.open_timeout = Postal.config.smtp_client.open_timeout
|
||||||
smtp_client.read_timeout = Postal.config.smtp_client.read_timeout
|
smtp_client.read_timeout = Postal.config.smtp_client.read_timeout
|
||||||
|
|
||||||
if @source_ip_address
|
if @source_ip_address
|
||||||
# Set the source IP as appropriate
|
# Set the source IP as appropriate
|
||||||
smtp_client.source_address = ip_type == :aaaa ? @source_ip_address.ipv6 : @source_ip_address.ipv4
|
smtp_client.source_address = ip_type == :aaaa ? @source_ip_address.ipv6 : @source_ip_address.ipv4
|
||||||
end
|
end
|
||||||
|
|
||||||
case ssl_mode
|
case ssl_mode
|
||||||
when 'Auto'
|
when 'Auto'
|
||||||
smtp_client.enable_starttls_auto(self.class.ssl_context_without_verify)
|
smtp_client.enable_starttls_auto(self.class.ssl_context_without_verify)
|
||||||
@@ -63,9 +66,17 @@ module Postal
|
|||||||
else
|
else
|
||||||
# Nothing
|
# Nothing
|
||||||
end
|
end
|
||||||
|
|
||||||
smtp_client.start(@source_ip_address ? @source_ip_address.hostname : self.class.default_helo_hostname)
|
smtp_client.start(@source_ip_address ? @source_ip_address.hostname : self.class.default_helo_hostname)
|
||||||
log "Connected to #{@remote_ip}:#{port} (#{hostname})"
|
log "Connected to #{@remote_ip}:#{port} (#{hostname})"
|
||||||
|
|
||||||
rescue => e
|
rescue => e
|
||||||
|
if e.is_a?(OpenSSL::SSL::SSLError) && ssl_mode == 'Auto'
|
||||||
|
log "SSL error (#{e.message}), retrying without SSL"
|
||||||
|
ssl_mode = nil
|
||||||
|
retry
|
||||||
|
end
|
||||||
|
|
||||||
log "Cannot connect to #{@remote_ip}:#{port} (#{hostname}) (#{e.class}: #{e.message})"
|
log "Cannot connect to #{@remote_ip}:#{port} (#{hostname}) (#{e.class}: #{e.message})"
|
||||||
@connection_errors << e.message unless @connection_errors.include?(e.message)
|
@connection_errors << e.message unless @connection_errors.include?(e.message)
|
||||||
smtp_client.disconnect rescue nil
|
smtp_client.disconnect rescue nil
|
||||||
|
|||||||
@@ -105,7 +105,10 @@ module Postal
|
|||||||
private
|
private
|
||||||
|
|
||||||
def resolve_hostname
|
def resolve_hostname
|
||||||
@hostname = Resolv.new.getname(@ip_address) rescue @ip_address
|
Resolv::DNS.open do |dns|
|
||||||
|
dns.timeouts = [10,5]
|
||||||
|
@hostname = dns.getname(@ip_address) rescue @ip_address
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def proxy(data)
|
def proxy(data)
|
||||||
|
|||||||
المرجع في مشكلة جديدة
حظر مستخدم