Learn F5 Technologies, Get Answers & Share Community Solutions Join DevCentral

Filter by:
  • Solution
  • Technology
code share

BASH Script to find ClientSSL's mapped to Virtual Servers

Problem this snippet solves:

Often times we may require to generate a report to know how many of the clientssl profiles are mapped to which virtual servers. One can use the simple tmsh list ltm virtual all one-line | grep ssl-profile-name.

But this would focus on one particular profile alone.

How about for every clientssl profiles that's present and to which vip its mapped.

How to use this snippet:

Create a simple bash file and paste the below code.

[ltm1:Active:In Sync] ~ # vi find-clientssl-mapped-to-virtuals

Save and exit (wq).

Run the bash script.

[ltm1:Active:In Sync] ~ # bash find-clientssl-mapped-to-virtuals

Final output will be in CSV file like below, You can winscp the output from the location /var/tmp/

Filename would be clientssl-mapped-to-virtuals-output.csv

Image Text

Tested on Version:
Comments on this Snippet
Comment made 03-May-2018 by patonbike 127

Very nice, I was actually just doing the exact same thing.

Here was my solution:

for i in `tmsh list ltm virtual { destination } |grep :https -B 1|grep ltm|awk '{print $3}'`; do echo $i; tmsh list ltm virtual $i { profiles }|grep clientside -B 1|grep -v clientside|grep -v tcp|grep -v "\-\-"|sed 's/{//g'; echo; done

Comment made 03-May-2018 by jaikumar_f5 1680

Yup thats doable too. But instead of grep -v clientside|grep -v tcp|grep -v "\-\-"|sed 's/{//g you can combine them as grep -vE "clientside|tcp|--" too.

Comment made 04-May-2018 by Thiyagu 185

Thanks a lot guys for your help. I have tried executing this scrip. however I'm able to get the SSL client profile name and VIP which are in "Common" partition and I have also tried executing the script from other partition but it is not successful to get the SSL client profile and the associated VIP from the other partition.

Could you please help me to modify the script to get the SSL client profile name and the associated VIP from other partition?

Regards, Thiyagu

Comment made 27-May-2018 by chasewoodard 0
  • How would I Winscp the file afterwards? btw Thank you for this.
Comment made 2 months ago by Jawed 0

unfortunately both tricks did not work for me. the script creates empty csv and for loop also return nothing for me. even just running this list ltm virtual { destination } does not work so how i can expect further processing from this command