Sonarqube SSO Configuration
Prerequisites
- Ensure the Global SSO Settings have already been configured for this cluster.
- Access to Keycloak Master Realm
SmoothGlue will automatically configure the Keycloak objects documented below. This Keycloak section primarily as reference if opting out of the auto-SSO feature. Skip to SSO Configuration if not manually setting up the Keycloak client and group.
Create Keycloak Client
- While you are in the
smoothgluerealm, click onClientsunderManagein the left pane. - Click
Create client. - Select
SAMLforClient type. - Enter client name
sonarqubeforClient ID. - Click on the
Nextbutton. Note: The application's FQDN name may be obtained by runningkubectl get virtualservice -A - Enter
https://{{ application_fqdn }}/oauth2/callback/samlforValid Redirect URIs. - Click on the
Savebutton. - Go to
Keystab. - Disable
Client signature required->Yes.
Creating Client Scopes
Sonarqube needs to be added in the Client Scopes.
- While you are in the
smoothgluerealm, click onClient Scopes. - Click
Create client scope. - Enter
SonarqubeforName. - Select
SAMLforProtocol, and click on theSavebutton. - Go to the
Mapperstab. - Click on
Configure a new mapper->User Property. - Enter the following information:
- Name -
Login - Property -
username - Leave
Friendly Nameblank - SAML Attribute Name -
login - SAML Attribute NameFormat -
Basic - Save
- Click
Client scope detailsnear the top of the screen.
- Name -
- Click on
Add mapper,By configuration,User Property. - Enter the following information:
- Name -
Name - Property -
username - Leave
Friendly Nameblank - SAML Attribute Name -
name - SAML Attribute NameFormat -
Basic - Save
- Name -
- Click on
Add mapper,By configuration,User Property. - Enter the following information:
- Name -
Email - Property -
email - Leave
Friendly Nameblank - SAML Attribute Name -
email - SAML Attribute NameFormat -
Basic - Save
- Name -
- Click on
Add mapper,By configuration,Group list. - Enter the following information:
- Name -
Groups - Group attribute name -
groups - Leave
Friendly Nameblank - SAML Attribute NameFormat -
Basic - Single Group Attribute - Enabled
- Full group path - Enabled
- Save
- Name -
- Go to
Clients, and click on thesonarqubeclient. - Go to the
Client Scopestab. - Click
Add client scope. - Enable the
Sonarqubeclient scope. - Click
Add->Default. - Click the kebab icon (3 vertical dots) on the
role_listrow and clickRemove->Delete.
Failing to remove the role_list Client Scope will cause the SonarQube container to throw the following error when attempting to log in:
com.onelogin.saml2.exception.ValidationError: Found an Attribute element with duplicated Name
SSO Configuration
Retrieve the certificate value from the Keycloak client:
- As a Keycloak Admin and within the
smoothgluerealm, clickRealm Settingson the left-hand panel. - Click on the
Keystab. - Click on the
Certificatebutton on the R256 row.
When using the automated SSO SmoothGlue feature, the client ID will contain a unique prefix and will already be configured, so please omit that in the config. Add the following values to bigbang-secrets.yaml to configure SSO:
addons:
sonarqube:
enabled: true
sso:
enabled: true
# The client ID of the Sonarqube client in Keycloak
client_id: "sonarqube" # omit unless manually created
# This is the RS256 key copied from Keycloak
certificate: "<certificate>"
# These are set to the SAML attributes defined in Client Scopes
login: "login"
name: "name"
email: "email"
group: "groups"
See How to Configure Big Bang Values for more information on configuring Big Bang applications.
Configure SonarQube SSO Admin Group
SonarQube will automatically create users in its datastore if they do not exist, but it will not automatically create groups. Groups MUST be manually created to have users automatically placed into them at login.
SmoothGlue comes pre-configured with a _structsureAdmins group within Keycloak for assigning users admin privileges across the platform. A System Integrator is responsible for creating the an associated group within SonarQube and assigning the correct permissions to the group.
Login with Admin Credentials
The default admin username is admin and a randomly generated password can be retrieved from the cluster. It is stored in the sonarqube-sonarqube-admin-password Kubernetes secret in the sonarqube namespace.
Create SSO Admin Group
After signing in as the default Admin account:
- Click
Administration. - Go to
Security->Groups. - Click
Create Group. - Name the group
/_structsureAdmins
Assign Admin Privileges to SSO Admin Group
After signing in as the default Admin account:
- Click
Administration. - Go to
Security->Global Permissions. - For the
/_structsureAdminsgroup, assign all of the permissions that thesonar-administratorshas.