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 TestEnv.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_009(self): assert TestEnv.apache_stop() == 0 HttpdConf(text=""" ServerAdmin [email protected] 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 SSLEngine on </VirtualHost> <VirtualHost *:12346> ServerName www.example2.org ServerAlias example2.org SSLEngine on </VirtualHost> <VirtualHost *:12346> ServerName not-forbidden.org ServerAlias example2.org SSLEngine on </VirtualHost> """).install() assert TestEnv.apache_fail() == 0
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 *:%s> ServerName not-forbidden.org ServerAlias test3.not-forbidden.org ServerAlias test4.not-forbidden.org SSLEngine on </VirtualHost> """ % (TestEnv.HTTPS_PORT)).install() assert TestEnv.apache_fail() == 0 assert (1, 0) == TestEnv.httpd_error_log_count()
def test_300_021(self): HttpdConf(text=""" MDMembers manual MDomain secret.com <VirtualHost *:12344> ServerName not.secret.com ServerAlias secret.com SSLEngine on </VirtualHost> """).install() assert TestEnv.apache_fail() == 0 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.*" ))