#!/bin/sh#set -xipsecconf=/usr/local/etc/unbound.opnsense.d/ipsec.conftmpipsecconf=/tmp/ipsec.confrm -f $tmpipsecconf#split at spaceset -f; IFS=' 'ipsec leases | grep " 172.16" |sed "s/'//g" | while read linedo set -- $line ip=$1; name=$3 echo "local-data: \"${name}.ipsec.example.com A ${ip}\"" >>${tmpipsecconf}doneset +f; unset IFScat ${tmpipsecconf}if cmp -s "$ipsecconf" "$tmpipsecconf"; then printf 'The file "%s" is the same as "%s"\n' "$ipsecconf" "$tmpipsecconf"else printf 'The file "%s" is different from "%s"\n' "$ipsecconf" "$tmpipsecconf" mv -f $tmpipsecconf $ipsecconf configctl unbound restartfi
[reload]command:/root/ipsecdns.sh > /root/ipsecdns_out.txt 2>&1parameter:type:scriptmessage:mobile IPSEC DNS update
service configd restart