Compare commits

...

15 commits

Author SHA1 Message Date
Christian Hesse
73f15a2df0 global-functions: $RmFile: ignore "no such item"...
... as this is still racy.
2026-05-07 15:58:07 +02:00
Christian Hesse
57385b5934 global-functions: $RmDir: ignore "no such item"...
... as this is still racy.
2026-05-07 15:58:07 +02:00
Christian Hesse
74d3fc2933 global-functions: $RmFile: remove with find...
... as this is still racy.
2026-05-07 15:58:07 +02:00
Christian Hesse
875df5da76 global-functions: $RmDir: remove with find...
... as this is still racy.
2026-05-07 15:58:07 +02:00
Christian Hesse
3aaba1f408 netwatch-dns: check with eworm.de and eworm.net
This should prevent against DENIC outages...

https://blog.denic.de/en/denic-reports-resolved-dnssec-disruption-affecting-de-domains/
2026-05-06 16:15:17 +02:00
Christian Hesse
0ef11bf11d global-functions: $IsDNSResolving: check with :retry 2026-05-06 16:15:17 +02:00
Christian Hesse
811df5abf2 global-functions: $IsDNSResolving: check with eworm.de and eworm.net
This should prevent against DENIC outages...

https://blog.denic.de/en/denic-reports-resolved-dnssec-disruption-affecting-de-domains/
2026-05-06 10:01:39 +02:00
Christian Hesse
cd4052ba6b Merge branch 'backup-filename-date' into next 2026-04-28 16:37:09 +02:00
Christian Hesse
2f5aa2f337 backup-{email,upload}: add setting in configuration 2026-04-28 16:36:45 +02:00
Christian Hesse
2f621a5981 backup-upload: drop the GMT offset from filename...
... as it is of little help only. Also it is ambiguous due
to signdness being dropped when cleaning the name.
2026-04-28 16:36:31 +02:00
Christian Hesse
fd956519e2 backup-email: drop the GMT offset from filename...
... as it is of little help only. Also it is ambiguous due
to signdness being dropped when cleaning the name.
2026-04-28 16:36:31 +02:00
Christian Hesse
0382a368ec backup-upload: support date & time in filename 2026-04-28 16:36:31 +02:00
Christian Hesse
d54a0d541d backup-email: support date & time in filename 2026-04-28 16:36:31 +02:00
Christian Hesse
174e16502a global-config: update comment on backup options 2026-04-28 16:36:15 +02:00
Christian Hesse
11dc1e2aa1 ipv6-update: log dynamic entry with info, not warning 2026-04-24 14:28:25 +02:00
9 changed files with 37 additions and 15 deletions

View file

@ -16,6 +16,7 @@
do={ :error ("Global config and/or functions not ready."); }; } delay=500ms max=50;
:local ScriptName [ :jobname ];
:global BackupFileNameDate;
:global BackupPassword;
:global BackupRandomDelay;
:global BackupSendBinary;
@ -73,7 +74,9 @@
# filename based on identity
:local DirName ("tmpfs/" . $ScriptName);
:local FileName [ $CleanName ($Identity . "." . $Domain) ];
:local Clock [ /system/clock/get ];
:local FileName [ $CleanName ($Identity . "." . $Domain . [ $IfThenElse \
($BackupFileNameDate = true) ("-" . $Clock->"date" . "-" . $Clock->"time") "" ] ) ];
:local FilePath ($DirName . "/" . $FileName);
:local BackupFile "none";
:local ExportFile "none";

View file

@ -17,6 +17,7 @@
do={ :error ("Global config and/or functions not ready."); }; } delay=500ms max=50;
:local ScriptName [ :jobname ];
:global BackupFileNameDate;
:global BackupPassword;
:global BackupRandomDelay;
:global BackupSendBinary;
@ -72,7 +73,9 @@
# filename based on identity
:local DirName ("tmpfs/" . $ScriptName);
:local FileName [ $CleanName ($Identity . "." . $Domain) ];
:local Clock [ /system/clock/get ];
:local FileName [ $CleanName ($Identity . "." . $Domain . [ $IfThenElse \
($BackupFileNameDate = true) ("-" . $Clock->"date" . "-" . $Clock->"time") "" ] ) ];
:local FilePath ($DirName . "/" . $FileName);
:local BackupFile "none";
:local ExportFile "none";

View file

@ -34,6 +34,7 @@ Configuration
The configuration goes to `global-config-overlay`, these are the parameters:
* `BackupFileNameDate`: whether to add date & time in filenames
* `BackupSendBinary`: whether to send binary backup
* `BackupSendExport`: whether to send configuration export
* `BackupSendGlobalConfig`: whether to send `global-config-overlay`

View file

