Rudimentary testing for client certs.
This commit is contained in:
parent
0f406e9daa
commit
6600c589ab
|
@ -85,7 +85,7 @@ class ServerConnection(tcp.TCPClient):
|
|||
if scheme == "https":
|
||||
clientcert = None
|
||||
if self.config.clientcerts:
|
||||
path = os.path.join(self.config.clientcerts, self.host) + ".pem"
|
||||
path = os.path.join(self.config.clientcerts, self.host.encode("idna")) + ".pem"
|
||||
if os.path.exists(path):
|
||||
clientcert = path
|
||||
try:
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
-----BEGIN RSA PRIVATE KEY-----
|
||||
MIICXQIBAAKBgQC+6rG6A/BGD0dI+mh2FZIqQZn82z/pGs4f3pyxbHb+ROxjjQOr
|
||||
fDCw2jc11XDxK7CXpDQAnkO6au/sQ5t50vSZ+PGhFD+t558VV2ausB5OYZsR7RRx
|
||||
gl1jsxWdde3EHGjxSK+aXRgFpVrZzPLSy6dl8tMoqUMWIBi0u1WTbmyYjwIDAQAB
|
||||
AoGBAKyqhmK9/Sjf2JDgKGnjyHX/Ls3JXVvtqk6Yfw7YEiaVH1ZJyu/lOgQ414YQ
|
||||
rDzyTpxXHdERUh/fZ24/FvZvHFgy5gWEQjQPpprIxvqCLKJhX73L2+TnXmfYDApb
|
||||
J7V/JfnTeOaK9LTpHsofB98A1s9DWX/ccOgKTtZIYMjYpdoBAkEA9hLvtixbO2A2
|
||||
ZgDcA9ftVX2WwdpRH+mYXl1G60Fem5nlO3Rl3FDoafRvSQNZiqyOlObvKbbYh/S2
|
||||
L7ihEMMNYQJBAMaeLnAc9jO/z4ApTqSBGUpM9b7ul16aSgq56saUI0VULIZcXeo3
|
||||
3BwdL2fEOOnzjNy6NpH2BW63h/+2t7lV++8CQQDK+S+1Sr0uKtx0Iv1YRkHEJMW3
|
||||
vQbxldNS8wnOf6s0GisVcZubsTkkPLWWuiaf1ln9xMc9106gRmAI2PgyRVHBAkA6
|
||||
iI+C9uYP5i1Oxd2pWWqMnRWnSUVO2gWMF7J7B1lFq0Lb7gi3Z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t4YGjeVYs0iQQsUL2E0G43c
|
||||
mOXfsq1b970Ep6xRS76EmZ+tTdFBd86tFTIhZJrOi67gs+twj5V2elyp3tQpg2ze
|
||||
G/jwDQS8V1X9CbfqBQriL7x5Tk4=
|
||||
-----END CERTIFICATE-----
|
|
@ -71,6 +71,9 @@ class TestHTTP(tutils.HTTPProxTest, SanityMixin):
|
|||
|
||||
class TestHTTPS(tutils.HTTPProxTest, SanityMixin):
|
||||
ssl = True
|
||||
# FIXME: Instrument pathod to actually test that client cert is being sent
|
||||
# correctly.
|
||||
clientcerts = True
|
||||
|
||||
|
||||
class TestReverse(tutils.ReverseProxTest, SanityMixin):
|
||||
|
|
|
@ -123,9 +123,13 @@ class ProxTestBase:
|
|||
|
||||
class HTTPProxTest(ProxTestBase):
|
||||
ssl = None
|
||||
clientcerts = False
|
||||
@classmethod
|
||||
def get_proxy_config(cls):
|
||||
return dict()
|
||||
d = dict()
|
||||
if cls.clientcerts:
|
||||
d["clientcerts"] = test_data.path("data/clientcert")
|
||||
return d
|
||||
|
||||
def pathoc(self, connect_to = None):
|
||||
p = libpathod.pathoc.Pathoc("localhost", self.proxy.port)
|
||||
|
|
Loading…
Reference in New Issue