以下配置环境都是Centos7.9
一、svn接入openldap认证
搭建svn的步骤省略,可看我之前的文章。。。
[root@localhost conf.d]cat subversion.conf
#LoadModule dav_svn_module modules/mod_dav_svn.so
#LoadModule authz_svn_module modules/mod_authz_svn.so
# 在早期的Httpd版本,需要配置需要加载的模块,当前版本不需要
<Location /svn>
DAV svn
SVNListParentPath on
SVNParentPath /home/svnroot
AuthType Basic
AuthName "Authorization"
#AuthUserFile /home/svnroot/passwd
AuthzSVNAccessFile /home/svnroot/authz
Satisfy all
Require valid-user
# 定义验证方式,这里同时使用ldap和file的方式,当ldap找不到的用户,会使用file中的用户进行验证。
AuthBasicProvider ldap
# 在早期版本中还会有这个参数,用于设置是否仅使用ldap的方式进行验证用户信息,默认是on,这个版本不需要
# AuthzLDAPAuthoritative off
# 绑定LDAP的DN
AuthLDAPBindDN "cn=admin,dc=test,dc=com"
# 配置LDAP的管理员密码
AuthLDAPBindPassword "123456"
#搭建的LDAP url地址
AuthLDAPURL "ldap://192.168.1.10:389/ou=People,dc=test,dc=com?uid?sub?(objectClass=*)"
Options Indexes FollowSymLinks
Order allow,deny
Allow from all
</Location>
二、ftp接入openldap认证
搭建ftp服务的步骤省略,可看我之前的文章。。。
[root@agent ~]# yum -y install openldap-clients nss-pam-ldapd pam_ldap
[root@agent ~]# vim /etc/nslcd.conf
uri ldap://192.168.1.10/
ldap_version 3
base dc=test,dc=com
ssl no
binddn cn=admin,dc=test,dc=com
bindpw 123456
[root@agent ~]# vim /etc/pam.d/vsftpd.vu
auth required pam_ldap.so
account required pam_ldap.so
[root@agent ~]# vim /etc/openldap/ldap.conf
host 192.168.1.10
BASE dc=test,dc=com
URI ldap://192.168.1.10
binddn cn=admin,dc=test,dc=com
bindpw 123456
systemctl restart nslcd
systemctl restart vsftpd
三、gitlab接入openldap认证
gitlab搭建过程请看我之前的文章。。。
gitlab_rails['ldap_enabled'] = true
gitlab_rails['ldap_servers'] = YAML.load <<-'EOS'
main: # 'main' is the GitLab 'provider ID' of this LDAP server
label: 'LDAP'
host: '192.168.1.10'
port: 389
uid: 'uid'
bind_dn: 'cn=admin,dc=test,dc=com'
password: '123456'
encryption: 'plain' # "start_tls" or "simple_tls" or "plain"
verify_certificates: true
smartcard_auth: false
active_directory: true
allow_username_or_email_login: true
lowercase_usernames: false
block_auto_created_users: false
base: 'ou=People,dc=test,dc=com'
user_filter: ''
attributes:
username: ['uid', 'userid', 'sAMAccountName']
email: ['mail', 'email', 'userPrincipalName']
name: 'cn'
first_name: 'givenName'
last_name: 'sn'
## EE only
group_base: ''
admin_group: ''
sync_ssh_keys: false
EOS