Skip to content

Commit 72ac1a6

Browse files
committed
Merge branch 'devel'
2 parents bf6debb + d514016 commit 72ac1a6

17 files changed

+87
-17
lines changed

.github/workflows/acme_sh-application-test.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,11 @@ jobs:
140140
docker-compose up -d
141141
docker-compose logs
142142
143+
- name: "[ WAIT ] Sleep for 10s"
144+
uses: juliangruber/sleep-action@v1
145+
with:
146+
time: 10s
147+
143148
- name: "Test http://acme-srv/directory is accessable"
144149
run: docker run -i --rm --network acme curlimages/curl -f http://acme-srv/directory
145150

@@ -252,6 +257,11 @@ jobs:
252257
docker-compose up -d
253258
docker-compose logs
254259
260+
- name: "[ WAIT ] Sleep for 10s"
261+
uses: juliangruber/sleep-action@v1
262+
with:
263+
time: 10s
264+
255265
- name: "Test http://acme-srv/directory is accessable"
256266
run: docker run -i --rm --network acme curlimages/curl -f http://acme-srv/directory
257267

@@ -364,6 +374,11 @@ jobs:
364374
docker-compose up -d
365375
docker-compose logs
366376
377+
- name: "[ WAIT ] Sleep for 10s"
378+
uses: juliangruber/sleep-action@v1
379+
with:
380+
time: 10s
381+
367382
- name: "Test http://acme-srv/directory is accessable"
368383
run: docker run -i --rm --network acme curlimages/curl -f http://acme-srv/directory
369384

.github/workflows/lego-application-test.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,11 @@ jobs:
111111
docker-compose up -d
112112
docker-compose logs
113113
114+
- name: "[ WAIT ] Sleep for 10s"
115+
uses: juliangruber/sleep-action@v1
116+
with:
117+
time: 10s
118+
114119
- name: "Test http://acme-srv/directory is accessable"
115120
run: docker run -i --rm --network acme curlimages/curl -f http://acme-srv/directory
116121

@@ -194,6 +199,11 @@ jobs:
194199
docker-compose up -d
195200
docker-compose logs
196201
202+
- name: "[ WAIT ] Sleep for 10s"
203+
uses: juliangruber/sleep-action@v1
204+
with:
205+
time: 10s
206+
197207
- name: "Test http://acme-srv/directory is accessable"
198208
run: docker run -i --rm --network acme curlimages/curl -f http://acme-srv/directory
199209

@@ -277,6 +287,11 @@ jobs:
277287
docker-compose up -d
278288
docker-compose logs
279289
290+
- name: "[ WAIT ] Sleep for 10s"
291+
uses: juliangruber/sleep-action@v1
292+
with:
293+
time: 10s
294+
280295
- name: "Test http://acme-srv/directory is accessable"
281296
run: docker run -i --rm --network acme curlimages/curl -f http://acme-srv/directory
282297

