Hello,
I'm trying to configure Layer 7 on multiple meraki firewalls (different network ID's) but the same organization. I got it to work by running the script twice on one page (example below) but I'm thinking there might be a better way to write the script. Thinking of a way to only need to state the firewall rules once in the script and somehow list the multiple network ID's. Any help if this is possible would be great.
import meraki
# Defining your API key as a variable in source code is not recommended
API_KEY = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
# Instead, use an environment variable as shown under the Usage section
# @ https://github.com/meraki/dashboard-api-python/
dashboard = meraki.DashboardAPI(API_KEY)
network_id = 'L_646829496481104079'
response = dashboard.mx_l7_firewall.updateNetworkL7FirewallRules(
network_id,
rules=[{'policy': 'deny', 'type': 'application', 'value': {'id': 'meraki:layer7/application/67', 'name': 'Xbox LIVE'}}, {'policy': 'deny', 'type': 'applicationCategory', 'value': {'id': 'meraki:layer7/category/2', 'name': 'Blogging'}}, {'policy': 'deny', 'type': 'host', 'value': 'google.com'}, {'policy': 'deny', 'type': 'port', 'value': '23'}, {'policy': 'deny', 'type': 'ipRange', 'value': '10.11.12.00/24'}, {'policy': 'deny', 'type': 'ipRange', 'value': '10.11.12.00/24:5555'}, {'policy': 'deny', 'type': 'blacklistedCountries', 'value': ['AX', 'CA']}, {'policy': 'deny', 'type': 'whitelistedCountries', 'value': ['US']}]
)
import meraki
# Defining your API key as a variable in source code is not recommended
API_KEY = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
# Instead, use an environment variable as shown under the Usage section
# @ https://github.com/meraki/dashboard-api-python/
dashboard = meraki.DashboardAPI(API_KEY)
network_id = 'L_646829496481104079'
response = dashboard.mx_l7_firewall.updateNetworkL7FirewallRules(
network_id,
rules=[{'policy': 'deny', 'type': 'application', 'value': {'id': 'meraki:layer7/application/67', 'name': 'Xbox LIVE'}}, {'policy': 'deny', 'type': 'applicationCategory', 'value': {'id': 'meraki:layer7/category/2', 'name': 'Blogging'}}, {'policy': 'deny', 'type': 'host', 'value': 'google.com'}, {'policy': 'deny', 'type': 'port', 'value': '23'}, {'policy': 'deny', 'type': 'ipRange', 'value': '10.11.12.00/24'}, {'policy': 'deny', 'type': 'ipRange', 'value': '10.11.12.00/24:5555'}, {'policy': 'deny', 'type': 'blacklistedCountries', 'value': ['AX', 'CA']}, {'policy': 'deny', 'type': 'whitelistedCountries', 'value': ['US']}]
)
print(response)