Closed MiguelCasaresRobles closed 2 years ago
Can someone elaborate under "details" for 9- Run the Open Distro security admin script to apply the changes made to the configuration files.
Hi team!
We will add instructions for SSO login using "onelogin"
IDP application
Website: [https://www.onelogin.com]
1- Create an account in onelogin
. Request a free trial if you don't have a paid license.
2-Add the onelogin
extension in your browser
3- Create a new user. This step can be skipped if you are just testing, you can use your onelogin
admin user for the example.
4- Create a new app using the "SAML Custom Connector (Advanced)"
template. Configure the SAML settings while you create the app.
5- Add the created user to the new app.
6-Get the metada.xml file and X.509 certificate from the application
7- Configure Open Distro security configuration files.
8- Run the Open Distro security admin script to apply the changes made to the configuration files.
9- Configure the Kibana configuration file.
10- Change the logout configuration in Kibana
11- Restart Kibana.
12- Test the configuration.
**1- Create an account in onelogin. Request a free trial if you don't have a paid license.
**2-Add the onelogin
extension in your browser
**3- Create a new user. This step can be skipped if you are just testing, you can use your onelogin
admin user for the example.
Login to onelogin
web console, select "Administration"
>> "Users"
>>"New User"
On the created user complete the mandatory fields and include also the field that we will use to send to Kibana as external role (Backend role) and map to Kibana roles. In this example, we use the field "Department"
:
**4- Create a new app using the "SAML Custom Connector (Advanced)"
template. Configure the SAML settings while you create the app.
Go to "Applications"
tab >> "Applications"
and the click on "Add app"
Select the "SAML Custom Connector (Advanced)"
application.
In "Info"
we selected the name "Wazuh"
Go to "Configuration"
tab and fill the information in red rectangles:
Go to "Parameters"
tab and click on "+"
to add a new parameter to the app:
In our example, we named the new parameter as "Roles"
, the we have to select the value "Department"
and "Include in SAML assertion"
The rest of the app configuration is left as default.
**5- Add the created user to the new app
Go to "Users"
and select the created user. Go to "Applications"
and click on "+"
to add a new application:
**6-Get the metada_onelogin.xml
file and X.509 certificate
from the application
Go to "Applications"
tab >> "Applications"
and then select the "Wazuh"
app. Click on "More Actions"
and then select "SAML Metadata"
Save the file as XML
or open it, select all and save it in XML
format. This will be our idp.metadata_file
in Opendistro_security configuration. The idp.entity_id
will be value of Issuer URL
in SSO
tab of the "Wazuh"
app:
The sp.entity_id
is the Audience (EntityID) in the "Configuration"
tab of the "Wazuh"
app:
The roles_key
is the name of the parameter added in the "Wazuh"
app. In our example is "Roles"
Finally, to obtain the exchange_key
go to SSO
tab of the "Wazuh"
app and select "View Details"
in "X.509 Certificate"
. Copy the blob of the certificate excluding the -----BEGIN CERTIFICATE-----
and -----END CERTIFICATE-----
lines:
**7- Configure Open Distro security configuration files.
We will need to configure some files in /usr/share/elasticsearch/plugins/opendistro_security/securityconfig/
. The files we will configure are config.yml
and roles_mapping.yml
- config.yml:
...
saml_auth_domain2:
http_enabled: true
transport_enabled: true
order: 1
http_authenticator:
type: saml
challenge: true
config:
idp:
metadata_file: "/usr/share/elasticsearch/plugins/opendistro_security/securityconfig/metadata_onelogin.xml"
entity_id: "https://app.onelogin.com/saml/metadata/xxxxxxx"
sp:
entity_id: wazuh-saml
kibana_url: https://<kibana_ip>
roles_key: Roles
exchange_key: 'X.509 Certificate'
authentication_backend:
type: noop
...
- roles_mapping.yml:
---
# In this file users, backendroles and hosts can be mapped to Open Distro Security roles.
# Permissions for Opendistro roles are configured in roles.yml
_meta:
type: "rolesmapping"
config_version: 2
# Define your roles mapping here
## Demo roles mapping
all_access:
reserved: false
backend_roles:
- "admin"
- "wazuh"
- "wazuh-admin"
description: "Maps admin to all_access"
...
**8- Run the Open Distro security admin script to apply the changes made to the configuration files.
/usr/share/elasticsearch/plugins/opendistro_security/tools/securityadmin.sh -cd /usr/share/elasticsearch/plugins/opendistro_security/securityconfig/ -nhnv -cacert /etc/elasticsearch/certs/root-ca.pem -cert /etc/elasticsearch/certs/admin.pem -key /etc/elasticsearch/certs/admin-key.pem -h localhost -icl
**9- Configure the Kibana configuration file.
We have to add these two lines in kibana.yml
:
opendistro_security.auth.type: "saml"
server.xsrf.whitelist: ["/_opendistro/_security/saml/acs/idpinitiated", "/_opendistro/_security/saml/acs", "/_opendistro/_security/saml/logout"]
10- Change the logout configuration in Kibana - /usr/share/kibana/plugins/opendistroSecurityKibana/server/auth/types/saml/routes.js**
...
this.router.get({
path: `/logout`,
validate: false
...
**11- Restart Kibana.
# systemtl restart kibana
**12- Test the configuration.
Go to your Kibana URL
and log in with your onelogin
account. Test also the logout.
Hi - not all the filepaths line up in the instructions above as they are for an outdated version of Wazuh but for the most part I was able to figure it out (ex. /usr/share/elasticsearch/plugins/opendistro_security/securityconfig/
became /usr/share/wazuh-indexer/plugins/opensearch-security/securityconfig
).
However, I am not able to figure out the equivalent file to kibana.yml
in step 10 of the Okta instructions, can someone point me in the right direction? Thanks!
Hi @ryangniadek, the document is currently being reworked and it will be updated to match the new version of wazuh very soon. Kibana.yml
is now opensearch_dashboards.yml
, you can find this in this path /etc/wazuh-dashboard/opensearch_dashboards.yml
. Step 10 should look like this
opensearch_security.auth.type: "saml"
server.xsrf.whitelist: ["/_plugins/_security/saml/acs", "/_plugins/_security/saml/logout", "/_opendistro/_security/saml/acs", "/_opendistro/_security/saml/logout", "/_opendistro/_security/saml/acs/idpinitiated"]
In step 9, what is the updated paths for the following certs:
/usr/share/elasticsearch/config/<cert_key>.pem
/usr/share/elasticsearch/config/<cert>.pem
/usr/share/elasticsearch/config/<ca_cert>.pem
@ryangniadek
/etc/wazuh-indexer/certs/admin-key.pem
/etc/wazuh-indexer/certs/admin.pem
/etc/wazuh-indexer/certs/root-ca.pem
There's an updated guide here that will be of help
Is it possible to get the default login form with a "Login with SAML" button?
Hello team,
Opendistro has many security features that we may consider to add as a guide in our documentation.
Introduction
In this guide, you can find some instructions to configure Single Sign On in Kibana using several Identity Providers (IdP) and the Open Distro for Elasticsearch Security plugin.
The guide assumes you already have an Open Distro installation. You can find instructions to install Open Distro for Elasticsearch in the Open Distro documentation: https://opendistro.github.io/for-elasticsearch-docs/docs/install/
The IdP covered are:
Required parameters
We will need to know some parameters to make the configurations:
idp.metadata_url
: URL to a XML file that contains metadata information about the application configured on the IdP side. It's used instead ofidp.metadata_file
idp.metadata_file
: XML File that contains the Metadata information about the application configured on the IdP side. It's used instead ofidp.metadata_url
idp.entity_id
: Entity ID of the Identity Provider.sp.entity_id
: Entity ID of the Service Provider.kibana_url
: URL to access Kibana.roles_key
: The attribute in the SAML assertion where the roles/groups are sent.exchange_key
: The key that will be used to sign the assertions.Identity Providers
Okta
# Okta Web: https://www.okta.com/ ## Steps list: **1- Create an account in Okta. Request a free trial if you don't have a paid license.** **2- Create a new user. This step can be skipped if you are just testing, you can use your Okta admin user for the example.** **3- Create a new group.** **4- Add the new user to the new group.** **5- Create a new app. Configure the SAML settings while you create the app.** **6- Add the new app to the new group.** **7- Note the necessary parameters from the new app's SAML settings.** **8- Configure Open Distro security configuration files.** **9- Run the Open Distro security admin script to apply the changes made to the configuration files.** **10- Configure the Kibana configuration file.** **11- Restart Kibana.** **12- Test the configuration.** ## Detailed steps: **1- Create an account in Okta. Request a free trial if you don't have a paid license.** **2- Create a new user. This step can be skipped if you are just testing, you can use your Okta admin user for the example.** Go to Directory → People ![createuser1](https://user-images.githubusercontent.com/30299229/81220791-2c7d2000-8fe2-11ea-8052-ea97dfca4c17.png) ![createuser2](https://user-images.githubusercontent.com/30299229/81220844-47e82b00-8fe2-11ea-8c00-893010ba0101.png) **3- Create a new group.** Go to Directory → Groups and add a group. ![creategroup1](https://user-images.githubusercontent.com/30299229/81220943-7108bb80-8fe2-11ea-86ba-0ffa5ec0ed5a.png) ![creategroup2](https://user-images.githubusercontent.com/30299229/81220966-7960f680-8fe2-11ea-9b23-7c9da8fbf92b.png) The name you give to your group will be used in the configuration. It will be our `backend_roles` in `roles_mapping.yml`. **4- Add the new user to the new group.** Go to Directory → Groups → **your group**. Click on `Manage People`. Add your user and save the changes. ![assignuser1](https://user-images.githubusercontent.com/30299229/81221011-87167c00-8fe2-11ea-925f-e266283caab3.png) **5- Create a new app. Configure the SAML settings while you create the app.** Go to Applications → Applications and click on `Add Aplication` and then `Create New App`. ![addapp1](https://user-images.githubusercontent.com/30299229/81221129-b5945700-8fe2-11ea-8d86-daeb708a8163.png) ![addapp2](https://user-images.githubusercontent.com/30299229/81221133-b6c58400-8fe2-11ea-95f0-42fbb2ac027b.png) In the `Create a New Application Integration` window, select `Web` platform and `SAML 2.0` sign-on method: ![addapp3](https://user-images.githubusercontent.com/30299229/81221138-b7f6b100-8fe2-11ea-8dd9-42724dfea6bc.png) We will be sent to the application configuration. The name of the example application is `wazuh-odfe-app`: ![addapp4](https://user-images.githubusercontent.com/30299229/81222847-43714180-8fe5-11ea-86e4-e75bcebaa151.png) As `Single sign on URL`, write `Azure Active Directory
# Azure Active Directory Web: https://portal.azure.com/ Note that you will have to request a free trial at least to make the configuration. You can do it in the process. ## Steps list: **1- Create a Microsoft account or use your own one if you already have one.** **2- Go to https://portal.azure.com/ and sign in with your Microsoft account.** **3- Create an app in `Azure Active Directory`:** **4- Create a role for your application.** **5- Assign a user to the app.** **6- Configure Single sign-on.** **7- Note the necessary parameters.** **8- Configure Open Distro security configuration files.** **9- Run the Open Distro security admin script to apply the changes made to the configuration files.** **10- Configure the Kibana configuration file.** **11- Restart Kibana.** **12- Test the configuration.** ## Detailed steps: **1- Create a Microsoft account or use your own one if you already have one.** **2- Go to https://portal.azure.com/ and sign in with your Microsoft account.** **3- Create an app in `Azure Active Directory`:** Go to `Azure Active Directory` → `Enterprise applications` and create a new application: ![ad](https://user-images.githubusercontent.com/30299229/81338230-8fd38480-90ac-11ea-8f47-d15160b6f7e6.png) ![enterpriseapp](https://user-images.githubusercontent.com/30299229/81338306-b1cd0700-90ac-11ea-9a44-6ef017987179.png) Select `Integrate any other application you don't find in the gallery`. Give a name to your application and click `Add`. I named my application `wazuh-sso`, but the name will not be used in the configuration. **4- Create a role for your application.** Go back to `Azure Active Directory` and click on `App registrations`: ![appreg](https://user-images.githubusercontent.com/30299229/81338687-53545880-90ad-11ea-9120-9d9cc3260f5b.png) Select your new app and click `Manifest`. ![manifest](https://user-images.githubusercontent.com/46934023/115479083-0914aa80-a21e-11eb-8a8c-70088e59c6ca.png) Add a new role to your application's `Manifest`: ```json { "allowedMemberTypes": [ "User" ], "description": "Wazuh role", "displayName": "Wazuh_role", "id": "PingOne
# PingOne Web: https://www.pingidentity.com/ ## Steps list: **1- Create an account in Ping Identity. Request a free trial if you don't have a paid license.** **2- Go to https://console.pingone.com/ and sign in with your Ping Identity account.** **3- Create an app in `Connections`** **4- Create a group and assign users** **5- Activate application and note the necessary parameters.** **6- Configure Open Distro security configuration files.** **7- Run the Open Distro security admin script to apply the changes made to the configuration files.** **8- Configure the Kibana configuration file.** **9- Restart Kibana.** **10- Test the configuration.** ## Detailed steps: **1- Create an account in Ping Identity. Request a free trial if you don't have a paid license.** **2- Go to https://console.pingone.com/ and sign in with your Ping Identity account.** **3- Create an app in `Connections`** Go to `Connections` -> `Applications` -> `Add Application`. Select `Web App` and then `SAML` -> `Configure` ![image](https://user-images.githubusercontent.com/46934023/121444205-6b0fa780-c965-11eb-8f4a-9bbb878f2a57.png) ![image](https://user-images.githubusercontent.com/46934023/121445522-04d85400-c968-11eb-8d65-eb58ab1120df.png) Give a name to your application and click Next. I named my application `wazuh-sso`, but the name will not be used in the configuration. Select `Manually Enter` on the `Provide App Metadata` ![image](https://user-images.githubusercontent.com/46934023/121445808-93e56c00-c968-11eb-8e42-dae34ec07aa5.png) Add the proper configuration: ACS URLS: `https://Google
# Google Web: https://workspace.google.com/ ## Steps list: **1- Create an account in Google Workspace. Request a free trial if you don't have a paid license.** **2- Go to https://admin.google.com/ac/apps/unified and sign in with your Google Admin account.** **3- Create and app with `Add custom SAML app`** **4- Turn ON acces for everyone** **5- Define attribute for users** **6- Configure Open Distro security configuration files.** **7- Run the Open Distro security admin script to apply the changes made to the configuration files.** **8- Configure the Kibana configuration file.** **9- Restart Kibana.** **10- Test the configuration.** ## Detailed steps: **1- Create an account in Google Workspace. Request a free trial if you don't have a paid license.** **2- Go to https://admin.google.com/ac/apps/unified and sign in with your Google Admin account.** **3- Create and app with `Add custom SAML app`** Go to `Add App` -> `Add custom SAML app`. Enter an `App name` and Continue ![image](https://user-images.githubusercontent.com/46934023/121606161-05362500-ca24-11eb-868f-11ad355370c7.png) We should take note of the following parameters to use on the ODFE configuration: `Entity ID` Select `DOWNLOAD METADATA` and keep this file. It will need to be uploaded to some web server (or store it on a specific folder to access it locally by the server) in order to use it on the ODFE configuration file ![image](https://user-images.githubusercontent.com/46934023/121606495-a6bd7680-ca24-11eb-8a13-80df68c12a97.png) After this, select Continue. Add the proper configuration: ACS URL: `https://Jumpcloud
# Jumpcloud Web: https://jumpcloud.com/ ## Steps list: **1- Create an account in Jumpcloud. Request a free trial if you don't have a paid license.** **2- Create a new user. This step can be skipped if you are just testing, you can use your Jumpcloud admin user for the example.** **3- Create a new group and assign the user** **4- Create a new app. Configure the SAML settings while you create the app.** **5- Note the necessary parameters from the new app's SAML settings.** **6- Configure Open Distro security configuration files.** **7- Run the Open Distro security admin script to apply the changes made to the configuration files.** **8- Configure the Kibana configuration file.** **9- Restart Kibana.** **10- Test the configuration.** ## Detailed steps: **1- Create an account in Jumpcloud. Request a free trial if you don't have a paid license.** **2- Create a new user. This step can be skipped if you are just testing, you can use your Jumpcloud admin user for the example.** Go to User Management -> Users -> (+) -> Manual user entry ![image](https://user-images.githubusercontent.com/46934023/142080228-46827b46-48df-498f-9635-e5eee07d8752.png) **3- Create a new group and assign the user** Go to User Management -> User Groups -> (+) ![image](https://user-images.githubusercontent.com/46934023/142080387-0467017c-439f-4257-a8d3-b1148008387a.png) The name you give to your group will be used in the configuration. It will be our backend_roles in roles_mapping.yml. Then go to the Users tab and select the newly created user. ![image](https://user-images.githubusercontent.com/46934023/142082370-5d17601d-0975-4074-8e8e-d1f5797e8679.png) Save the changes. **4- Create a new app. Configure the SAML settings while you create the app.** Go to SSO -> (+) -> Custom SAML App ![image](https://user-images.githubusercontent.com/46934023/142082761-6219dc9e-3597-4092-8a2d-61cb7a815bc7.png) Complete the SSO tab with the appropriate information ![image](https://user-images.githubusercontent.com/46934023/142083213-bbd25f78-fddb-4a76-a1d2-cc7f6ac4815d.png) ![image](https://user-images.githubusercontent.com/46934023/142083248-84abd462-9420-462f-8aea-1d7ef6814269.png) ![image](https://user-images.githubusercontent.com/46934023/142086271-a91fe373-fa54-435b-b0c4-1afa95268e07.png) IdP Entity ID: `wazuh` (this will be the idp.entity_id in our Open Distro configuration) SP Entity ID: `wazuh-saml` (this will be the sp.entity_id in our Open Distro configuration) ACS URL: `https://