SevOne SAML Single Sign On Setup Guide
ABOUT
Single Sign-On (SSO) is available with dex. This document provides details on how to configure SAML (Security Assertion Markup Language) using Okta and Service Provided Initiated Azure Active Directory Single Sign-On (SP-initiated Azure AD SSO) setups. These setups have been tested and are supported by IBM SevOne. There are other identity providers which may work but have not been tested by IBM SevOne.
There are security implications of IdP (Identity Provider) initiated SAML before implementing it with SevOne NMS. Currently, the version of dex SevOne uses, only supports SP-initiated Single Sign-On.
IdP-Initiated flows carry a security risk and are therefore NOT recommended. Make sure you understand the risks before enabling IdP-Initiated Single Sign-On.
In an IdP-initiated flow neither Auth0 (which receives the unsolicited response from the Identity Provider) nor the application (that receives the unsolicited response generated by Auth0) can verify that the user actually started the flow. Because of this, enabling this flow opens the possibility of an Login CSRF attack, where an attacker can trick a legitimate user into unknowingly logging into the application with the identity of the attacker. Please refer to LOGIN CSRF section below for details.
SevOne recommends use of SP (Service Provider)-Initiated flows whenever possible. For details, please refer to https://auth0.com/docs/protocols/saml/idp-initiated-sso#risks-of-using-an-idp-initiated-sso-flow.
In this guide if there is,
- [any reference to master] OR
- [[if a CLI command contains master] AND/OR
- [its output contains master]],
it means leader.
And, if there is any reference to slave, it means follower.
CONFIGURE SAML USING OKTA SETUP
➤ Prerequisite
- IP Address of SevOne NMS Cluster Leader required.
To use Single Sign-On feature, you must be on SevOne NMS 5.7.2.15 or higher version.
➤ Login to Okta Account
- Sign-in to your Okta account.
- Click on Admin button in the upper-right corner.
- Click on Applications drop-down and select Applications.
- Click on Add Application button.
Click on Create New App button in the left-panel.
Ensure that in the upper-left corner, Classic UI option is chosen.
- Choose SAML 2.0 as a Sign on method.
- Click on Create button to initiate Create SAML Integration.
- Enter App name.
- You may choose to add an App logo. This field is optional.
Click on Next button to ➤ Create / Configure SAML application.
➤ Create / Configure SAML application
- Create a new SAML application in your SAML provider site.
- Add a Single Sign-On URL. Note: Example
https://<Cluster Leader IP address>/sso/callback
Note: If the SAML application requires Recipient and Destination URLs, use the above URL for both. - Add an Audience URI (also known as, SP Entity
ID).Note: Example
https://<Cluster Leader IP address>/sso/callback
- For IdP initiated login support, Default RelayState must be set to the NMS client ID, sevonenms.
- Add an attribute statement for name that has the value that maps to the user login in SevOne NMS.
- Your configuration must look as follows.
Example
In this example, 10.168.129.48 is the Cluster Leader IP address.
- Provide permissions to the users to use the app.
➤ Gather Information required for NMS configuration
You will need the following from the SAML provider in the NMS configuration.
- The Identity Provider Single Sign-On URL.
- The Identity Provider Issuer.
- The x.509 certificate.
➤ Configure Single Sign-On in NMS
- Copy x.509 certificate, /secrets/dex/saml.pem, to SevOne NMS' cluster leader.Important: If directory /secrets/dex does not exist, create it.
- SSH into your Cluster Leader as
support.
$ ssh support@<Cluster Leader IP address>
- Run /usr/local/scripts/dex_setup_template.sh script to update the config
template.
$ sudo su $ podman exec -it nms-nms-nms /bin/bash $ bash /usr/local/scripts/dex_setup_template.sh
Note: Running dex_setup_template.sh generates a new MySQL dex password as well as a new OAuth secret. If this script must be run again for any reason, please use the new password and secret for any editing to be done on the generated /config/dex.yaml file. Failure to do so, results in the following authentication error for all active dex connectors.Error
Authentication Exception: Invalid client credentials.
- Using the text editor of your choice, edit /config/dex.yaml file.
vi /config/dex.yaml
- Uncomment the SAML section (starting with line - id: saml) by removing the # from
each line.Note: The first 3 lines that start with ## should remain as comments.
- id - is an identifier unique to dex. If you do not have any other connections with id of SAML, you may leave it as is. This is for Internal Use Only, but must be unique if you are configuring multiple connectors.
- name - set to a reasonable value. This value will be displayed to users when presented with login options.
- type - leave as saml.
- Set config.ssoURL to the Identity Provider Single Sign-On URL.
- Set config.ssoIssuer to the Identity Provider Issuer.
- Set config.ca value to the file path where your x.509 certificate is located. For example, /secrets/dex/saml.pem.
- Depending on your Identity Server Configuration, you may need to change the values of config.usernameAttr and config.emailAttr to match those of your server's attribute statements.
- If your Identity Server requires a GET authentication request, instead of the default
POST, place the following line under the SAML connector config since it configures how
dex must handle the SAML
response.
authnRequestBindingType: "HTTP-Redirect"
- Uncomment the SAML section (starting with line - id: saml) by removing the # from
each line.
- If you used the domain name for <Cluster Leader IP address> in the previous section, replace all instances of the Cluster Leader IP address with the Domain Name.
- If you have signed certificates set up on your SevOne NMS cluster, please update the following
to validate these certificates. Under sevone > connector > config,
- Add caCertFile and set it with a path to your CA.
- Set noVerify to false to validate the certificates.
- Please do not change any configuration in the storage, web, and frontend sections without first consulting with SevOne Support.
- Your dex configuration file, /config/dex.yaml must look like the
following.
Example with detailed comments
# Note: Dex should only be running on the cluster master / leader # the URL here can be the IP or the hostname of the cluster master / leader # Cluster master / leader IP that will issue the valid auth tokens. This has to be # reachable by DI, the NMS and the IdP # If behind a proxy, this should be the proxy address to the cluster master / leader. The same # proxy address for the issuer should be configured for the IdP, DI and the NMS. Everyone # needs to agree on the issuer and it has to be the same # in all of the login cases in order for SSO to work. issuer: https://10.49.8.85/sso # Backend storage for authenticated clients storage: type: mysql config: host: 127.0.0.1:3307 database: dex_db user: dex # This is the MySQL password used to allow access to the dex database password: W7Pp9CXMsBCgeRlu0n61oI15705nYMLvhETPTPW9Z2FQ2lL7mD3QR9M6GlUHamDLrcgVt2dd7CJb86D5Su5biEumHJcvOuRPjK0pWWJRDZV48WX96c3q6Gftvchb66Xy ssl: mode: "false" logger: level: "debug" format: "text" # The port where dex will run web: http: 127.0.0.1:5556 # The login page for dex authentication frontend: dir: /opt/dex/web theme: sevone issuer: SevOne extra: heading_logo_url: /images/sevone_rgb_web.png # The connector for doing local SevOne authentication connectors: - id: sevone name: SevOne auth type: sevone config: restUrl: https://10.49.8.85/api resetPassUrl: https://10.49.8.85/doms/login/newPassword.html caCertFile: /secrets/nginx/nginx.crt noVerify: true ## To get a SAML connector working, replace: ## - The ssoURL and ssoIssuer with URLs from the SAML provider ## - redirectURI/entityIssuer addresses need to point to the cluster master hostname or IP - id: saml name: saml type: saml config: ssoURL: "https://okta.com/app/sevoneapp/sso/saml2" ssoIssuer: "http://www.okta.com/abcdefg" redirectURI: "https://10.49.8.85/sso/callback" ca: /secrets/dex/saml.pem usernameAttr: name emailAttr: email oauth2: # skips asking the user to grant permission for login skipApprovalScreen: true # the OpenID Connect flow types to enable. DO NOT EDIT responseTypes: ["code","token","id_token"] # This defines which applications can authenticate using dex. Below is an example # NMS configuration, but other applications (e.g. DI) can be configured here staticClients: # The client_id. Use this id as the 'Default Relay State' when configuring a SAML # Service Provider. - id: sevonenms # The redirect URIs matter for SP initiated logins (client (NMS) initiated logins). # It should contain all the peers in the cluster with both their hostnames and IPs that are # allowed to do SP initiated login. Also with HTTP and HTTPS access. # The user can be redirected to one of these after a successful login. redirectURIs: - 'http://10.49.11.236/callback.php' - 'https://10.49.11.236/callback.php' - 'http://10.49.8.85/callback.php' - 'https://10.49.8.85/callback.php' name: 'SevOne NMS' # The client_secret for the NMS client. The NMS will need this to initiate login. secret: L0VoyU23I1gUjbjlQPH8JvCc4S2Xv0Kh0Vb6j4Wzt7NX9gSn5duFMxRzAWU74mBZOnd78zAIQPOh815ry0QCB1QEbVwriGKlYBPqkOagkGlR2cfK6IJMXS4KFEy64lds # samlInitiated is required to enable SAML's IdP initiated flow. If not using # SAML, you may omit this section. samlInitiated: # This is where users will finally be redirected after a SAML IdP initiated login. # It can be any peer in the cluster. redirectURI: https://10.49.8.85/callback.php # Let dex keep a list of passwords which can be used to login to dex. # We don't allow that so lets keep it disabled. enablePasswordDB: false
- Restart SSO service. Please refer to section RESTART SINGLE SIGN-ON SERVICE.
-
Enable SSO. Please refer to section ENABLE SINGLE SIGN-ON.
dex wraps SAML in OpenID-Connect tokens.
CONFIGURE SAML USING AZURE ACTIVE DIRECTORY SINGLE SIGN-ON SETUP
➤ Prerequisite
- Azure Active Directory (AD) subscription. If you do not have a subscription, you may obtain a free account.
- Azure Active Directory (AD) Security Assertion Markup Language (SAML) Toolkit Single Sign-On
(SSO) enabled subscription.Note: Please refer to https://docs.microsoft.com/en-us/azure/active-directory/saas-apps/saml-toolkit-tutorial for details.
- IP Address of SevOne NMS Cluster Leader required.Important: Upgrade / Install SevOne NMS
To use Single Sign-On feature, you must be on SevOne NMS 5.7.2.15 or higher version.
➤ Create / Configure Azure Active Directory Single Sign-On application
- Login to the Azure portal.Important: Your account must be an Azure subscription administrator / owner.
- Navigate to Azure Active Directory under Azure Services.
- Click Add button to add an Enterprise application.
- Click Create your own application button.Important: If the button is unavailable, your account may not have the correct permissions.
- Enter application name.
- Select Integrate any other application application you don't find in the gallery. i.e., Non-gallery.
- From left navigation bar, under Manage, click Users and groups.Important: Here, you will determine which Azure users to provide access to Single Sign-On.
- Click Add user/group, and select the Azure users and groups to have access to Single Sign-On.
- Click Assign after users and groups have been added.
- From left navigation bar, under Manage, click Single sign-on.
- Select SAML as the single sign-on method.Note: You are now on SAML-based sign-on page.
To go back, click Single sign-on under Manage in the left navigation bar.
- Click
in section Basic SAML Configuration to edit.
- Change Identifier (Entity ID) to https://<Cluster Leader IP address>/sso/callback where <Cluster Leader IP address> is the IP address of your SevOne NMS cluster leader.
- Change Reply URL (Assertion Consumer Service URL) to https://<Cluster Leader IP
address>/sso/callback where <Cluster Leader IP address> is the IP address of your
SevOne NMS cluster leader.Important: This field is used for IDP-initiated SSO, so it will not be used, but is required for application setup.
- Click Save followed by
to close.
Important: If you get a pop-up asking if you want to test the app, decline it for now. - Click
in section User Attributes & Claims to edit.
- Claim name for value user.mail must be http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name.
- Click Add new claim.
- Enter name as displayname.
- Enter namespace as http://schemas.microsoft.com/identity/claims.
- Enter source attribute as user.displayname.
- In section SAML Signing Certificate,
- for Certificate (Base64) > click Download.Important: The raw certificate will not work.
- for Certificate (Base64) > click Download.
- In section Set up <your application name>, you will need the login URL for the next steps.
➤ Configure Single Sign-On in NMS
- Copy x.509 certificate, /secrets/dex/saml.pem, to SevOne NMS' cluster leader.Important: If directory /secrets/dex does not exist, create it.
- SSH into your Cluster Leader as support.
$ ssh support@<Cluster Leader IP address>
- Run /usr/local/scripts/dex_setup_template.sh script to update the config template.
$ sudo su $ podman exec -it nms-nms-nms /bin/bash $ bash /usr/local/scripts/dex_setup_template.sh
Note: Running dex_setup_template.sh generates a new MySQL dex password as well as a new OAuth secret. If this script must be run again for any reason, please use the new password and secret for any editing to be done on the generated /config/dex.yaml file. Failure to do so, results in the following authentication error for all active dex connectors.Error
Authentication Exception: Invalid client credentials.
- Using a text editor of your choice, edit /config/dex.yaml file.
vi /config/dex.yaml
- Uncomment the SAML section (starting with line - id: azure or - id:
okta) by removing the # from each line.Note: The first 3 lines that start with ## should remain as comments.
- id - is an identifier unique to dex. If you do not have any other connections with id of SAML, you may leave it as is.
- name - is the text that will be shown on the user interface of Single Sign-On page. You may have a string with spaces if you wrap it in quotation marks.
- type - leave as saml.
- ssoURL - on Azure, under the 4th section of Single Sign-On page, Set up <your application name>, copy the Login URL and paste it here, wrapping in quotation marks. For example, "SSO Login URL".
- ssoIssuer - change the name of this field to entityIssuer and set the field to "https://<Cluster Leader IP address>/sso/callback"; it must be wrapped in quotes.
- redirectURI - leave as-is.
- ca - set field as /secrets/dex/saml.pem.
- usernameAttr - set to "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name"; it must be wrapped in quotes. This maps to the name attribute in the 2nd section of the SAML-based Single Sign-On page, under Attributes & Claims.
- emailAttr - set to "http://schemas.microsoft.com/identity/claims/displayname"; it must be wrapped in quotes. This maps to the EmailAddress attribute in Azure.
Example
- id: saml name: saml type: saml config: ssoURL: "https://login.microsoftonline.com/uuid/saml2" entityIssuer: "https://10.49.8.85/sso/callback" redirectURI: "https://10.49.8.85/sso/callback" ca: /secrets/dex/saml.pem usernameAttr: "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name" emailAttr: "http://schemas.microsoft.com/identity/claims/displayname"
- Uncomment the SAML section (starting with line - id: azure or - id:
okta) by removing the # from each line.
- Restart SSO service. Please refer to section RESTART SINGLE SIGN-ON SERVICE.
- Enable SSO. Please refer to section ENABLE SINGLE SIGN-ON.
RESTART SINGLE SIGN-ON SERVICE
Restart Single Sign-On service, dex, on the Cluster Leader for the configuration changes to take effect.
systemctl restart dex
ENABLE SINGLE SIGN-ON
- Log into the SevOne GUI as an administrator.Important: If you are already logged in, refresh the user interface.
- From the navigation bar, click on the Administration menu and select Cluster Manager.
- Click on Cluster Settings tab.
- Choose Login subtab.
- Field Enable Peer Certificate Verification must be unchecked if you are using an unsigned SSL certificate.
- Select the Enable Single Sign-On check box to enable Single Sign-On.
- Click Save to save the Login settings.Note: If you have followed the instructions to configure dex but have encountered the following error, it may be related to one of the following issues.
Error
Login did not save successfully. The following errors were reported: Single Sign-On - Invalid configuration. Please configure Dex before enabling Single Sign-On.
- You may need to regenerate the SSL certificate for your appliance. Please refer to Generate a
Self-Signed Certificate or a Certificate Signing Request guide for details on generating the SSL
certificate.Important: Please make sure the Common Name when generating your certificate request matches the OpenID-Connect Issuer URL field on this page. It should be the appliance IP address.
- Configured DNS server in NMS should be able to resolve the OpenID-Connect Issuer URL.
- You may need to regenerate the SSL certificate for your appliance. Please refer to Generate a
Self-Signed Certificate or a Certificate Signing Request guide for details on generating the SSL
certificate.
REDIRECT ON LOGOUT
If you only have IdP initiated login enabled, NMS has the ability to redirect externally on logout or session timeout.
Execute the following command to add the destination URL to the Cluster Leader's database.
mysqlconfig -h $cluster_master_ip -e "INSERT INTO net.settings(setting, value) \
VALUES('logout_url', '$destination_url') ON DUPLICATE KEY UPDATE value = VALUES(value)"
HSA CONFIGURATION
If the Cluster Leader fails over to its HSA, Single Sign-On will stop working. Please make sure that dex is not running on an HSA prior to a failover - it should be kept in stopped state. If you have dex running on an HSA prior to a failover, ability to login will be impaired on the entire NMS cluster.
Once the Cluster Leader fails over to the HSA, the authentication will fallback to local SevOne authentication. At this point, dex can be configured for Single Sign-On. And, dex can now be started and Single Sign-On can be enabled from the User Interface.
When the Cluster Leader fails over to the HSA, the Identity Provider configuration must be updated to point to the HSA's IP Address / hostname.
Execute the following steps to enable Single Sign-On on the HSA.
- Fail over the Cluster Leader to the HSA.
- Make sure the HSA has a valid dex config. This includes a valid dex secret and
dex MySQL password. To ensure the conditions are met, run the following setup script each
time a failover/takeover
happens.
bash /usr/local/scripts/dex_setup_template.sh
Note: This will regenerate a bare-minimum working dex configuration with a valid dex secret and dex MySQL password. Update the existing /config/dex.yaml file with the newly generated dex secret and dex MySQL password. - Port all configuration options from the Cluster Leader's /config/dex.yaml file on
to the HSA. Note: Even if the setup script is used to generate a valid dex configuration, you are still required to port the configuration from the Cluster Leader.
- Restart dex on the HSA.
- Enable Single Sign-On from the graphical user interface. Execute the steps below.
- From the navigation bar, click the Administration menu and select Cluster Manager.
- Click on Cluster Settings tab.
- Click on Login subtab.
- Unselect the Enable Single Sign-On check box.
- Click Save to save the settings.
- Select the Enable Single Sign-On check box.
- Click Save to save the settings.
dex wraps SAML in OpenID-Connect tokens.
UPGRADE PROCESS
If you are upgrading from SevOne NMS 5.7.2.15, had Single Sign-On enabled, and dex configuration has changed, you will need to re-enable Single Sign-On. Please follow the steps below.
- SSH into the Cluster Leader IP address as support.
$ ssh support@<Cluster Leader IP address>
- Rerun the setup script.
$ sudo su $ podman exec -it nms-nms-nms /bin/bash $ bash /usr/local/scripts/dex_setup_template.sh
- A new config will be written to /config/dex.yaml. And, it will save the old config to /config/dex.yaml.backup.
- Copy and paste the custom config from connectors section in
/config/dex.yaml.backup to the connectors section in
/config/dex.yaml.Important:
- yaml files are sensitive about indentations. Please be sure your indentation is correct.
- If you had any other custom config outside of connectors section in the old config file, you will need to transfer that config over to the new config file as well.
- Restart Single Sign-On service, dex, on the Cluster Leader for the configuration changes
to take effect.
systemctl restart dex
LOGIN CSRF
Login CSRF is a type of attack where the attacker can force the user to log in to the attacker’s account on a website and thus reveal information about what the user is doing while logged in. The risk varies depending on the application and hard to detect / evaluate it. If a public registration for the application exists, the risk of an attack increases drastically as it is very easy for the attacker to create an account and thus, know the credentials for it.
Login CSRF is like any other CSRF. The only difference is that it occurs on the login form. For additional information, you may search for CSRF in general from your web browser.
To prevent Login CSRF, you must implement a token system in your code to ensure that a random token (i.e., CSRFToken) is generated which is set as a cookie and as a hidden value in the form. When the form is submitted, the code must check if the token in the form is the same as the token in the cookie and if the token matches, you will be able to log in.
The token works as a protection because the attacker does not know the value of the cookie CSRFToken and therefore, cannot send that value in the form.
TROUBLESHOOTING
➤ Is DEX Running?
To identify the status of dex on the Cluster Leader, you must execute the following command.
- Execute the following command from the host to check the dex status.
systemctl status dex
If dex is running, it will return a message similar to the example below.
Exampledex.service - Dex Loaded: loaded (/etc/containers/systemd/dex.container; generated) Active: active (running) since Tue 2024-07-09 17:34:59 UTC; 2h 1min ago Process: 2365965 ExecStopPost=/usr/bin/podman rm -v -f -i --cidfile=/run/dex.cid (code=exited, status=0/SUCCESS) Process: 2365934 ExecStop=/usr/bin/podman rm -v -f -i --cidfile=/run/dex.cid (code=exited, status=0/SUCCESS) Main PID: 2366012 (conmon) Tasks: 8 (limit: 50216) Memory: 36.4M CGroup: /system.slice/dex.service ├─libpod-payload-8e37a5524368883e88c0110ac49f63b8316f4a4143a23a1a8add5d8b1d4e91a3 │ └─2366022 /usr/local/bin/dex serve /config/dex.yaml └─runtime ├─2366009 /usr/bin/fuse-overlayfs -o lowerdir=/var/lib/containers/storage/overlay/l/XOFTFBIRI3IHVUTF7QIIMDMREL:/var/lib/containers/storage/overlay/l/CP> └─2366012 /usr/bin/conmon --api-version 1 -c 8e37a5524368883e88c0110ac49f63b8316f4a4143a23a1a8add5d8b1d4e91a3 -u 8e37a5524368883e88c0110ac49f63b8316f4a>
This indicates that you are on the Cluster Leader, /config/dex.yaml file is present, and dex is RUNNING.
If dex is not running, you will see a message similar to the example below.
Exampledex.service - Dex Loaded: loaded (/etc/containers/systemd/dex.container; generated) Active: inactive (dead)
In this scenario, make sure that, you are on the Cluster Leader and /config/dex.yaml file is present prior to restarting dex.
systemctl restart dex
Note: systemctl status dex script does not consider if Single Sign-On is enabled.Single Sign-On can be enabled from the SevOne NMS Graphical User Interface. Enter the URL of your Cluster Leader, from the navigation bar, click on Administration menu, select Cluster Manager, select tab Cluster Settings, subtab Login. You will see field Enable Single Sign-On under Single Sign-On section.
FAQs
- What is Default RelayState?
In SAML spec, the RelayState is an optional parameter. We use the Default RelayState to signify specific login journey inside dex and it is important to be matched by both the IdP configuration and the /config/dex.yaml file. Currently it is set to NMS Client ID, sevonenms.
For additional details, please refer to https://stackoverflow.com/a/34351756
- What is NMS Client ID? Why is it set to sevonenms?
NMS Client ID is set to sevonenms but, it can be changed.
The NMS Client ID is passed in the Default RelayState field from the IdP in order to trigger the authentication against the correct client setup in dex. This is needed as dex can support multiple different clients and we use it to distinguish an NMS specific authentication journey.
- What is the difference between Identity Provider Single Sign-On URL & Identity
Provider Issuer?
These are provided from the IdP configuration and must be part of a valid IdP configuration. The customer must configure dex accordingly.
- What is x.509 Certificate?
This is the IdP provided certificate. Each IdP must have a certificate that needs to be copied on SevOne NMS box and dex must be configured to use it for validation purposes.
- What does ssoURL & ssoIssuer mean in /config/dex.yaml
file?
The ssoURL and the ssoIssuer must be provided by the IdP. These are customer specific and must be configured by the customer. If the customer has a working IdP configuration then, they should be able to specify the ssoURL and ssoIssuer from the IdP configuration.
- What does redirectURI & entityIssuer mean in /config/dex.yaml
file?
The redirectURI and entityIssuer must point to the NMS Cluster Leader's IP address. redirectURI is a URL that handles the login authentication. The user will be redirected here from the Identity Provider so, the URL must be reachable.
For example, https://10.168.128.11/sso/callback, where 10.168.128.11 is the <Cluster Leader IP address>.
- How can I determine if I have only IdP initiated login enabled?
IdP relates to a specific SAML workflow. Generally, this is what most customers will use and it depends on their requirements. Service Provider initiated login is also available through dex but it has to be configured accordingly.
- Does SevOne support SHA-256 or higher certificate signing algorithm?
Yes.
- What are the certificate signing options?
Applications can only sign SAML assertions.
- What is the requirement for IdP?
Base64-encoded and URLs.
- Is Service Provider Metadata required?
No.
- Is SAML JIT support required?
No.
- Is User Provisioning support required?
No.