Unverified Commit 4af101e1 authored by wobblesprout's avatar wobblesprout
Browse files

Allow smtpd_listener to accept multiple items

parent 43ac54a8
......@@ -181,7 +181,7 @@ A Boolean to define whether to configure postfix as a satellite relay host. Thi
Default: False.
##### `smtp_listen`
A string to define the IP on which to listen in master.cf. This can also be set to 'all' to listen on all interfaces. If master_smtp is defined smtp_listen will not be used.
A string or array to define the IP or IPs on which to listen in master.cf. This can also be set to 'all' to listen on all interfaces. If master_smtp is defined smtp_listen will not be used.
Default: '127.0.0.1'.
Example: '::1'.
......
......@@ -143,7 +143,7 @@ class postfix (
Variant[Array[String], String] $root_mail_recipient = 'nobody', # root_mail_recipient
Optional[Boolean] $chroot = undef,
Boolean $satellite = false,
String $smtp_listen = '127.0.0.1', # postfix_smtp_listen
Variant[Array[String], String] $smtp_listen = '127.0.0.1', # postfix_smtp_listen
Boolean $use_amavisd = false, # postfix_use_amavisd
Boolean $use_dovecot_lda = false, # postfix_use_dovecot_lda
Variant[Integer[2, 3], Boolean] $use_schleuder = false, # postfix_use_schleuder
......
......@@ -405,8 +405,21 @@ describe 'postfix' do
context 'when specifying smtp_listen' do
let(:params) { { smtp_listen: 'all' } }
it 'does stuff' do
skip 'need to write this still'
it 'updates master.cf to listen to all addresses' do
is_expected.to contain_file(postfix_master_cf_path).with_content(
%r{smtp inet n - n - - smtpd}
)
end
end
context 'when specifying multiple smtp_listen addresses' do
let(:params) { { smtp_listen: ['192.168.0.123', '10.0.0.123'] } }
it 'updates master.cf with multiple smtp listeners' do
is_expected.to contain_file(postfix_master_cf_path).with_content(
%r{192.168.0.123:smtp inet n - n - - smtpd}
).with_content(
%r{10.0.0.123:smtp inet n - n - - smtpd}
)
end
end
context 'when use_amavisd is true' do
......
......@@ -15,7 +15,9 @@
<% elsif @smtp_listen == 'all' -%>
smtp inet n - <%= @jail %> - - smtpd
<% else -%>
<%= @smtp_listen %>:smtp inet n - <%= @jail %> - - smtpd
<%- [@smtp_listen].flatten.each do |listen_address| %>
<%= listen_address %>:smtp inet n - <%= @jail %> - - smtpd
<%- end -%>
<% end -%>
<% if @master_submission -%>
<%= @master_submission %>
......
......@@ -12,7 +12,9 @@
<% if @smtp_listen == 'all' -%>
smtp inet n - <%= @jail %> - - smtpd
<% else -%>
<%= @smtp_listen %>:smtp inet n - <%= @jail %> - - smtpd
<%- [@smtp_listen].flatten.each do |listen_address| %>
<%= listen_address %>:smtp inet n - <%= @jail %> - - smtpd
<%- end -%>
<% end -%>
#smtp inet n - n - - smtpd
#submission inet n - n - - smtpd
......
......@@ -12,7 +12,9 @@
<% if @smtp_listen == 'all' -%>
smtp inet n - <%= @jail %> - - smtpd
<% else -%>
<%= @smtp_listen %>:smtp inet n - <%= @jail %> - - smtpd
<%- [@smtp_listen].flatten.each do |listen_address| %>
<%= listen_address %>:smtp inet n - <%= @jail %> - - smtpd
<%- end -%>
<% end -%>
#smtp inet n - n - - smtpd
#submission inet n - n - - smtpd
......
......@@ -12,7 +12,9 @@
<% if @smtp_listen == 'all' -%>
smtp inet n - <%= @jail %> - - smtpd
<% else -%>
<%= @smtp_listen %>:smtp inet n - <%= @jail %> - - smtpd
<%- [@smtp_listen].flatten.each do |listen_address| %>
<%= listen_address %>:smtp inet n - <%= @jail %> - - smtpd
<%- end -%>
<% end -%>
#submission inet n - n - - smtpd
# -o smtpd_etrn_restrictions=reject
......
......@@ -14,7 +14,9 @@
<% elsif @smtp_listen == 'all' -%>
smtp inet n - n - - smtpd
<% else -%>
<%= @smtp_listen %>:smtp inet n - n - - smtpd
<%- [@smtp_listen].flatten.each do |listen_address| %>
<%= listen_address %>:smtp inet n - <%= @jail %> - - smtpd
<%- end -%>
<% end -%>
<% if @master_submission -%>
<%= @master_submission %>
......
......@@ -14,7 +14,9 @@
<% elsif @smtp_listen == 'all' -%>
smtp inet n - n - - smtpd
<% else -%>
<%= @smtp_listen %>:smtp inet n - n - - smtpd
<%- [@smtp_listen].flatten.each do |listen_address| %>
<%= listen_address %>:smtp inet n - <%= @jail %> - - smtpd
<%- end -%>
<% end -%>
<% if @master_submission -%>
<%= @master_submission %>
......
......@@ -12,7 +12,9 @@
<% elsif @smtp_listen == 'all' -%>
smtp inet n - <%= @jail %> - - smtpd
<% else -%>
<%= @smtp_listen %>:smtp inet n - <%= @jail %> - - smtpd
<%- [@smtp_listen].flatten.each do |listen_address| %>
<%= listen_address %>:smtp inet n - <%= @jail %> - - smtpd
<%- end -%>
<% end -%>
<% if @master_submission -%>
<%= @master_submission %>
......
......@@ -12,7 +12,9 @@
<% elsif @smtp_listen == 'all' -%>
smtp inet n - <%= @jail %> - - smtpd
<% else -%>
<%= @smtp_listen %>:smtp inet n - <%= @jail %> - - smtpd
<%- [@smtp_listen].flatten.each do |listen_address| -%>
<%= listen_address %>:smtp inet n - <%= @jail %> - - smtpd
<%- end -%>
<% end -%>
<% if @master_submission -%>
<%= @master_submission %>
......
......@@ -12,7 +12,9 @@
<% elsif @smtp_listen == 'all' -%>
smtp inet n - <%= @jail %> - - smtpd
<% else -%>
<%= @smtp_listen %>:smtp inet n - <%= @jail %> - - smtpd
<%- [@smtp_listen].flatten.each do |listen_address| %>
<%= listen_address %>:smtp inet n - <%= @jail %> - - smtpd
<%- end -%>
<% end -%>
<% if @master_submission -%>
<%= @master_submission %>
......
......@@ -15,7 +15,9 @@
<% elsif @smtp_listen == 'all' -%>
smtp inet n - <%= @jail %> - - smtpd
<% else -%>
<%= @smtp_listen %>:smtp inet n - <%= @jail %> - - smtpd
<%- [@smtp_listen].flatten.each do |listen_address| %>
<%= listen_address %>:smtp inet n - <%= @jail %> - - smtpd
<%- end -%>
<% end -%>
<% if @master_submission -%>
<%= @master_submission %>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment