|
53 | 53 | # Then the sssd.conf file is shared through shared_sssd_conf_path to compute nodes.
|
54 | 54 | # Only contacting the secret manager from head node avoids giving permission to compute nodes to contact the secret manager.
|
55 | 55 |
|
| 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 | + |
56 | 100 | # Write sssd.conf file
|
57 | 101 | template sssd_conf_path do
|
58 | 102 | source 'directory_service/sssd.conf.erb'
|
59 | 103 | owner 'root'
|
60 | 104 | group 'root'
|
61 | 105 | mode '0600'
|
62 | 106 | 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 |
66 | 108 | )
|
67 | 109 | sensitive true
|
68 | 110 | end
|
|
0 commit comments