Commit graph

39 commits

Author SHA1 Message Date
Christian Hesse
7b1c275cc2 script-updates: add option to ignore global-config changes 2019-04-02 08:48:35 +02:00
Christian Hesse
594aef2aab check-certificates: support multiple passphrases 2019-04-01 22:45:38 +02:00
Christian Hesse
1cd7679a07 update-tunnelbroker: get tunnelbroker config from interface comment 2019-01-04 20:20:20 +01:00
Christian Hesse
870f00bb36 global: variable names are CamelCase
___  _         ___     __
           / _ )(_)__ _   / _/__ _/ /_
          / _  / / _ `/  / _/ _ `/ __/
         /____/_/\_, /  /_/ \_,_/\__/
 _       __     /___/       _             __
| |     / /___ __________  (_)___  ____ _/ /
| | /| / / __ `/ ___/ __ \/ / __ \/ __ `/ /
| |/ |/ / /_/ / /  / / / / / / / / /_/ /_/
|__/|__/\__,_/_/  /_/ /_/_/_/ /_/\__, (_)
                                /____/

RouterOS has some odd behavior when it comes to variable names. Let's
have a look at the interfaces:

[admin@MikroTik] > / interface print where name=en1
Flags: D - dynamic, X - disabled, R - running, S - slave
 #     NAME                                TYPE       ACTUAL-MTU L2MTU
 0  RS en1                                 ether            1500  1598

That looks ok. Now we use a script:

{ :local interface "en1";
  / interface print where name=$interface; }

And the result...