.github/workflows/python-test.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,13 @@ jobs:
6161
pylint --rcfile=".github/pylintrc" acme_srv/ || pylint-exit $?
6262
- name: "Pylint folder: tools"
6363
run: |
64-
pylint --rcfile=".github/pylintrc" tools/ || pylint-exit $?
64+
pylint --rcfile=".github/pylintrc" tools/*.py || pylint-exit $?
6565
- name: "Pylint folder: examples/db_handler"
6666
run: |
67-
pylint --rcfile=".github/pylintrc" examples/db_handler/ || pylint-exit $?
67+
pylint --rcfile=".github/pylintrc" examples/db_handler/*.py || pylint-exit $?
6868
- name: "Pylint folder: examples/ca_handler"
6969
run: |
70-
pylint --rcfile=".github/pylintrc" examples/ca_handler/ || pylint-exit $?
70+
pylint --rcfile=".github/pylintrc" examples/ca_handler/*.py || pylint-exit $?
7171
7272
- name: "Linting with pycodestyle"
7373
run: |

CHANGES.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,15 @@ This is a high-level summary of the most important changes. For a full list of
55
changes, see the [git commit log](https://github.com/grindsa/acme2certifier/commits)
66
and pick the appropriate release branch.
77

8+
## Changes in 0.19.3
9+
10+
**Features and Improvements**:
11+
12+
- disable TLSv1.0 and TLSv1.1 fallback when conduction TLS-ALP=1 challenge validation
13+
- python3-cryptography will be installed via pip to fulfill dependencies from pyOpenssl
14+
- Changed encoding detection library from chardet to charset_normalizer
15+
- [lgtm](https://lgtm.com/projects/g/grindsa/acme2certifier/context:python) conformance
16+
817
## Changes in 0.19.2
918

1019
**Features and Improvements**:

acme_srv/helper.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ def fqdn_in_san_check(logger, san_list, fqdn):
425425
result = True
426426
break
427427
except Exception:
428-
pass
428+
logger.error('ERROR: fqdn_in_san_check() SAN split failed: {0}'.format(san))
429429

430430
logger.debug('fqdn_in_san_check() ended with: {}'.format(result))
431431
return result
@@ -880,6 +880,10 @@ def servercert_get(logger, hostname, port=443, proxy_server=None):
880880
context = ssl.create_default_context()
881881
context.check_hostname = False
882882
context.verify_mode = ssl.CERT_NONE
883+
# reject insecure ssl version
884+
context.options |= ssl.OP_NO_SSLv3
885+
context.options |= ssl.OP_NO_TLSv1
886+
context.options |= ssl.OP_NO_TLSv1_1
883887

884888
if proxy_server:
885889
(proxy_proto, proxy_addr, proxy_port) = proxystring_convert(logger, proxy_server)
@@ -888,7 +892,8 @@ def servercert_get(logger, hostname, port=443, proxy_server=None):
888892
sock.setproxy(proxy_proto, proxy_addr, port=proxy_port)
889893
try:
890894
sock.connect((hostname, port))
891-
with context.wrap_socket(sock, server_hostname=hostname) as sslsock: # lgtm [py/insecure-protocol]
895+
with context.wrap_socket(sock, server_hostname=hostname) as sslsock:
896+
logger.debug('servercert_get() configure proxy: {0}:{1} version: {2}'.format(hostname, port, sslsock.version()))
892897
der_cert = sslsock.getpeercert(True)
893898
# from binary DER format to PEM
894899
if der_cert:

acme_srv/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
# 1) we don't load dependencies by storing it in __init__.py
44
# 2) we can import it in setup.py for the same reason
55
# 3) we can import it into your module module
6-
__version__ = '0.19.2'
6+
__version__ = '0.19.3'
77
__dbversion__ = '0.18'

examples/Docker/apache2/django/Dockerfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ RUN apt-get install --no-install-recommends -y \
1414
python3-mysqldb \
1515
python3-pymysql \
1616
python3-psycopg2 \
17-
python3-cryptography \
1817
python3-yaml \
1918
&& rm -rf /var/lib/apt/lists/*
2019

examples/Docker/apache2/wsgi/Dockerfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ RUN apt-get install --no-install-recommends -y \
99
apache2-data \
1010
libapache2-mod-wsgi-py3 \
1111
curl \
12-
python3-cryptography \
1312
&& rm -rf /var/lib/apt/lists/*
1413

1514
# install python requirements

examples/Docker/nginx/django/Dockerfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ RUN apt-get install --no-install-recommends -y \
1515
python3-pymysql \
1616
python3-psycopg2 \
1717
python3-yaml \
18-
python3-cryptography \
1918
&& rm -rf /var/lib/apt/lists/*
2019

2120
# install python requirements

examples/Docker/nginx/wsgi/Dockerfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ RUN apt-get install --no-install-recommends -y \
99
uwsgi \
1010
uwsgi-plugin-python3 \
1111
curl \
12-
python3-cryptography \
1312
&& rm -rf /var/lib/apt/lists/*
1413

1514
# install python requirements

examples/acme2certifier_wsgi.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
CONFIG = load_config()
2525
try:
2626
DEBUG = CONFIG.getboolean('DEFAULT', 'debug')
27-
except BaseException:
27+
except Exception:
2828
DEBUG = False
2929

3030

examples/ca_handler/cmp_ca_handler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def _csr_san_get(self, csr):
7373
if value:
7474
o_list.append(value)
7575
except Exception:
76-
pass
76+
self.logger.error('ERROR: CAhandler._csr_san_get(): SAN split failed: {0}'.format(san))
7777

7878
if o_list:
7979
sans = '"{0}"'.format(', '.join(o_list))

examples/ca_handler/xca_ca_handler.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@ def _requestname_get(self, csr):
486486
try:
487487
(_identifiier, request_name,) = san_list[0].split(':')
488488
except Exception:
489-
pass
489+
self.logger.error('ERROR: CAhandler._request_name_get(): SAN split failed: {0}'.format(san_list))
490490

491491
self.logger.debug('CAhandler._request_name_get() ended with: {0}'.format(request_name))
492492
return request_name
@@ -697,7 +697,7 @@ def enroll(self, csr):
697697
request_name = self._requestname_get(csr)
698698
if request_name:
699699
# import CSR to database
700-
_csr_info = self._csr_import(csr, request_name)
700+
_csr_info = self._csr_import(csr, request_name) # lgtm [py/unused-local-variable]
701701

702702
# prepare the CSR to be signed
703703
csr = build_pem_file(self.logger, None, b64_url_recode(self.logger, csr), None, True)

requirements.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
setuptools
22
jwcrypto
3+
cryptography
34
pyOpenssl
45
dnspython
56
certsrv[ntlm]
67
pytz
78
configparser
89
python-dateutil
9-
requests[use_chardet_on_py3]
10+
requests
1011
pysocks
1112
josepy
1213
acme

test/test_cmp_ca_handler.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,15 @@ def test_031_csr_san_get(self, mock_san):
294294
olist = []
295295
self.assertEqual('"bar1, bar2"', self.cahandler._csr_san_get('csr'))
296296

297+
@patch('examples.ca_handler.cmp_ca_handler.csr_san_get')
298+
def test_032_csr_san_get(self, mock_san):
299+
""" test _csr_san_get - single damaged san """
300+
mock_san.return_value = ['foo:bar1', 'bar2']
301+
olist = []
302+
with self.assertLogs('test_a2c', level='INFO') as lcm:
303+
self.assertEqual('"bar1"', self.cahandler._csr_san_get('csr'))
304+
self.assertIn('ERROR:test_a2c:ERROR: CAhandler._csr_san_get(): SAN split failed: bar2', lcm.output)
305+
297306
def test_032_poll(self):
298307
""" test trigger """
299308
self.assertEqual(('Method not implemented.', None, None, 'poll_identifier', False), self.cahandler.poll('cert_name', 'poll_identifier', 'csr'))

test/test_helper.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1050,6 +1050,14 @@ def test_149_fqdn_in_san_check(self):
10501050
san_list = ['foo1.bar.local', 'DNS:foo.bar.local']
10511051
self.assertTrue(self.fqdn_in_san_check(self.logger, san_list, fqdn))
10521052

1053+
def test_150_fqdn_in_san_check(self):
1054+
""" successful check two entries one match """
1055+
fqdn = 'foo.bar.local'
1056+
san_list = ['foo1.bar.local']
1057+
with self.assertLogs('test_a2c', level='INFO') as lcm:
1058+
self.assertFalse(self.fqdn_in_san_check(self.logger, san_list, fqdn))
1059+
self.assertIn('ERROR:test_a2c:ERROR: fqdn_in_san_check() SAN split failed: foo1.bar.local', lcm.output)
1060+
10531061
def test_150_sha256_hash_hex(self):
10541062
""" sha256 digest as hex file """
10551063
self.assertEqual('2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae', self.sha256_hash_hex(self.logger, 'foo'))

test/test_xca_ca_handler.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,9 @@ def test_059_requestname_get(self, mock_cn, mock_san):
462462
""" CAhandler._requestname_get empty cn empty san"""
463463
mock_cn.return_value = None
464464
mock_san.return_value = []
465-
self.assertFalse(self.cahandler._requestname_get('csr'))
465+
with self.assertLogs('test_a2c', level='INFO') as lcm:
466+
self.assertFalse(self.cahandler._requestname_get('csr'))
467+
self.assertIn("ERROR:test_a2c:ERROR: CAhandler._request_name_get(): SAN split failed: []", lcm.output)
466468

467469
@patch('examples.ca_handler.xca_ca_handler.csr_san_get')
468470
@patch('examples.ca_handler.xca_ca_handler.csr_cn_get')
@@ -483,11 +485,21 @@ def test_061_requestname_get(self, mock_cn, mock_san):
483485
@patch('examples.ca_handler.xca_ca_handler.csr_san_get')
484486
@patch('examples.ca_handler.xca_ca_handler.csr_cn_get')
485487
def test_062_requestname_get(self, mock_cn, mock_san):
486-
""" CAhandler._requestname_get empty cn empty dsmaged san"""
488+
""" CAhandler._requestname_get empty cn empty damaged san"""
487489
mock_cn.return_value = None
488490
mock_san.return_value = ['dns:foo', 'bar']
489491
self.assertEqual('foo', self.cahandler._requestname_get('csr'))
490492

493+
@patch('examples.ca_handler.xca_ca_handler.csr_san_get')
494+
@patch('examples.ca_handler.xca_ca_handler.csr_cn_get')
495+
def test_063_requestname_get(self, mock_cn, mock_san):
496+
""" CAhandler._requestname_get empty cn empty damaged san"""
497+
mock_cn.return_value = None
498+
mock_san.return_value = ['foo', 'bar']
499+
with self.assertLogs('test_a2c', level='INFO') as lcm:
500+
self.assertEqual(None, self.cahandler._requestname_get('csr'))
501+
self.assertIn("ERROR:test_a2c:ERROR: CAhandler._request_name_get(): SAN split failed: ['foo', 'bar']", lcm.output)
502+
491503
def test_063_cert_insert(self):
492504
""" CAhandler._revocation_insert with empty rev_dic """
493505
rev_dic = {}

0 commit comments

Comments
 (0)