Forum Discussion
report for all SSL
Looking how to create a more formatted report of all SSL certificates
I run command tmsh list sys file ssl-cert all > /ssl.txt which then I import into excel. However the ssl.txt each ssl certificate components (expiry date, serial , etc) is listed in rows there is no delimiter. I would like each row of information listed in columns
How would I put this to an output text file
PARTITIONS=( $(tmsh list auth partition one-line | sed -e 's/ //g' | grep -oP '(?<=partition)[^{]+' -) )
for partition in ${PARTITIONS[*]}; do tmsh -q -c "cd /$partition; list sys file ssl-cert" done
9 Replies
what command to use for all partitions and then dump to a text file?
- Kevin_K_51432Historic F5 Account
Greetings,
This should do the trick:tmsh -c "cd /; list sys file ssl-cert /*/*" > /ssl.txt
Kevin
How would I put this to an output text file
PARTITIONS=( $(tmsh list auth partition one-line | sed -e 's/ //g' | grep -oP '(?<=partition)[^{]+' -) )
for partition in ${PARTITIONS[*]}; do tmsh -q -c "cd /$partition; list sys file ssl-cert" done
The results have each field a row, I need each field between {} to be a column.
- Kevin_K_51432Historic F5 Account
Greetings,
You'll need to output this using the "one-line" option. Then using awk, extract each interesting column.The $ represents the position within the column (minus one).
I'm extracting those mentioned in the description:
tmsh -c "cd /; list sys file ssl-cert /*/* one-line" | awk '{print $4, $6, $7, $14, $15, $32, $33}' Common/mykey2.crt certificate-key-size 2048 expiration-date 1542902160 serial-number 249033360 Common/mykey3.crt certificate-key-size 2048 expiration-date 1542902167 serial-number 249033367 Common/mykey4.crt certificate-key-size 2048 expiration-date 1542902173 serial-number 249033373 Common/mykey.crt certificate-key-size 2048 expiration-date 1542901585 serial-number 249032785
Try running the command without the "| awk" filter to see the columns and then count over (minus one).
Hope this makes sense and is helpful!
Kevin this is the command I'm using tmsh -c "cd /; list sys file ssl-cert // one-line" /SSLreports/newssl.txt
it doesn't work getting an error
tmsh An option may be specified once. A command may follow the options, in which case the shell exits after executing the command.
- Kevin_K_51432Historic F5 Account
It looks like you're missing the redirect (>) after the (one-line"). This is used to redirect the output to a file. So give this a try:
tmsh -c "cd /; list sys file ssl-cert /*/* one-line" > /SSLreports/newssl.txt
Great! thanks so much
- Kevin_K_51432Historic F5 Account
You're very welcome!
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