配置存储库以使用 LDAP

要启用轻量级目录访问协议 (LDAP) 支持:

  1. 打开 Repository 配置文件 $PREFIX/etc/anaconda-server/config.yaml,添加如下配置:

    account_names_filter: false
    USER_REGEX: ^[a-z0-9_][a-z0-9_-.]+$
    LDAP:
      # Replace with company LDAP server
      URI: 'ldap://<ldap.company.com>'
    
      # Replace <uid=%(username)s,ou=People,dc=company,dc=com> with your company specific LDAP Bind/Base DN
      # Bind directly to this Base DN.
      BIND_DN: '<uid=%(username)s,ou=People,dc=company,dc=com>'
    
      # Map LDAP keys into application specific keys
      KEY_MAP:
          name: 'cn'
          company: 'o'
          location: 'l'
          email: 'mail'
    
  2. 切换认证为LDAP时,admin账号丢失,需要重新添加admin账号:

    anaconda-server-admin set-superuser "jsmith"
    
  3. 运行flask-ldap-login-check命令以验证 LDAP 连接:

    flask-ldap-login-check binstar.wsgi:app --username 'jsmith' --password 'abc123DEF'
    

    注意:将jsmith和替换abc123DEF为您的 LDAP 用户名和密码。

  4. 要应用更改,请重新启动存储库服务器:

    supervisorctl restart all
    
  5. 打开一个新的浏览器窗口并导航到您的本地存储库安装:

    http://your.anaconda.repository
    

    注意:替换your.anaconda.repository为您的存储库服务器 IP 地址或域名。

  6. 使用您的 LDAP 凭据登录。

  7. 可选的。您可以使用选项 OPT_NETWORK_TIMEOUT 和 OPT_TIMEOUT 以秒为单位设置 LDAP 网络超时。默认值为 0,表示没有超时。

    例如,要将超时设置为 60 秒,请将此块添加到配置文件中的 LDAP 设置:

    OPTIONS:
       OPT_NETWORK_TIMEOUT: 60
       OPT_TIMEOUT: 60