hezz_370754
Aug 29, 2018Nimbostratus
Export VIP, Cert CN and Cert expiration date
Hi all,
Client has requested the following information; VIP NAME, VIP IP, Cert CN + Cert Duration.
I have a script that exports VIP and Pool, was hoping to collate all the information into this if possible.
virtuallist=$(tmsh list ltm virtual | grep virtual | cut -d' ' -f3 | tr "\n" " " );
for v in $virtuallist ;
do
DEST=""; POOL=""; MEMB=""; DEST=$(tmsh list ltm virtual $v | grep destination | cut -d' ' -f6)
POOL=$(tmsh list ltm virtual $v | grep pool | cut -d' ' -f6)
MEMB=$(tmsh list ltm pool $POOL | egrep 'address '| sed '$!N;s/\n/ /')
if [ "$POOL" != "" ];
then
echo ""; echo " Virtual: $v - $DEST"; echo " Pool: $POOL"; echo "$MEMB";
else
echo ""; echo "!! Virtual $v $DEST has no pool assigned"; echo "";
fi
done
:wq
Cert expiry can be listed from -
tmsh list sys file ssl-cert expiration-string
Have noticed CN can be pulled using regex -
regexp {CN=([^,]+)} [mcget {session.ssl.cert.subject} ] CNFull CNValue;
return $CNValue
Would there be a way to compilate this all into one script? I am very new to F5 and scripting, any help would be appreciated.