UNCLASSIFIED

Commit 987995b2 authored by thomas.burton's avatar thomas.burton
Browse files

updated docs for SAML integration.

parent dee56743
...@@ -3,3 +3,5 @@ ...@@ -3,3 +3,5 @@
0.1.0 (06/15/2020) 0.1.0 (06/15/2020)
Manifests for deploying Twistlock 20.04.196 Manifests for deploying Twistlock 20.04.196
0.2.0 (08/24/2020)
Updated docs/readme.md to reflect keycloak SAML setup.
# Twistlock # Twistlock
## This should not go into production with license and token . ## This should not go into production with license and token
## Twistlock under DSOP ## Twistlock under DSOP
The Twistlock Platform provides vulnerability management and compliance across the application lifecycle by scanning images and serverless functions to prevent security and compliance issues from progressing through the development pipeline, and continuously monitoring all registries and environments. The Twistlock Platform provides vulnerability management and compliance across the application lifecycle by scanning images and serverless functions to prevent security and compliance issues from progressing through the development pipeline, and continuously monitoring all registries and environments.
This installation follows the Twistlock documented guidance. Twistlock documentation can be found at: This installation follows the Twistlock documented guidance. Twistlock documentation can be found at:
https://docs.paloaltonetworks.com/prisma/prisma-cloud/20-04/prisma-cloud-compute-edition-admin/welcome.html <https://docs.paloaltonetworks.com/prisma/prisma-cloud/20-04/prisma-cloud-compute-edition-admin/welcome.html>
The Twistlock Console is deployed as a part of the gitops. Once deployed the process of setting up daemonsets is currently a manual process. For this installation the following information is needed: The Twistlock Console is deployed as a part of the gitops. Once deployed the process of setting up daemonsets is currently a manual process. For this installation the following information is needed:
...@@ -18,13 +18,17 @@ The Twistlock Console is deployed as a part of the gitops. Once deployed the pr ...@@ -18,13 +18,17 @@ The Twistlock Console is deployed as a part of the gitops. Once deployed the pr
* Elasticsearch and Kibana deployed to Kubernetes namespace * Elasticsearch and Kibana deployed to Kubernetes namespace
Install kubectl Install kubectl
``` ```
brew install kubectl brew install kubectl
``` ```
Install kustomize Install kustomize
``` ```
brew install kustomize brew install kustomize
``` ```
### Deployment ### Deployment
Clone repository Clone repository
...@@ -33,6 +37,7 @@ Clone repository ...@@ -33,6 +37,7 @@ Clone repository
git clone https://repo1.dsop.io/platform-one/apps/twistlock.git git clone https://repo1.dsop.io/platform-one/apps/twistlock.git
cd twstlock cd twstlock
``` ```
Apply kustomized manifest Apply kustomized manifest
``` ```
kubectl -k ./ kubectl -k ./
...@@ -43,21 +48,23 @@ kubectl -k ./ ...@@ -43,21 +48,23 @@ kubectl -k ./
The application needs a administrator, the license file needs to be installed, then a defender.yaml needs to be generated and deployed, then logging needs to be enabled. This has been consolidated in a script called twistlock_setup.sh. The application needs a administrator, the license file needs to be installed, then a defender.yaml needs to be generated and deployed, then logging needs to be enabled. This has been consolidated in a script called twistlock_setup.sh.
The Variables required are as follows: The Variables required are as follows:
``` ```
$ //Environment //Environment
$ TWISTLOCK_CONSOLE_USER=Administrator $ TWISTLOCK_CONSOLE_USER=Administrator
$ TWISTLOCK_CONSOLE_PASSWORD=< my password> $ TWISTLOCK_CONSOLE_PASSWORD=< my password>
$ TWISTLOCK_EXTERNAL_ROUTE=twistlock.fences.dsop.io $ TWISTLOCK_EXTERNAL_ROUTE=twistlock.fences.dsop.io
$ TWISTLOCK_LICENSE= $ TWISTLOCK_LICENSE=
$ TOKEN=<Generated Bearer token Manage/Authentication/User Certificates> $ TOKEN=<Generated Bearer token Manage/Authentication/User Certificates>
``` ```
This process requires kubectl to be installed and able to communicate with the DSOP cluster. This process requires kubectl to be installed and able to communicate with the DSOP cluster.
#### Add an Administrator #### Add an Administrator
Initially there is no users associated with twistlock console. Go to the external URL and add an Administrator account and a password. Alternatively, run the following script: Initially there is no users associated with twistlock console. Go to the external URL and add an Administrator account and a password. Alternatively, run the following script:
``` ``
//Add Administrator //Add Administrator
if ! curl -k -H 'Content-Type: application/json' -X POST \ if ! curl -k -H 'Content-Type: application/json' -X POST \
-d "{\"username\": \"$TWISTLOCK_CONSOLE_USER\", \"password\": \"$TWISTLOCK_CONSOLE_PASSWORD\"}" \ -d "{\"username\": \"$TWISTLOCK_CONSOLE_USER\", \"password\": \"$TWISTLOCK_CONSOLE_PASSWORD\"}" \
...@@ -66,9 +73,10 @@ if ! curl -k -H 'Content-Type: application/json' -X POST \ ...@@ -66,9 +73,10 @@ if ! curl -k -H 'Content-Type: application/json' -X POST \
echo "Error creating Twistlock Console user $TWISTLOCK_CONSOLE_USER" echo "Error creating Twistlock Console user $TWISTLOCK_CONSOLE_USER"
exit 1 exit 1
fi fi
``` ``
#### Install the license #### Install the license
The License can be added directly from the TWISTLOCK_EXTERNAL_ROUTE. When first logging in the admin user will be prompted for a license. The following script will install the license: The License can be added directly from the TWISTLOCK_EXTERNAL_ROUTE. When first logging in the admin user will be prompted for a license. The following script will install the license:
``` ```
...@@ -78,31 +86,35 @@ if ! curl -k \ ...@@ -78,31 +86,35 @@ if ! curl -k \
-H 'Content-Type: application/json' \ -H 'Content-Type: application/json' \
-X POST \ -X POST \
-d "{\"key\": \"$TWISTLOCK_LICENSE\"}" \ -d "{\"key\": \"$TWISTLOCK_LICENSE\"}" \
https://$TWISTLOCK_EXTERNAL_ROUTE/api/v1/settings/license; then https://$TWISTLOCK_EXTERNAL_ROUTE/api/v1/settings/license; then
echo "Error uploading Twistlock license to console" echo "Error uploading Twistlock license to console"
exit 1 exit 1
fi fi
``` ```
#### Install Defender with Twistcli #### Install Defender with Twistcli
This can be found in the Manage/System/Download. After download ensure the file is made executable. This can be found in the Manage/System/Download. After download ensure the file is made executable.
``` ```
$ chmod +x twistcli chmod +x twistcli
``` ```
The "Bearer" token can be found in the twistlock application Manage/Authorization/User Certificates. Alternatively, run the following commands The "Bearer" token can be found in the twistlock application Manage/Authorization/User Certificates. Alternatively, run the following commands
``` ```
//Windows twistcli: //Windows twistcli:
curl --progress-bar -L -k --header "authorization: Bearer $TOKEN" https://twistlock.fences.dsop.io/api/v1/util/windows/twistcli.exe > twistcli.exe; curl --progress-bar -L -k --header "authorization: Bearer $TOKEN" https://twistlock.fences.dsop.io/api/v1/util/windows/twistcli.exe > twistcli.exe;
``` ```
``` ```
Linux twistcli: Linux twistcli:
curl --progress-bar -L -k --header "authorization: Bearer $TOKEN" https://twistlock.fences.dsop.io/api/v1/util/twistcli > twistcli; chmod a+x twistcli; curl --progress-bar -L -k --header "authorization: Bearer $TOKEN" https://twistlock.fences.dsop.io/api/v1/util/twistcli > twistcli; chmod a+x twistcli;
``` ```
``` ```
Mac OS twistcli: Mac OS twistcli:
...@@ -114,16 +126,21 @@ curl --progress-bar -L -k --header "authorization: Bearer TOKEN" https://twistlo ...@@ -114,16 +126,21 @@ curl --progress-bar -L -k --header "authorization: Bearer TOKEN" https://twistlo
1) Download Daemonset 1) Download Daemonset
The following command can be authenticated by TOKEN or Username/Password. The following command can be authenticated by TOKEN or Username/Password.
``` ```
./twistcli defender export kubernetes --namespace twistlock --privileged --cri --monitor-service-accounts --monitor-istio --user $TWISTLOCK_CONSOLE_USER --password $TWISTLOCK_CONSOLE_PASSWORD --address https://$TWISTLOCK_EXTERNAL_ROUTE --cluster-address twistlock-console:8084 ./twistcli defender export kubernetes --namespace twistlock --privileged --cri --monitor-service-accounts --monitor-istio --user $TWISTLOCK_CONSOLE_USER --password $TWISTLOCK_CONSOLE_PASSWORD --address https://$TWISTLOCK_EXTERNAL_ROUTE --cluster-address twistlock-console:8084
``` ```
#####Download the daemonset.yaml. The default Image is set to teh Prisma server. We need to pull images from Platform 1. The image URL needs to be changed:
##### Download the daemonset.yaml. The default Image is set to teh Prisma server. We need to pull images from Platform 1. The image URL needs to be changed
##### Image: registry.dsop.io/platform-one/apps/twistlock/defender:20.04.169 ##### Image: registry.dsop.io/platform-one/apps/twistlock/defender:20.04.169
2) Install Defender 2) Install Defender
```
``
kubectl apply -f defender.yaml kubectl apply -f defender.yaml
``` ``
Install Defender from the Console UI Install Defender from the Console UI
The Daemonset generator is located in the Twistlock Console Under Manage -> Defenders -> Deploy -> Daemonset The Daemonset generator is located in the Twistlock Console Under Manage -> Defenders -> Deploy -> Daemonset
...@@ -143,7 +160,9 @@ Nodes use Container Runtime Interface (CRI), not Docker - On ...@@ -143,7 +160,9 @@ Nodes use Container Runtime Interface (CRI), not Docker - On
Nodes runs inside containerized environment - Off Nodes runs inside containerized environment - Off
#### Set up Logging #### Set up Logging
Run this code while setting the correct variables: Run this code while setting the correct variables:
``` ```
if ! curl -k \ if ! curl -k \
-u $TWISTLOCK_CONSOLE_USER:$TWISTLOCK_CONSOLE_PASSWORD \ -u $TWISTLOCK_CONSOLE_USER:$TWISTLOCK_CONSOLE_PASSWORD \
...@@ -164,4 +183,55 @@ if ! curl -k \ ...@@ -164,4 +183,55 @@ if ! curl -k \
fi fi
``` ```
## Integrating with SAML
Integrating Prisma Cloud with SAML consists of setting up your IdP, then configuring Prisma Cloud to integrate with it. for keycloak integration we will use use ADFS as the IdP.
Setting up Prisma Cloud in Keycloak
1. Follow the keycloak instructions under docs/keycloak named `configure-keycloak.md`
2. In Keycloak select the baby-yoda realm
3. On the left column, select "Clients", then new client.
4. Select load file and choose the "client.json" if available. If not, use the 'saml_example.json.md' for the correct settings. The client info can be manually entered if the client isn't available. Go into the configuration and select "Save".
5. In the left column Create a `Client Scope` for twistlock with a SAML Protocol. Return to yout twistlock client and Add the Client scope to the `Your twistlock client` client.
6. Back in the Client configuration, under "Scope" Add the twistlock scope just created.
7. Select the "Installation" tab, the download the connection file in `Mod Auth Mellon format`
_This is needed for the keycloak connection string._
8. Create a user in keycloak for twistlock. Add the user to the IL2 Group.
### The following is required for manual configuration
1. Navigate to the Twistlock URL and create an admin user, then add a license key.
2. Navigate to "Manage" -> "Authentication" in the left navigation bar.
3. Select "SAML" then the enable switch.
4. Open the installation file from keycloak.
a. The Identity Provider SSO is `https://keycloak.fences.dsop.io/auth/realms/your-realm/protocol/saml`
b. The Identity Provider is `https://keycloak.fences.dsop.io/auth/realms/your-realm`
c. The root URL is `https://twistlock.fences.dsop.io`
5. Paste the client certificate token in the x509 area. The certificate must be in pem format and include the header and footer. When completed select "Save".
If this fails, the certificate is not formatted correctly. Copy the cert to a file and test its validity.
Copy the certificate into a vi session and ensure there are three lines:
-----BEGIN CERTIFICATE-----
(certificate from step 7 keycloak install file)
-----END CERTIFICATE-----
*note: when SAML is added, the twistlock console will default to keycloak. If you need to bypass the saml auth process add "#!/login" the the end of the root url.*
6. Create a twistlock user using the same name as in step
7. There should be a "SAML box to select. If this selection is not visible, go to a different tab, then return to users.
"clientId": "unique_clinet_id__twistlock",
"name": "twistlock",
"rootUrl": "https://twistlock.fences.dsop.io/api/v1/authenticate",
"surrogateAuthRequired": false,
"enabled": true,
"alwaysDisplayInConsole": false,
"clientAuthenticatorType": "client-secret",
"redirectUris": [
"*"
],
"webOrigins": [],
"notBefore": 0,
"bearerOnly": false,
"consentRequired": false,
"standardFlowEnabled": true,
"implicitFlowEnabled": false,
"directAccessGrantsEnabled": false,
"serviceAccountsEnabled": false,
"publicClient": false,
"frontchannelLogout": true,
"protocol": "saml",
"attributes": {
"saml.assertion.signature": "true",
"saml.force.post.binding": "true",
"saml.multivalued.roles": "false",
"saml.encrypt": "false",
"saml.server.signature": "true",
"saml.server.signature.keyinfo.ext": "false",
"exclude.session.state.from.auth.response": "false",
"saml.signing.certificate": "this is populated from a previous export and will be recreated",
"saml.signature.algorithm": "RSA_SHA256",
"saml_force_name_id_format": "false",
"saml.client.signature": "false",
"tls.client.certificate.bound.access.tokens": "false",
"saml.authnstatement": "true",
"display.on.consent.screen": "false",
"saml_name_id_format": "username",
"saml.signing.private.key": "this will be populated with a key from a previous install if importing a json client description",
"saml_signature_canonicalization_method": "http://www.w3.org/2001/10/xml-exc-c14n#",
"saml.onetimeuse.condition": "false"
},
"authenticationFlowBindingOverrides": {},
"fullScopeAllowed": true,
"nodeReRegistrationTimeout": -1,
"defaultClientScopes": [
"web-origins",
"role_list",
"roles",
"profile",
"email"
],
"optionalClientScopes": [
"address",
"phone",
"offline_access",
"microprofile-jwt"
],
"access": {
"view": true,
"configure": true,
"manage": true
}
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment