Unverified Commit bbfcbbba authored by wobblesprout's avatar wobblesprout
Browse files

Allow multiple smtp_listen IPs as a string

parent 4af101e1
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -181,7 +181,7 @@ A Boolean to define whether to configure postfix as a satellite relay host. Thi
Default: False.

##### `smtp_listen`
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.
A string or an array of strings to define the 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'.

+12 −1
Original line number Diff line number Diff line
@@ -411,7 +411,18 @@ describe 'postfix' do
              )
            end
          end
          context 'when specifying multiple smtp_listen addresses' do
          context 'when specifying multiple smtp_listen addresses as string' 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 specifying multiple smtp_listen addresses as array' do
            let(:params) { { smtp_listen: ['192.168.0.123', '10.0.0.123'] } }

            it 'updates master.cf with multiple smtp listeners' do
+1 −1
Original line number Diff line number Diff line
@@ -15,7 +15,7 @@
<% elsif @smtp_listen == 'all' -%>
smtp      inet  n       -       <%= @jail %>       -       -       smtpd
<% else -%>
  <%- [@smtp_listen].flatten.each do |listen_address| %>
  <%- (@smtp_listen.is_a?(Array) ? @smtp_listen : @smtp_listen.split(' ')).each do |listen_address| -%>
<%= listen_address %>:smtp      inet  n       -       <%= @jail %>       -       -       smtpd
  <%- end -%>
<% end -%>
+1 −1
Original line number Diff line number Diff line
@@ -12,7 +12,7 @@
<% if @smtp_listen == 'all' -%>
smtp      inet  n       -       <%= @jail %>       -       -       smtpd
<% else -%>
  <%- [@smtp_listen].flatten.each do |listen_address| %>
  <%- (@smtp_listen.is_a?(Array) ? @smtp_listen : @smtp_listen.split(' ')).each do |listen_address| -%>
<%= listen_address %>:smtp      inet  n       -       <%= @jail %>       -       -       smtpd
  <%- end -%>
<% end -%>
+1 −1
Original line number Diff line number Diff line
@@ -12,7 +12,7 @@
<% if @smtp_listen == 'all' -%>
smtp      inet  n       -       <%= @jail %>       -       -       smtpd
<% else -%>
  <%- [@smtp_listen].flatten.each do |listen_address| %>
  <%- (@smtp_listen.is_a?(Array) ? @smtp_listen : @smtp_listen.split(' ')).each do |listen_address| -%>
<%= listen_address %>:smtp      inet  n       -       <%= @jail %>       -       -       smtpd
  <%- end -%>
<% end -%>
Loading