Skip to content

Commit aab55e2

Browse files
Andrew Evansbalasankarc
authored andcommitted
Add active directory + smart card settings to gitlab.yml
An upcoming change in GitLab will introduce two new settings in the `ldap:` -> `servers:` subsections, to allow authenticating users via smart card against LDAP servers that are Active Directory based. The configuration is per-server-specific, so should be placed in the same configuration block as other LDAP settings. This change exposes the new settings and adds defaults to omnibus. The `smartcard_ad_cert_format` setting should default to `nil` / off, and administrators must opt-in to the new behavior by configuring a value for it. Changelog: added
1 parent dd5b541 commit aab55e2

File tree

4 files changed

+20
-0
lines changed

4 files changed

+20
-0
lines changed

files/gitlab-config-template/gitlab.rb.template

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -521,6 +521,8 @@ external_url 'GENERATED_EXTERNAL_URL'
521521
# verify_certificates: true
522522
# smartcard_auth: false
523523
# active_directory: true
524+
# smartcard_ad_cert_field: 'altSecurityIdentities'
525+
# smartcard_ad_cert_format: null # 'issuer_and_serial_number', 'issuer_and_subject' , 'principal_name'
524526
# allow_username_or_email_login: false
525527
# lowercase_usernames: false
526528
# block_auto_created_users: false
@@ -542,6 +544,8 @@ external_url 'GENERATED_EXTERNAL_URL'
542544
# verify_certificates: true
543545
# smartcard_auth: false
544546
# active_directory: true
547+
# smartcard_ad_cert_field: 'altSecurityIdentities'
548+
# smartcard_ad_cert_format: null # 'issuer_and_serial_number', 'issuer_and_subject' , 'principal_name'
545549
# allow_username_or_email_login: false
546550
# lowercase_usernames: false
547551
# block_auto_created_users: false

files/gitlab-cookbooks/gitlab/attributes/default.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,8 @@
301301
default['gitlab']['gitlab_rails']['ldap_sync_ssh_keys'] = nil
302302
default['gitlab']['gitlab_rails']['ldap_sync_time'] = nil
303303
default['gitlab']['gitlab_rails']['ldap_active_directory'] = nil
304+
default['gitlab']['gitlab_rails']['ldap_smartcard_ad_cert_field'] = nil
305+
default['gitlab']['gitlab_rails']['ldap_smartcard_ad_cert_format'] = nil
304306
####
305307

306308
default['gitlab']['gitlab_rails']['smartcard_enabled'] = false

files/gitlab-cookbooks/gitlab/templates/default/gitlab.yml.erb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -791,6 +791,8 @@ production: &base
791791
## EE only
792792
group_base: <%= quote(@ldap_group_base) %>
793793
admin_group: <%= quote(@ldap_admin_group) %>
794+
smartcard_ad_cert_field: <%= quote(@ldap_smartcard_ad_cert_field) %>
795+
smartcard_ad_cert_format: <%= quote(@ldap_smartcard_ad_cert_format) %>
794796
sync_ssh_keys: <%= quote(@ldap_sync_ssh_keys) %>
795797
sync_time: <%= @ldap_sync_time %>
796798
<% end %>

spec/chef/cookbooks/gitlab/recipes/gitlab-rails/gitlab_yml/ldap_spec.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
password: nil,
2121
port: nil,
2222
prevent_ldap_sign_in: false,
23+
smartcard_ad_cert_field: nil,
24+
smartcard_ad_cert_format: nil,
2325
sync_ssh_keys: nil,
2426
sync_time: nil,
2527
uid: nil,
@@ -55,7 +57,10 @@
5557
encryption: 'plain',
5658
bind_dn: 'dc=example,dc=com',
5759
password: 's3cr3t',
60+
active_directory: true,
5861
smartcard_auth: 'required',
62+
smartcard_ad_cert_field: 'extendedAttribute1',
63+
smartcard_ad_cert_format: 'rfc822_name',
5964
base: '',
6065
user_filter: '',
6166
}
@@ -87,7 +92,10 @@
8792
encryption: 'plain',
8893
bind_dn: 'dc=example,dc=com',
8994
password: 's3cr3t',
95+
active_directory: true,
9096
smartcard_auth: 'required',
97+
smartcard_ad_cert_field: 'extendedAttribute1',
98+
smartcard_ad_cert_format: 'rfc822_name',
9199
base: '',
92100
user_filter: '',
93101
}
@@ -113,6 +121,8 @@
113121
ldap_method: 'plain',
114122
ldap_bind_dn: 'foobar',
115123
ldap_active_directory: 'asdf',
124+
ldap_smartcard_ad_cert_field: 'extendedAttribute2',
125+
ldap_smartcard_ad_cert_format: 'subject',
116126
ldap_allow_username_or_email_login: false,
117127
ldap_lowercase_usernames: true,
118128
ldap_group_base: 'dc-example.com',
@@ -127,6 +137,8 @@
127137
expected_output = {
128138
enabled: true,
129139
prevent_ldap_sign_in: false,
140+
smartcard_ad_cert_field: 'extendedAttribute2',
141+
smartcard_ad_cert_format: 'subject',
130142
sync_time: 10,
131143
host: 'primary.ldap',
132144
port: 389,

0 commit comments

Comments
 (0)