Forum Discussion
How to grep particular certificate name or common name from list of all certificates?
I am looking for a tmsh command which can give me the ability to grep (search) particular common name or subset of common name in all certificate list.
- Lee_Sutcliffe
Nacreous
This should work to return the common name in the subject. You may want to experiment with line numbers before to display the cert name too
tmsh list sys file ssl-cert | grep my-common-name
- MehulT
Nimbostratus
You can also try to get all the related information on that particular certificate
tmsh list sys file ssl-cert one-line | grep my-common-name
- Seyler
Nimbostratus
The awk snippet works for extracting the different parts, but you still need to know which section is the key / cert / chain. I needed to extract a specific section, and found this on the OpenSSL mailinglist.
- Andy_McGrath
Cumulonimbus
If you have certs on partitions other than 'Common' use the following from bash:
tmsh list sys file ssl-cert '/*/*' one-line | grep my-common-name
If you want to just output the file name do the following:
tmsh list sys file ssl-cert '/*/*' one-line | grep my-common-name | awk '{print $4}'
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