Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mx_firewall_control - Unable to update ruleset from input-file or directly #51

Open
maxencecolson opened this issue Jul 20, 2023 · 1 comment

Comments

@maxencecolson
Copy link

Hello,

I try to use the script mx_firewall_control.py to update rulesets L3 but I've got a error message with the commands to add a ruleset.

PS C:\Meraki Python Scripts> python mxfirewallcontrol.py -o "XXXXX" -f "type:network, name: Template site MX67" -c append-file:update_input.txt
2023-07-20 18:43:07 -- Retrieving organization info...
GET https://api.meraki.com/api/v1/organizations
200
2023-07-20 18:43:07 -- Selecting networks and templates according to filters...
GET https://api.meraki.com/api/v1/organizations/YYYYY/networks
200
2023-07-20 18:43:08 -- SIMULATION MODE. CHANGES WILL NOT BE SAVED. USE "-m commit" TO OVERRIDE
2023-07-20 18:43:08 -- ERROR 28: Invalid input file format "update_input.txt"
2023-07-20 18:43:08 -- ERROR: Unable to load source ruleset

But I think to follow and apply correctly the format for the file as explained on the README (to be honest, it's just a test so I don't modify a lot the template txt file provided). Also the txt file is in the same folder than the .PY.

Below the file:
update_input.txt

Also I tried to use the direct command, and I've the same type of error with an invalid format.

PS C:\Meraki Python Scripts> python mxfirewallcontrol.py -o "XXXXX" -f"type:network, name:Template site MX67" -c 
insert:1:"[{""protocol"":""any"", ""srcPort"":""Any"", ""srcCidr"":""10.6.0.1"", ""destPort"":""Any"", ""destCidr"":""any"", ""policy"":""deny"", ""syslogEnabled"":false, ""comment"":""Line 3""}]" -m commit
2023-07-20 18:59:43 -- Retrieving organization info...
GET https://api.meraki.com/api/v1/organizations
200
2023-07-20 18:59:44 -- Selecting networks and templates according to filters...
GET https://api.meraki.com/api/v1/organizations/YYYYY/networks
200
2023-07-20 18:59:44 -- SIMULATION MODE. CHANGES WILL NOT BE SAVED. USE "-m commit" TO OVERRIDE
2023-07-20 18:59:44 -- ERROR: ERROR 50: Ruleset to be added must be given in JSON format

What I'm doing wrong ?

PS1: I don't have any issue for the "print" command
PS2: I use Windows10/Visual Studio Code to launch the script.

In advance, thank you very much

@maxencecolson
Copy link
Author

UPDATE:
I fixed the 1rst issue, it's related to add an "ENTER" (line break) at the end of the txt file.
But not for the second case with JSON Format.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant