Skip to content

Commit 9e6404c

Browse files
authored
Add LDAP feature support (#80)
Added LDAP support to hostcfgd
1 parent e93494c commit 9e6404c

22 files changed

Lines changed: 1177 additions & 9 deletions

data/templates/common-auth-sonic.j2

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,15 @@ auth [success=2 default=ignore] pam_exec.so /usr/sbin/cache_radius
6868
# Local
6969
auth [success=done new_authtok_reqd=done default=ignore{{ ' auth_err=die maxtries=die' if not auth['failthrough'] }}] pam_unix.so nullok try_first_pass
7070

71+
{% elif auth['login'] == 'ldap,local' %}
72+
auth [success=2 default=ignore] pam_ldap.so minimum_uid=1000 try_first_pass
73+
auth [success=1 default=ignore] pam_unix.so nullok try_first_pass
74+
{% elif auth['login'] == 'local,ldap' %}
75+
auth [success=2 default=ignore] pam_unix.so nullok try_first_pass
76+
auth [success=1 default=ignore] pam_ldap.so minimum_uid=1000 try_first_pass
77+
{% elif auth['login'] == 'ldap' %}
78+
auth [success=1 default=ignore] pam_ldap.so minimum_uid=1000 try_first_pass
79+
7180
{% else %}
7281
auth [success=1 default=ignore] pam_unix.so nullok try_first_pass
7382

data/templates/ldap.conf.j2

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{{ ldap_cfg.cfg_servers(servers) }}
2+
3+
base {{ ldap_cfg.cfg_base(servers) }}
4+
5+
ldap_version {{ ldap_cfg.cfg_version(servers) }}
6+
7+
binddn {{ ldap_cfg.cfg_bind(servers) }}
8+
9+
bindpw {{ ldap_cfg.cfg_bindpw(servers) }}
10+
11+
port {{ ldap_cfg.cfg_port(servers) }}
12+
13+
scope {{ ldap_cfg.cfg_scope(servers) }}
14+
15+
timelimit {{ ldap_cfg.cfg_timeout(servers) }}
16+
17+
bind_timelimit {{ ldap_cfg.cfg_bind_timeout(servers) }}

data/templates/nslcd.conf.j2

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# /etc/nslcd.conf
2+
# nslcd configuration file. See nslcd.conf(5)
3+
# for details.
4+
5+
# The user and group nslcd should run as.
6+
uid nslcd
7+
gid nslcd
8+
9+
# The location at which the LDAP server(s) should be reachable.
10+
{{ ldap_cfg.cfg_servers(servers) }}
11+
12+
# The search base that will be used for all queries.
13+
base {{ ldap_cfg.cfg_base(servers) }}
14+
15+
16+
# The LDAP protocol version to use.
17+
ldap_version {{ ldap_cfg.cfg_version(servers) }}
18+
19+
# The DN to bind with for normal lookups.
20+
binddn {{ ldap_cfg.cfg_bind(servers) }}
21+
bindpw {{ ldap_cfg.cfg_bindpw(servers) }}
22+
23+
# The DN used for password modifications by root.
24+
#rootpwmoddn cn=admin,dc=example,dc=com
25+
26+
# SSL options
27+
#ssl off
28+
#tls_reqcert never
29+
tls_cacertfile /etc/ssl/certs/ca-certificates.crt
30+
31+
# The search scope.
32+
scope {{ ldap_cfg.cfg_scope(servers) }}
33+
34+
timelimit {{ ldap_cfg.cfg_timeout(servers) }}
35+
36+
bind_timelimit {{ ldap_cfg.cfg_bind_timeout(servers) }}
37+
38+
nss_initgroups_ignoreusers ALLLOCAL
39+
40+
nss_min_uid 1000
41+

0 commit comments

Comments
 (0)