diff --git a/test/data/testkey.pem b/test/data/testkey.pem index af8d9d8f6..b804bd4c2 100644 --- a/test/data/testkey.pem +++ b/test/data/testkey.pem @@ -1,32 +1,68 @@ -----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/L0Th2UZR2oxN/0 -hORkK676LBhmYgDPG+n9AkAJOnPIFQVAEBAO9bAxFrje8z6GRt332IlgxuiTeDE3 -EAlH9tmZma4Tri4sWnhJwCsxl+5hWamI8NL4EIeXRvPw +MIIG5QIBAAKCAYEAwvtKxoZvBV2AxPAkCx8PXbuE7KeqK9bBvk8x+JchPMdf/KZj +sdu2v6Gm8Hi053i7ZGxouFvonJxHAiK6cwk9OY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VPdGFnbzEPMA0GA1UECgwGUGF0aG9kMREwDwYD +VQQDDAh0ZXN0LmNvbYIJALONCAWZxPhUMAwGA1UdEwQFMAMBAf8wKQYDVR0RBCIw +IIIIdGVzdC5jb22CCXRlc3QyLmNvbYIJdGVzdDMuY29tMA0GCSqGSIb3DQEBCwUA +A4IBgQBcTedXtUb91DxQRtg73iomz7cQ4niZntUBW8iE5rpoA7prtQNGHMCbHwaX +tbWFkzBmL5JTBWvd/6AQ2LtiB3rYB3W/iRhbpsNJ501xaoOguPEQ9720Ph8TEveM +208gNzGsEOcNALwyXj2y9M19NGu9zMa8eu1Tc3IsQaVaGKHx8XZn5HTNUx8EdcwI +Z/Ji9ETDCL7+e5INv0tqfFSazWaQUwxM4IzPMkKTYRcMuN/6eog609k9r9pp32Ut +rKlzc6GIkAlgJJ0Wkoz1V46DmJNJdJG7eLu/mtsB85j6hytIQeWTf1fll5YnMZLF +HgNZtfYn8Q0oTdBQ0ZOaZeQCfZ8emYBdLJf2YB83uGRMjQ1FoeIxzQqiRq8WHRdb +9Q45i0DINMnNp0DbLMA4numZ7wT9SQb6sql9eUyuCNDw7nGIWTHUNfLtU1Er3h1d +icJuApx9+//UN/pGh0yTXb3fZbiI4IehRmkpnIWonIAwaVGm6JZU04wiIn8CuBho +/qQdlS8= -----END CERTIFICATE----- diff --git a/test/scripts/generate.sh b/test/scripts/generate.sh new file mode 100755 index 000000000..eec3077da --- /dev/null +++ b/test/scripts/generate.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +if [ ! -f ./private.key ] +then + openssl genrsa -out private.key 3072 +fi +openssl req \ + -batch \ + -new -x509 \ + -key private.key \ + -sha256 \ + -out cert.pem \ + -days 9999 \ + -config ./openssl.cnf +openssl x509 -in cert.pem -text -noout +cat ./private.key ./cert.pem > testcert.pem +rm ./private.key ./cert.pem diff --git a/test/scripts/openssl.cnf b/test/scripts/openssl.cnf new file mode 100644 index 000000000..5c8903541 --- /dev/null +++ b/test/scripts/openssl.cnf @@ -0,0 +1,39 @@ +[ req ] +default_bits = 1024 +default_keyfile = privkey.pem +distinguished_name = req_distinguished_name +x509_extensions = v3_ca + +[ req_distinguished_name ] +countryName = Country Name (2 letter code) +countryName_default = NZ +countryName_min = 2 +countryName_max = 2 +stateOrProvinceName = State or Province Name (full name) +stateOrProvinceName_default = Otago +localityName = Locality Name (eg, city) +0.organizationName = Organization Name (eg, company) +0.organizationName_default = Pathod +commonName = Common Name (e.g. server FQDN or YOUR name) +commonName_default = test.com +commonName_max = 64 + +[ v3_req ] + +basicConstraints = CA:FALSE +keyUsage = nonRepudiation, digitalSignature, keyEncipherment + +[ v3_ca ] + +keyUsage = digitalSignature, keyEncipherment +subjectKeyIdentifier=hash +authorityKeyIdentifier=keyid:always,issuer:always +basicConstraints = CA:true +subjectAltName = @alternate_names + + +[ alternate_names ] + +DNS.1 = test.com +DNS.2 = test2.com +DNS.3 = test3.com diff --git a/test/test_pathod.py b/test/test_pathod.py index 09aaca8e1..c966222f1 100644 --- a/test/test_pathod.py +++ b/test/test_pathod.py @@ -70,7 +70,7 @@ class TestCustomCert(tutils.DaemonTests): r = self.pathoc(r"get:/p/202") assert r.status_code == 202 assert r.sslinfo - assert "Widgits" in str(r.sslinfo.certchain[0].get_subject()) + assert "test.com" in str(r.sslinfo.certchain[0].get_subject()) class TestSSLCN(tutils.DaemonTests):