Forum Discussion
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 i...
Kevin_Stewart
Aug 29, 2018Employee
This could be significantly optimized, but here's a rough try:
!/bin/bash
for v in $virtuallist ;
do
DEST="";
POOL="";
MEMB="";
echo "NAME = $v"
DEST=$(tmsh list ltm virtual $v | grep destination | cut -d' ' -f6)
echo "DEST = $DEST"
CSSL=$(tmsh list ltm virtual test-vip profiles |grep -vE 'profiles|ltm virtual' |grep -B1 "context clientside" |grep -v "context clientside" |sed 's/ //g;s/{//')
echo "CSSL = $CSSL"
CERT=$(tmsh list ltm profile client-ssl web1.codestew.net cert |grep -vE "ltm profile|\}" |sed 's/ cert //g')
CEXP=$(tmsh list sys file ssl-cert web1.codestew.net.crt expiration-string |grep -vE "sys file|\}" |sed 's/ expiration-string "//;s/"//')
echo "CEXP = $CEXP"
POOL=$(tmsh list ltm virtual $v | grep pool | cut -d' ' -f6)
if [ "$POOL" != "" ]
then
echo "POOL = $POOL"
MEMB=$(tmsh list ltm pool $POOL | egrep 'address '| sed '$!N;s/\n/,/;s/ address//g')
echo "MEMB = $MEMB"
fi
echo "--------"
done
Sample output:
NAME = test1-vip
DEST = 192.168.1.26:https
CSSL = web1.f5demolabs.net
CEXP = Jul 26 19:10:16 2019 GMT
POOL = pool1
MEMB = 192.168.1.10, 192.168.1.11
--------
NAME = test2-vip
DEST = 192.168.1.27:https
CSSL = web2.f5demolabs.net
CEXP = Jul 26 19:10:16 2019 GMT
POOL = pool2
MEMB = 192.168.1.20, 192.168.1.21
--------
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects