Skip to content

Commit 780b638

Browse files
author
Colleen Murphy
committed
Stop setting a default cookie
Like passwords, secret cookies shouldn't have defaults. This change removes the default and hard fails when a value is needed and not set.
1 parent 5c485b8 commit 780b638

5 files changed

Lines changed: 2 additions & 61 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,7 @@ RabbitMQ Environment Variables in rabbitmq_env.config
222222
####`erlang_cookie`
223223

224224
The erlang cookie to use for clustering - must be the same between all nodes.
225+
This value has no default and must be set explicitly if using clustering.
225226

226227
###`key_content`
227228

lib/puppet/type/rabbitmq_erlang_cookie.rb

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,6 @@
33

44
newparam(:path, :namevar => true)
55

6-
validate do
7-
# This does pre-validation on the content property and force parameter.
8-
# The intent is to simulate the prior behavior to the invention of this
9-
# type (see https://github.com/puppetlabs/puppetlabs-rabbitmq/blob/4.1.0/manifests/config.pp#L87-L117)
10-
# where validation occurs before the catalog starts being applied.
11-
# This prevents other resources from failing after attempting to apply
12-
# this resource and having it fail due to the force parameter being
13-
# set to false.
14-
is = (File.read(self[:path]) if File.exists?(self[:path])) || ''
15-
should = self[:content]
16-
failstring = 'The current erlang cookie needs to change. In order to do this the RabbitMQ database needs to be wiped. Please set force => true to allow this tohappen automatically.'
17-
fail(failstring) if (is != should && self[:force] != :true)
18-
end
19-
206
newproperty(:content) do
217
desc 'Content of cookie'
228
newvalues(/^\S+$/)

manifests/config.pp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@
9797
require => File['/etc/rabbitmq'],
9898
}
9999

100-
101100
if $config_cluster {
102101

103102
if $erlang_cookie == undef {

manifests/params.pp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
$delete_guest_user = false
6060
$env_config = 'rabbitmq/rabbitmq-env.conf.erb'
6161
$env_config_path = '/etc/rabbitmq/rabbitmq-env.conf'
62-
$erlang_cookie = 'EOKOWXQREETZSHFNTPEY'
62+
$erlang_cookie = undef
6363
$node_ip_address = 'UNSET'
6464
$plugin_dir = "/usr/lib/rabbitmq/lib/rabbitmq_server-${version}/plugins"
6565
$port = '5672'

spec/unit/puppet/type/rabbitmq_erlang_cookie_spec.rb

Lines changed: 0 additions & 45 deletions
This file was deleted.

0 commit comments

Comments
 (0)