Commit graph

311 commits

Author SHA1 Message Date
Peter Eckersley
2613a8b579 Continue work on Apache multivhost
* Apache: do not assume directives will be CamelCased

* Fixup

* Elaborate

* Simplify the definition of vh_p
2017-05-02 15:38:49 -07:00
Noah Swartz
f57f35b1dd Start work on multivhost support in Apache
* get through parsing

* not slice

* add mult vhost per file

* idx line backwards

* blocks be wrong

* always close ifmod

* let's not mess up indexes

* don't double add multi

* fix some lint, only dedupe multi

* tests

* fix lint

* in progress bit flip

* try to pick the right vhost

* take Dominic's suggestion

* don't redo search

* add ancestor

* we now support multiple vhosts

* yay

* add docstrings
2017-05-02 15:38:27 -07:00
Brad Warren
5ca8f7c5b9 Add lockfile (#4449)
* add lock_file

* cleanup lock file

* Add LockFile tests

* add lock_dir

* add lock_dir_until_exit

* add set_up_core_dir and move lock_dir_until_exit

* Move lock_and_call to certbot.test.util

* Add lock to Apache

* Add lock to the Nginx plugin

* Improve permissions error message

* sort plugins

* add test_prepare_order

* provide more actionable permissions error

* Document and catch use of OSError

* don't lock a directory twice

* add conditional dependency on ordereddict

* Add lock_test

* expand sorted plugins comment

* Add lock_test to lint

* make make_lineage more conventional and flexible

* enhance lock_test.py

* add lock_test to tox

* Readd success message

* make py26 happy

* add test_acquire_without_deletion
2017-05-01 14:49:12 -07:00
Noah Swartz
09377437dc Merge pull request #4387 from dhuang/shh-apache-version
Do not output apache version when deploying cert
2017-03-21 16:39:31 -07:00
Daniel Huang
1e36783986 Still include apache version in debug logging 2017-03-18 21:37:37 -04:00
Daniel Huang
b9121a8a37 Do not output apache version when deploying cert (#4023) 2017-03-18 21:14:53 -04:00
Yen Chi Hsuan
97db9e646a Fix _get_runtime_cfg on Python 3 (#4262) 2017-03-18 18:06:32 -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
Yen Chi Hsuan
7d02e129f9 Fix certbot-apache tests on Python 3 (#4172) 2017-02-24 18:21:21 -08:00
Joona Hoikkala
28cbd6e7d3 Fix for case sensitivity when looking for vhosts (#4193) 2017-02-23 20:28:36 -08:00
Amjad Mashaal
1fd847e216 Adding checking name validity to the Apache plugin (#3639) 2017-02-01 07:12:51 -08:00
Josh Soref
6a39a42f45 Spelling (#4101)
* spelling: action

* spelling: artifacts

* spelling: asymmetric

* spelling: attempts

* spelling: bizarre

* spelling: certbot

* spelling: certificate

* spelling: certainly

* spelling: challenge

* spelling: client

* spelling: collated

* spelling: correct

* spelling: considered

* spelling: custom

* spelling: distinguish

* spelling: encoding

* spelling: enhancement

* spelling: equivalent

* spelling: execution

* spelling: existence

* spelling: failed

* spelling: handshake

* spelling: hyphen

* spelling: initialized

* spelling: initialization

* spelling: interpretation

* spelling: letsencrypt

* spelling: multiline

* spelling: multipart

* spelling: necessary

* spelling: otherwise

* spelling: output

* spelling: overridden

* spelling: positives

* spelling: preferable

* spelling: progress

* spelling: recommended

* spelling: referring

* spelling: relativity

* spelling: request

* spelling: requiring

* spelling: separate

* spelling: source

* spelling: specified

* spelling: standard

* spelling: successfully

* spelling: unparseable

* spelling: useful
2017-01-26 16:21:54 -08:00
Juho Juopperi
2797a0377d Fix misspelling "recieved" (#4059) 2017-01-17 13:43:43 -08:00
Brad Warren
9c9004aff1 Stop IDisplay AssertionErrors (#4010)
Fixes #3996.

I'm pretty confident this PR solves the problem. I've audited all calls to IDisplay methods and the assertions done in certbot.display.util are now done in all our unit tests.

With that said, it wouldn't hurt to have someone else double check I didn't miss anything. The easiest way to do this is to grep for IDisplay in our code and ensure all calls to IDisplay methods are valid. This means every method call other than notification (because a notification call is always OK) either provides a value for default or force_interactive. This is defined in interfaces.py.

I've also been considering removing the assertion that's been causing us trouble here from our release. The only argument I have for not doing so is it may hinder 3rd party plugin development. When they use IDisplay, they have the same problem as we do with prompting users without a TTY. Not keeping this assertion in makes it more likely they won't notice the issue and Certbot will crash on an unsuspecting user.

With that said, none of our known 3rd party plugins use IDisplay at all.

* Provide force_interactive in _get_certname

* Use force_interactive when asking for webroot

* Factor IDisplay assertion into it's own function

* Add util.patch_get_utility()

* Allow custom path to patch_get_utiity

* Change GetEmailTest to use patch_get_utility

* Use new_callable to create new objects

* Modify tests to use patch_get_utility

* Improve FreezableMock documentation

* Add user facing error to TTY magic

* Comment out assert_valid_call

* Add test_input_assertion_fail2()
2017-01-10 16:25:33 -08:00
osirisinferi
f9b8933f37 Add line number to Augeas syntax error message (#3974)
* Add line number to Augeas syntax error message

* Use `format()` for message formatting

* Pleasing Python 2.6
2017-01-06 12:58:51 -08:00
Brad Warren
28ce10fef5 Don't add ServerAlias directives when the domain is already covered by a wildcard (#3917)
* correctly match * and ? in ServerAlias directives

* update Apache wildcard test

* Consolidate wildcard matching and remove bad test

* Test Apache vhost selection with wildcards

* Added few more tests to proof vhost selection
2016-12-20 15:53:52 -08:00
Brad Warren
ae379568b1 Mitigate problems for people who run without -n (#3916)
* CLI flag for forcing interactivity

* add --force-interactive

* Add force_interactive error checking and tests

* Add force_interactive parameter to FileDisplay

* add _can_interact

* Add _return_default

* Add **unused_kwargs to NoninteractiveDisplay

* improve _return_default assertion

* Change IDisplay calls and write tests

* Document force_interactive in interfaces.py

* Don't force_interactive with a new prompt

* Warn when skipping an interaction for the first time

* add specific logger.debug message
2016-12-19 12:45:40 -08:00
Peter Eckersley
59c602d9ca Parallalelise nosetests from tox (#3836)
* Parallalelise nosetests from tox

* Parallelise even more things, break even more things

* Now unbreak all the tests that aren't ready for ||ism

* Try to pass tests!

 - Remove non-working hack in reporter_test
 - also be selective about ||ism in the cover environment

* Try again

* certbot-apache tests also work, given enough time

* Nginx may need more time in Travis's cloud

* Unbreak reporter_test under ||ism

* More timeout

* Working again?

* This goes way faster

* Another big win

* Split a couple more large test suites

* A last improvement

* More ||ism!

* ||ise lint too

* Allow nosetests to figure out how many cores to use

* simplify merge

* Mark the new CLI tests as ||izable

* Simplify reporter_test changes

* Rationalise ||ism flags

* Re-up coverage

* Clean up reporter tests

* Stop modifying testdata during tests

* remove unused os
2016-12-06 20:39:16 -08:00
Blake Griffith
65d9e997e5 Refactor cli_test.py and main_test.py (#3828)
* Begin breaking out cli_test.py

* simplify main

* refactor porse tests

* move determine account tests to main_test.py

* move duplicate cert test to main_test.py

* move cli stuff out of the way

* add test_renewal.py

* move error test into error_handler_test.py

* move test_read_file

* move test_no_gui out of MainTest

* move test_install_abspath to parsetest

* Move main tests into main_test.py

* move cli tests back into cli_test.py

* clean up cli_test.py

* move punycode test to util_test.py

* Fix NameError from missing plugins_disco

* Fix linting errors

* test_renewal.py -> renewal_test.py

* rm not_cli_test.py

* Move main._handle_exception test to main_test.py

* Move renewal import in renewal_test.py

from @ohemorange comments

* certbot.tests.test_util -> certbot.tests.util

* Fix issues from rebasing.

* Fix testing issue with option_was_set

* fix linting issue
2016-12-05 15:22:14 -08:00
Nick Fong
dd8772b608 Remove get_all_certs_keys() from Apache and Nginx (#3768)
- Remove get_all_certs_keys() implementation in
    - certbot-apache/certbot_apache/configurator.py
- Remove corresponding tests for get_all_certs_keys() in
    - certbot-apache/certbot_apache/tests/configurator_test.py
- Remove get_all_certs_keys() implementation in
    - certbot-nginx/certbot_nginx/configurator.py
    - certbot-nginx/certbot_nginx/parser.py
- Remove corresponding tests for get_all_certs_keys() in:
    - certbot-nginx/certbot_nginx/tests/configurator_test.py
    - certbot-nginx/certbot_nginx/tests/parser_test.py

Resolves #3762
2016-11-08 17:19:05 -08:00
Erica Portnoy
d54cb76432 Remove the curses dialog, thereby deprecating the --help and --dialog command line options (#3665)
* Remove the curses dialog, thereby deprecating the --help and --dialog command line options

* Deprecate --dialog and suppress --text
2016-10-21 15:45:57 -07:00
Brad Warren
6d0ba6de8e Fix Apache constants tests (#3630)
* Allow running constants_test.py individually

* Mock until tests pass

Mock out both functions used to determine the OS in
certbot_apache.tests.constants_test.
2016-10-13 13:54:22 -07:00
DanCld
ed7c022565 Lint fix, space before parentheses 2016-08-22 08:16:20 +03:00
DanCld
df68b44d38 Fix apache logs dir for centos 2016-08-21 21:50:14 +03:00
Peter Eckersley
7da7d47e8a Merge remote-tracking branch 'origin/master' into multi-topic-help 2016-08-12 17:40:49 -07:00
Joona Hoikkala
14f3710250
Added check for /files/ 2016-08-10 10:39:10 +03:00
Joona Hoikkala
51191c2ea5
Added linter exception 2016-08-10 01:50:40 +03:00
Joona Hoikkala
6c3ae10f9b
Added test case 2016-08-10 01:39:53 +03:00
Joona Hoikkala
f4948855f0
Added None check and according test 2016-08-10 01:24:21 +03:00
Joona Hoikkala
c29e8c3332
Refactored get_file_path 2016-08-09 23:43:11 +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
093ebd2f03
Tests 2016-07-30 11:49:04 +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
Ville Skyttä
c7b89c334b Use logger.warning instead of deprecated warn 2016-07-22 09:54:28 +03:00
Ville Skyttä
86b287b338 Use assertEqual instead of deprecated assertEquals 2016-07-22 09:54:28 +03:00
Peter Eckersley
a49d26f607 Merge remote-tracking branch 'origin/master' into multi-topic-help 2016-07-20 16:56:23 -07:00
Brad Warren
2e50b38b45 Merge pull request #3182 from certbot/issue_2983
Handle commas in apache filenames (Issue 2983)
2016-07-15 16:31:16 -07:00
Noah Swartz
a4d38c8831 add file in sites-enabled so git doesn't throw it out 2016-07-11 14:32:00 -07:00
Noah Swartz
8f1a141d2a incorporate brad's comments 2016-07-11 13:20:31 -07:00
Blake Griffith
9bc50d4a47 Try to fix travis-ci lint failure 2016-07-11 12:44:21 -05:00
Peter Eckersley
c051826ea2 Merge pull request #3261 from certbot/apache-path-fallback
Apache plugin PATH fallback
2016-07-08 16:59:28 -07:00
Noah Swartz
1fc84c83e2 Merge pull request #3234 from sagi/rewrite
Comment out corresponding RewriteConds for filtered RewriteRule
2016-07-08 16:06:26 -07:00
Noah Swartz
1bbfde1771 don't code while distracted 2016-07-08 15:35:29 -07:00
Noah Swartz
d8c2dd1a5c add self 2016-07-08 15:28:12 -07:00
Noah Swartz
1113e28046 fix typo 2016-07-08 15:22:56 -07:00
Noah Swartz
d4a8820bdc wrap with escapes 2016-07-08 15:04:44 -07:00
Peter Eckersley
0bedeb449a Refactor path_surgery into plugins.util so that nginx can call it 2016-07-08 14:03:21 -07:00
Peter Eckersley
757a8ddae7 Fixes & tests 2016-07-08 13:21:37 -07:00
Peter Eckersley
cecac803a0 Do this more cleanly 2016-07-08 13:21:37 -07:00
Peter Eckersley
a322f44f2b Implement PATH fallback for apachectl search 2016-07-08 13:21:37 -07:00
Peter Eckersley
754b7956b3 Make the error even more informative 2016-07-08 13:21:37 -07:00
Peter Eckersley
c3244df951 more doc improvements 2016-07-08 10:12:57 -07:00
Peter Eckersley
fd35a1c724 Explain why Apache [appears] not to be installed
Would help debug #3244
2016-07-06 12:43:48 -07:00
sagi
0e9622322a typo 2016-07-01 22:17:41 +00:00
sagi
7459360780 Add more test cases 2016-07-01 22:08:37 +00:00
sagi
15ba12ed46 Parsing State Machine + some tests 2016-07-01 21:06:16 +00:00
sagi
a9abc7b39e typo 2016-07-01 15:17:37 +00:00
Peter Eckersley
7b50960ac0 Address review comments 2016-06-29 13:57:58 -07:00
Noah Swartz
b64da855a2 lint 2016-06-29 11:55:22 -07:00
Noah Swartz
395843f3f4 fix coverage 2016-06-29 11:06:18 -07:00
Noah Swartz
a9679e2c25 create regression test 2016-06-28 18:08:38 -07:00
Noah Swartz
2884a7fcb7 Merge branch 'master' into issue_2983 2016-06-28 17:57:10 -07:00
Noah Swartz
78b30539fa augeas tests 2016-06-28 17:56:31 -07:00
Peter Eckersley
e93ace79cc Test coverage & fix 2016-06-25 12:06:43 -07:00
Peter Eckersley
e0691ede2c Provide clear log messages when Apache tries a default vhost 2016-06-25 10:59:41 -07:00
Peter Eckersley
f6069c2297 Explain what is happening when the user cancels vhost selection 2016-06-25 10:59:41 -07:00
Noah Swartz
d67bc67681 add self 2016-06-24 16:17:09 -07:00
Noah Swartz
07fb5dd9cc escape and unescape augeas 2016-06-24 15:55:51 -07:00
Peter Eckersley
85769844f2 Merge pull request #3191 from joohoi/centos_listen
Don't add wildcard listen if user has more specific configuration
2016-06-23 11:26:05 -07:00
Dominic Cleal
1caf3e9935
Merge Augeas fix for comment line continuations
From 64189250e2

Fixes #2050
2016-06-22 10:00:31 +01:00
Joona Hoikkala
418a5d501f
Refactored adding of listen statements 2016-06-20 08:58:22 +03:00
Joona Hoikkala
5a872b829d
Added tests 2016-06-20 08:57:51 +03:00
Joona Hoikkala
556582bb3b Merge remote-tracking branch 'upstream/master' into centos_listen 2016-06-18 23:50:58 +03:00
Joona Hoikkala
3c9f4d5fc7
If port is set for any IP, do not attempt to autoconfigure 2016-06-18 23:50:30 +03:00
Noah Swartz
50d900718b add invalid file for cover 2016-06-16 16:22:42 -07:00
Noah Swartz
68dd7e9192 don't add empty vhosts 2016-06-16 12:32:34 -07:00
Noah Swartz
48b03d91cf return if error 2016-06-16 12:30:48 -07:00
Noah Swartz
5a126a9277 ignore bad files in initial sweep 2016-06-16 12:00:43 -07:00
Noah Swartz
aec91b84a0 Merge pull request #3128 from joohoi/1173_import
Initialize Augeas in a different method to be able to react to ImportError
2016-06-09 17:44:10 -07:00
Joona Hoikkala
1f6e999153
Move recovery_routine() to augeas init 2016-06-06 13:10:34 +03:00
Joona Hoikkala
e263132283
Refactor and lint fixes 2016-06-06 12:44:49 +03:00
Joona Hoikkala
7239361342
Test coverage for NoInstallationError 2016-06-06 12:36:54 +03:00
Joona Hoikkala
08ccc64cd1
Initialize augeas in a new method 2016-06-06 12:04:44 +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
f0dc0de40a Catch more le_util usage in certbot-apache 2016-05-26 13:43:00 -05: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
Noah Swartz
686e60b4bf Merge pull request #3033 from certbot/reredirect
Fix warning about already enabled redirect in Apache
2016-05-19 16:12:25 -07:00
Sagi Kedmi
ad76de2502 OCSP Stapling Enhancement for Apache (#2723)
Currently supports only Apache >=2.3.3.
letsencrypt --staple-ocsp -d dumpbits.com [no problem to set it on for apache => 2.3.3]
To check OCSP Stapling:
[~]$ echo QUIT | openssl s_client -connect dumpbits.com:443 -status 2>/dev/null | grep -A 31 'OCSP Resp'
OCSP Response Data:
    OCSP Response Status: successful (0x0)
    Response Type: Basic OCSP Response
    Version: 1 (0x0)
    Responder Id: C = US, O = Let's Encrypt, CN = Let's Encrypt Authority X3
    Produced At: Mar 26 17:54:00 2016 GMT
    Responses:
    Certificate ID:
      Hash Algorithm: sha1
      Issuer Name Hash: 7EE66AE7729AB3FCF8A220646C16A12D6071085D
      Issuer Key Hash: A84A6A63047DDDBAE6D139B7A64565EFF3A8ECA1
      Serial Number: 032A2108AAA650E6EE2E6B041C03C2612A19
    Cert Status: good
    This Update: Mar 26 17:00:00 2016 GMT
    Next Update: Apr  2 17:00:00 2016 GMT

    Signature Algorithm: sha256WithRSAEncryption
         64:f2:71:02:6a:97:d9:eb:13:c1:5c:7a:f5:eb:26:89:3b:40:
         e3:08:82:f7:71:d4:fa:61:4a:8e:4a:7d:e9:53:84:e9:3a:89:
         67:66:08:d9:0e:79:65:9a:8d:dc:fb:07:cc:93:4f:eb:4e:3c:
         cc:7f:cd:fd:db:8f:c3:25:c3:54:87:a9:9c:35:6f:c1:39:31:
         e0:b1:f6:b1:3d:52:5d:db:bb:69:0f:23:05:fe:33:29:1f:ff:
         c6:af:17:a5:98:58:50:3a:48:93:5c:09:4b:f3:91:36:48:31:
         ed:ee:47:4d:66:c3:25:cf:56:b7:f4:48:80:eb:b8:f0:27:b1:
         97:18:b4:88:71:c6:55:5d:bb:25:16:48:98:85:8a:12:8d:64:
         bf:51:df:39:b1:44:91:e1:f2:c6:c3:7d:23:2b:d2:0f:4c:7f:
         57:b1:c9:ae:ec:32:b5:6a:87:bd:83:43:f1:f7:3c:8c:11:5c:
         9d:a5:12:fa:e6:79:87:45:c6:1d:46:c8:14:1e:8d:d1:de:7a:
         0d:e4:53:f2:c9:b6:e5:6e:cb:91:14:bb:04:38:36:4f:71:55:
         e1:ff:71:c7:a6:31:ed:db:6c:0f:d7:f5:ef:0c:6e:08:6b:e0:
         37:cf:ca:a5:67:89:c2🇩🇪8e:36:6d:2f:41:7f:9f:10:c6🇩🇪
         4d:b1:2d:09
======================================
2016-05-19 16:04:18 -07:00
Brad Warren
66a1399920 Add tests for multidomain vhost redirects 2016-05-19 09:40:17 -07:00
Brad Warren
574d20ecc4 Record enhancements applied to vhosts 2016-05-19 09:28:26 -07:00
sagi
886776d741 Make lint happy 2016-05-17 18:29:39 +00:00
sagi
3cf3e5b685 Detect RewriteEngine directives that originate in VirtualHosts 2016-05-17 18:07:52 +00:00
Peter Eckersley
11180e0c48 Merge pull request #2942 from domcleal/2735-augeas-escaped-space-args
Merge Augeas fix for escaped spaces in arguments
2016-05-09 17:20:25 -07:00
Joona Hoikkala
a949b579d8
Merge remote-tracking branch 'upstream/master' into sysd_os 2016-05-09 08:57:25 +02:00
Dominic Cleal
3d90fb8097
Merge Augeas fix for escaped spaces in arguments
From f741b8b4f2

Fixes #2735
2016-05-07 22:04:51 +01:00
Dominic Cleal
9059a49664
Merge Augeas fix for empty section continuations
From 568be1bc39

Fixes #2731
2016-05-07 21:03:29 +01:00
Marius Gedminas
d73e2e68ac Add a test for #2906 2016-05-02 11:45:07 +03:00
Marius Gedminas
8b4f48556d Catch the right exception
Conrary to the docstring of choose_vhost(), when you run non-interactive
certificate renewals and the Apache plugin fails to discover the correct
vhost, it raises MissingCommandlineFlag and not PluginError.
2016-05-02 09:45:27 +03:00
Marius Gedminas
528a816f70 Don't fail authentication when vhost cannot be found
Should fix #677 and #2600.
2016-05-02 09:30:32 +03:00
Joona Hoikkala
0773f626f9 Resolved merge conflicts 2016-04-16 15:19:57 +03:00
Brad Warren
c9fdc926e0 Merge branch 'master' into fix-apache-conf-test 2016-04-14 18:40:51 -07:00
Brad Warren
75a1d81458 More stray ncrypt reference cleanup 2016-04-14 17:04:23 -07:00
Brad Warren
3a975ac580 Use command to find certbot path 2016-04-14 16:27:22 -07:00
Brad Warren
7472812edd Reverted bad path change 2016-04-14 14:01:25 -07:00
Brad Warren
755dc2f08d s/Let's Encrypt/Certbot certbot-apache 2016-04-13 16:36:53 -07:00
Brad Warren
2002511f81 s/letsencrypt/certbot letsencrypt-apache 2016-04-13 16:30:57 -07:00