Skip to content

Commit

Permalink
Merge remote-tracking branch 'github/letsencrypt/master' into acme-py…
Browse files Browse the repository at this point in the history
…lint
  • Loading branch information
kuba committed Jan 9, 2016
2 parents dba69d0 + ed85726 commit a367c98
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 3 deletions.
2 changes: 2 additions & 0 deletions acme/acme/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ class Error(jose.JSONObjectWithFields, errors.Error):
('connection', 'The server could not connect to the client to '
'verify the domain'),
('dnssec', 'The server could not validate a DNSSEC signed domain'),
('invalidEmail',
'The provided email for a registration was invalid'),
('malformed', 'The request message was malformed'),
('rateLimited', 'There were too many requests of a given type'),
('serverInternal', 'The server experienced an internal error'),
Expand Down
2 changes: 2 additions & 0 deletions docs/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -371,10 +371,12 @@ are provided here mainly for the :ref:`developers <hacking>` reference.
In general:

* ``sudo`` is required as a suggested way of running privileged process
* `Python`_ 2.6/2.7 is required
* `Augeas`_ is required for the Python bindings
* ``virtualenv`` and ``pip`` are used for managing other python library
dependencies

.. _Python: https://wiki.python.org/moin/BeginnersGuide/Download
.. _Augeas: http://augeas.net/
.. _Virtualenv: https://virtualenv.pypa.io

Expand Down
1 change: 1 addition & 0 deletions letsencrypt-apache/letsencrypt_apache/configurator.py
Original file line number Diff line number Diff line change
Expand Up @@ -1302,6 +1302,7 @@ def restart(self):
"""
self.config_test()
logger.debug(self.reverter.view_config_changes(for_logging=True))
self._reload()

def _reload(self):
Expand Down
3 changes: 3 additions & 0 deletions letsencrypt-apache/letsencrypt_apache/tls_sni_01.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
"""A class that performs TLS-SNI-01 challenges for Apache"""

import os
import logging

from letsencrypt.plugins import common

from letsencrypt_apache import obj
from letsencrypt_apache import parser

logger = logging.getLogger(__name__)

class ApacheTlsSni01(common.TLSSNI01):
"""Class that performs TLS-SNI-01 challenges within the Apache configurator
Expand Down Expand Up @@ -104,6 +106,7 @@ def _mod_config(self):
self.configurator.reverter.register_file_creation(
True, self.challenge_conf)

logger.debug("writing a config file with text: %s", config_text)
with open(self.challenge_conf, "w") as new_conf:
new_conf.write(config_text)

Expand Down
6 changes: 4 additions & 2 deletions letsencrypt-nginx/letsencrypt_nginx/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def get_vhosts(self):
for filename in servers:
for server in servers[filename]:
# Parse the server block into a VirtualHost object
parsed_server = _parse_server(server)
parsed_server = parse_server(server)
vhost = obj.VirtualHost(filename,
parsed_server['addrs'],
parsed_server['ssl'],
Expand Down Expand Up @@ -451,7 +451,7 @@ def _get_servernames(names):
return names.split(' ')


def _parse_server(server):
def parse_server(server):
"""Parses a list of server directives.
:param list server: list of directives in a server block
Expand All @@ -471,6 +471,8 @@ def _parse_server(server):
elif directive[0] == 'server_name':
parsed_server['names'].update(
_get_servernames(directive[1]))
elif directive[0] == 'ssl' and directive[1] == 'on':
parsed_server['ssl'] = True

return parsed_server

Expand Down
20 changes: 20 additions & 0 deletions letsencrypt-nginx/letsencrypt_nginx/tests/parser_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,26 @@ def test_get_all_certs_keys(self):
c_k = nparser.get_all_certs_keys()
self.assertEqual(set([('foo.pem', 'bar.key', filep)]), c_k)

def test_parse_server_ssl(self):
server = parser.parse_server([
['listen', '443']
])
self.assertFalse(server['ssl'])

server = parser.parse_server([
['listen', '443 ssl']
])
self.assertTrue(server['ssl'])

server = parser.parse_server([
['listen', '443'], ['ssl', 'off']
])
self.assertFalse(server['ssl'])

server = parser.parse_server([
['listen', '443'], ['ssl', 'on']
])
self.assertTrue(server['ssl'])

if __name__ == "__main__":
unittest.main() # pragma: no cover
4 changes: 3 additions & 1 deletion letsencrypt/reverter.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def rollback_checkpoints(self, rollback=1):
"Unable to load checkpoint during rollback")
rollback -= 1

def view_config_changes(self):
def view_config_changes(self, for_logging=False):
"""Displays all saved checkpoints.
All checkpoints are printed by
Expand Down Expand Up @@ -144,6 +144,8 @@ def view_config_changes(self):

output.append(os.linesep)

if for_logging:
return os.linesep.join(output)
zope.component.getUtility(interfaces.IDisplay).notification(
os.linesep.join(output), display_util.HEIGHT)

Expand Down

0 comments on commit a367c98

Please sign in to comment.