[admin@MikroTik] > { :local interface "en1";
{...   / interface print where name=$interface; }
Flags: D - dynamic, X - disabled, R - running, S - slave
 #     NAME                                TYPE       ACTUAL-MTU L2MTU
 0  RS en1                                 ether            1500  1598

... still looks ok.
We make a little modification to the script:

{ :local name "en1";
  / interface print where name=$name; }

And the result:

[admin@MikroTik] > { :local name "en1";
{...   / interface print where name=$name; }
Flags: D - dynamic, X - disabled, R - running, S - slave
 #     NAME                                TYPE       ACTUAL-MTU L2MTU
 0  RS en1                                 ether            1500  1598
 1   S en2                                 ether            1500  1598
 2   S en3                                 ether            1500  1598
 3   S en4                                 ether            1500  1598
 4   S en5                                 ether            1500  1598
 5  R  br-local                            bridge           1500  1598

Ups! The filter has no effect!
That happens whenever the variable name ($name) matches the property
name (name=).

And another modification:

{ :local type "en1";
  / interface print where name=$type; }

And the result:

[admin@MikroTik] > { :local type "en1";
{...   / interface print where name=$type; }
Flags: D - dynamic, X - disabled, R - running, S - slave
 #     NAME                                TYPE       ACTUAL-MTU L2MTU

Ups! Nothing?
Even if the variable name ($type) matches whatever property name (type=)
things go wrong.

The answer from MikroTik support (in Ticket#2019010222000454):

> This is how scripting works in RouterOS and we will not fix it.

To get around this we use variable names in CamelCase. Let's hope
Mikrotik never ever introduces property names in CamelCase...

*fingers crossed*
2019-01-04 12:35:34 +01:00
Christian Hesse
7d06a7e8c2 global-{config,functions}: move variables, make independent 2019-01-03 16:09:03 +01:00
Christian Hesse
6e03a3b935 script-updates: add configuration versioning 2019-01-03 15:36:26 +01:00
Christian Hesse
fe04b8b8db rename script 'check-lte-firmware-update' -> 'check-lte-firmware-upgrade'
That's the correct wording from commands..
2019-01-02 22:50:23 +01:00
Michael Gisbers
ca16f286ef update-tunnelbroker: move configuration to global-config...
... and get the external ip address from cloud.

Signed-off-by: Michael Gisbers <michael@gisbers.de>
Signed-off-by: Christian Hesse <mail@eworm.de>
2019-01-02 15:02:42 +01:00
Christian Hesse
472cd3d905 update copyright for 2019 2019-01-02 09:38:34 +01:00
Christian Hesse
44be3d8d07 check-certificates: support auto-renew of certificates 2018-12-20 15:55:40 +01:00
Christian Hesse
ee49fe3184 update-gre-address: remove settings from global-config
Instead read infos from gre interface comment.
2018-12-19 17:22:36 +01:00
Christian Hesse
9f077ab8bf ipv6-update: remove settings from global-config
Instead make it more robust by reading comments.
2018-12-19 16:48:34 +01:00
Christian Hesse
6f606f9ca5 email-backup: support cloud backup 2018-12-18 22:48:28 +01:00
Christian Hesse
9346df67d7 add script 'check-lte-firmware-update' 2018-12-14 23:04:18 +01:00
Christian Hesse
6e4d715937 global-functions: add identity tag in $SendNotification
... and send subject in telegram message.
2018-11-28 21:19:39 +01:00
Christian Hesse
c4f8c1ad52 global-config: add identity tag 2018-11-26 13:45:02 +01:00
Christian Hesse
015f8e01b5 global-config: sort sms-action alphabetically 2018-11-13 10:20:45 +01:00
Christian Hesse
e17389749f global-config: add more examples for mode button and sms-action 2018-11-13 10:20:14 +01:00
Christian Hesse
7aae1bf9dd global-config: default for telegram is empty strings...
... to make sure the api is not flooded with invalid requests.
2018-10-10 10:22:18 +02:00
Christian Hesse
5e4ef0ab8f global-functions: add function to notify via e-mail and telegram 2018-10-09 15:46:39 +02:00
Christian Hesse
977a5d5f5e global-functions: move daily psk secrets to global-config 2018-10-09 14:17:19 +02:00
Christian Hesse
7b4bef1a1e make GeneratePSK a global function 2018-10-09 14:15:34 +02:00
Christian Hesse
9c3f3b9f20 add global-functions 2018-10-09 14:15:34 +02:00
Christian Hesse
311475e67c add script 'bridge-port-toggle'
... to toggle between configuration 'default' and 'alt'.
2018-10-04 14:03:09 +02:00
Christian Hesse
17f64b48af bridge-port-to-default: support different configurations
Just add something like this to your bridge ports:

comment="default:br-ext,alt:br-intern"
2018-10-04 13:56:09 +02:00
Christian Hesse
ea4b739d00 global-config: add missing semicolons 2018-10-04 13:32:21 +02:00
Christian Hesse
be673737d3 start scripts with a magic token / shebang 2018-09-27 00:18:43 +02:00
Christian Hesse
5fff04ed0e fix typos 2018-09-13 22:25:38 +02:00
Christian Hesse
95794d0367 sms-action: move configuration to global-config 2018-09-13 22:07:12 +02:00
Christian Hesse
172d789f2a add scripts mode-button-{event,scheduler} 2018-09-10 22:15:54 +02:00
Christian Hesse
2de26a6617 check-routeros-update: enable auto update for safe version 2018-09-05 23:45:35 +02:00
Christian Hesse
23b167e84b check-routeros-update: resend notification if version changes 2018-08-30 11:14:01 +02:00
Christian Hesse
21f2b04f9a script-updates: add support for url suffix
This allows to fetch from different branch...
2018-08-27 11:15:03 +02:00
Christian Hesse
07e54dd88b add empty comment at first line...
... for better formatting in export.
2018-08-24 16:58:30 +02:00
Christian Hesse
2ec96e9db4 add script 'gps-track' 2018-08-06 14:21:55 +02:00
Christian Hesse
a80591f510 script-updates: always accept updates from file 2018-07-10 00:05:30 +02:00
Christian Hesse
a6d809ef8e global-config: script-updates url examples for github and gitlab 2018-07-09 17:06:17 +02:00
Christian Hesse
56e641a980 script-updates: support fetch from url 2018-07-09 16:05:04 +02:00
Christian Hesse
e1f134ead5 add scripts 2018-07-05 15:34:08 +02:00