返回介绍

PART Ⅰ : 容器云OPENSHIFT

PART Ⅱ:容器云 KUBERNETES

PART Ⅲ:持续集成与持续部署

PART Ⅴ:日志/监控/告警

PART Ⅵ:基础

PART Ⅶ:数据存储、处理

PART VIII:CODE

PART X:HACKINTOSH

PART XI:安全

SonarQube

发布于 2024-06-08 21:16:46 字数 9056 浏览 0 评论 0 收藏 0

OpenLDAP的条目组织形式

Sonaeqube官方文档的操作步骤

1、Sonarqube安装LDAP插件

配置--> 应用市场

2、修改配置文件/opt/sonarqube/conf/sonar.properties

如果sonarqube的部署实例是使用Dockers的话,则可通过环境变量的方式注入以下配置

sonar.security.realm=LDAP
sonar.forceAuthentication=true
ldap.authentication=simple
ldap.url=ldap://openldap-service.openldap.svc:389
ldap.bindDn=cn=admin,dc=curiouser,dc=com
ldap.bindPassword=******

# User Configuration
ldap.user.baseDn=ou=employee,dc=curiouser,dc=com
ldap.user.request=(&(memberOf=cn=sonarqube,ou=applications,dc=curiouser,dc=com)(cn={0}))
ldap.user.realNameAttribute=sn
ldap.user.emailAttribute=mail

相关配置

PropertyDescriptionDefault valueRequiredExample
sonar.security.realmSet this to LDAP authenticate first against the external sytem. If the external system is not reachable or if the user is not defined in the external system, authentication will be performed against SonarQube's internal database.noneYesLDAP (only possible value)
sonar.authenticator.downcaseSet to true when connecting to a LDAP server using a case-insensitive setup.falseNo
ldap.urlURL of the LDAP server. If you are using ldaps, you should install the server certificate into the Java truststore.noneYesldap://localhost:10389
ldap.bindDnThe username of an LDAP user to connect (or bind) with. Leave this blank for anonymous access to the LDAP directory.noneNocn=sonar,ou=users,o=mycompany
ldap.bindPasswordThe password of the user to connect with. Leave this blank for anonymous access to the LDAP directory.noneNosecret
ldap.authenticationPossible values: simple, CRAM-MD5, DIGEST-MD5, GSSAPI. See the tutorial on authentication mechanismssimpleNo
ldap.realmSee Digest-MD5 Authentication, CRAM-MD5 AuthenticationnoneNoexample.org
ldap.contextFactoryClassContext factoryclass. com.sun.jndi.ldap.LdapCtxFactoryNo
ldap.StartTLSEnable use of StartTLSfalseNo
ldap.followReferralsFollow referrals or not. See Referrals in the JNDItrue

用户配置

PropertyDescriptionDefault valueRequiredExample
ldap.user.baseDnDistinguished Name (DN) of the root node in LDAP from which to search for users.NoneYescn=users,dc=example,dc=org
ldap.user.requestLDAP user request.(&(objectClass=inetOrgPerson)(uid={login}))No(&(objectClass=user)(sAMAccountName={login}))
ldap.user.realNameAttributeAttribute in LDAP defining the user’s real name.cnNo
ldap.user.emailAttributeAttribute in LDAP defining the user’s email.mailNo

Group Mapping Only groups are supported (not roles). Only static groups are supported (not dynamic groups).

For the delegation of authorization, groups must be first defined in SonarQube. Then, the following properties must be defined to allow SonarQube to automatically synchronize the relationships between users and groups.

PropertyDescriptionDefault valueRequiredExample for Active Directory
ldap.group.baseDnDistinguished Name (DN) of the root node in LDAP from which to search for groups.noneNocn=groups,dc=example,dc=org
ldap.group.requestLDAP group request.(&(objectClass=groupOfUniqueNames)(uniqueMember={dn}))No(&(objectClass=group)(member={dn}))
ldap.group.idAttributeProperty used to specifiy the attribute to be used for returning the list of user groups in the compatibility mode.cnNosAMAccountName

重启Sonarqube,启动过程中如果出现以下日志,则证明LDAP连接成功

INFO org.sonar.INFO Security realm: LDAP ...
INFO o.s.p.l.LdapContextFactory Test LDAP connection: OK

3、登录验证

4、权限控制

将admin用户的管理员权限删除,赋予另一个用户

  1. https://hub.docker.com/_/sonarqube?tab=description
  2. https://docs.sonarqube.org/latest/instance-administration/delegated-auth/

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文