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

Feature/ldap authentication #528

Merged
merged 2 commits into from
May 21, 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
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,32 @@ To use https connection to management console, turn `['rabbitmq']['web_console_s

Enables any plugins listed in the `node['rabbitmq']['enabled_plugins']` and disables any listed in `node['rabbitmq']['disabled_plugins']` attributes.

### Ldap Plugin & Configuration

To enable ldap plugin do the following
1. `default['rabbitmq']['ldap']['enabled'] = true`
2. `default['rabbitmq']['auth_backends'] = 'rabbit_auth_backend_internal, rabbit_auth_backend_ldap'`
3. Add to your plugins the `rabbitmq_auth_backend_ldap` plugin
4. Set your configurations in `default['rabbitmq']['ldap']['conf']` variable

##### Example configuration

```ruby
default['rabbitmq']['ldap']['conf'] = {
:servers => ["<your servers>"],
:user_bind_pattern => "${username}@<your domain>",
:dn_lookup_attribute => "sAMAccountName",
:dn_lookup_base => "DC=<CHANGEME>,DC=<CHANGEME>",
:port => <CHANGEME (number)>,
:log => <CHANGEME (boolean)>,
:vhost_access_query => '{constant, true}',
:topic_access_query => '{constant, true}',
:resource_access_query => '{constant, true}',
:tag_queries => "[{administrator, {constant, false}}]"
}
```


### users

Enables any users listed in the `node['rabbitmq']['enabled_users']` and disables any listed in `node['rabbitmq']['disabled_users']` attributes.
Expand Down
9 changes: 9 additions & 0 deletions attributes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,15 @@
# job control
default['rabbitmq']['job_control'] = 'initd'

#authentication
#define auth backend (internal auth is set by default)
# Ldap Example:
# default['rabbitmq']['auth_backends'] = 'rabbit_auth_backend_internal, rabbit_auth_backend_ldap'
default['rabbitmq']['auth_backends'] = 'rabbit_auth_backend_internal'
default['rabbitmq']['ldap']['enabled'] = false
default['rabbitmq']['ldap']['conf'] = {}


# ssl
default['rabbitmq']['ssl'] = false
default['rabbitmq']['ssl_port'] = 5671
Expand Down
12 changes: 12 additions & 0 deletions templates/default/rabbitmq.config.erb
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
{ssl, [{versions, [<%= @ssl_versions %>]}]},
<% end %>
{rabbit, [
{auth_backends, [<%= node['rabbitmq']['auth_backends'] %>]},
<% if node['rabbitmq']['clustering']['enable'] -%>
<%if node['rabbitmq']['clustering']['use_auto_clustering'] -%>
{cluster_nodes, {[<%= node['rabbitmq']['clustering']['cluster_nodes'].map { |n| "'#{n['name']}'"}.join(',') %>], disc}},
Expand Down Expand Up @@ -130,6 +131,17 @@
,{<%= key %>, <%= value %>}
<% end -%>
]}
<%if node['rabbitmq']['ldap']['enabled']%>
,{rabbitmq_auth_backend_ldap, [
<% node['rabbitmq']['ldap']['conf'].each_with_index do |(key, value), index| -%>
<%if index == 0%>
{<%= key %>, <%= value %>}
<%else%>
,{<%= key %>, <%= value %>}
<%end%>
<% end -%>
]}
<% end %>
<% node['rabbitmq']['conf'].each do |key,value| -%>
,{<%= key %>, <%= value %>}
<% end -%>
Expand Down