A Python tool to manage NG WAF deployments on Fastly services, offering features like provisioning, edge security object management, traffic ramping, and backend synchronization.
Before running the script, ensure the following are installed and set up:
- Python 3.x
requestslibrary for Python (Installable viapip3 install requests)- Access credentials for NG WAF and Fastly
- Cookie file: A
.voltron_cookiefile containing thecookievalue from Voltron.
To use the tool, you need to create a .voltron_cookie file with the full cookie value from Voltron. Here’s how you can do that:
-
Login to the Voltron Dashboard:
- Open your browser, navigate to Voltron, and log in.
-
Open the Developer Tools:
- Right-click the page, select "Inspect" (or press
F12), and go to the Network tab.
- Right-click the page, select "Inspect" (or press
-
Capture a cURL Request:
- In the Network tab, perform any action on the Voltron dashboard to trigger a request.
- Locate a request made to Voltron.
- Right-click the request and select "Copy as cURL".
-
Extract the Cookie:
- From the copied cURL, find the
-H 'cookie: ...'section, and copy the entire cookie string.
- From the copied cURL, find the
-
In your project directory, create a
.voltron_cookiefile that includes the cookie string. -
The content of the
.voltron_cookiefile will look something like this:
_ga=GA1.2.184163117.1724087216; _gid=GA1.2.1553403690.1725903286; goth-session=MTcyNTk...The script automatically checks if the .voltron_cookie file is out of date (older than one day). If it is, you will be prompted to enter a new cookie value.
-
Clone the Repository:
git clone https://github.com/fastly/ngwafcli.git cd ngwafcli -
Install Dependencies:
pip3 install requests parsel
The script can be executed using command-line arguments to manage corp groups.
Execute the script with parameters:
python3 voltron.py --corp 'your_corp_name' --action 'add' --groups 'group1' 'group2'python3 voltron.py --corp 'ExampleCorp' --action 'add' --groups 'sigsci-edge-dynamic-backends' 'rate-limiting'The script supports batch processing with multiple sites from a CSV file. Ensure the CSV contains columns for site_name and fastly_sid.
site_name,fastly_sid
site1,serviceID1
site2,serviceID2
To use a CSV file:
python3 voltron.py --csv_file 'path/to/sites.csv'- Automatically prompts the user for a new cookie if the
.voltron_cookiefile is older than 1 day.
- Add a corp to specified groups such as
sigsci-edge-dynamic-backendsorrate-limiting.
Contributions are welcome! Fork the repository and submit pull requests.
Sina Siar - @ssiar - ssiar@fastly.com