Skip to content

Commit

Permalink
Merge pull request #55 from sylvainfaivre/remove-guest-user
Browse files Browse the repository at this point in the history
feat(config.sls): remove guest user by default
  • Loading branch information
myii authored Nov 21, 2019
2 parents ff04ee9 + 57efa45 commit 04fdc01
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pillar.example
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ rabbitmq:
- definition: '{"ha-mode": "all"}'
vhost:
vh_name: '/virtual/host'
# default guest user will be removed unless this is set to false
remove_guest_user: true
user:
user1:
- password: password
Expand Down
6 changes: 6 additions & 0 deletions rabbitmq/config.sls
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,9 @@ rabbitmq_user_{{ name }}:
- require:
- service: rabbitmq-server
{% endfor %}

{% if salt['pillar.get']('rabbitmq:remove_guest_user', True) %}
rabbitmq_user_guest:
rabbitmq_user.absent:
- name: guest
{% endif %}
11 changes: 11 additions & 0 deletions test/integration/default/controls/rabbitmq_users_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# frozen_string_literal: true

control 'rabbitmq users' do
title 'should include/exclude the given users'

describe command('rabbitmqctl list_users') do
its('stdout') { should include 'user1' }
its('stdout') { should include 'user2' }
its('stdout') { should_not include 'guest' }
end
end

0 comments on commit 04fdc01

Please sign in to comment.