Update config

This commit is contained in:
Adrien Ferrand
2019-06-24 13:59:16 +02:00
parent 14d2430313
commit 6889af7816
2 changed files with 21 additions and 14 deletions
@@ -142,7 +142,7 @@ def _prepare_acme_server(workspace, acme_type, acme_xdist):
# Also disable strict mode for now, since Pebble v2.1.0 added specs in
# strict mode for which Certbot is not compliant for now.
# See https://github.com/certbot/certbot/pull/7175
# See https:/l/github.com/certbot/certbot/pull/7175
# TODO: Add back -strict mode once Certbot is compliant with Pebble v2.1.0+
config['services']['pebble']['command'] = config['services']['pebble']['command']\
.replace('-strict', '')
@@ -150,14 +150,16 @@ def _prepare_acme_server(workspace, acme_type, acme_xdist):
with open(os.path.join(instance_path, 'docker-compose.yml'), 'w') as file_handler:
file_handler.write(yaml.dump(config))
with open(os.path.join(instance_path, 'test', 'pebble-config.json'), 'r') as file_handler:
config = yaml.load(file_handler.read())
with open(os.path.join(instance_path, 'test', 'config', 'pebble-config.json'), 'r') as file_handler:
config = json.loads(file_handler.read())
# Setup the OCSP Responder URL for Pebble to local mock
config['ocspResponderURL'] = 'http://127.0.0.1:{0}'.format(MOCK_OCSP_SERVER_PORT)
config['pebble']['ocspResponderURL'] = 'http://127.0.0.1:{0}'.format(MOCK_OCSP_SERVER_PORT)
with open(os.path.join(instance_path, 'test', 'pebble-config.json'), 'w') as file_handler:
file_handler.write(yaml.dump(config))
print(json.dumps(config))
with open(os.path.join(instance_path, 'test', 'config', 'pebble-config.json'), 'w') as file_handler:
file_handler.write(json.dumps(config))
# Launch the ACME CA server.
_launch_command(['docker-compose', 'up', '--force-recreate', '-d'], cwd=instance_path)
@@ -27,14 +27,6 @@ from six.moves import socketserver, SimpleHTTPServer
from certbot_integration_tests.utils import ocsp_server
from certbot_integration_tests.utils.constants import MOCK_OCSP_SERVER_PORT
try:
import urllib3
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
except ImportError:
# Handle old versions of request with vendorized urllib3
from requests.packages.urllib3.exceptions import InsecureRequestWarning
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
RSA_KEY_TYPE = 'rsa'
ECDSA_KEY_TYPE = 'ecdsa'
@@ -49,6 +41,7 @@ def check_until_timeout(url):
for _ in range(0, 150):
time.sleep(1)
try:
_ignore_https_warnings()
if requests.get(url, verify=False).status_code == 200:
return
except requests.exceptions.ConnectionError:
@@ -299,8 +292,10 @@ def mock_ocsp_server(directory_url, workspace):
key_path = os.path.join(workspace, 'ocsp_key.pem')
cert_path = os.path.join(workspace, 'ocsp_cert.pem')
with open(key_path, 'w') as file_h:
_ignore_https_warnings()
file_h.write(requests.get(root_url + '/intermediate-key', verify=False).content)
with open(cert_path, 'w') as file_h:
_ignore_https_warnings()
file_h.write(requests.get(root_url + '/intermediate', verify=False).content)
environ = os.environ.copy()
@@ -310,3 +305,13 @@ def mock_ocsp_server(directory_url, workspace):
process = subprocess.Popen([sys.executable, ocsp_server.__file__], env=environ)
return process, 'http://127.0.0.1:{0}'.format(MOCK_OCSP_SERVER_PORT)
def _ignore_https_warnings():
try:
import urllib3
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
except ImportError:
# Handle old versions of request with vendorized urllib3
from requests.packages.urllib3.exceptions import InsecureRequestWarning
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)