Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1193)

Unified Diff: chrome/browser/chromeos/login/test/https_forwarder.py

Issue 2719273002: Disable commonName matching for certificates (Closed)
Patch Set: Style cleanup Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/login/test/https_forwarder.py
diff --git a/chrome/browser/chromeos/login/test/https_forwarder.py b/chrome/browser/chromeos/login/test/https_forwarder.py
index e68bcca41758bb7be2e3a84386fa550def9376dd..27f059f78ce5a4a97201fe65533184a4e68b8a6e 100644
--- a/chrome/browser/chromeos/login/test/https_forwarder.py
+++ b/chrome/browser/chromeos/login/test/https_forwarder.py
@@ -9,6 +9,7 @@ server that supports http only to be accessed over https.
import BaseHTTPServer
import minica
import re
+import socket
import SocketServer
import sys
import urllib2
@@ -161,9 +162,32 @@ class ServerRunner(testserver_base.TestServerRunner):
host = self.options.host
ssl_host = self.options.ssl_host
+ # Allow |ssl_host| to be an IP address or a domain name, and ensure
+ # it gets added as the appropriate subjectAltName of the generated
+ # certificate.
+ dns_sans = None
+ ip_sans = None
+ ip = None
+ if ip is None:
+ try:
+ ip = socket.inet_pton(socket.AF_INET, ssl_host)
+ ip_sans = [ip]
+ except socket.error:
+ pass
+ if ip is None:
+ try:
+ ip = socket.inet_pton(socket.AF_INET6, ssl_host)
+ ip_sans = [ip]
+ except socket.error:
+ pass
+ if ip is None:
+ dns_sans = [ssl_host]
+
(pem_cert_and_key, ocsp_der) = minica.GenerateCertKeyAndOCSP(
subject = self.options.ssl_host,
- ocsp_url = None)
+ ocsp_url = None,
+ ip_sans = ip_sans,
+ dns_sans = dns_sans)
server = MultiThreadedHTTPSServer((host, port),
RequestForwarder,
« no previous file with comments | « no previous file | chrome/browser/policy/configuration_policy_handler_list_factory.cc » ('j') | net/tools/testserver/minica.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698