nexus3配置ldap(active directory)和权限分配

nexus3 配置了ldap的active directory认证方式,并且通过ldap的group来分配role权限。

server administration config → security → LDAP:

1、新建一个connection,配置如下:


connection配置信息

name: 新的configuration唯一标识

LDAP server address: ldap地址,一般是389端口

Search base: search base进一步限定了与LDAP服务器的连接。通常对应于组织的域名。例如,dc = example,dc = com

Authentication method: 认证方式,通常选择simple authentication

Simple Authentication: 简单身份验证由用户名和密码组成。对于不使用安全ldaps协议的生产部署,不建议使用简单身份验证,因为它通过网络发送明文密码。

填写完基本的connection信息后,进行verify connection验证,如果通过点击next,进行user和group信息填写;不通过的常见问题在文章最后说明。

2、填写user和group信息:


user信息

configuration template:你的ldap类型,我这里用的是active directory

Base DN: 对应于用作用户条目基础的专有名称集合。此DN与前面的search base相关。例如,如果您的用户都包含在ou = users,dc = sonatype,dc = com中,并且您指定了dc = sonatype,dc = com的搜索库,则使用值ou = users。

User subtree: 如果基本DN下面的树可以包含用户条目,则值为true;如果所有用户都包含在指定的基本DN中,则为false。例如,如果所有用户都在ou = users,dc = sonatype,dc = com,则此字段应为False。如果用户可以在组织单位内的组织单位中显示,例如ou = development,ou = users,dc = sonatype,dc = com,则此字段应为True。

Object class: 此值是RFC-2798中定义的标准对象类。它为用户指定对象类。常见值为inetOrgPerson,person,user或posixAccount。

User filter: 这允许您配置过滤器以限制对用户记录的搜索。它可以用作性能改进。

User ID attribute: 这是上面指定的对象类的属性,它从LDAP服务器提供用户的标识符。存储库管理器使用此属性作为用户ID值。

Real name attribute: 这是Object类的属性,它提供用户的真实姓名。存储库管理器在需要显示用户的真实姓名时使用此属性,类似于内部名字和姓氏属性的使用。

3、配置group:group可以选择从ldap代入,也可以选择不带入。代入的好处是讲ldap原来的group带入可以作为role,这样对于整个ldap的用户权限能很好管理:


group配置

常见错误总结:

1、Failed to connect to LDAP Server: 10.xxx.x.0:389 [Caused by java.net.ConnectException: Connection refused (Connection refused)]

原因通常是域名有误,dc=example,dc=com这里可能需要修改。

2、Failed to connect to LDAP Server: [LDAP: error code 32 - 0000208D: NameErr: DSID-0310020A, problem 2001 (NO_OBJECT), data 0, best match of: 'DC=example,DC=com' ]

在【Connection】这个标签页,Search base填写DC=example,DC=com就够了,不需要写CN、OU等其它参数。

3、Failed to connect to LDAP Server: Failed to retrieve ldap information for users. [Caused by javax.naming.NameNotFoundException: [LDAP: error code 32 - 0000208D: NameErr: DSID-0310020A, problem 2001 (NO_OBJECT), data 0, best match of: 'DC=example,DC=com' ]]

Base DN这一栏,填写CN或者OU就够了,要确保正确。 不需要写DC,因为前面Search base已经写过了,或者可以完全空白。


参考:

官方文档:https://help.sonatype.com/repomanager3/security/ldap

博客匿蟒 :https://note.qidong.name/2017/09/nexus-ldap/

你可能感兴趣的:(nexus3配置ldap(active directory)和权限分配)