mirror of
https://github.com/eworm-de/routeros-scripts
synced 2024-05-14 08:04:19 +00:00
ipsec-to-dns: handle "CN=" from peer's id
This was missing in commit bff6689b10
and
cause the dns entry to be delete and re-created over and over again.
This commit is contained in:
parent
23e5c01a42
commit
03fb459ea4
1 changed files with 4 additions and 2 deletions
|
@ -16,8 +16,9 @@
|
||||||
:global PrefixInZone;
|
:global PrefixInZone;
|
||||||
|
|
||||||
:global CharacterReplace;
|
:global CharacterReplace;
|
||||||
:global LogPrintExit2;
|
:global EscapeForRegEx;
|
||||||
:global IfThenElse;
|
:global IfThenElse;
|
||||||
|
:global LogPrintExit2;
|
||||||
|
|
||||||
:local Zone \
|
:local Zone \
|
||||||
([ $IfThenElse ($PrefixInZone = true) "ipsec." ] . \
|
([ $IfThenElse ($PrefixInZone = true) "ipsec." ] . \
|
||||||
|
@ -35,7 +36,8 @@
|
||||||
:foreach DnsRecord in=[ /ip/dns/static/find where comment ~ $CommentPrefix ] do={
|
:foreach DnsRecord in=[ /ip/dns/static/find where comment ~ $CommentPrefix ] do={
|
||||||
:local DnsRecordVal [ /ip/dns/static/get $DnsRecord ];
|
:local DnsRecordVal [ /ip/dns/static/get $DnsRecord ];
|
||||||
:local PeerId [ $CharacterReplace ($DnsRecordVal->"comment") $CommentPrefix "" ];
|
:local PeerId [ $CharacterReplace ($DnsRecordVal->"comment") $CommentPrefix "" ];
|
||||||
:if ([ :len [ /ip/ipsec/active-peers/find where id=$PeerId dynamic-address=($DnsRecordVal->"address") ] ] > 0) do={
|
:if ([ :len [ /ip/ipsec/active-peers/find where id~("^(CN=)?" . [ $EscapeForRegEx $PeerId ] . "\$") \
|
||||||
|
dynamic-address=($DnsRecordVal->"address") ] ] > 0) do={
|
||||||
$LogPrintExit2 debug $0 ("Peer " . $PeerId . " (" . $DnsRecordVal->"name" . ") still exists. Not deleting DNS entry.") false;
|
$LogPrintExit2 debug $0 ("Peer " . $PeerId . " (" . $DnsRecordVal->"name" . ") still exists. Not deleting DNS entry.") false;
|
||||||
} else={
|
} else={
|
||||||
:local Found false;
|
:local Found false;
|
||||||
|
|
Loading…
Reference in a new issue