1
0
mirror of https://github.com/certbot/certbot.git synced 2026-01-26 07:41:33 +03:00
Commit Graph

20 Commits

Author SHA1 Message Date
Adrien Ferrand
9174c631d9 Disable TLS session tickets for Apache 2.4.11+ (#7191)
* Implement the logic

* Update tests

* Fix lint and changelog

* Update configurator.py

* Move the TLS configs in a dedicated folder. Fix the formalism of their naming and location.

* Improve existing test to check all TLS config have their hash registered in Certbot

* Corrections after review

* Improve a test

* Remove commented useless lines in TLS configs

* Add a nice warning. Because I am nice.

* Fix lint

* Add a test
2019-07-29 22:54:51 +03:00
Joona Hoikkala
3877af6619 Gradually increasing HSTS max-age (#5912)
This PR adds the functionality to enhance Apache configuration to include HTTP Strict Transport Security header with a low initial max-age value.

The max-age value will get increased on every (scheduled) run of certbot renew regardless of the certificate actually getting renewed, if the last increase took place longer than ten hours ago. The increase steps are visible in constants.AUTOHSTS_STEPS.

Upon the first actual renewal after reaching the maximum increase step, the max-age value will be made "permanent" and will get value of one year.

To achieve accurate VirtualHost discovery on subsequent runs, a comment with unique id string will be added to each enhanced VirtualHost.

* AutoHSTS code rebased on master

* Fixes to match the changes in master

* Make linter happy with metaclass registration

* Address small review comments

* Use new enhancement interfaces

* New style enhancement changes

* Do not allow --hsts and --auto-hsts simultaneuously

* MyPy annotation fixes and added test

* Change oldest requrements to point to local certbot core version

* Enable new style enhancements for run and install verbs

* Test refactor

* New test class for main.install tests

* Move a test to a correct test class
2018-06-21 07:27:19 -07:00
Brad Warren
d557475bb6 update Apache ciphersuites (#5383) 2018-01-09 07:46:21 -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
Yen Chi Hsuan
ba3b14d4da Add Arch Linux constants for Apache (#4466) 2017-06-08 12:08:47 -07:00
Brad Warren
844c2d3438 Finish work on #4718.
* Update in response to changes in #4720.

* Update ALL_SSL_OPTIONS_HASHES.

* Add warning to Apache's SSL options files.
2017-06-01 14:35:03 -07:00
Erica Portnoy
44f4743b51 Mechanism for automatically updating options-ssl-apache.conf file
* add file update mechanism + tests to apache

* update with actual hashes, and update apache test to match since there aren't previous versions
2017-06-01 14:35:03 -07:00
Sagi Kedmi
26a7023b8d Change QSA to NE in HTTPS redirection (#4204)
* Change QSA to NE in HTTPS redirection

* Seamless transition to new HTTPS redirection RewriteRule
2017-03-02 16:49:34 -08:00
DanCld
df68b44d38 Fix apache logs dir for centos 2016-08-21 21:50:14 +03:00
Joona Hoikkala
c346cdf2f3 Changed SUSE mod handling constant 2016-08-02 09:57:34 +03:00
Joona Hoikkala
b891cac3dc Added suse constants 2016-07-31 01:10:28 +03:00
Joona Hoikkala
28fc02143b Remove enmod and dismod values as they are not needed 2016-07-30 11:59:58 +03:00
Joona Hoikkala
c87282d5aa Un-debian the defaults 2016-07-30 10:44:46 +03:00
Joona Hoikkala
a5859910e7 If os name is not found, try LIKE var from os-release 2016-07-30 10:43:38 +03:00
LeCoyote
8d6502a756 Update constants.py
Add strings for Gentoo: one matches platform.linux_distribution(), the other matches contents of /etc/os-release
2016-06-02 18:17:21 +04:00
LeCoyote
2a9e190cf2 Changed Gentoo os_info string
See bug #3091
2016-05-29 15:54:01 +04:00
Peter Eckersley
883510338c Merge branch 'master' into sysd_os 2016-05-27 14:48:03 -07:00
Blake Griffith
d9d2377242 Rename certbot.le_util to certbot.util
Also rename certbot/tests/le_util_test.py to certbot/tests/util_test.py
2016-05-25 18:50:02 -05:00
Joona Hoikkala
0773f626f9 Resolved merge conflicts 2016-04-16 15:19:57 +03:00
Brad Warren
2002511f81 s/letsencrypt/certbot letsencrypt-apache 2016-04-13 16:30:57 -07:00