ipsec-to-dns: strip "CN=" from peer's id

This commit is contained in:
Christian Hesse 2022-10-19 08:50:00 +02:00
parent 621154ab83
commit bff6689b10

View file

@ -46,8 +46,9 @@
:foreach Peer in=[ /ip/ipsec/active-peers/find where !(dynamic-address=[]) ] do={ :foreach Peer in=[ /ip/ipsec/active-peers/find where !(dynamic-address=[]) ] do={
:local PeerVal [ /ip/ipsec/active-peers/get $Peer ]; :local PeerVal [ /ip/ipsec/active-peers/get $Peer ];
:local Comment ($CommentPrefix . $PeerVal->"id"); :local PeerId [ $CharacterReplace ($PeerVal->"id") "CN=" "" ];
:local HostName [ :pick ($PeerVal->"id") 0 [ :find ($PeerVal->"id" . ".") "." ] ]; :local Comment ($CommentPrefix . $PeerId);
:local HostName [ :pick $PeerId 0 [ :find ($PeerId . ".") "." ] ];
:local Fqdn ($HostName . "." . $Zone); :local Fqdn ($HostName . "." . $Zone);
:local DnsRecord [ /ip/dns/static/find where name=$Fqdn ]; :local DnsRecord [ /ip/dns/static/find where name=$Fqdn ];