35 Commits
Author SHA1 Message Date
Jacob Hoffman-AndrewsandBrad Warren d327c1c28f Tweak non-root error message. (#4944)
For most people, the right answer will be "run as root," so we should emphasize
that over the "how to run as non-root" instructions.
2017-07-18 12:47:10 -07:00
Zach ShepherdandBrad Warren af8dae6cb2 Check domains for accidental inclusion of a scheme (#4788)
Currently, accidentally including a scheme with the domain name does not
produce a particularly helpful error message.

Examples without this change:
1. `certbot certonly -d https://test.example.com --webroot`:

Saving debug log to /tmp/certbot/logs/letsencrypt.log
Obtaining a new certificate
An unexpected error occurred:
The request message was malformed :: Error creating new authz :: Invalid character in DNS name
Please see the logfiles in /tmp/certbot/logs for more details.

2. `certbot certonly -d http://hoeveelmensengaveneeneuroomtezienhoeveelmenseneeneurogaven.example.com`

Requested domain http://hoeveelmensengaveneeneuroomtezienhoeveelmenseneeneurogaven.example.com is not a FQDN because label http://hoeveelmensengaveneeneuroomtezienhoeveelmenseneeneurogaven is too long.

Examples with this change:
1. `certbot certonly -d https://test.example.com --webroot`:

Requested name https://test.example.com appears to be a URL, not a FQDN. Try again without the leading "https://".

2. `certbot certonly -d http://hoeveelmensengaveneeneuroomtezienhoeveelmenseneeneurogaven.example.com`

Requested name http://hoeveelmensengaveneeneuroomtezienhoeveelmenseneeneurogaven.example.com appears to be a URL, not a FQDN. Try again without the leading "http://".

(Resolves #4785)
2017-06-06 15:51:16 -07:00
Yen Chi HsuanandBrad Warren c9e9879ad9 Enable unit tests on OS X (#4697)
* Add OS X test

* Fix apache tests

* Use absolute path first so that certbot works with non-standard $PATH

Some tests use a fake $PATH, which prevents invoking `sw_vers`

* Also test Python 3 on Mac

* Set ulimit to fix "Too many open files"
2017-06-01 09:03:54 -07:00
Brad WarrenandGitHub 462c0aba62 Modify special action types only once (#4656) 2017-05-17 14:25:50 -07:00
Brad Warren d467295d2a Make 42d07d7 more closely follow repo conventions 2017-05-15 15:01:54 -07:00
Ryan Pineo 42d07d756d support version 0.12.0 of configargparse
fixes #4648
2017-05-12 20:18:27 -04:00
Yen Chi HsuanandBrad Warren c6fcb017b8 Use universal_newlines=True whereever the output is used (#4626) 2017-05-08 10:55:02 -07:00
Brad WarrenandPeter Eckersley 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
Brad WarrenandGitHub e194e0dd5f Refactoring for better logging (#4444)
* Move colored_logging.py to log.py

* Add atexit.register code to util

* Add tests for atexit_register

* Copy except_hook to log

* Add pre_arg_setup

* move setup_log_file_handler to log.py

* Add post_arg_setup

* move changes to main

* Undo changes to MainTest

* s/pre_arg_setup/pre_arg_parse_setup

* s/post_arg_setup/post_arg_parse_setup
2017-03-30 16:17:57 -07:00
Amjad MashaalandBrad Warren 1fd847e216 Adding checking name validity to the Apache plugin (#3639) 2017-02-01 07:12:51 -08:00
Nick FongandPeter Eckersley a146102c73 Remove extra space introduced by #3994 (#4012)
Resolves #4011
The commits from PR #3994 failed to mention that they resolve #3347
2017-01-10 11:49:11 -08:00
Nick FongandPeter Eckersley 31d7b5f6d7 Fix Error Message for invalid FQDNs (#3994)
* Add better error handling for invalid FQDNs

Add explicit error handling for labels that are empty.  Also add test
cases to test invalid domains.

* Add more thorough tests
2017-01-09 18:59:48 -08:00
Peter Eckersley f495863da9 Check --check-ocsp flags, and test those checks 2016-12-21 14:38:26 -08:00
Peter Eckersley 7a18a124ce Better error handling 2016-12-21 14:38:26 -08:00
Joona HoikkalaandPeter Eckersley e9f040e209 Make default renewal file permissions more strict (#3891) 2016-12-10 11:19:20 -08:00
Erica PortnoyandGitHub 0a7ca2f32e Implement the --cert-name flag to select a lineage by its name, and the rename verb. (#3785)
* Rename and simplify main functions

* pass certname to auth method

* find cert by certname flag

* Implement --cert-name command

* don't ask to confirm new cert when we have domains and no existing certs with the lineage name

* Refactor and add --new-cert-name flag

* add interactivity to rename verb

* allow noninteractive and more descriptive function names
2016-12-08 11:53:30 -08:00
Peter EckersleyandErica Portnoy cc86ff2a21 Improve the "certbot certificates" output (#3846)
* Begin making "certbot certificates" future safe

* Handle the case where a renewal conf file has no "server" entry
2016-12-07 16:02:13 -08:00
kaiyouandPeter Eckersley 82c69815d1 Fix writing pem files with Python3 (#3757)
* Standardize arguments name for mode and chmod in the util API

* Handle OpenSSL pem as bytes objects only for Python3 compatibility

* Handle OpenSSL pem as bytes objects only (remaining bits)

* Manipulate bytes objects only when testing PEM-related functions

* Fix argument order when calling util.unique_file
2016-11-07 14:22:20 -08:00
Jacob Hoffman-AndrewsandBrad Warren db4c88856a Fix non-ASCII domain check. (#3727)
* Fix non-ASCII domain check.

Previously, the code would convert to utf-8, check for non-ASCII, and then try
to use .format() to interpolate the result into an error message. This would
generate a second error that would cause the whole message to get dropped, and
the program to silently exit. The problem can be succinctly observed like so:

$ python
>>> "{0}".format("ウェブ.crud.net")
'\xe3\x82\xa6\xe3\x82\xa7\xe3\x83\x96.crud.net'
>>> "{0}".format(u"ウェブ.crud.net")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-2: ordinal not in range(128)

Note for the curious: This problem only seems to happen with .format():

>>> "%s" % ("ウェブ.crud.net")
'\xe3\x82\xa6\xe3\x82\xa7\xe3\x83\x96.crud.net'
>>> "%s" % (u"ウェブ.crud.net")
u'\u30a6\u30a7\u30d6.crud.net'
2016-11-02 16:14:14 -07:00
schoenandBrad Warren 605a3cc931 Stop rejecting punycode domain names (#3626)
* Punycode is about to be permitted; stop rejecting it

* Remove spurious bracket

* More brackets rather than fewer!

* Change ops_test's notion of valid domains

* Remove spurious "certonly" from new test

* Make test more localized

* Remove commented-out punycode prohibition
2016-10-17 19:48:48 -07:00
Brad Warren 307b2e5307 Reject domains with only one label 2016-09-16 16:53:25 -07:00
Brad Warren f2e0afc96c add enforce_le_validity function 2016-09-16 16:08:51 -07:00
Brad Warren 72ca219097 fix typo -- domains should be domain 2016-09-16 15:05:39 -07:00
Yen Chi Hsuan fe76d558ed Enable unit tests of certbot core on Python 3 2016-08-06 21:09:43 +08:00
Peter EckersleyandGitHub e1d8ba4977 Merge pull request #3269 from yan12125/python3-certonly
Python 3 support for certonly
2016-08-05 14:43:55 -07:00
Yen Chi Hsuan 8a09a7ed67 Python 3 support for certonly 2016-07-30 23:07:02 +08:00
Joona Hoikkala 63a47f8b6b Fix variable name 2016-07-30 11:07:04 +03:00
Joona Hoikkala 95fad04fdd Added method to get the LIKE var contents as a list 2016-07-30 10:39:35 +03:00
Ville Skyttä c7b89c334b Use logger.warning instead of deprecated warn 2016-07-22 09:54:28 +03:00
Brad Warren 48b7c01a59 bring make_or_verify_dir docstring up to date 2016-07-08 14:06:15 -07:00
Blake Griffith a148d2ddfa Limit domains to 255 octets. 2016-06-17 18:59:33 -05:00
Blake Griffith 6156b452bc Fix FQDN checks. 2016-06-17 18:59:33 -05:00
mrstanwell ee622618a2 Strip "\n" from end of OS version string for OS X.
If you don't, it ends up in the UserAgent header and you get an error
like:
Invalid header value 'CertbotACMEClient/0.8.0 (darwin 10.10.5\n)...'
2016-06-03 00:42:40 -05: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