Commit graph

218 commits

Author SHA1 Message Date
Brad Warren
21cebbb520 filter by port in http01 2018-01-16 22:28:58 -08:00
Brad Warren
886ff583b3 fix bytes 2018-01-16 22:22:01 -08:00
Brad Warren
8568cc391b add find_best_http_vhost port test 2018-01-16 22:16:57 -08:00
Brad Warren
d95eed3b5d respect port in find_best_http_vhost 2018-01-16 22:10:22 -08:00
Brad Warren
c429a15edf filter defaults 2018-01-16 21:45:20 -08:00
Brad Warren
cb59903a40 fix typo 2018-01-16 21:40:06 -08:00
Brad Warren
60d825c56a fix typo 2018-01-16 21:39:00 -08:00
Brad Warren
e4b3bda05d include default vhosts 2018-01-16 21:37:58 -08:00
Brad Warren
9bb48778dc fix typo 2018-01-16 21:13:13 -08:00
Brad Warren
90ca31f15c Don't add includes twice 2018-01-16 21:12:40 -08:00
Brad Warren
ac06b0d759 fix test-same-vhost 2018-01-16 21:11:17 -08:00
Brad Warren
cdf4d4b0ce fix typo 2018-01-16 21:06:54 -08:00
Brad Warren
485b534557 add test_same_vhost 2018-01-16 21:06:10 -08:00
Brad Warren
5f6a350a56 fix tests 2018-01-16 21:01:00 -08:00
Brad Warren
f91f6d418e add alias 2018-01-16 20:59:22 -08:00
Brad Warren
0aa6898218 play coverage games 2018-01-16 20:50:55 -08:00
Brad Warren
abc0287cde make lint happy 2018-01-16 20:44:41 -08:00
Brad Warren
72144f6cb7 fix typo 2018-01-16 20:39:56 -08:00
Brad Warren
4c001ad466 check for Include in vhost 2018-01-16 20:39:17 -08:00
Brad Warren
94f521553e test for rewrite 2018-01-16 20:32:09 -08:00
Brad Warren
3e348332a9 fix http-01 tests? pt2 2018-01-16 20:29:26 -08:00
Brad Warren
8d09c4c6cd fix http-01 tests? 2018-01-16 20:19:30 -08:00
Brad Warren
aa0678a14e fix enmod test 2018-01-16 20:06:59 -08:00
Brad Warren
daeda80bb0 does double backslash make pylint happy? 2018-01-16 20:03:11 -08:00
Brad Warren
dbef9b64ef remove S which doesn't seem to work across contexts 2018-01-16 19:00:54 -08:00
Brad Warren
6c14d88068 fix order args 2018-01-16 18:46:44 -08:00
Brad Warren
0e95baf8a4 uncomment tests 2018-01-16 18:23:34 -08:00
Brad Warren
00da23cbf2 use stricter rewriterule 2018-01-16 18:22:48 -08:00
Brad Warren
75a9ec8796 remove ifmod rewrite 2018-01-16 18:19:34 -08:00
Brad Warren
de1d5c1abb enable mod_rewrite 2018-01-16 18:18:16 -08:00
Brad Warren
d7989650f3 remove unneeded directives 2018-01-16 18:17:35 -08:00
Brad Warren
8b03dc33bd fix quote spacing 2018-01-16 18:16:33 -08:00
Joona Hoikkala
1df91d749f
Include overrides to every VirtualHost 2018-01-17 02:04:11 +02:00
Joona Hoikkala
3819e36fe7
Finalized HTTP vhost discovery and added overrides 2018-01-16 20:33:25 +02:00
Brad Warren
368ca0c109 Small cleanup for Apache HTTP-01
* Remove http_doer from self

