Skip to content

Commit

Permalink
Merge pull request #249 from fadenb/bug/duplicate_listen_option_ipv6only
Browse files Browse the repository at this point in the history
Bugfix for duplicate listen option caused by hardcoded `ipv6only=on` in template
  • Loading branch information
James Fryman committed Feb 4, 2014
2 parents e423db2 + 4fb4129 commit de42889
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions manifests/resource/mailhost.pp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
$ipv6_enable = false,
$ipv6_listen_ip = '::',
$ipv6_listen_port = '80',
$ipv6_listen_options = 'default',
$ipv6_listen_options = 'default ipv6only=on',
$ssl = false,
$ssl_cert = undef,
$ssl_key = undef,
Expand All @@ -64,7 +64,7 @@
group => 'root',
mode => '0644',
}

if !is_integer($listen_port) {
fail('$listen_port must be an integer.')
}
Expand Down
4 changes: 2 additions & 2 deletions manifests/resource/vhost.pp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
# for SSL Support. This is not generated by this module.
# [*ssl_dhparam*] - This directive specifies a file containing
# Diffie-Hellman key agreement protocol cryptographic parameters, in PEM
# format, utilized for exchanging session keys between server and client.
# format, utilized for exchanging session keys between server and client.
# [*ssl_key*] - Pre-generated SSL Key file to reference for SSL
# Support. This is not generated by this module.
# [*ssl_port*] - Default IP Port for NGINX to listen with this SSL
Expand Down Expand Up @@ -124,7 +124,7 @@
$ipv6_enable = false,
$ipv6_listen_ip = '::',
$ipv6_listen_port = '80',
$ipv6_listen_options = 'default',
$ipv6_listen_options = 'default ipv6only=on',
$add_header = undef,
$ssl = false,
$ssl_cert = undef,
Expand Down
4 changes: 2 additions & 2 deletions spec/defines/resource_mailhost_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
:title => 'should set the IPv6 listen options',
:attr => 'ipv6_listen_options',
:value => 'spdy',
:match => ' listen [::]:80 spdy ipv6only=on;',
:match => ' listen [::]:80 spdy;',
},
{
:title => 'should set servername(s)',
Expand Down Expand Up @@ -241,7 +241,7 @@
:title => 'should set the IPv6 listen options',
:attr => 'ipv6_listen_options',
:value => 'spdy',
:match => ' listen [::]:80 spdy ipv6only=on;',
:match => ' listen [::]:80 spdy;',
},
{
:title => 'should set servername(s)',
Expand Down
4 changes: 2 additions & 2 deletions spec/defines/resource_vhost_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
:title => 'should set the IPv6 listen options',
:attr => 'ipv6_listen_options',
:value => 'spdy',
:match => ' listen [::]:80 spdy ipv6only=on;',
:match => ' listen [::]:80 spdy;',
},
{
:title => 'should set servername(s)',
Expand Down Expand Up @@ -321,7 +321,7 @@
:title => 'should set the IPv6 listen options',
:attr => 'ipv6_listen_options',
:value => 'spdy default',
:match => ' listen [::]:443 ssl spdy default ipv6only=on;',
:match => ' listen [::]:443 ssl spdy default;',
},
{
:title => 'should set servername(s)',
Expand Down
2 changes: 1 addition & 1 deletion templates/mailhost/mailhost.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ server {
listen <%= @listen_ip %>:<%= @listen_port %><% if @listen_options %> <%= @listen_options %><% end %>;
<% # check to see if ipv6 support exists in the kernel before applying %>
<% if @ipv6_enable && (defined? @ipaddress6) %>
listen [<%= @ipv6_listen_ip %>]:<%= @ipv6_listen_port %><% if @ipv6_listen_options %> <%= @ipv6_listen_options %><% end %> ipv6only=on;
listen [<%= @ipv6_listen_ip %>]:<%= @ipv6_listen_port %><% if @ipv6_listen_options %> <%= @ipv6_listen_options %><% end %>;
<% end %>
server_name <%= @server_name.join(" ") %>;
protocol <%= @protocol %>;
Expand Down
2 changes: 1 addition & 1 deletion templates/mailhost/mailhost_ssl.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ server {
listen <%= @ssl_port %>;
<% # check to see if ipv6 support exists in the kernel before applying %>
<% if @ipv6_enable && (defined? @ipaddress6) %>
listen [<%= @ipv6_listen_ip %>]:<%= @ipv6_listen_port %> <% if @ipv6_listen_options %><%= @ipv6_listen_options %><% end %> ipv6only=on;
listen [<%= @ipv6_listen_ip %>]:<%= @ipv6_listen_port %> <% if @ipv6_listen_options %><%= @ipv6_listen_options %><% end %>;
<% end %>
server_name <%= @server_name.join(" ") %>;
protocol <%= @protocol %>;
Expand Down
2 changes: 1 addition & 1 deletion templates/vhost/vhost_header.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ server {
listen <%= @listen_ip %>:<%= @listen_port %><% if @listen_options %> <%= @listen_options %><% end %>;
<% # check to see if ipv6 support exists in the kernel before applying %>
<% if @ipv6_enable && (defined? @ipaddress6) %>
listen [<%= @ipv6_listen_ip %>]:<%= @ipv6_listen_port %> <% if @ipv6_listen_options %><%= @ipv6_listen_options %><% end %> ipv6only=on;
listen [<%= @ipv6_listen_ip %>]:<%= @ipv6_listen_port %> <% if @ipv6_listen_options %><%= @ipv6_listen_options %><% end %>;
<% end %>
server_name <%= @rewrite_www_to_non_www ? @name.gsub(/^www\./, '') : @server_name.join(" ") %>;
<% if defined? @auth_basic -%>
Expand Down
2 changes: 1 addition & 1 deletion templates/vhost/vhost_ssl_header.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
server {
listen <%= @listen_ip %>:<%= @ssl_port %> ssl<% if @spdy == 'on' %> spdy<% end %><% if @listen_options %> <%= @listen_options %><% end %>;
<% if @ipv6_enable && (defined? @ipaddress6) %>
listen [<%= @ipv6_listen_ip %>]:<%= @ssl_port %> ssl<% if @spdy == 'on' %> spdy<% end %><% if @ipv6_listen_options %> <%= @ipv6_listen_options %><% end %> ipv6only=on;
listen [<%= @ipv6_listen_ip %>]:<%= @ssl_port %> ssl<% if @spdy == 'on' %> spdy<% end %><% if @ipv6_listen_options %> <%= @ipv6_listen_options %><% end %>;
<% end %>
server_name <%= @rewrite_www_to_non_www ? @name.gsub(/^www\./, '') : @server_name.join(" ") %>;

Expand Down

0 comments on commit de42889

Please sign in to comment.