Commit graph

8007 commits

Author SHA1 Message Date
Brad Warren
08ae6f4d06 Fix hook test.
Up until now, this test was written incorrectly. In addition, when it has
failed, it simply prints error messages rather than reporting that the test
failed. This fixes both of these problems.
2017-09-29 17:11:10 -07:00
Brad Warren
cad7d4c8ed Update master to reflect 0.18.2 (#5127)
* Release 0.18.2

(cherry picked from commit d031c42b98)

* Bump version to 0.19.0
2017-09-27 16:02:40 -07:00
Joona Hoikkala
ba84b7ab49 Add test to prevent regressions of #4183 (#5134) 2017-09-27 15:51:28 -07:00
ohemorange
7412099567 Allow multiple interactive certname selections in certbot delete (#5133) 2017-09-27 15:47:40 -07:00
r5d
85deca588f Stop using print in certbot.main module. (#5121)
* Stop using print in `certbot.main` module.

* Update certbot.main.plugins_cmd` function.

* Update test methods `test_plugins_no_args`,
`test_plugins_no_args_unprivileged`, `test_plugins_init` and
`test_plugins_prepare` in `cerbot.tests.MainTest` class.

Addresses #3720.

* certbot: Add `patch_get_utility_with_stdout` function.

* Add functions `certbot.tests.util.patch_get_utility_with_stdout`
  and `certbot.tests.util._create_get_utility_mock_with_stdout`.

* certbot: tests: Update tests in MainTest.

* Update methods `test_plugins_no_args`,
`test_plugins_no_args_unprivileged`, and `test_plugins_init`,
`test_plugins_prepare` to use `patch_get_utility_with_stdout`.

* certbot: tests: Update _create_get_utility_mock_with_stdout.

* Update certbot.tests.util._create_get_utility_mock_with_stdout
  function. The mock function for all IDisplay methods, except
  `notification` method, calls _write_msg and _assert_valid_call.

* certbot: tests: Update `patch_get_utility_with_stdout`

* Update doc string.
* Argument stdout's default value is None now.

* certbot: tests: Update util._create_get_utility_mock_with_stdout.
2017-09-25 18:42:31 -07:00
Brad Warren
8b7d6c4ea3 Update changelog for 0.18.2 (#5128) 2017-09-25 16:46:04 -07:00
Christian Becker
36d5221bac certbot-dns-google: enable automatic credential lookup on google cloud (#5117)
- when no credentials are passed it will try to get valid credentials
using the google metadata service
- this is a feature of the google SDK, so we don't need to handle that
explicitly
- previous behaviour with a credentials file is retained
2017-09-25 12:17:15 -07:00
Joona Hoikkala
1ce813c3cc Do not parse disabled configuration files from under sites-available on Debian / Ubuntu (#4104)
This changes the apache plugin behaviour to only parse enabled configuration files and respecting the --apache-vhost-root CLI parameter for new SSL vhost creation. If --apache-vhost-root isn't defined, or doesn't exist, the SSL vhost will be created to originating non-SSL vhost directory.

This PR also implements actual check for vhost enabled state, and makes sure parser.parse_file() does not discard changes in Augeas DOM, by doing an autosave.

Also handles enabling the new SSL vhost, if it's on a path that's not parsed by Apache.

Fixes: #1328
Fixes: #3545
Fixes: #3791
Fixes: #4523
Fixes: #4837
Fixes: #4905

* First changes

* Handle rest of the errors

* Test fixes

* Final fixes

* Make parse_files accessible and fix linter problems

* Activate vhost at later time

* Cleanup

* Add a new test case, and fix old

* Enable site later in deploy_cert

* Make apache-conf-test default dummy configuration enabled

* Remove is_sites_available as obsolete

* Cleanup

* Brought back conditional vhost_path parsing

* Parenthesis

* Fix merge leftovers

* Fix to work with the recent changes to new file creation

* Added fix and tests for non-symlink vhost in sites-enabled

* Made vhostroot parameter for ApacheParser optional, and removed extra_path

* Respect vhost-root, and add Include statements to root configuration if needed

* Fixed site enabling order to prevent apache restart error while enabling mod_ssl

* Don't exclude Ubuntu / Debian vhost-root cli argument

* Changed the SSL vhost directory selection priority

* Requested fixes for paths and vhost discovery

* Make sure the Augeas DOM is written to disk before loading new files

* Actual checking for if the file is parsed within existing Apache configuration

* Fix the order of dummy SSL directives addition and enabling modules

* Restructured site_enabled checks

* Enabling vhost correctly for non-debian systems
2017-09-25 12:03:09 -07:00
Noah Swartz
ade01d618b add info about -d (#5097) 2017-09-21 08:52:01 -07:00
Michał Zegan
5a4028c763 fix dns-rfc2136 plugin not respecting cnames (#5101)
* fix dns-rfc2136 plugin not respecting cnames

The plugin does not work if the domain of a certificate is found to have a cname record in dns.
That is because when plugin tries to find zone boundary, it searches from the domain up for the SOA record, and each DNS response is checked for the answer being empty, assuming that empty answer means no SOA record is present and the higher level domain has to be checked, and non empty answer section means that this domain is a zone root.
However, if the initial domain, or any upper level domain except the zone root has a cname record pointing to the zone root, then the server will, instead of returning an empty answer, return one containing two records, first a cname pointing to the zone root, then the SOA record of zone root, and that will make the check fail and use a wrong domain as a zone name during update.
Fix that by replacing a check for empty answer with explicitly searching in response's answer section for a SOA record matching the domain that is being checked.

* dns-rfc2136: fix lint errors
2017-09-20 11:29:48 -07:00
yomna
48fd7ee260 Updating the AWS letstest documentation (#5091)
* Better documentation for working w/ AWS.

* Addressing feedback.

* profile name -> key name
2017-09-19 10:25:36 -07:00
Brad Warren
6aabb31eb5 Merge pull request #5118 from erikrose/certbot-auto-timeout
Certbot auto timeout
2017-09-18 15:56:26 -07:00
Noah Swartz
3acde31ed3 Merge pull request #5096 from certbot/0.18.1-release-notes
Add 0.18.1 release notes
2017-09-18 13:45:01 -07:00
Erik Rose
e7884898ec Simplify and stop repeating knowledge by hard-coding timeout into HttpsGetter.get().
Also, switch timeout to 30 so it has every opportunity to actually work, even in bad network weather. (I posit that people are used to 30-second timeouts.)

Stop catching URLError explicitly, since it's a subclass of the already-caught IOError.
2017-09-18 09:55:16 -04:00
Chris J
9be4fedeec Add timeout to certbot-auto HTTPS fetches. Fix #4473. 2017-09-18 09:52:17 -04:00
Chris Julian
f0caf5b04f #4435. CLI Argument Default Organization (#5037)
* Enhancement #4435. Organizing defaults in prepare_and_parse_args()

* Playing fast and loose with tox.

Discovered screwy case involving flag_default returning empty list (domains)

* Setting defaults for more low-hanging fruit. Some caveats remain.

* key_path default to None

* Applying PR feedback: explicit defaults even where redundant

* Obsessive quote consistency

* Set testing config path arguments to a 'certonly' default

* Copy the default domains list rather than get reference

* Build a testing Config from CLI_DEFAULTS

* Update some email tests for use with defaults in config.

config.email and config.noninteractive_mode in these tests
used to be magic-mock'd, so were True-ish. The default
email is now None and default noninteractive_mode is
False, so update in tests accordingly.

* Lint...

* Copy anything retrieved using flag_defaults. Apply this to test_cli_ini_domains too.

* Put those quotes back. Backslashes are just the worst.

* Remove vestigial line

* A test to ensure no regressions around modifying CLI_DEFAULTS
2017-09-15 17:10:43 -07:00
Seong-ho Cho
f6be07da74 fix #5111 AttributeError occured with >=pyOpenSSL-17.2.0 (#5112) 2017-09-15 16:57:10 -07:00
r5d
7c16e0da26 certbot: Let plugins_cmd be run as un-priviliged user. (#5103)
* certbot: Let plugins_cmd be run as un-priviliged user.

* certbot/main.py (main): Update function.

Addresses issue #4350.

* * Add test certbot.tests.main_testMainTest.test_plugins_no_args_unpriviliged
2017-09-15 16:55:05 -07:00
Noah Swartz
03624fa9db add domain name when having issues in the warn output (#5105) 2017-09-15 16:51:06 -07:00
Noah Swartz
d3a00a97a3 fix NAME to CERTNAME (#5114) 2017-09-15 16:47:08 -07:00
Brad Warren
4bc0c83ca7 Add --no-self-upgrade to test farm test. (#5095) 2017-09-14 17:33:32 -07:00
Brad Warren
7d0a77ffcf Release 0.18.1 (#5093)
* Release 0.18.1

(cherry picked from commit 8010822a0b)

* Bump version to 0.19.0
2017-09-14 17:32:45 -07:00
Noah Swartz
837f691992 Merge pull request #5108 from certbot/issue_5107
add a help output for cert-name
2017-09-13 16:39:54 -07:00
Noah Swartz
174a006d9c add renew to existing doc 2017-09-13 11:37:07 -07:00
Noah Swartz
b529250535 add a help output for cert-name 2017-09-12 10:52:51 -07:00
Brad Warren
134d499b07 Add 0.18.1 release notes 2017-09-08 13:33:47 -07:00
Brad Warren
68283940cd Test farm improvements (#5088)
* prevent regressions of #5082

* Fix test_leauto_upgrades.sh

test_leauto_upgrades.sh has been incorrectly been succeeding because while peep
doesn't work with newer versions of pip and letsencrypt-auto would crash,
the output included the version number so we reported the test as passing.
This updates letsencrypt-auto to the oldest version that still works for the
purpose of the test and sets pipefail so errors are properly reported.

* Test symlink creation in test_leauto_upgrades.sh

* Pin dependencies in test_sdists.sh.

* Fix permissions errors in test_tests.sh
2017-09-07 17:54:40 -07:00
Brad Warren
82d0ff1df2 Fix permissions error when upgrading certbot-auto. (#5086)
Now we always check if we have root access if --cb-auto-has-root is not given
on the command line. This allows certbot-auto to properly acquire root when
upgrading from an older version. People upgrading from 0.18.0 to 0.18.1 may
check for root access twice, however, if root's user ID is 0, this check is
essentially a noop. If root's user ID is not 0, we'll request root access a 2nd
time during this upgrade.
2017-09-07 17:23:57 -07:00
Brad Warren
d4fe812508 Update changelog to reflect 0.18.0 (#5081) 2017-09-07 16:06:07 -07:00
Brad Warren
6988491b67 Merge pull request #5080 from certbot/candidate-0.18.0
Release 0.18.0
2017-09-07 05:57:12 -07:00
Brad Warren
1a79f82082 Also check new path when determining cli_command (#5082) 2017-09-06 20:22:27 -07:00
yomna
9fb132ba69 Merge pull request #5075 from certbot/specify-min-six-version
Specify the minimum six version in ACME
2017-09-05 17:49:42 -07:00
Brad Warren
a7267b0fcd Bump version to 0.19.0 2017-09-05 16:07:03 -07:00
Brad Warren
756c44f7af
Release 0.18.0 2017-09-05 16:06:43 -07:00
Brad Warren
d710c441e2 Specify the minimum six version in acme 2017-09-05 10:07:32 -07:00
ohemorange
8ad18cbe6e Use ffdhe2048 Nginx DH params to fix Weak-DH bug (#4973)
* Rename plugins.common.install_ssl_options_conf to plugins.common.install_version_controlled_file

* Install ssl_dhparams file

* Add installation test

* Add ssl_dhparam option when making a server block ssl

* add install_ssl_dhparams to Installer common plugin class

* Remove redundant code and tests

* update MANIFEST.in
2017-09-01 07:57:30 -07:00
Noah Swartz
c6bdad4ffb mention that revoke doesn't effect rate limit (#5070)
fixes #2720
2017-09-01 07:57:07 -07:00
Noah Swartz
39696456db Link to changelog from readme (#5069)
fixes #3420
2017-09-01 07:56:49 -07:00
Brad Warren
bbf397a9f9 Fix documentation build failures (#5068)
* sphinxify error_handler docs
2017-08-31 16:35:53 -07:00
r5d
7cb8c1264f certbot: Update renew command output in quiet mode. (#5062)
* certbot: Update `renew` command output in quiet mode.

* certbot/renewal.py (_renew_describe_results): Update function.
* certbot/tests/main_test.py (_test_renewal_common): Update method.
  Add optional arg `stdout`; Modify `mock_get_utilitiy`, `stdout`.
  (test_quiet_renew): Update method.
2017-08-31 11:01:15 -07:00
Noah Swartz
b6f8a477b8 Merge pull request #5064 from certbot/letsencrypt-travis
Don't send IRC notifications from forks
2017-08-31 11:19:29 -05:00
Brad Warren
06dd645e85 encrypt channel 2017-08-30 10:34:05 -07:00
Chris Julian
2bfc92e58d #4071 Mixin to prevent setting return_value after initializing certain Mock objects (#4963)
* Addressing #4071 Wrote an ImmutableReturnMixin to prevent developers overriding return_value in certain Mock objects

* Language

* Loosening the assumption that underlying _mock objects need to be Immutable-like simplifies implementation

* Addressing #4071

* Ensure side_effects and return_values are pushed down to the underlying _mock in FreezableMocks. And IDisplay mocks are no longer frozen in _create_get_utility_mock()

* Edit a handful of tests to not override the mock_get_utility return_value

* Brief explainer of FreezableMock.__setattr__

* Incorporating PR feedback and some compatibility

* FreezableMock __getattr__ needs a shortcut in case of return_value or side_effect

* Changing return_value only forbidden if set before freezing

* Remove unnecessary else block

* Expanded doc strings

* Bring a couple new tests in line with patch_get_utility() norms
2017-08-30 09:52:45 -07:00
Brad Warren
ae0be73b53 Make common Installer base class (#5055)
* Add installer class

* Add wrapped reverter methods to common.Installer.

* Use Installer class in Apache plugin

* Use Installer class in Nginx plugin

* Don't create reverter in Apache and Nginx plugins
2017-08-28 17:06:09 -07:00
Noah Swartz
8d362d4469 Merge pull request #5029 from certbot/issue_4792
expand nginx no name error
2017-08-28 14:04:56 -07:00
Ted Marynicz
133f636817 Update install.rst (#5057)
Minor typo fix in VE para
2017-08-28 11:59:08 -07:00
Noah Swartz
df71ec33b3 switch from triple quotes to single quotes 2017-08-28 13:45:42 -05:00
Josh Soref
b2b3285bf5 Add the word instead to renew error (#5053)
Closes #4118
2017-08-25 10:25:59 -07:00
r5d
b43bf8f94a Stop using print in certbot.cli module. (#5028)
* Update cerbot.tests.util.patch_get_utility (#3720)

* Add new arg `stdout_notification` to
  `cerbot.tests.util.patch_get_utility` function.

  If `stdout_notification` is True, then the mock
  interfaces.IDisplay.notification function will print out to stdout.

* Add new arg `stdout_notification` to _create_get_utility_mock
  function.

* Add new function `_stdout_notification`.

* Stop using print in certbot.cli (#3720)

* certbot/cli.py (HelpfulArgumentParser._usage_string)
(HelpfulArgumentParser.__init__): Update methods.
* certbot/tests/cli_test.py (test_cli_ini_domains, test_no_args)
(test_install_abspath, test_help, test_help_no_dashes)
(test_parse_domains, test_preferred_challenges, test_server_flag)
(test_must_staple_flag, test_no_gui, test_staging_flag)
(test_dry_run_flag, test_option_was_set)
(test_encode_revocation_reason, test_force_interactive)
(test_deploy_hook_conflict, test_deploy_hook_matches_renew_hook)
(test_deploy_hook_sets_renew_hook, test_renew_hook_conflict)
(test_renew_hook_matches_deploy_hook)
(test_renew_hook_does_not_set_renew_hook, test_max_log_backups_error)
(test_max_log_backups_success, test_webroot_map)
(test_report_config_interaction_str)
(test_report_config_interaction_iterable): Update tests.
* certbot/tests/main_test.py (test_certificates)
(test_certonly_abspath, test_certonly_bad_args)
(test_agree_dev_preview_config): Update tests.

* certbot: Refactor cli_test.ParseTest.

* certbot/tests/cli_test.py (ParseTest._unmocked_parse): Rename parse
to _unmocked_parse.
(parse): New method.
(ParseTest._help_output, ParseTest.test_cli_ini_domains)
(ParseTest.test_no_args, ParseTest.test_install_abspath)
(ParseTest.test_help, ParseTest.test_help_no_dashes)
(ParseTest.test_parse_domains, ParseTest.test_preferred_challenges)
(ParseTest.test_server_flag, ParseTest.test_must_staple_flag)
(ParseTest.test_no_gui, ParseTest.test_staging_flag)
(ParseTest.test_dry_run_flag, ParseTest.test_option_was_set)
(ParseTest.test_encode_revocation_reason)
(ParseTest.test_force_interactive)
(ParseTest.test_deploy_hook_conflict)
(ParseTest.test_deploy_hook_matches_renew_hook)
(ParseTest.test_deploy_hook_sets_renew_hook)
(ParseTest.test_renew_hook_conflict)
(ParseTest.test_renew_hook_matches_deploy_hook)
(ParseTest.test_renew_hook_does_not_set_renew_hook)
(ParseTest.test_max_log_backups_error)
(ParseTest.test_max_log_backups_success): Update methods.

* certbot: Refactor cli_test.SetByCliTest

* certbot/tests/cli_test.py (SetByCliTest.test_webroot_map)
(SetByCliTest.test_report_config_interaction_str)
(SetByCliTest.test_report_config_interaction_iteratable)
(_call_set_by_cli): Update methods.

* certbot: cli: Fix style.

* certbot/cli.py (HelpfulArgumentParser.__init__): Update method.

* certbot: Revert changes to tests.util.patch_get_utility

* certbot/tests/util.py (patch_get_utility): Remove
`stdout_notification` arg.
(_creat_get_utility_mock): Remove `stdout_notification` arg.
(_stdout_notification): Remove function.

* certbot: Revert changes to MainTest.

* certbot/tests/main_test.py
(MainTest.test_certificates, MainTest.test_certonly_abspath)
(MainTest.test_certonly_bad_args): Update methods.

* certbot: cli_test.py: Remove 'pylint: disable' lines.

* certbot/tests/cli_test.py (ParseTest.parse): Update method.
(_call_set_by_cli): Update function.
2017-08-25 10:05:58 -07:00
Brad Warren
a5fae7eab5 certbot-auto OS dependency update system (#4971)
* Add version number to bootstrap scripts.

* Always determine Bootstrap function and version.

* Write bootstrap version into venv.

* Add PrevBootstrapVersion function.

* Add OS bootstrapping check to phase 2.

* Differentiate -n and renew when rebootstrapping.

* Quote all environment variables.

* Correct test condition

* Add loud warning about hardcoded version list.

* s/VENV_BOOTSTRAP_VERSION/BOOTSTRAP_VERSION_PATH

* Properly handle noop bootstrap functions.
2017-08-23 11:01:20 -07:00