/meraki-update-l7-firewall-rules

Example of python script to update the L7 firewall rules of a Meraki MX

Primary LanguagePythonApache License 2.0Apache-2.0

Meraki Update L7 Firewall (MX) rules

What is it ?

Example of python script to update the L7 firewall rules of a Meraki MX as follow :

image

Prerequisites

  • Meraki Dashboard access
  • Meraki API key
  • Meraki network ID

Get started

  1. Clone or download this repo
git clone https://github.com/xaviervalette/meraki-update-l7-firewall-rules
  1. Install required packages
python3 -m pip install -r requirements.txt
  1. Add a config.yml file as follow:
└── meraki-update-l7-firewall-rules/
+   ├── config.yml
    ├── requirements.txt
    └── src/
         └── main.py  
  1. In the config.yml file, add the following variables:
#config.yml
---
apiKey: "<yourApiKey>"
networkId: "<yourNetworkId1>"
...
  1. Now you can run the code by using the following command:
python3 src/main.py

Output

The output should be as followed:

Request status code : 200 

{'rules': [{'policy': 'deny', 'type': 'application', 'value': {'id': 'meraki:layer7/application/101', 'name': 'CBS Sports'}}, {'policy': 'deny', 'type': 'application', 'value': {'id': 'meraki:layer7/application/40', 'name': 'ESPN'}}, {'policy': 'deny', 'type': 'application', 'value': {'id': 'meraki:layer7/application/96', 'name': 'foxsports.com'}}]}