From bff6689b103287f44c573e3134b9b9a64c36c0a8 Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Wed, 19 Oct 2022 08:50:00 +0200 Subject: ipsec-to-dns: strip "CN=" from peer's id --- ipsec-to-dns | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ipsec-to-dns b/ipsec-to-dns index cf36987..705b5e7 100644 --- a/ipsec-to-dns +++ b/ipsec-to-dns @@ -46,8 +46,9 @@ :foreach Peer in=[ /ip/ipsec/active-peers/find where !(dynamic-address=[]) ] do={ :local PeerVal [ /ip/ipsec/active-peers/get $Peer ]; - :local Comment ($CommentPrefix . $PeerVal->"id"); - :local HostName [ :pick ($PeerVal->"id") 0 [ :find ($PeerVal->"id" . ".") "." ] ]; + :local PeerId [ $CharacterReplace ($PeerVal->"id") "CN=" "" ]; + :local Comment ($CommentPrefix . $PeerId); + :local HostName [ :pick $PeerId 0 [ :find ($PeerId . ".") "." ] ]; :local Fqdn ($HostName . "." . $Zone); :local DnsRecord [ /ip/dns/static/find where name=$Fqdn ]; -- cgit v1.2.3-70-g09d2