# Pycontrol to set client ssl cipher list

**URL:** <https://community.f5.com/t/pycontrol-to-set-client-ssl-cipher-list/27931>\
**Category:** Technical Forums\
**Tags:** icontrol, dev, devops\
**Created:** [December 29, 2010, 4:09pm UTC](https://community.f5.com/t/pycontrol-to-set-client-ssl-cipher-list/27931 "2010-12-29T16:09:06Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![andy\_12\_5042](https://avatars.discourse-cdn.com/v4/letter/a/82dd89/32.png) [@andy\_12\_5042](https://community.f5.com/u/andy_12_5042)\
**Post date:** [December 29, 2010, 4:09pm UTC](https://community.f5.com/t/pycontrol-to-set-client-ssl-cipher-list/27931/1 "2010-12-29T16:09:06Z")

</div>

I have a function that I need to set the cipher list via icontrol with pycontrol. I have written lots of functions that work great,however for some reason I can get this to work. I am sure it is due to my lack of knowlege in python as I am relatively new to this…

I will paste the function below. ( I have written a class and exposed this and many other functions) Also to be clear , I have given the parameter profile\_names in the def \_\_init\_\_ in the class so that this is named on creating an instance of the class object. Since this paramter is required for anything you do to a client ssl profile , it made sense to set this once.

def set\_cipher\_list(self,cipher):

self.cipher=cipher

cipher\_s=s.typefactory.create(‘LocalLB.ProfileStringArraySequence’)

cipher\_s.values=[self.cipher]

cipher\_s.default\_flag = 0

cipher\_s\_seq=[cipher\_s]

set\_cipher=s.set\_cipher\_list(profile\_names=[self.name],ciphers=[cipher\_s])

“”“This is how I am calling in my main code. (Sorry my terminology may be off) I am keeping all classes and functions as modules and import to a single main.py. So I am creating an instance of the class object and then using functions/methods that are available in that class to operate on the client ssl profile…”“”

site=clientprof.ClientProf(“test2”)

site.set\_cipher\_list((‘DEFAULT’))

What happens when I make the call is that it sets the cipher custom check box but the cipher list is empty. There is no error returned as it will let you do this and just sets the cipher to none. I thought icontrol is expecting an array, which is why I am probably incorrectly giving the parameter above.

Anybody know what I am doing wrong and how to pass this in properly so I can set ciphers to whatever I may need??

PS I really enjoy pycontrol as it has been great. I have used to do all kinds of stuff and for the most part I have sort of self taught myself as well as python general. I am not a developer though and still run into walls occasionally.

Thanks

Andy

---

<div class="post-metadata">

**Author:** ![Joe\_Pruitt](https://d1p9zq3aats0t8.cloudfront.net/user_avatar/community.f5.com/joe_pruitt/32/8438_2.png) [@Joe\_Pruitt](https://community.f5.com/u/Joe_Pruitt)\
**Post date:** [December 29, 2010, 7:14pm UTC](https://community.f5.com/t/pycontrol-to-set-client-ssl-cipher-list/27931/2 "2010-12-29T19:14:15Z")

</div>

Thanks for posting your solutions Andy! I’ve removed the two posts that had zero replies on them.

-Joe
