Forum Discussion
report for all SSL
- Oct 20, 2017
How would I put this to an output text file
!/bin/bashPARTITIONS=( $(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
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!
KevinHelp 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