routeros-generate-apps-addr.../updateAppFromDnsCache-template.rsc
Eliezer Croitoru 505e642430 1
2025-01-07 01:48:53 +02:00

36 lines
771 B
Plaintext

{
:do {
:local debug 0;
:local addressList "###ADDRESS_LIST###";
##INSERT_LINES
:foreach dom in=$staticDomains do={
:do {
/ip/firewall/address-list/add address=$dom list=$addressList;
} on-error={
if ($debug > 0) do={
:log info "error adding ";
}
}
}
:foreach rec in=[/ip/dns/cache/print as-value ] do={
:foreach regexTestString in=$regexString do={
if ( ($rec->"type")~"(CNAME|A)\$" ) do={
if ( ($rec->"name")~"$regexTestString" ) do={
:do {
/ip/firewall/address-list/add address=($rec->"name") list=$addressList;
} on-error={
if ($debug > 0) do={
:log info "error adding ";
}
}
}
}
}
}
} on-error={
:log info "RUNTIME Error";
}
}