def test_730_003(self): # just configuring one file will not work domain = self.test_domain domains = [domain, 'www.%s' % domain] testpath = os.path.join(TestEnv.GEN_DIR, 'test_920_001') # cert that is only 10 more days valid CertUtil.create_self_signed_cert(domains, { "notBefore": -80, "notAfter": 10 }, serial=730001, path=testpath) cert_file = os.path.join(testpath, 'pubcert.pem') pkey_file = os.path.join(testpath, 'privkey.pem') assert os.path.exists(cert_file) assert os.path.exists(pkey_file) conf = HttpdConf() conf.add_admin("*****@*****.**") conf.start_md(domains) conf.add_line("MDCertificateFile %s" % (cert_file)) conf.end_md() conf.add_vhost(domain) conf.install() assert TestEnv.apache_fail() == 0 conf = HttpdConf() conf.add_admin("*****@*****.**") conf.start_md(domains) conf.add_line("MDCertificateKeyFile %s" % (pkey_file)) conf.end_md() conf.add_vhost(domain) conf.install() assert TestEnv.apache_fail() == 0
def test_300_004(self): assert TestEnv.apache_stop() == 0 HttpdConf(text=""" MDomain not-forbidden.org www.not-forbidden.org mail.not-forbidden.org test3.not-forbidden.org MDomain example2.org test3.not-forbidden.org www.example2.org mail.example2.org """).install() assert TestEnv.apache_fail() == 0
def test_300_021(self, confFile, expErrMsg): TestEnv.install_test_conf(confFile) assert TestEnv.apache_fail() == 0, "Server did start for {}".format( confFile) assert (1, 0) == TestEnv.apache_err_count() if expErrMsg: assert TestEnv.apache_err_scan(re.compile(expErrMsg))
def test_300_021(self): HttpdConf(text=""" MDomain secret.com <VirtualHost *:12344> ServerName not.secret.com ServerAlias secret.com SSLEngine on </VirtualHost> """).install() assert TestEnv.apache_fail() == 0, "Server did start for {}".format(line) assert (1, 0) == TestEnv.httpd_error_log_count() assert TestEnv.httpd_error_log_scan( re.compile(".*Virtual Host not.secret.com:0 matches Managed Domain 'secret.com', but the name/alias not.secret.com itself is not managed. A requested MD certificate will not match ServerName.*") )
def test_300_011(self): HttpdConf(text=""" MDomain not-forbidden.org manual www.not-forbidden.org mail.not-forbidden.org test3.not-forbidden.org <VirtualHost *:12346> ServerName not-forbidden.org ServerAlias test3.not-forbidden.org ServerAlias test4.not-forbidden.org </VirtualHost> """).install() assert TestEnv.apache_fail() == 0 assert (1, 0) == TestEnv.httpd_error_log_count()
def test_300_009(self): assert TestEnv.apache_stop() == 0 HttpdConf(text=""" MDMembers manual MDomain not-forbidden.org www.not-forbidden.org mail.not-forbidden.org test3.not-forbidden.org MDomain example2.org www.example2.org www.example3.org <VirtualHost *:12346> ServerName example2.org ServerAlias www.example3.org </VirtualHost> <VirtualHost *:12346> ServerName www.example2.org ServerAlias example2.org </VirtualHost> <VirtualHost *:12346> ServerName not-forbidden.org ServerAlias example2.org </VirtualHost> """).install() assert TestEnv.apache_fail() == 0
def test_300_009(self): # vhosts with overlapping MDs assert TestEnv.apache_stop() == 0 TestEnv.install_test_conf("test_009"); assert TestEnv.apache_fail() == 0
def test_300_004(self): # two MDomain definitions, overlapping TestEnv.install_test_conf("test_001"); assert TestEnv.apache_stop() == 0 TestEnv.install_test_conf("test_004"); assert TestEnv.apache_fail() == 0
def test_300_003(self): # two MDomain definitions, exactly the same assert TestEnv.apache_stop() == 0 TestEnv.install_test_conf("test_003"); assert TestEnv.apache_fail() == 0
def test_300_011(self): # MDomain, misses one ServerAlias TestEnv.install_test_conf("test_011"); assert TestEnv.apache_fail() == 0 assert (1, 0) == TestEnv.apache_err_count()