G
Gelonida N
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.
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.