Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I pass a SSL certificate to a SOAP server using SOAPpy / Python

I am building a script to access a HTTPS/TLS TCP site that requires a X.509 certifcate that I have as a .pfx file.

I am using SOAPpy 0.12.5 and Python 2.7 and have started off with code as below,

import SOAPpy
url = "192.168.0.1:5001"
server = SOAPpy.SOAPProxy(url)

# I think I need to pass the cert to server here...

server.callSoapRPC(xxxx)

If I try running this it fails with the following message

socket.error: [Errno 10061] No connection could be made because the target machine actively refused it

Any sugestions how to tie the .pfx certificate to the SOAPproxy?

Thanks

like image 471
KermitG Avatar asked Nov 13 '22 15:11

KermitG


1 Answers

I managed to do it this way:

import SOAPpy
SOAPpy.Config.SSL.cert_file = 'cert_file'
SOAPpy.Config.SSL.key_file = 'key_file'

server = SOAPpy.SOAPProxy(url, config=config)
like image 83
Daniel Hartmann Avatar answered Dec 18 '22 10:12

Daniel Hartmann