Forum Discussion

andy_12_5042's avatar
andy_12_5042
Icon for Nimbostratus rankNimbostratus
Dec 29, 2010

Pycontrol to set client ssl cipher list

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