In beta!
Still working on the documentation. It's not complete, or accurate, at the moment!
- Problem Statement
- Requirements
- Webex
- Webex Webhook
- Send a Webex test message
- Pipedream Setup
- Cisco API Console Registration
- PSQRT Walk Through
- Workflow Diagram
- References
Using the Cisco Security Advisories portal, it can be difficult to determine what PSIRT notifications have been updated with new information, affected products, workarounds, and patches.
This project creates a Webex App bot, using buttons and cards, that utilizes Webex Webhooks, Pipedream workflows, the Cisco PSIRT openVuln API, MongoDB, and Github Actions to respond to a Webex App message, and deliver an XLXS file of all updated Cisco PSIRT notifications that have occurred in the last 7 days.
This XLXS file will make it easier for a security team to review updated PSIRT information and take any required remediation without the need of setting up a Python environment and creating all the required connections.
Registered accounts with the following services:
- Webex - https://web.webex.com You can use the browser based client without installing the Webex messaging application. But the Webex app makes things easier.
- Pipedream - https://pipedream.com
- Cisco PSIRT OpenVuln API - https://developer.cisco.com/psirt/
- MongoDB - https://www.mongodb.com
- Github - https://github.com
Running separately, and concurrently, is psirt-gsheets. This script creates a Google Sheets document with the updated Cisco PSIRTs. The PSIRT Bot uses the Google Sheets publish to the web functionality to attach the latest report to the Webex app response.
- Create an account at https://www.webex.com.
- Create a new Bot app.
- Record the following details:
- Bot access token
- Bot username
- Bot ID
Using the Webex for Developers documentation, create a "messages" -> "created" and "attachmentActions" -> "created" Webhook. The target URL in the Webhook configuration is the Pipedream Webhook receiver URL.
From the Webex app, send a test message to the newly created Webex Bot. This message should appear in the "Select Event" section of the HTTP?Webhook "Trigger" event in Pipedream.
- Create a Pipedream.com account
- Click on "Settings"
- Click on "Environment Variables"
- Click on "NEW ENVIRONMENT VARIABLE"
- Create the following Environment Variables
- "Bearer" - Webex App Bearer Token
- "git_action" - Github Action Token
- "psirt_otoken_client_id" - Obtained in the "Cisco API Console Registration" section
- "psirt_otoken_client_secret" - Obtained in the "Cisco API Console Registration" section
- Create a new Workflow
- Add a trigger
- Click on the plus sign underneath the trigger step
- Add a Python step
- Select "Run Python Code"
- Name the step "get_user"
- Add the code included in the following image
- Click on the plus sign underneath the "get_user" step
- In the "Search for an app" field, type "filter"
- Select "Filter"
- Select "End Workflow on Custom Condition"
- Click on the "Reason" box and expand the "steps" data
- Select "First_Name"
- Complete the "Reason" logic to look like the following image
Note: To be able to find the required fields, a test messages must have been sent to the Pipedream receiver by following the instructions in the "Webex" section above.
- Follow the same steps to complete the "Condition" logic
- Click on the plus sign underneath the trigger step
- Add a Python step
- Select "Run Python Code"
- Name the step "get_msg"
- Add the code included in the following image
- Go back to the main Pipedream dashboard and select "Accounts"
- Click "CONNECT AN APP"
- In the "Search for an App" box, type "Mongo"
- Select "MongoDB"
- Complete the required account information and validate Pipedream can connect to your MongoDB database
- Click on the plus sign underneath the "get_msg" step
- In the "Search for an app" field, type "mongo"
- Select "MongoDB"
- Select "Use any MongoDB API"
- Complete the "MongoDB Account", "Database", "Collection" fields to connect MongoDB
- Add the "Data" objects and expressions to match the following image
- Name the step "create_new_document"
- Click on the plus sign underneath the trigger step
- Add a Python step
- Select "Run Python Code"
- Name the step "Github_Action"
- Add the code included in the following image
- Click on the plus sign underneath the trigger step
- Add a Python step
- Select "Run Python Code"
- Name the step "python" - or anything else you like. Since it's the last step, the name is not important.
- Add the code included in the following image
- You will need to test each step of the workflow to validate it works correctly
- Once all steps are validated, click on the "Deploy" button in the top right
- You will be taken to the "inspect" console that shows a summary of each step and a log of each Webhook request
An account will also need to be created to access the Cisco API Console.
-
Once logged into the Cisco API Console, click on "My Keys & Apps"
-
Click on "Register a New Apps
-
Give your application a name
-
Provide an optional description of the application
-
Select "Client Credentials" in the "OAuth2.0 Credentials" section
-
Select the "Cisco PSIRT openVuln API" check box
-
Agree to the "Terms of Service"
-
Click on "Register"
Save the "Key" and "Client Secret" in a secure place. These credentials will need to be added as Github secrets for the Github action to work properly.
This script requires a Python environment and the libraries included in the requirements.txt file.
Import requirements file: pip install -r requirements.txt
All the API keys are stored in a config.ini file using configparser. Your config.ini file should look like this:
Follow the instructions in the "Cisco API Console Registration section"
The generated "Key" and "Client Secret" should be used as the client_id and client_secret objects in psirt.py.
$ python.exe psirt-bot.py
psirt-bot.py is the main script.
It retrieves a calls OAuth Bearer access token, collects the number of active PSIRT listings and the number of PSIRTs that have been updated in the last 7-days.
It then collects Webex App user information stored in the MongoDB instance, and responds to the requester with a report of the PSIRTs that have been updated in the last 7-day, 14-days, or 30-days based on the selection related to the first adaptive card.
If the script is run locally, a CSV file of the report is also generated an placed in the 'reports' folder.
Example conversation in the Webex App:
YouTube walk through video from a user perspective.