Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update the ssl_ciphers parameter to support the OpenSSL style #785

Merged
merged 1 commit into from
Dec 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -775,8 +775,12 @@ Default value: `undef`

Data type: `Array`

Support only a given list of SSL ciphers. Example: `['dhe_rsa,aes_256_cbc,sha','dhe_dss,aes_256_cbc,sha', 'ecdhe_rsa,aes_256_cbc,sha']`. Supported ciphers in your install can be listed with: rabbitmqctl eval 'ssl:cipher_suites().'
Functionality can be tested with cipherscan or similar tool: https://github.com/jvehent/cipherscan.git
Support only a given list of SSL ciphers, using either the Erlang or OpenSSL styles.
Supported ciphers in your install can be listed with: `rabbitmqctl eval 'ssl:cipher_suites().'`
Functionality can be tested with cipherscan or similar tool: https://github.com/mozilla/cipherscan

* Erlang style: `['ecdhe_rsa,aes_256_cbc,sha', 'dhe_rsa,aes_256_cbc,sha']`
* OpenSSL style: `['ECDHE-RSA-AES256-SHA', 'DHE-RSA-AES256-SHA']`

Default value: $rabbitmq::params::ssl_ciphers

Expand Down Expand Up @@ -1777,4 +1781,3 @@ Valid values: %r{^\S+$}
namevar

The name of the vhost to add

7 changes: 5 additions & 2 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -254,8 +254,11 @@
# POODLE and BEAST attacks. Please see the
# [RabbitMQ SSL](https://www.rabbitmq.com/ssl.html) documentation for more information.
# @param ssl_ciphers
# Support only a given list of SSL ciphers. Example: `['dhe_rsa,aes_256_cbc,sha','dhe_dss,aes_256_cbc,sha', 'ecdhe_rsa,aes_256_cbc,sha']`. Supported ciphers in your install can be listed with: rabbitmqctl eval 'ssl:cipher_suites().'
# Functionality can be tested with cipherscan or similar tool: https://github.com/jvehent/cipherscan.git
# Support only a given list of SSL ciphers, using either the Erlang or OpenSSL styles.
# Supported ciphers in your install can be listed with: `rabbitmqctl eval 'ssl:cipher_suites().'`
# Functionality can be tested with cipherscan or similar tool: https://github.com/mozilla/cipherscan
# * Erlang style: `['ecdhe_rsa,aes_256_cbc,sha', 'dhe_rsa,aes_256_cbc,sha']`
# * OpenSSL style: `['ECDHE-RSA-AES256-SHA', 'DHE-RSA-AES256-SHA']`
# @param stomp_port
# The port to use for Stomp.
# @param stomp_ssl_only
Expand Down
19 changes: 17 additions & 2 deletions spec/classes/rabbitmq_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1101,7 +1101,7 @@
end
end

describe 'ssl options with ssl ciphers' do
describe 'ssl options with ssl ciphers (in Erlang [pre-3.7.9] format)' do
let(:params) do
{ ssl: true,
ssl_port: 3141,
Expand All @@ -1112,7 +1112,22 @@
end

it 'sets ssl ciphers to specified values' do
is_expected.to contain_file('rabbitmq.config').with_content(%r{ciphers,\[[[:space:]]+{dhe_rsa,aes_256_cbc,sha},[[:space:]]+{ecdhe_rsa,aes_256_cbc,sha}[[:space:]]+\]})
is_expected.to contain_file('rabbitmq.config').with_content(%r{ciphers,\[[[:space:]]+{ecdhe_rsa,aes_256_cbc,sha},[[:space:]]+{dhe_rsa,aes_256_cbc,sha}[[:space:]]+\]})
end
end

describe 'ssl options with ssl ciphers (in OpenSSL style)' do
let(:params) do
{ ssl: true,
ssl_port: 3141,
ssl_cacert: '/path/to/cacert',
ssl_cert: '/path/to/cert',
ssl_key: '/path/to/key',
ssl_ciphers: ['ECDHE-RSA-AES256-SHA', 'DHE-RSA-AES256-SHA'] }
end

it 'sets ssl ciphers to specified values' do
is_expected.to contain_file('rabbitmq.config').with_content(%r{ciphers,\[[[:space:]]+"ECDHE-RSA-AES256-SHA",[[:space:]]+"DHE-RSA-AES256-SHA"[[:space:]]+\]})
end
end

Expand Down
17 changes: 15 additions & 2 deletions templates/rabbitmq.config.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
% This file managed by Puppet
% Template Path: <%= @module_name %>/templates/rabbitmq.config
[
<%-
if @ssl_ciphers && @ssl_ciphers.size > 0
ssl_ciphers = @ssl_ciphers.map do |cipher|
if cipher.split(',').size > 1
"{#{cipher}}"
else
"\"#{cipher}\""
end
end.join(",\n ")
else
ssl_ciphers = nil
end
-%>
<%- if @ssl and @ssl_versions -%>
{ssl, [{versions, [<%= @ssl_versions.sort.map { |v| "'#{v}'" }.join(', ') %>]}]},
<%- end -%>
Expand Down Expand Up @@ -79,7 +92,7 @@
<%- end -%>
<%- if @ssl_ciphers and @ssl_ciphers.size > 0 -%>
,{ciphers,[
<%= @ssl_ciphers.sort.map{|k| "{#{k}}"}.join(",\n ") %>
<%= ssl_ciphers %>
]}
<%- end -%>
]},
Expand Down Expand Up @@ -122,7 +135,7 @@
<%- end -%>
<%- if @ssl_ciphers and @ssl_ciphers.size > 0 -%>
,{ciphers,[
<%= @ssl_ciphers.sort.map{|k| "{#{k}}"}.join(",\n ") %>
<%= ssl_ciphers %>
]}
<%- end -%>
]}
Expand Down