-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Stefan Eissing
committed
Jun 4, 2018
1 parent
67876bc
commit e710019
Showing
11 changed files
with
191 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,15 @@ | ||
v1.1.12 | ||
---------------------------------------------------------------------------------------------------- | ||
* less confusing logging when MDNotifyCmd returns a failure exit code | ||
* MDNotifyCmd can be configured with arguments to which the managed domain | ||
names are appended on invocation | ||
* added more test cases for MDNotifyCmd use | ||
|
||
v1.1.11 | ||
---------------------------------------------------------------------------------------------------- | ||
* fixes a Null Dereference when specially crafted requests are sent to the server. Reported | ||
by Daniel Caminada <[email protected]>. | ||
|
||
v1.1.10 | ||
---------------------------------------------------------------------------------------------------- | ||
* fixes error in renew window calculation that may lead to mod_md running | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,7 @@ | |
# | ||
|
||
AC_PREREQ([2.69]) | ||
AC_INIT([mod_md], [1.1.10], [[email protected]]) | ||
AC_INIT([mod_md], [1.1.12], [[email protected]]) | ||
|
||
LT_PREREQ([2.2.6]) | ||
LT_INIT() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -396,6 +396,24 @@ def test_500_111(self): | |
assert r['http_status'] == 303 | ||
assert r['http_headers']['Location'] == expLocation | ||
|
||
def test_500_120(self): | ||
# test case: NP dereference reported by Daniel Caminada <[email protected]> | ||
domain = "test500-120-" + TestDrive.dns_uniq | ||
name = "www." + domain | ||
conf = HttpdConf( TestDrive.TMP_CONF ) | ||
conf.add_admin( "admin@" + domain ) | ||
conf.add_drive_mode( "manual" ) | ||
conf.add_md( [name] ) | ||
conf.add_vhost(TestEnv.HTTPS_PORT, name, aliasList=[], withSSL=True) | ||
conf.install() | ||
assert TestEnv.apache_restart() == 0 | ||
r = TestEnv.run( [ "openssl", "s_client", | ||
"-connect", "%s:%s" % (TestEnv.HTTPD_HOST, TestEnv.HTTPS_PORT), | ||
"-servername", "example.com", "-crlf" | ||
], "GET https:// HTTP/1.1\nHost: example.com\n\n" ) | ||
assert TestEnv.apache_restart() == 0 | ||
# assert that no crash is reported in the log | ||
assert not TestEnv.apache_err_scan( re.compile("^.* child pid \S+ exit .*$") ) | ||
|
||
# --------- critical state change -> drive again --------- | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -425,54 +425,6 @@ def test_7011(self): | |
self._check_md_names(domain, dns_list) | ||
assert TestEnv.await_completion( [ domain ], 10 ) | ||
|
||
#----------------------------------------------------------------------------------------------- | ||
# test case: signup with configured notify cmd that is invalid | ||
# | ||
def test_7020(self): | ||
domain = ("%s-" % self.test_n) + TestAuto.dns_uniq | ||
|
||
# generate config with two MDs | ||
dnsList = [ domain, "www." + domain ] | ||
conf = HttpdConf( TestAuto.TMP_CONF ) | ||
conf.add_admin( "[email protected]" ) | ||
conf._add_line( "MDNotifyCmd blablabla" ) | ||
conf.add_drive_mode( "auto" ) | ||
conf.add_md( dnsList ) | ||
conf.add_vhost( TestEnv.HTTPS_PORT, domain, aliasList=[ dnsList[1] ], withSSL=True ) | ||
conf.install() | ||
|
||
# restart, check that md is in store | ||
assert TestEnv.apache_restart() == 0 | ||
self._check_md_names( domain, dnsList ) | ||
# await drive completion | ||
assert TestEnv.await_completion( [ domain ], 30 ) | ||
self._check_md_cert(dnsList) | ||
# this command should have failed and logged an error | ||
assert (1, 0) == TestEnv.apache_err_total() | ||
|
||
def test_7021(self): | ||
domain = ("%s-" % self.test_n) + TestAuto.dns_uniq | ||
|
||
# generate config with two MDs | ||
dnsList = [ domain, "www." + domain ] | ||
conf = HttpdConf( TestAuto.TMP_CONF ) | ||
conf.add_admin( "[email protected]" ) | ||
conf._add_line( "MDNotifyCmd %s/notify.py" % TestEnv.TESTROOT ) | ||
conf.add_drive_mode( "auto" ) | ||
conf.add_md( dnsList ) | ||
conf.add_vhost( TestEnv.HTTPS_PORT, domain, aliasList=[ dnsList[1] ], withSSL=True ) | ||
conf.install() | ||
|
||
# restart, check that md is in store | ||
assert TestEnv.apache_restart() == 0 | ||
self._check_md_names( domain, dnsList ) | ||
# await drive completion | ||
assert TestEnv.await_completion( [ domain ], 30 ) | ||
self._check_md_cert(dnsList) | ||
# this command should have failed and logged an error | ||
TestEnv.apachectl_stderr = None | ||
assert (0, 0) == TestEnv.apache_err_total() | ||
|
||
#----------------------------------------------------------------------------------------------- | ||
# test case: one MD with several dns names. sign up. remove the *first* name | ||
# in the MD. restart. should find and keep the existing MD. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
# test mod_md notify support | ||
|
||
import json | ||
import os | ||
import pytest | ||
import re | ||
import socket | ||
import ssl | ||
import sys | ||
import time | ||
|
||
from datetime import datetime | ||
from httplib import HTTPSConnection | ||
from test_base import TestEnv | ||
from test_base import HttpdConf | ||
from test_base import CertUtil | ||
|
||
|
||
def setup_module(module): | ||
print("setup_module module:%s" % module.__name__) | ||
TestEnv.init() | ||
TestEnv.APACHE_CONF_SRC = "data/test_auto" | ||
TestEnv.check_acme() | ||
TestEnv.clear_store() | ||
TestEnv.install_test_conf(); | ||
assert TestEnv.apache_start() == 0 | ||
|
||
|
||
def teardown_module(module): | ||
print("teardown_module module:%s" % module.__name__) | ||
assert TestEnv.apache_stop() == 0 | ||
|
||
|
||
class TestAuto: | ||
|
||
@classmethod | ||
def setup_class(cls): | ||
time.sleep(1) | ||
cls.dns_uniq = "%d.org" % time.time() | ||
cls.TMP_CONF = os.path.join(TestEnv.GEN_DIR, "auto.conf") | ||
|
||
|
||
def setup_method(self, method): | ||
print("setup_method: %s" % method.__name__) | ||
TestEnv.apache_err_reset(); | ||
TestEnv.clear_store() | ||
TestEnv.install_test_conf(); | ||
self.test_n = re.match("test_(.+)", method.__name__).group(1) | ||
self.test_domain = ("%s-" % self.test_n) + TestAuto.dns_uniq | ||
|
||
def teardown_method(self, method): | ||
print("teardown_method: %s" % method.__name__) | ||
|
||
#----------------------------------------------------------------------------------------------- | ||
# MD host with notifcy command | ||
# | ||
#----------------------------------------------------------------------------------------------- | ||
# test case: signup with configured notify cmd that is invalid | ||
# | ||
def test_9001(self): | ||
domain = ("%s-" % self.test_n) + TestAuto.dns_uniq | ||
|
||
# generate config with two MDs | ||
dnsList = [ domain, "www." + domain ] | ||
conf = HttpdConf( TestAuto.TMP_CONF ) | ||
conf.add_admin( "[email protected]" ) | ||
conf.add_notify_cmd( "blablabla" ) | ||
conf.add_drive_mode( "auto" ) | ||
conf.add_md( dnsList ) | ||
conf.add_vhost( TestEnv.HTTPS_PORT, domain, aliasList=[ dnsList[1] ], withSSL=True ) | ||
conf.install() | ||
|
||
# restart, and retrieve cert | ||
assert TestEnv.apache_restart() == 0 | ||
assert TestEnv.await_completion( [ domain ], 30 ) | ||
# this command should have failed and logged an error | ||
assert (1, 0) == TestEnv.apache_err_total() | ||
|
||
def test_9010(self): | ||
domain = ("%s-" % self.test_n) + TestAuto.dns_uniq | ||
ncmd = ("%s/notify.py" % TestEnv.TESTROOT) | ||
nlog = ("%s/notify.log" % TestEnv.GEN_DIR) | ||
|
||
# generate config with two MDs | ||
dnsList = [ domain, "www." + domain ] | ||
conf = HttpdConf( TestAuto.TMP_CONF ) | ||
conf.add_admin( "[email protected]" ) | ||
conf.add_notify_cmd( "%s %s" % (ncmd, nlog) ) | ||
conf.add_drive_mode( "auto" ) | ||
conf.add_md( dnsList ) | ||
conf.add_vhost( TestEnv.HTTPS_PORT, domain, aliasList=[ dnsList[1] ], withSSL=True ) | ||
conf.install() | ||
|
||
# restart, and retrieve cert | ||
assert TestEnv.apache_restart() == 0 | ||
assert TestEnv.await_completion( [ domain ], 30 ) | ||
# this command should have failed and logged an error | ||
assert (0, 0) == TestEnv.apache_err_total() | ||
nlines = open(nlog).readlines() | ||
assert 1 == len(nlines) | ||
assert ("['%s', '%s', '%s']" % (ncmd, nlog, domain)) == nlines[0] | ||
|
||
def test_9011(self): | ||
domain = ("%s-" % self.test_n) + TestAuto.dns_uniq | ||
ncmd = ("%s/notify.py" % TestEnv.TESTROOT) | ||
nlog = ("%s/notify.log" % TestEnv.GEN_DIR) | ||
|
||
# generate config with two MDs | ||
dnsList = [ domain, "www." + domain ] | ||
conf = HttpdConf( TestAuto.TMP_CONF ) | ||
conf.add_admin( "[email protected]" ) | ||
conf.add_notify_cmd( "%s %s test_9011" % (ncmd, nlog) ) | ||
conf.add_drive_mode( "auto" ) | ||
conf.add_md( dnsList ) | ||
conf.add_vhost( TestEnv.HTTPS_PORT, domain, aliasList=[ dnsList[1] ], withSSL=True ) | ||
conf.install() | ||
|
||
# restart, and retrieve cert | ||
assert TestEnv.apache_restart() == 0 | ||
assert TestEnv.await_completion( [ domain ], 30 ) | ||
# this command should have failed and logged an error | ||
assert (0, 0) == TestEnv.apache_err_total() | ||
nlines = open(nlog).readlines() | ||
assert 1 == len(nlines) | ||
assert ("['%s', '%s', 'test_9011', '%s']" % (ncmd, nlog, domain)) == nlines[0] | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters