What’s new in 6.42 (2018-Apr-13 11:03):
netwatch - limit to read, write, test and reboot policies for Netwatch script execution;
I have just upgraded my router to v6.42.1 (due to the latest in a growing list of very troubling security flaws, thanks Mikrotik).
Netwatch was working fine until then. I find that I can still put an entry in a log file using Netwatch, but I cannot change a variable from a Netwatch script.
So I am guessing the issue is to do with permissions. I have no idea if these can be changed. I have not found a handle for it yet, if indeed this is the issue.
OK so in your particular issue, not being able to call a script, if you go to the script itself and uncheck all policy options with the exception of read, write, test and reboot, you should be able to call the script (it worked for me).
Assuming of course you script does not require other policy options to function correctly.
I am no longer able to change the value of a global variable from within Netwatch.
If I create a script to change the global variable, and call that from Netwatch, the global variable will not change unless the policy option “policy” is checked for the script.
I verified this by a manual run of the script.
Since Netwatch can now only call scripts that have (at most) policies “read”, “write”, “test” and “reboot” - the script will not call when I check the “policy” option, as is seemingly required in order to modify a global variable.
Intuitively I would have figured that the “write” option would be enough to allow us to change a global variable. However it is the “policy” option that appears to allow us to do this. Not sure if it has always been this way, or if it is a bug.
Anyhow it appears that the usefulness of Netwatch is somewhat limited moving forward.
Yes you can put the entire scripts in the NetWatch Up/Down script windows.
However in my case - writing to a global variable - this ceased to work with the new software version no matter whether I put the function in the NetWatch script window, or I called a script with the function in it, as explained above.
So I guess it is just a matter of what you are doing in the script - as some script permissions (functions) seems to have been removed for NetWatch.
Hi.
Following your method I got to have netwatch to execute the up and down scripts. As test I just wrote a line in the log and I checked both the run counter and the log. So fine.
Then I put some more lines in the same test scripts, and tried to run the command trying to execute a command, like /tool e-mail, it doesn’t execute it and, moreover, doesn’t execute nothing else before or after the command. This even happens just executing the script from Winbox or terminal.
So, probably the command execution inside the script itself is the problem, not only netwatch !
Is something you have seen in your tests?..