Skip to content

Commit 778eaa1

Browse files
authored
Merge pull request #1632 from Cicco0/add-missing-mailhost-ssl
Add ssl parameter to IPv6 listen directive
2 parents dfdcdf3 + 3f44898 commit 778eaa1

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

spec/defines/resource_mailhost_spec.rb

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -559,7 +559,7 @@
559559
title: 'should enable IPv6',
560560
attr: 'ipv6_enable',
561561
value: true,
562-
match: ' listen [::]:587 default ipv6only=on;'
562+
match: ' listen [::]:587 ssl default ipv6only=on;'
563563
},
564564
{
565565
title: 'should not enable IPv6',
@@ -571,19 +571,19 @@
571571
title: 'should set the IPv6 listen IP',
572572
attr: 'ipv6_listen_ip',
573573
value: '2001:0db8:85a3:0000:0000:8a2e:0370:7334',
574-
match: ' listen [2001:0db8:85a3:0000:0000:8a2e:0370:7334]:587 default ipv6only=on;'
574+
match: ' listen [2001:0db8:85a3:0000:0000:8a2e:0370:7334]:587 ssl default ipv6only=on;'
575575
},
576576
{
577577
title: 'should set the IPv6 ssl port',
578578
attr: 'ssl_port',
579579
value: 45,
580-
match: ' listen [::]:45 default ipv6only=on;'
580+
match: ' listen [::]:45 ssl default ipv6only=on;'
581581
},
582582
{
583583
title: 'should set the IPv6 listen options',
584584
attr: 'ipv6_listen_options',
585585
value: 'spdy',
586-
match: ' listen [::]:587 spdy;'
586+
match: ' listen [::]:587 ssl spdy;'
587587
},
588588
{
589589
title: 'should set servername(s)',
@@ -695,6 +695,11 @@
695695
content = catalogue.resource('concat::fragment', "#{title}-ssl").send(:parameters)[:content]
696696
expect(content).to include('listen *:587 ssl;')
697697
end
698+
699+
it 'contains `ssl` in the listen directive for ipv6' do
700+
content = catalogue.resource('concat::fragment', "#{title}-ssl").send(:parameters)[:content]
701+
expect(content).to include('listen [::]:587 ssl default ipv6only=on;')
702+
end
698703
end
699704

700705
context 'when version comes from parameter' do
@@ -704,6 +709,11 @@
704709
content = catalogue.resource('concat::fragment', "#{title}-ssl").send(:parameters)[:content]
705710
expect(content).to include('listen *:587 ssl;')
706711
end
712+
713+
it 'contains `ssl` in the listen directive for ipv6' do
714+
content = catalogue.resource('concat::fragment', "#{title}-ssl").send(:parameters)[:content]
715+
expect(content).to include('listen [::]:587 ssl default ipv6only=on;')
716+
end
707717
end
708718

709719
context 'mail proxy parameters' do

templates/mailhost/mailhost_ssl.epp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ server {
1717
listen <%= $ip %>:<%= $ssl_port %> ssl;
1818
<%- } -%>
1919
<%- $ipv6_listen_ip.each |$ipv6| { -%>
20-
listen [<%= $ipv6 %>]:<%= $ssl_port %> <% if $ipv6_listen_options { %><%= $ipv6_listen_options %><% } %>;
20+
listen [<%= $ipv6 %>]:<%= $ssl_port %><% if versioncmp($nginx_version, '1.15.0') >= 0 { %> ssl<% } %> <% if $ipv6_listen_options { %><%= $ipv6_listen_options %><% } %>;
2121
<%- } -%>
2222
<%= $mailhost_common -%>
2323

0 commit comments

Comments
 (0)