Forum Discussion
find unused ssl certificates
i am searching for a script to find unused certificates object in v11.X because i want to clean up expired n unused ssl certificates
1 Reply
- arpydays
Nimbostratus
you may have this already but this command will check the cert expiry
run /sys crypto check-certI'm not aware of any tools to find unused certs, you may need to develop one to suit your needs. The quick script below may be of use, it'll grap all the SSL profiles used on VSs, then check what certs are used in those profiles. Then grabs all the certs on the box and compares that against the used certs. There should be 3 files generated, allcerts, usedcerts and unusedcerts. Note this only checks for usage via VS profiles, not sure about other places they could be used, e.g. profiles applied dynamically via irules or APM usage. You could add keys if you wanted.
cheers
!/bin/bash [ -f usedcerts ] && rm usedcerts CLIENTSSL=`tmsh -q -c "cd /;show ltm virtual recursive profiles" \ | grep -i 'ClientSSL'|awk '!a[$4]++ {print $4}'` SERVERSSL=`tmsh -q -c "cd /;show ltm virtual recursive profiles" \ | grep -i 'ServerSSL'|awk '!a[$4]++ {print $4}'` for x in ${CLIENTSSL} do `tmsh -q -c "cd /;list ltm profile client-ssl $x cert chain" \ | awk '/cert | chain / && !/none/ {print "/"$2 >> "usedcerts"}'` done for x in ${SERVERSSL} do `tmsh -q -c "cd /;list ltm profile server-ssl $x cert chain" \ | awk '/cert | chain / && !/none/ {print "/"$2 >> "usedcerts"}'` done [ -f usedcerts ] || { echo "No certs used"; exit; } `tmsh -q -c "cd /;list sys crypto recursive cert" | grep '^sys' | awk '{print $4 > "allcerts"}'` grep -Fvf usedcerts allcerts > unusedcerts
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* 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