xmlrpc ssl (slightly embarrassing, long post)

Ng Pheng Siong ngps at netmemetic.com
Thu Jun 5 15:30:33 CEST 2003


According to Rune Hansen  <rune.hansen at sinsenveien83.com>:
>      def __init__(self, server_address, RequestHandlerClass):
>          """Constructor.  May be extended, do not override."""
>          BaseServer.__init__(self, server_address, RequestHandlerClass)
> 	#OpenSSL
>          ctx = SSL.Context(SSL.SSLv23_METHOD)
>          ctx.set_options(SSL.OP_NO_SSLv2)
>          ctx.set_verify(SSL.VERIFY_PEER, verify_cb)
>          ctx.use_privatekey_file ('key.pem')
>          ctx.use_certificate_file('cert.pem')
>          self.socket = 
> SSL.Connection(ctx,socket.socket(self.address_family,self.socket_type))

Not sure which SSL library you're using, but M2Crypto's works:

In one window:

  ngps at vista:~/prog/ngps/m2/demo/medusa$ python START_xmlrpc.py
  info: Medusa (V1.1) started at Thu Jun  5 21:43:38 2003
          Hostname: vista.netmemetic.com
          Port:9080
  
  warning: Computing default hostname
  info: Medusa (V1.1) started at Thu Jun  5 21:43:38 2003
          Hostname: vista.netmemetic.com
          Port:9443
  
  M2Crypto HTTPS Server (v0.09)

In another window:

  ngps at vista:~/prog/ngps/m2/demo/ssl$ python xmlrpc_cli.py
  Sure, that works
  Sure, that works

First window says:

  method="Testing" params=(1, 2, 3)
  127.0.0.1:1028 - - [05/Jun/2003:13:44:03 +0800] "POST /RPC2 HTTP/1.0" 200 242
  method="BringOn" params=('SOAP',)
  127.0.0.1:1029 - - [05/Jun/2003:13:44:03 +0800] "POST /RPC2 HTTP/1.0" 200 242

There is also a demo server based on TCPServer.



-- 
Ng Pheng Siong <ngps at netmemetic.com> 

http://firewall.rulemaker.net  -+- Manage Your Firewall Rulebase Changes
http://www.post1.com/home/ngps -+- Open Source Python Crypto & SSL




More information about the Python-list mailing list