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_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_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_910_01(self): # generate a simple MD domain = self.test_domain dnsList = [domain] conf = HttpdConf() conf.add_admin("*****@*****.**") conf.add_drive_mode("manual") conf.add_md(dnsList) conf.add_vhost(TestEnv.HTTPS_PORT, domain, aliasList=[]) conf.install() # create valid/invalid challenges subdirs challenges_dir = TestEnv.store_challenges() dirs_before = ["aaa", "bbb", domain, "zzz"] for name in dirs_before: os.makedirs(os.path.join(challenges_dir, name)) assert TestEnv.apache_restart() == 0 # the one we use is still there assert os.path.isdir(os.path.join(challenges_dir, domain)) # and the others are gone missing_after = ["aaa", "bbb", "zzz"] for name in missing_after: assert not os.path.exists(os.path.join(challenges_dir, name))