配置存储库以使用Active Directory#

Microsoft Active Directory 是一个提供目录服务的服务器程序,它使用开放的行业标准轻量级目录访问协议(LDAP)。

要启用Active Directory支持:

  1. 打开仓库配置文件 $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.server.url>'
    
        # This BIND_DN/BIND_PASSWORD default to '', this is shown here for
        # demonstrative purposes. To enable Authorized Bind, insert the AD
        # BIND_DN and BIND_AUTH password for and authorized AD user.
        #
        #e.g. 'BIND_DN': '<cn=Authorized User,cn=users,dc=company,dc=local>'
        #e.g. 'BIND_AUTH': '<AuthUsrPassword>'
    
        # The values '' perform an anonymous bind so we may use search/bind method
        BIND_DN: ''
        BIND_AUTH: ''
    
        # Adding the USER_SEARCH field tells the flask-ldap-login that we
        # are using the search/bind method
        USER_SEARCH:
            base: <cn=users,dc=company,dc=local>
            filter: sAMAccountName=%(username)s
    
        # Map ldap keys into application specific keys
        KEY_MAP:
            name: 'cn'
            company: 'o'
            location: 'l'
            email: 'userPrincipalName'
    
  2. 要应用更改,请重新启动仓库服务器:

    supervisorctl restart all
    
  3. 运行 flask-ldap-login-check 命令以验证 Active Directory 连接性:

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

    注意:将jsmithabc123DEF替换为您的Active Directory用户名和密码。

    您会看到类似于以下的响应:

    [anaconda.server] Started Site
    Got userdata for jsmith
    {'company': None, 'email': None, 'location': None, 'name': 'Jane Smith'}
    
  4. 打开您的浏览器并导航到您的本地仓库安装位置:

    http://your.anaconda.repository
    

    注意:将 your.anaconda.repository 替换为您的仓库 IP 地址或域名。

  5. 使用Active Directory登录。