Skip to content

Commit d5d03b6

Browse files
committed
Make DirectoryService/AdditionalSssdConfigs be merged into default domain configuration rather than be appended.
Signed-off-by: Giacomo Marciani <[email protected]>
1 parent 91d146e commit d5d03b6

File tree

3 files changed

+48
-26
lines changed

3 files changed

+48
-26
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ This file is used to list changes made in each version of the AWS ParallelCluste
1212
- Add support for both FQDN and LDAP Distinguished Names in the configuration parameter `DirectoryService/DomainName`. The new validator now checks both the syntaxes.
1313
- New `update_directory_service_password.sh` script deployed on the head node supports the manual update of the Active Directory password in the SSSD configuration.
1414
The password is retrieved by the AWS Secrets Manager as from the cluster configuration.
15+
- Make `DirectoryService/AdditionalSssdConfigs` be merged into final SSSD configuration rather than be appended.
1516

1617
**CHANGES**
1718
- Disable deeper C-States in x86_64 official AMIs and AMIs created through `build-image` command, to guarantee high performance and low latency.

cookbooks/aws-parallelcluster-config/recipes/directory_service.rb

Lines changed: 45 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,16 +53,58 @@
5353
# Then the sssd.conf file is shared through shared_sssd_conf_path to compute nodes.
5454
# Only contacting the secret manager from head node avoids giving permission to compute nodes to contact the secret manager.
5555

56+
# Configure SSSD domain properties
57+
domain_properties = {
58+
# Mandatory properties that must not be overridden by the user.
59+
'id_provider' => 'ldap',
60+
'ldap_schema' => 'AD',
61+
62+
# Mandatory properties that are meant to be set via dedicated cluster config properties,
63+
# but that can also be overridden via DirectoryService/AdditionalSssdConfigs.
64+
'ldap_uri' => ldap_uri_components.join(','),
65+
'ldap_search_base' => ldap_search_base,
66+
'ldap_default_bind_dn' => node['cluster']['directory_service']['domain_read_only_user'],
67+
'ldap_default_authtok' => shell_out!("aws secretsmanager get-secret-value --secret-id #{node['cluster']['directory_service']['password_secret_arn']} --region #{node['cluster']['region']} --query 'SecretString' --output text").stdout.strip,
68+
'ldap_tls_reqcert' => node['cluster']['directory_service']['ldap_tls_req_cert'],
69+
70+
# Optional properties for which we provide a default value,
71+
# that are not meant to be set via dedicated cluster config properties,
72+
# but that can be overridden by the user via DirectoryService/AdditionalSssdConfigs.
73+
'cache_credentials' => 'True',
74+
'default_shell' => '/bin/bash',
75+
'fallback_homedir' => '/home/%u',
76+
'ldap_id_mapping' => 'True',
77+
'ldap_referrals' => 'False',
78+
'use_fully_qualified_names' => 'False',
79+
}
80+
81+
# Optional properties that are meant to be set via dedicated cluster config properties.
82+
# - ldap_tls_ca_cert
83+
# - ldap_access_filter
84+
# - access_provider only if ldap_access_filter is specified
85+
86+
unless node['cluster']['directory_service']['ldap_tls_ca_cert'].eql?('NONE')
87+
domain_properties['ldap_tls_cacert'] = node['cluster']['directory_service']['ldap_tls_ca_cert']
88+
end
89+
90+
unless node['cluster']['directory_service']['ldap_access_filter'].eql?('NONE')
91+
domain_properties['access_provider'] = 'ldap'
92+
domain_properties['ldap_access_filter'] = node['cluster']['directory_service']['ldap_access_filter']
93+
end
94+
95+
# Optional properties that are meant to be set via DirectoryService/AdditionalSssdConfigs
96+
if node['cluster']['directory_service']['additional_sssd_configs']
97+
domain_properties.merge!(node['cluster']['directory_service']['additional_sssd_configs'])
98+
end
99+
56100
# Write sssd.conf file
57101
template sssd_conf_path do
58102
source 'directory_service/sssd.conf.erb'
59103
owner 'root'
60104
group 'root'
61105
mode '0600'
62106
variables(
63-
ldap_default_authtok: shell_out!("aws secretsmanager get-secret-value --secret-id #{node['cluster']['directory_service']['password_secret_arn']} --region #{node['cluster']['region']} --query 'SecretString' --output text").stdout,
64-
ldap_uri: ldap_uri_components.join(","),
65-
ldap_search_base: ldap_search_base
107+
domain_properties: domain_properties
66108
)
67109
sensitive true
68110
end

cookbooks/aws-parallelcluster-config/templates/default/directory_service/sssd.conf.erb

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,7 @@
11
[domain/default]
2-
id_provider = ldap
3-
cache_credentials = True
4-
ldap_schema = AD
5-
ldap_uri = <%= @ldap_uri %>
6-
ldap_search_base = <%= @ldap_search_base %>
7-
ldap_default_bind_dn = <%= node['cluster']['directory_service']['domain_read_only_user'] %>
8-
ldap_default_authtok = <%= @ldap_default_authtok %>
9-
<% if node['cluster']['directory_service']['ldap_tls_ca_cert'] != 'NONE' %>
10-
ldap_tls_cacert = <%= node['cluster']['directory_service']['ldap_tls_ca_cert'] %>
11-
<% end %>
12-
ldap_tls_reqcert = <%= node['cluster']['directory_service']['ldap_tls_req_cert'] %>
13-
ldap_id_mapping = True
14-
fallback_homedir = /home/%u
15-
default_shell = /bin/bash
16-
use_fully_qualified_names = False
17-
ldap_referrals = False
18-
<% if node['cluster']['directory_service']['additional_sssd_configs'] %>
19-
<% node['cluster']['directory_service']['additional_sssd_configs'].each_pair do |param, value| %>
2+
<%# Domain properties are added in lexicographic order to make the resulting configuration easier to navigate %>
3+
<% @domain_properties.sort_by { |key| key }.to_h.each_pair do |param, value| %>
204
<%= "#{param} = #{value}" %>
21-
<% end %>
22-
<% end %>
23-
<% if node['cluster']['directory_service']['ldap_access_filter'] != 'NONE' %>
24-
access_provider = ldap
25-
ldap_access_filter = <%= node['cluster']['directory_service']['ldap_access_filter'] %>
265
<% end %>
276

287
[domain/local]

0 commit comments

Comments
 (0)