gitlab、openvpn配置ldap认证

gitlab配置ldap认证:

vim /etc/gitlab/gitlab.rb

添加以下内容:
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: 'xxx.xxx.xxx.xxx'  #指定ldap服务器地址
    port: 389        #指定ldap服务端口
    uid: 'cn'        #指定登录用户名采用ldap的字段名称
    method: 'plain' # "tls" or "ssl" or "plain"
    bind_dn: 'cn=xxx,dc=xxx,dc=com'  #指定ldap服务器的管理员信息即bin_dn
    password: 'xxx'              #指定ldap服务器的管理员密码
    active_directory: true
    allow_username_or_email_login: true    #是否允许用户名或者email登录,true即允许。如果此处用户要使用ldap中的mail进行登录,则mail地址必须为"用户名@xxx.com",否则无法登录。
    block_auto_created_users: false
    base: 'dc=xxx,dc=com'          #指定ldap服务器的base域
    attributes:
      username: ['cn', 'uid']
      email:    ['mail', 'email']
EOS

内容添加完成之后,需要使用gitlab-ctl reconfigure进行配置重置,同时使用gitlab-ctl restart重启服务即可。

openvpn配置ldap认证:

#安装openvpn ldap认证插件
yum install openvpn-auth-ldap 

#编辑配置文件/etc/openvpn/auth/ldap.conf,内容如下:
<LDAP>
    URL        ldap://xxx.xxx.xxx.xxx:389  #指定ldap server地址以及端口
    BindDN    "cn=xxx,dc=xxx,dc=com"  #指定binddn信息即管理员信息
    Password    "xxx"           #指定管理员密码 Timeout 15   TLSEnable no FollowReferrals yes </LDAP> <Authorization> BaseDN "dc=xxx,dc=com"  #指定base dn 域 SearchFilter "(&(cn=%u))"   #指定搜索条件,此处若使用cn作为用户名,则不用修改 RequireGroup false </Authorization>

#编辑/etc/openvpn/server.conf文件,增加以下两行:
plugin /usr/lib64/openvpn/plugin/lib/openvpn-auth-ldap.so "/etc/openvpn/auth/ldap.conf cn=%u" #指定ldap认证插件地址,此处操作系统为64位。并指定auth ldap认证配置文件位置。
client-cert-not-required  #设置客户端可以不用通过证书认证,输入ldap中用户名和密码即可实现认证。
配置完成之后,需要重启openvpn服务。

猜你喜欢

转载自www.cnblogs.com/crysmile/p/9483006.html
今日推荐