def test_600_000(self): # test case: generate config with md -> restart -> drive -> generate config # with vhost and ssl -> restart -> check HTTPS access domain = self.test_domain dnsList = [domain, "www." + domain] conf = HttpdConf() conf.add_admin("admin@" + domain) conf.add_drive_mode("manual") conf.add_md(dnsList) conf.install() # - restart, check that md is in store assert TestEnv.apache_restart() == 0 TestEnv.check_md(domain, dnsList) # - drive assert TestEnv.a2md(["-vvvv", "drive", domain])['rv'] == 0 assert TestEnv.apache_restart() == 0 TestEnv.check_md_complete(domain) # - append vhost to config conf.add_vhost(TestEnv.HTTPS_PORT, domain, aliasList=[dnsList[1]]) conf.install() assert TestEnv.apache_restart() == 0 # check: SSL is running OK cert = CertUtil.load_server_cert(TestEnv.HTTPD_HOST, TestEnv.HTTPS_PORT, domain) assert domain in cert.get_san_list() # check file system permissions: TestEnv.check_file_permissions(domain)
def test_702_001(self): domain = self.test_domain # generate config with one MD domains = [domain, "www." + domain] conf = HttpdConf() conf.add_admin("admin@" + domain) conf.add_drive_mode("auto") conf.add_md(domains) conf.install() # # restart, check that MD is synched to store assert TestEnv.apache_restart() == 0 TestEnv.check_md(domains) stat = TestEnv.get_md_status(domain) assert stat["watched"] == 0 # # add vhost for MD, restart should drive it conf.add_vhost(domains) conf.install() assert TestEnv.apache_restart() == 0 assert TestEnv.await_completion([domain]) TestEnv.check_md_complete(domain) stat = TestEnv.get_md_status(domain) assert stat["watched"] == 1 cert = TestEnv.get_cert(domain) assert domain in cert.get_san_list() # # challenges should have been removed # file system needs to have correct permissions TestEnv.check_dir_empty(TestEnv.store_challenges()) TestEnv.check_file_permissions(domain)
def test_602_000(self): # test case: generate config with md -> restart -> drive -> generate config # with vhost and ssl -> restart -> check HTTPS access domain = self.test_domain domains = [domain, "www." + domain] # - generate config with one md conf = HttpdConf() conf.add_admin("admin@" + domain) conf.add_drive_mode("manual") conf.add_md(domains) conf.install() # - restart, check that md is in store assert TestEnv.apache_restart() == 0 TestEnv.check_md(domains) # - drive assert TestEnv.a2md(["-v", "drive", domain])['rv'] == 0 assert TestEnv.apache_restart() == 0 TestEnv.check_md_complete(domain) # - append vhost to config conf.add_vhost(domains) conf.install() assert TestEnv.apache_restart() == 0 # check: SSL is running OK cert = TestEnv.get_cert(domain) assert domain in cert.get_san_list() # check file system permissions: TestEnv.check_file_permissions(domain)
def test_702_001(self): domain = self.test_domain # generate config with one MD dns_list = [domain, "www." + domain] conf = HttpdConf() conf.add_admin("admin@" + domain) conf.add_drive_mode("auto") conf.add_md(dns_list) conf.install() # restart, check that MD is synched to store assert TestEnv.apache_restart() == 0 TestEnv.check_md(domain, dns_list) time.sleep(2) # assert drive did not start TestEnv.check_md(domain, dns_list, TestEnv.MD_S_INCOMPLETE) assert TestEnv.apache_err_scan( re.compile('.*\[md:debug\].*no mds to drive')) # add vhost for MD, restart should drive it conf.add_vhost(TestEnv.HTTPS_PORT, domain, aliasList=[dns_list[1]]) conf.install() assert TestEnv.apache_restart() == 0 assert TestEnv.await_completion([domain]) TestEnv.check_md_complete(domain) cert = CertUtil.load_server_cert(TestEnv.HTTPD_HOST, TestEnv.HTTPS_PORT, domain) assert domain in cert.get_san_list() # challenges should have been removed TestEnv.check_dir_empty(TestEnv.store_challenges()) # file system needs to have correct permissions TestEnv.check_file_permissions(domain)
def test_600_000(self): # test case: generate config with md -> restart -> drive -> generate config # with vhost and ssl -> restart -> check HTTPS access domain = "r000-" + TestRoundtrip.dns_uniq dnsList = [domain, "www." + domain] # - generate config with one md conf = HttpdConf(TestRoundtrip.TMP_CONF, True) conf.add_admin("admin@" + domain) conf.add_drive_mode("manual") conf.add_md(dnsList) conf.install() # - restart, check that md is in store assert TestEnv.apache_restart() == 0 self._check_md_names(domain, dnsList) # - drive assert TestEnv.a2md(["-v", "drive", domain])['rv'] == 0 self._check_md_cert(dnsList) # - append vhost to config conf.add_vhost(TestEnv.HTTPS_PORT, domain, aliasList=[dnsList[1]], withSSL=True) conf.install() assert TestEnv.apache_restart() == 0 # check: SSL is running OK cert = CertUtil.load_server_cert(TestEnv.HTTPD_HOST, TestEnv.HTTPS_PORT, domain) assert domain in cert.get_san_list() # check file system permissions: TestEnv.check_file_permissions(domain)
def test_500_100(self): # test case: md with one domain domain = self.test_domain name = "www." + domain self._prepare_md([name]) assert TestEnv.apache_start() == 0 # drive prevMd = TestEnv.a2md(["list", name])['jout']['output'][0] assert TestEnv.a2md(["drive", "-c", "http-01", name])['rv'] == 0 TestEnv.check_md_credentials([name]) self._check_account_key(name) # check archive content storeMd = json.loads( open(TestEnv.store_archived_file(name, 1, 'md.json')).read()) for f in [ 'name', 'ca', 'domains', 'contacts', 'renew-mode', 'renew-window', 'must-staple' ]: assert storeMd[f] == prevMd[f] # check file system permissions: TestEnv.check_file_permissions(name) # check: challenges removed TestEnv.check_dir_empty(TestEnv.store_challenges()) # check how the challenge resources are answered in sevceral combinations result = TestEnv.get_meta(domain, "/.well-known/acme-challenge", False) assert result['rv'] == 0 assert result['http_status'] == 404 result = TestEnv.get_meta(domain, "/.well-known/acme-challenge/", False) assert result['rv'] == 0 assert result['http_status'] == 404 result = TestEnv.get_meta(domain, "/.well-known/acme-challenge/123", False) assert result['rv'] == 0 assert result['http_status'] == 404 assert result['rv'] == 0 cdir = os.path.join(TestEnv.store_challenges(), domain) os.makedirs(cdir) open(os.path.join(cdir, 'acme-http-01.txt'), "w").write("content-of-123") result = TestEnv.get_meta(domain, "/.well-known/acme-challenge/123", False) assert result['rv'] == 0 assert result['http_status'] == 200 assert result['http_headers']['Content-Length'] == '14'
def test_500_100(self): # test case: md with one domain domain = "test500-100-" + TestDrive.dns_uniq name = "www." + domain self._prepare_md([name]) assert TestEnv.apache_start() == 0 # drive prevMd = TestEnv.a2md(["list", name])['jout']['output'][0] assert TestEnv.a2md(["drive", "-c", "http-01", name])['rv'] == 0 self._check_md_cert([name]) self._check_account_key(name) # check: challenges removed TestEnv.check_dir_empty(TestEnv.path_challenges()) # check archive content assert json.loads( open(TestEnv.path_domain(name, archiveVersion=1)).read()) == prevMd # check file system permissions: TestEnv.check_file_permissions(name)
def test_700_001(self): domain = "test700-001-" + TestAuto.dns_uniq # generate config with one MD dns_list = [domain, "www." + domain] conf = HttpdConf(TestAuto.TMP_CONF) conf.add_admin("admin@" + domain) conf.add_drive_mode("auto") conf.add_md(dns_list) conf.install() # restart, check that MD is synched to store assert TestEnv.apache_restart() == 0 self._check_md_names(domain, dns_list) time.sleep(2) # assert drive did not start md = TestEnv.a2md(["-j", "list", domain])['jout']['output'][0] assert md['state'] == TestEnv.MD_S_INCOMPLETE assert 'account' not in md['ca'] assert TestEnv.apache_err_scan( re.compile('.*\[md:debug\].*no mds to auto drive')) # add vhost for MD, restart should drive it conf.add_vhost(TestEnv.HTTPS_PORT, domain, aliasList=[dns_list[1]], withSSL=True) conf.install() assert TestEnv.apache_restart() == 0 assert TestEnv.await_completion([domain]) self._check_md_cert(dns_list) cert = CertUtil.load_server_cert(TestEnv.HTTPD_HOST, TestEnv.HTTPS_PORT, domain) assert domain in cert.get_san_list() # challenges should have been removed TestEnv.check_dir_empty(TestEnv.path_challenges()) # file system needs to have correct permissions TestEnv.check_file_permissions(domain)
def test_502_100(self): # test case: md with one domain domain = "test502-100-" + TestDrive.dns_uniq name = "www." + domain self._prepare_md([name]) assert TestEnv.apache_start() == 0 # drive prevMd = TestEnv.a2md(["list", name])['jout']['output'][0] assert TestEnv.a2md(["-v", "drive", "-c", "http-01", name])['rv'] == 0 self._check_md_cert([name]) self._check_account_key(name) # check archive content assert json.loads( open(TestEnv.path_domain(name, archiveVersion=1)).read()) == prevMd # check file system permissions: TestEnv.check_file_permissions(name) # check: challenges removed TestEnv.check_dir_empty(TestEnv.path_challenges()) # check how the challenge resources are answered in sevceral combinations result = TestEnv.get_meta(domain, "/.well-known/acme-challenge", False) assert result['rv'] == 0 assert result['http_status'] == 404 result = TestEnv.get_meta(domain, "/.well-known/acme-challenge/", False) assert result['rv'] == 0 assert result['http_status'] == 404 result = TestEnv.get_meta(domain, "/.well-known/acme-challenge/123", False) assert result['rv'] == 0 assert result['http_status'] == 404 assert result['rv'] == 0 cdir = os.path.join(TestEnv.path_challenges(), domain) os.makedirs(cdir) open(os.path.join(cdir, 'acme-http-01.txt'), "w").write("content-of-123") result = TestEnv.get_meta(domain, "/.well-known/acme-challenge/123", False) assert result['rv'] == 0 assert result['http_status'] == 200 assert result['http_headers']['Content-Length'] == '14'