* Refactor _find_best_vhost
2018-01-15 22:08:37 -08:00
Joona Hoikkala
60dd67a60e Use static directory under workdir for HTTP challenges (#5428)
* Use static directory under workdir for HTTP challenges

* Handle the reverter file registration before opening file handle
2018-01-14 15:22:22 -08:00
Joona Hoikkala
28dad825af
Do not try to remove temp dir if it wasn't created 2018-01-11 20:44:40 +02:00
Brad Warren
f0f5defb6f Address minor concerns with Apache HTTP-01
* enable other modules

* change port type

* remove maxDiff from test class

* update port comment

* add -f to a2dismod
2018-01-11 09:59:25 -08:00
Joona Hoikkala
fa97877cfb Make sure that Apache is listening on port 80 and has mod_alias
* Ensure that mod_alias is enabled

* Make sure we listen to port http01_port
2018-01-11 14:48:32 +02:00
Brad Warren
2ba334a182 Add basic HTTP01 support to Apache
* Add a simple version of HTTP01

* remove cert from chall name

* make directory work on 2.2

* cleanup challenges when finished

* import shutil

* fixup perform and cleanup tests

* Add tests for http_01.py
2018-01-10 23:35:09 -08:00
Brad Warren
9e95208101
Factor out common challengeperformer logic (#5413) 2018-01-10 18:34:45 -08:00
Brad Warren
d557475bb6
update Apache ciphersuites (#5383) 2018-01-09 07:46:21 -08:00
Joona Hoikkala
a3a66cd25d Use apache2ctl modules for Gentoo systems. (#5349)
* Do not call Apache binary for module reset in cleanup()

* Use apache2ctl modules for Gentoo
2018-01-04 14:36:16 -08:00
Joona Hoikkala
0e92d4ea98 Parse variables without whitespace separator correctly in CentOS family of distributions (#5318) 2017-12-11 11:50:56 -08:00
Jannis Leidel
2abc94661a Use josepy instead of acme.jose. (#5203) 2017-12-11 11:25:09 -08:00
Brad Warren
78d97ca023 Bump version to 0.21.0 2017-12-06 14:52:16 -08:00
Brad Warren
f1554324da
Release 0.20.0 2017-12-06 14:46:55 -08:00
Joona Hoikkala
dc78fd731e Distribution specific override functionality based on class inheritance (#5202)
Class inheritance based approach to distro specific overrides.

How it works:
The certbot-apache plugin entrypoint has been changed to entrypoint.ENTRYPOINT which is a variable containing appropriate override class for system, if available.

Override classes register themselves using decorator override.register() which takes a list of distribution fingerprints (ID & LIKE variables in /etc/os-release, or platform.linux_distribution() as a fallback). These end up as keys in dict override.OVERRIDE_CLASSES and values for the keys are references to the class that called the decorator, hence allowing self-registration of override classes when they are imported. The only file importing these override classes is entrypoint.py, so adding new override classes would need only one import in addition to the actual override class file.

Generic changes:

    Parser initialization has been moved to separate class method, allowing easy override where needed.
    Cleaned up configurator.py a bit, and moved some helper functions to newly created apache_util.py
    Split Debian specific code from configurator.py to debian_override.py
    Changed define_cmd to apache_cmd because the parameters are for every distribution supporting this behavior, and we're able to use the value to build the additional configuration dump commands.
    Moved add_parser_mod() from configurator to parser add_mod()
    Added two new configuration dump parsing methods to update_runtime_variables() in parser: update_includes() and update_modules().
    Changed init_modules() in parser to accommodate the changes above. (ie. don't throw existing self.modules out).
    Moved OS based constants to their respective override classes.
    Refactored configurator class discovery in tests to help easier test case creation using distribution based override configurator class.
    tests.util.get_apache_configurator() now takes keyword argument os_info which is string of the desired mock OS fingerprint response that's used for picking the right override class.

This PR includes two major generic additions that should vastly improve our parsing accuracy and quality:

    Includes are parsed from config dump from httpd binary. This is mandatory for some distributions (Like OpenSUSE) to get visibility over the whole configuration tree because of Include statements passed on in command line, and not via root httpd.conf file.
    Modules are parsed from config dump from httpd binary. This lets us jump into correct IfModule directives if for some reason we have missed the module availability (because of one being included on command line or such).

Distribution specific changes
Because of the generic changes, there are two distributions (or distribution families) that do not provide such functionality, so it had to be overridden in their respective override files. These distributions are:

    CentOS, because it deliberately limits httpd binary stdout using SELinux as a feature. We are doing opportunistic config dumps here however, in case SELinux enforcing is off.
    Gentoo, because it does not provide a way to invoke httpd with command line parsed from its specific configuration file. Gentoo relies heavily on Define statements that are passed over from APACHE2_OPTS variable /etc/conf.d/apache2 file and most of the configuration in root Apache configuration are dependent on these values.

Debian

    Moved the Debian specific parts from configurator.py to Debian specific override.

CentOS

    Parsing of /etc/sysconfig/httpd file for additional Define statements. This could hold other parameters too, but parsing everything off it would require a full Apache lexer. For CLI parameters, I think Defines are the most common ones. This is done in addition of opportunistic parsing of httpd binary config dump.
    Added CentOS default Apache configuration tree for realistic test cases.

Gentoo

    Parsing Defines from /etc/conf.d/apache2 variable APACHE2_OPTS, which holds additional Define statements to enable certain functionalities, enabling parts of the configuration in the Apache2 DOM. This is done instead of trying to parse httpd binary configuration dumps.
    Added default Apache configuration from Gentoo to testdata, including /etc/conf.d/apache2 file for realistic test cases.


* Distribution specific override functionality based on class inheritance

* Need to patch get_systemd_os_like to as travis has proper os-release

* Added pydoc

* Move parser initialization to a method and fix Python 3 __new__ errors

* Parser changes to parse HTTPD config

* Try to get modules and includes from httpd process for better visibility over the configuration

* Had to disable duplicate-code because of test setup (PyCQA/pylint/issues/214)

* CentOS tests and linter fixes

* Gentoo override, tests and linter fixes

* Mock the process call in all the tests that require it

* Fix CentOS test mock

* Restore reseting modules list functionality for cleanup

* Move OS fingerprinting and constant mocks to parent class

* Fixes requested in review

* New entrypoint structure and started moving OS constants to override classes

* OS constants move continued, test and linter fixes

* Removed dead code

* Apache compatibility test changest to reflect OS constant restructure

* Test fix

* Requested changes

* Moved Debian specific tests to own test file

* Removed decorator based override class registration in favor of entrypoint dict

* Fix for update_includes for some versions of Augeas

* Take fedora fix into account in tests

* Review fixes
2017-12-04 11:49:18 -08:00
Brad Warren
48173ed1cb
Switch from nose to pytest (#5282)
* Use pipstrap to install a good version of pip

* Use pytest in cb-auto tests

* Remove nose usage in auto_test.py

* remove nose dev dep

* use pytest in test_tests

* Use pytest in tox

* Update dev dependency pinnings

* remove nose multiprocess lines

* Use pytest for coverage

* Use older py and pytest for old python versions

* Add test for Error.__str__

* pin pytest in oldest test

* Fix tests for DNS-DO plugin on py26

* Work around bug for Python 3.3

* Clarify dockerfile comments
2017-12-01 10:59:55 -08:00
Felix Yan
5d2f6eb8ed Fix typos in certbot_apache/tests/configurator_test.py (#5193) 2017-10-19 11:23:07 -07:00