@ -40,6 +40,7 @@ Configuration
The configuration goes to `global-config-overlay`, these are the parameters:
* `BackupFileNameDate`: whether to add date & time in filenames
* `BackupSendBinary`: whether to send binary backup
* `BackupSendExport`: whether to send configuration export
* `BackupSendGlobalConfig`: whether to send `global-config-overlay`

View file

@ -90,7 +90,9 @@
# Toggle this to disable color output in terminal/cli.
:global TerminalColorOutput true;
# This defines what backups to generate and what password to use.
# This defines whether to add date & time in filenames, what backups to generate,
# the password to use, and what random delay (between 0 and given seconds) to apply.
:global BackupFileNameDate false;
:global BackupSendBinary false;
:global BackupSendExport true;
:global BackupSendGlobalConfig true;

View file

@ -15,7 +15,7 @@
# Git commit id & info, expected configuration version
:global CommitId "unknown";
:global CommitInfo "unknown";
:global ExpectedConfigVersion 142;
:global ExpectedConfigVersion 143;
# global variables not to be changed by user
:global GlobalFunctionsReady false;
@ -812,10 +812,15 @@
# check if DNS is resolving
:set IsDNSResolving do={
:do {
:resolve "low-ttl.eworm.de";
:local I 1;
:retry {
:set I ($I ^ 1);
:resolve ("low-ttl.eworm." . ({ "de"; "net" }->$I));
} delay=50ms max=6;
} on-error={
:return false;
}
:return true;
}
@ -1200,10 +1205,12 @@
}
:onerror Err {
/file/remove $DirName;
/file/remove [ find where name=$DirName ];
} do={
$LogPrint error $0 ("Removing directory '" . $DirName . "' failed: " . $Err);
:return false;
:if (!($Err ~ "no such item")) do={
$LogPrint error $0 ("Removing directory '" . $DirName . "' failed: " . $Err);
:return false;
}
}
:return true;
}
@ -1229,10 +1236,12 @@
}
:onerror Err {
/file/remove $FileName;
/file/remove [ find where name=$FileName ];
} do={
$LogPrint error $0 ("Removing file '" . $FileName . "' failed: " . $Err);
:return false;
:if (!($Err ~ "no such item")) do={
$LogPrint error $0 ("Removing file '" . $FileName . "' failed: " . $Err);
:return false;
}
}
:return true;
}

View file

@ -54,7 +54,7 @@
:local Pool [ /ipv6/pool/get [ find where prefix=$PdPrefix ] name ];
:if ([ :len [ /ipv6/firewall/address-list/find where comment=("ipv6-pool-" . $Pool) ] ] = 0) do={
/ipv6/firewall/address-list/add list=("ipv6-pool-" . $Pool) address=:: comment=("ipv6-pool-" . $Pool) dynamic=yes;
$LogPrint warning $ScriptName ("Added dynamic ipv6 address list entry for ipv6-pool-" . $Pool);
$LogPrint info $ScriptName ("Added dynamic ipv6 address list entry for ipv6-pool-" . $Pool);
}
:local AddrList [ /ipv6/firewall/address-list/find where comment=("ipv6-pool-" . $Pool) ];
:local OldPrefix [ /ipv6/firewall/address-list/get ($AddrList->0) address ];

View file

@ -115,13 +115,15 @@
:local Data false;
:onerror Err {
:local I 1;
:retry {
:set I ($I ^ 1);
:set Data ([ /tool/fetch check-certificate=yes-without-crl output=user \
http-header-field=({ "accept: application/dns-message" }) \
url=(($DohServer->"doh-url") . "?dns=" . [ :convert to=base64 ([ :rndstr length=2 ] . \
"\01\00" . "\00\01" . "\00\00" . "\00\00" . "\00\00" . "\09doh-check\05eworm\02de\00" . \
"\00\10" . "\00\01") ]) as-value ]->"data");
} delay=1s max=3;
"\01\00" . "\00\01" . "\00\00" . "\00\00" . "\00\00" . "\09doh-check\05eworm" . \
({ "\02de"; "\03net" }->$I) . "\00" . "\00\10" . "\00\01") ]) as-value ]->"data");
} delay=500ms max=6;
} do={
$LogPrint warning $ScriptName ("Request to DoH server " . ($DohServer->"doh-url") . \
" failed: " . $Err);

View file

@ -67,6 +67,7 @@
140="The scripts 'lease-script' was renamed to 'dhcpv4-server-lease', configuration was updated automatically.";
141="Introduced script 'dhcpv6-client-lease' to run several scripts on IPv6 DHCP client lease.";
142="Added a setting for 'mod/notification-email' to check availability of certificate chain.";
143="Made backup scripts 'backup-email' and 'backup-upload' support date & time in filenames.";
};
# Migration steps to be applied on script updates