MobSF now supports SSO using SAML2, starting with version 4.0.1.
There are three user roles:
Admin
: This is the primary administrator account created during the initial setup. This role can manage users with other roles.Maintainer
: This role has permission to scan, suppress, and delete.Viewer
: This role is read-only and can only view the scan results.
For SSO integration, we only support Maintainer
and Viewer
roles.
!> When SSO is enabled, password authentication and Admin
role is turned off by default. To allow password login or admin account, set the environment variable MOBSF_SP_ALLOW_PASSWORD
to 1
before running MobSF.
The section covers how you can set up MobSF with Okta for SSO.
To setup Okta SSO, you need the Assertion Consumer Service URL from MobSF
- Assertion Consumer Service (ACS) URL - This is where Okta sends the SAML assertion via HTTP POST. The ACS URL is
<http/https>://<mobsf_host>:<mobsf_port>/sso/acs/
. For example, if you have MobSF running in your local environment, the ACS URL will behttp://localhost:8000/sso/acs/
To enable Okta SSO in MobSF, you need the Metadata URL from Okta.
- Metadata URL - This Okta URL contains metadata information required by MobSF, such as the entity ID, X509 Certificate, and SSO URL.
- Log in to your Okta Admin account.
- Under Applications, click on Create App Integration.
- Choose SAML 2.0 and click Next.
- In the General Settings, configure the following:
- App Name:
MobSF
- App logo: Use the MobSF Logo
- App Name:
![MobSF App Integration](https://private-user-images.githubusercontent.com/4301109/333020460-fefcbe0f-3c4b-400d-9e88-dfd19e836e73.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkwNTYzOTYsIm5iZiI6MTczOTA1NjA5NiwicGF0aCI6Ii80MzAxMTA5LzMzMzAyMDQ2MC1mZWZjYmUwZi0zYzRiLTQwMGQtOWU4OC1kZmQxOWU4MzZlNzMucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIwOCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMDhUMjMwODE2WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9MzRjOTA3NDQ5Mjc5ZTBiZmRjYWQ2YmViODE3ZmExN2NhODQyYTI1ZmI2MzU1OWJjY2UyMzAwYmFkZDkzZDkyYiZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.TjPaIMKQuvS-QO9BVDhUik2bdPNk0swtscecKjSPPaU)
- In the next Configure SAML tab, configure the following:
- Single sign-on URL:
<MobSF ACS URL>
- Check the box
Use this for Recipient URL and Destination URL
- Check the box
- Audience URI (SP Entity ID):
<MobSF ACS URL>
- Name ID format:
EmailAddress
- Application username:
Email
- Update application username on:
Create and Update
- Single sign-on URL:
- Under the Attribute Statements (optional) section, create a new attribute statement to send the user email to MobSF.
- Name:
email
- Name format:
Unspecified
- Value:
user.email
- Name:
- Under the Group Attribute Statements (optional) section, create a new attribute statement to send appropriate roles to MobSF.
- Name:
role
- Name format:
Unspecified
- Filter:
Matches Regex
,.*
- Name:
![SAML settings](https://private-user-images.githubusercontent.com/4301109/333026252-b7b9a2de-8d11-4f24-b8ac-1efe893ebafd.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkwNTYzOTYsIm5iZiI6MTczOTA1NjA5NiwicGF0aCI6Ii80MzAxMTA5LzMzMzAyNjI1Mi1iN2I5YTJkZS04ZDExLTRmMjQtYjhhYy0xZWZlODkzZWJhZmQucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIwOCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMDhUMjMwODE2WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9MTA4NWM1MDA2YWI3ZDc3MzY5MWQ5ODcyYmViZmMxYzliMjAxMWUxOTkwYjMwZWU1M2M0YTU3Mjc3MDYyNTZmYiZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.Kz9OilVjSCc7EoObfg15NTMtQamhOUuA5uJsdVyszc0)
-
In the next Feedback screen, tick the
This is an internal app that we have created
option and click Finish to create the MobSF Okta integration. -
You must create at least two Okta groups for the MobSF roles
Maintainer
andViewer
. The group name should contain the stringmaintainer
in it to be associated with theMaintainer
role, and any other group name will be assigned to the Read-OnlyViewer
role. You can add corresponding users to each group. -
Go to the Assignment tab of the MobSF app and assign the groups corresponding to
Maintainer
andViewer
roles.
![Screenshot 2024-05-22 at 8 36 41 PM](https://private-user-images.githubusercontent.com/4301109/333024880-f419add2-66a5-47b7-93da-349a5d958cd2.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkwNTYzOTYsIm5iZiI6MTczOTA1NjA5NiwicGF0aCI6Ii80MzAxMTA5LzMzMzAyNDg4MC1mNDE5YWRkMi02NmE1LTQ3YjctOTNkYS0zNDlhNWQ5NThjZDIucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIwOCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMDhUMjMwODE2WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9NTE4NjNmMjMxYmY4ZTZlZWQ3Nzg0ZmJmMzNjMmYxNzY4NzIxOWMzYjY1OWM1ZDI0NTMyZmRmMWMzYTIyNjJjMCZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.CJPULeY2NVip13tjmF5hgtDYraTJ4aa6tmM4VpiYNwc)
- Now Go to the Sign On tab of the created app and copy the
Metadata URL
.
![Metadata URL](https://private-user-images.githubusercontent.com/4301109/333022662-9e193176-1c26-48ba-ad92-54950b050344.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkwNTYzOTYsIm5iZiI6MTczOTA1NjA5NiwicGF0aCI6Ii80MzAxMTA5LzMzMzAyMjY2Mi05ZTE5MzE3Ni0xYzI2LTQ4YmEtYWQ5Mi01NDk1MGIwNTAzNDQucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIwOCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMDhUMjMwODE2WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9NmNkODUwZGYzM2E3YmJmMTg1ZmE3YzM2NGQ0YTY0ZTVjMTJkNzgwMzRkNGVmMjE4ZTVhNzBlMDJjYmY0YzkxNCZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.vJLjPnJdmY-PN5aUoFxPc5fScPiO0iMBOiYVbiQGb3c)
-
After you have created the Okta MobSF app integration, Set the environment variable
MOBSF_IDP_METADATA_URL
to the OktaMetadata URL
. -
Run MobSF, and now SSO with Okta is enabled.
When running MobSF behind a reverse proxy such as Nginx, ensure that the actual domain name reaches MobSF by setting headers such as X-Forwarded-Host
, X-Forwarded-Port
and
X-Forwarded-For
.
Example Nginx settings
location / {
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Port 443;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
....
}
Alternatively, you can directly set the hostname using the environment variable MOBSF_SP_HOST
. Example: MOBSF_SP_HOST=https://mobsf.yourdomain.com
Errors such as Invalid dict settings: sp_acs_url_invalid
is an indication that MobSF couldn't find the correct hostname.