1
0
مراية لـ https://github.com/postalserver/postal.git تم المزامنة 2025-12-01 05:43:04 +00:00

By default, we will now listen directly on various ports [breaking]

This allows us to avoid messing around with changes to iptables and generally makes installation easier for everyone.

If you have an instance of postal before this, you will need to do a couple of things to ensure your installation continues to work.

1. You will need to specify a `fast_server.bind_address` in your postal.yml configuration file. This is the IP that you dedicated to the fast server.
2. You will need to allow Ruby to listen on privileged ports (sudo setcap 'cap_net_bind_service=+ep' /usr/bin/ruby2.3).
3. You will need to remove any iptables rules that you may have added previously to accomodate the older way of doing this.
هذا الالتزام موجود في:
Adam Cooke
2017-05-05 11:42:28 +01:00
الأصل f9b6485f22
التزام d4fd6b9925
4 ملفات معدلة مع 14 إضافات و11 حذوفات

عرض الملف

@@ -22,8 +22,8 @@ web_server:
fast_server: fast_server:
enabled: false enabled: false
bind_address: 0.0.0.0 bind_address: 0.0.0.0
port: 5010 port: 80
ssl_port: 5011 ssl_port: 443
proxy_protocol: false proxy_protocol: false
default_private_key_path: # Defaults to config/fast_server.key default_private_key_path: # Defaults to config/fast_server.key
default_tls_certificate_path: # Defaults to config/fast_server.cert default_tls_certificate_path: # Defaults to config/fast_server.cert
@@ -58,14 +58,12 @@ workers:
quantity: 1 quantity: 1
smtp_server: smtp_server:
port: 25
tls_enabled: false tls_enabled: false
tls_certificate_path: # Defaults to config/smtp.crt tls_certificate_path: # Defaults to config/smtp.crt
tls_private_key_path: # Defaults to config/smtp.key tls_private_key_path: # Defaults to config/smtp.key
proxy_protocol: false proxy_protocol: false
log_connect: true log_connect: true
evented: true
ports:
- 2525
smtp_relays: smtp_relays:
- -
@@ -88,7 +86,7 @@ dns:
smtp: smtp:
host: 127.0.0.1 host: 127.0.0.1
port: 2525 port: 25
username: # Complete when Postal is running and you can username: # Complete when Postal is running and you can
password: # generate the credentials within the interface. password: # generate the credentials within the interface.
from_name: Postal from_name: Postal

عرض الملف

@@ -8,6 +8,7 @@ fast_server:
# This can be enabled to enable click & open tracking on emails. It is disabled by # This can be enabled to enable click & open tracking on emails. It is disabled by
# default as it requires a separate static IP address on your server. # default as it requires a separate static IP address on your server.
enabled: false enabled: false
bind_address:
general: general:
# This can be changed to allow messages to be sent from multiple IP addresses # This can be changed to allow messages to be sent from multiple IP addresses

عرض الملف

@@ -6,14 +6,19 @@ module Postal
class Server class Server
def run def run
if Postal.config.fast_server.bind_address.blank?
Postal.logger_for(:fast_server).info "Cannot start fast server because no bind address has been specified"
exit 1
end
Thread.abort_on_exception = true Thread.abort_on_exception = true
TrackCertificate TrackCertificate
server_sockets = { server_sockets = {
TCPServer.new(Postal.config.fast_server.bind_address, Postal.config.fast_server.ssl_port) => {:ssl => true}, TCPServer.new(Postal.config.fast_server.bind_address, Postal.config.fast_server.ssl_port) => {:ssl => true},
TCPServer.new(Postal.config.fast_server.bind_address, Postal.config.fast_server.port) => {:ssl => false}, TCPServer.new(Postal.config.fast_server.bind_address, Postal.config.fast_server.port) => {:ssl => false},
} }
Postal.logger_for(:fast_server).info("Fast server started listening on HTTP port #{Postal.config.fast_server.port}") Postal.logger_for(:fast_server).info("Fast server started listening on HTTP (#{Postal.config.fast_server.bind_address}:#{Postal.config.fast_server.port})")
Postal.logger_for(:fast_server).info("Fast server started listening on HTTPS port #{Postal.config.fast_server.ssl_port}") Postal.logger_for(:fast_server).info("Fast server started listening on HTTPS port (#{Postal.config.fast_server.bind_address}:#{Postal.config.fast_server.ssl_port})")
loop do loop do
client = nil client = nil
ios = select(server_sockets.keys, nil, nil, 1) ios = select(server_sockets.keys, nil, nil, 1)

عرض الملف

@@ -7,7 +7,6 @@ module Postal
def initialize(options = {}) def initialize(options = {})
@options = options @options = options
@options[:ports] ||= Postal.config.smtp_server.ports
@options[:debug] ||= false @options[:debug] ||= false
prepare_environment prepare_environment
end end
@@ -49,7 +48,7 @@ module Postal
if ENV['SERVER_FD'] if ENV['SERVER_FD']
@server = TCPServer.for_fd(ENV['SERVER_FD'].to_i) @server = TCPServer.for_fd(ENV['SERVER_FD'].to_i)
else else
@server = TCPServer.open('::', @options[:ports].first) @server = TCPServer.open('::', Postal.config.smtp_server.port)
end end
@server.autoclose = false @server.autoclose = false
@server.close_on_exec = false @server.close_on_exec = false
@@ -62,7 +61,7 @@ module Postal
@server.setsockopt(Socket::SOL_TCP, Socket::TCP_KEEPCNT, 5) @server.setsockopt(Socket::SOL_TCP, Socket::TCP_KEEPCNT, 5)
end end
ENV['SERVER_FD'] = @server.to_i.to_s ENV['SERVER_FD'] = @server.to_i.to_s
logger.info "Listening" logger.info "Listening on port #{Postal.config.smtp_server.port}"
end end
def unlisten def unlisten