m2crypto https, xmlrpc and ignore server name mismatch

Discussion in 'Python' started by Gelonida N, Aug 2, 2011.

  1. Gelonida N

    Gelonida N Guest

    Hi,


    Just started playing with m2crypto's xmlrpc

    The code I'm using is:

    import xmlrpclib
    from M2Crypto.m2xmlrpclib import Server, SSL_Transport
    from M2Crypto.SSL.Context import Context

    ctx = Context()
    # modify context
    svr = Server(rpc_url, SSL_Transport(ctx), encoding='utf-8')
    svr.mymethod1(1)
    svr.mymethod2(2)


    What I wondered is following:

    For testing I would like to ignore the fact, that the hostname in the
    request is different from the hostname in the server certificate.

    On the other hand I would like to verify that the server name from the
    server's certidicate matches a certain criteria.

    What would be the code to do this.

    import xmlrpclib
    from M2Crypto.m2xmlrpclib import Server, SSL_Transport
    from M2Crypto.SSL.Context import Context


    def check_func(server_certificate):
    hostname = get_hostname_from_cert()
    return hostname.endswith('.mydomain.com')

    ctx = Context()
    # modify context
    # add code to ignore server name mismatch
    # add code to call check_func. accept request only if it returns True
    svr = Server(rpc_url, SSL_Transport(ctx), encoding='utf-8')
    svr.mymethod1(1)
    svr.mymethod2(2)


    Thanks in advance for any pointers.
    Gelonida N, Aug 2, 2011
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Etienne Posthumus
    Replies:
    1
    Views:
    1,095
    Roger Binns
    Apr 1, 2004
  2. Fadly Tabrani
    Replies:
    1
    Views:
    469
    Paul Clinch
    Oct 21, 2004
  3. McCann, Brian

    M2Crypto and general HTTPS help needed

    McCann, Brian, Jul 25, 2006, in forum: Python
    Replies:
    0
    Views:
    319
    McCann, Brian
    Jul 25, 2006
  4. Gelonida N

    m2crypto https, xmlrpc, keep_alive

    Gelonida N, Aug 2, 2011, in forum: Python
    Replies:
    0
    Views:
    173
    Gelonida N
    Aug 2, 2011
  5. Gelonida N

    m2crypto https, xmlrpc, and cookies

    Gelonida N, Aug 2, 2011, in forum: Python
    Replies:
    0
    Views:
    178
    Gelonida N
    Aug 2, 2011
Loading...

Share This Page