Code Monkey home page Code Monkey logo

do-know / crypt-le Goto Github PK

View Code? Open in Web Editor NEW
352.0 28.0 60.0 378 KB

Crypt::LE - Let's Encrypt / Buypass / ZeroSSL and other ACME-servers client and library in Perl for obtaining free SSL certificates (inc. generating RSA/ECC keys and CSRs). HTTP/DNS verification is supported out of the box, EAB (External Account Binding) supported, easily extended with plugins, easily dockerized.

Home Page: https://Do-Know.com

License: Artistic License 2.0

Perl 99.74% Dockerfile 0.26%
perl free-ssl-certificates crypt-le certificate crypt ssl zerossl docker-ssl docker rsa

crypt-le's Introduction

Crypt-LE

This module provides the functionality necessary to use Let's Encrypt API and generate free SSL certificates for your domains. It can also be used to generate private RSA/ECC keys and Certificate Signing Requests without resorting to openssl command line. Crypt::LE is shipped with a self-sufficient client for obtaining SSL certificates - le.pl.

New v0.39 release is available. This introduces some new features, such as:

  • EAB (External Account Binding) support used by some CAs (via eab-kid and eab-hmac-key parameters).
  • Asynchronous order finalization support, which awaits for order completion respecting the retry intervals indicated by the CA.
  • Direct support of known ACME-compatible CAs via ca parameter, so you do not need to remember which URL some specific CA is using.

Such directly supported CAs are: buypass.com, google.com, letsencrypt.org, ssl.com, zerossl.com. You do not need to know or specify the URLs for those - only their name in the ca parameter. See the examples of using different CAs in the Other certificate providers and custom ACME servers section below.

Any other ACME-compatible CA can also be used by specifying the URL for its directory in the directory parameter.

Both ACME v1 and ACME v2 protocols and wildcard certificate issuance are supported.

Please note that ACME v1 is being deprecated by Let's Encrypt and, starting from version 0.34 of the client, the default version selected is ACME v2 (unless you have specified the version explicitly using --api option or specified a custom server using --server option - in the latter case the client will use auto-sensing to select appropriate protocol version).

COMPATIBILITY

  • The code has been successfully tested on more than 500 combinations of OS and Perl versions. It should install and run fine on Linux, FreeBSD, NetBSD, etc. It also works on Mac OS X and Windows (tested with ActiveState and Strawberry Perl).

  • If you are a Windows user, you can download portable Win32/Win64 binaries (they work even on Windows XP and require NO installation).

  • In addition, you can use the latest Docker Image (lightweight non-root container).

Table of Contents

REQUIREMENTS

For Linux

With Linux systems there are just 3 essential things which should be in place for the package to be successfully installed: "gcc", "make" and the SSL development package (usually either "libssl-dev" or "openssl-devel"). You can install those as shown below - note that your server may already have them, so you might just try installing the client/library itself.

  • For CentOS minimal installation: sudo yum install gcc openssl-devel

  • For Debian/Ubuntu server installation: sudo apt-get install make gcc libssl-dev

For Windows

With Windows there are no specific requirements at all and you don't have to install anything if you want to use Windows binaries - self-sufficient and portable. Otherwise you just need to install Perl (see below).

If you use Strawberry Perl, then CPANminus will be already pre-installed and you will only need to instatll Crypt::LE itself. It is enough to download the portable version of Strawberry Perl for your platform (64bit or less likely 32bit). Then just unzip it to the directory of your choice (say C:\Perl64) and use "cpanm" to install Crypt::LE.

If you use ActiveState Perl, then after installing the Perl itself, you will need to install App-cpanminus (using 'ppm' - Perl Package Manager). Note that for business license users ActiveState offers more ppm packages (including Crypt-LE), so it could then be installed directly, without the need to install App-cpanminus.

INSTALLATION

The installation is quite easy and straightforward. The provided client does not need any specific privileges (certainly does not need to be run as a root or any privileged user). Keep in mind that the client functionality can be extended with plugins, so make sure you have read the Plugins section and especially Plugins in multiuser environment notes.

For Windows you can just download and unzip the latest release of the client - you do not have to install anything, even if you intend to use custom Perl plugins. You would only need to install the Crypt::LE library on Windows if you intend to use it with your own client (or the custom version of le.pl). For more details, checksum files and a 32bit client please see the releases page.

With CPANminus

cpanm Crypt::LE

With CPAN

cpan -i Crypt::LE

Manual installation

perl Makefile.PL
make
make test
make install

Windows installation (if you do not want to use the binaries)

cpanm -f Log::Log4perl
cpanm Crypt::LE

Note: there might be some rare cases where installation fails on Linux - for example on a freshly installed Debian 10 (buster) you may see an error for Net::SSLeay. This can be fixed by running sudo apt-get install libnet-ssleay-perl.

CLIENT

Overview

With le.pl you should be able to quickly get your SSL certificates issued. Run it without parameters to see how it is used or with --help for an extended help and examples. The client supports 'http' and 'dns' challenges out of the box.

Important: By default all your actions are run against the test server, which behaves exactly as the live one, but produces certificates not trusted by the browsers. Once you have tested the process and want to get an actual trusted certificate, always append --live parameter to the command line.

Quick start on Windows

Download and unzip the latest release of the client for Windows, then run the client and follow the instructions (replace example.org with your domain):

le64.exe -email "[email protected]" -key account.key -csr domain.csr -csr-key domain.key -crt domain.crt -domains "example.org,www.example.org" -generate-missing -live

Quick start on Linux/Mac

Install the client using one of the methods described (usually cpan -i Crypt::LE should be sufficient), then run the client and follow the instructions (replace example.org with your domain):

le.pl -email "[email protected]" -key account.key -csr domain.csr -csr-key domain.key -crt domain.crt -domains "example.org,www.example.org" -generate-missing -live

Usage examples

Interactive certificate issuance:

le.pl --key account.key --email "[email protected]" --csr domain.csr --csr-key domain.key --crt domain.crt --domains  "www.domain.ext,domain.ext" --generate-missing

That will generate an account key and a CSR if they are missing. If any of those files exists, they will just be loaded, so it is safe to re-run the client.

Please note that --email parameter is only used for the initial registration. To update it later you can use --update-contacts option. Even though it is optional, you may want to have your email registered to receive certificate expiration notifications.

To use HTTP verification and have challenge files created/removed automatically, you can use --path and --unlink parameters:

le.pl --key account.key --email "[email protected]" --csr domain.csr --csr-key domain.key --crt domain.crt --domains "www.domain.ext,domain.ext" --generate-missing --unlink --path /some/path/.well-known/acme-challenge

If www.domain.ext and domain.ext use different "webroots", you can specify those in --path parameter, as a comma-separated list as follows:

le.pl --key account.key --email "[email protected]" --csr domain.csr --csr-key domain.key --crt domain.crt --domains "www.domain.ext,domain.ext" --generate-missing --unlink --path /a/.well-known/acme-challenge,/b/.well-known/acme-challenge

Please note that with multiple webroots specified, the amount of those should match the amount of domains listed. They will be used in the same order as the domains given and all of those folders should be writable.

To use DNS verification of domain ownership, you can use --handle-as parameter:

 le.pl ... --handle-as dns

For more examples, logging configuration and all available parameters overview use --help:

le.pl --help

Two step flow

If you want to run the process in two steps (accept a challenge and then continue after running some other process), you can use --delayed flag. That flag interrupts the process once the challenge is received and appropriate information about what is required is printed or logged.

Once you have fulfilled the requirements (by either creating a verification file or a DNS record), you can re-run the process with exactly the same parameters, BUT without --delayed option.

Other certificate providers and custom ACME servers

By default the client uses Let's Encrypt CA (Certificate Authority) to get SSL certificates. However, you can also use it with other ACME-compatible servers. Please note that those might have different limitations or requirements - for example, ZeroSSL does not have the staging/testing environment, and it also uses so-called EAB (External Account BInding), so you will need to use 2 parameters retrieved from the Developer's section of your ZeroSSL account - eab-kid and eab-hmac-key, and use those for your command. Another CA, such as Bypass, does have a testing environment, and it does not use EAB, but requires for the email address to be specified. It also does not support more than 5 domains on one certificate and does not support wildcards.

Some examples:
  1. Using ZeroSSL, providing the server parameter explicitly (to be deprecated), and providing eab-kid and eab-hmac-key:

le.pl --csr domain.csr --csr-key domain.key --domains "some.domain.tld" --crt domain.crt --generate-missing --server https://acme.zerossl.com/v2/DV90 --eab-kid ... --eab-hmac-key ... --key my.key

  1. Using ZeroSSL, providing the directory parameter explicitly, and providing eab-kid and eab-hmac-key:

le.pl --csr domain.csr --csr-key domain.key --domains "some.domain.tld" --crt domain.crt --generate-missing --directory https://acme.zerossl.com/v2/DV90/directory --eab-kid ... --eab-hmac-key ... --key my.key

  1. Using ZeroSSL, providing the ca parameter, and providing eab-kid and eab-hmac-key:

le.pl --csr domain.csr --csr-key domain.key --domains "some.domain.tld" --crt domain.crt --generate-missing --ca zerossl.com --eab-kid ... --eab-hmac-key ... --key my.key --live

(notice the --live parameter in this case - that is because there is no staging environment, so running the command without --live would produce an error "CA does not support staging environment, please specify 'live' explicitly.")

  1. Using Buypass.com (staging environment):

le.pl --csr domain.csr --csr-key domain.key --domains "some.domain.tld" --crt domain.crt --generate-missing --ca buypass.com --key my.key --email "[email protected]"

(notice that email parameter is mandatory for this CA, and without it you would get an error "Email is a required contact")

  1. Using Buypass.com (production environment):

le.pl --csr domain.csr --csr-key domain.key --domains "some.domain.tld" --crt domain.crt --generate-missing --ca buypass.com --key my.key --email "[email protected]" --live

(notice that email parameter is mandatory for this CA, and without it you would get an error "Email is a required contact")

The CAs which are directly supported by name are currently these: buypass.com, google.com, letsencrypt.org, ssl.com, zerossl.com.

If CA is ACME-compatible, but not listed above, it would still be supported as long as you know the correct directory URL to specify via a directory parameter - for example, Digicert is supported, but you would need to get a unique directory URL along with the values for the eab-kid and eab-hmac-key parameters.

WINDOWS CLIENT

Everything described above for the Perl client is applicable to the Windows client, which you can download from the Releases page. The only difference is that you will be running either le32.exe or le64.exe (depending on your platform) instead of le.pl. There is one thing though you need to take into account when you are specifying the --path to store verification files for the HTTP verification on Windows:

You should NOT use a single backslash before the closing quote (if you had path quoted) - you need to either use a double-backslash or none at all. This is specific to Windows environment. To illustrate:

  • --path C:\Directory - right
  • --path C:\Directory\ - right
  • --path "C:\Directory" - right
  • --path "C:\\Directory\\" - right
  • --path "C:\Directory\\" - right
  • --path "C:\Directory\" - wrong

You can also use a forward slash (/) if you like.

WILDCARD CERTIFICATES SUPPORT

To issue a wildcard certificate, use DNS verification and specify the domain in the following format: *.some.domain.

 le.pl ... --domains "*.some.domain" --handle-as dns

Please note that at the moment wildcards are only supported by the v2.0 of the API and they can only be issued if DNS verification is used.

Important - if you are issuing a wildcard certificate and also want a so-called "naked domain" ("some.domain") to be covered, list both of those names in the domains parameter. You will then need to create two TXT records with identical names but different values - this is normal and this is how you should create them.

 le.pl ... --domains "*.some.domain, some.domain" --handle-as dns

PFX/P12 (IIS) SUPPORT

Windows binaries include export functions into PFX/P12 format, which is normally required by IIS. The export (in addition to saving certificates in PEM format) can be activated by specifying a PFX password with --export-pfx option.

  le.pl ... --export-pfx "mypassword"

Note: This fuction does NOT require OpenSSL or any PFX conversion tools to be installed on your machine - it is supported internally by the client.

By default, exported PFX file will be seen as "Crypt::LE exported" under the "Friendly Name" column of the Certificate Management Console. If you want to specify your own arbitrary string instead, use --tag-pfx parameter.

  le.pl ... --export-pfx "mypassword" --tag-pfx "My own Friendly Name"

NB: If you are receiving an error mentioning PKCS12 during an attempt to export to PFX, please ensure that the domain key which you have specified with --csr-key option is indeed a private key in PEM format (with -----BEGIN and -----END lines around it). If it is a key exported via MMC in Windows for example, you may need to export the key and remove the passphrase from it before it can be used, for example as mentioned in this guide. If the key has been generated by the client itself, you should see no errors, as it is already in the expected format.

IDN (INTERNATIONALIZED DOMAIN NAMES) SUPPORT

If you are using IDN (Internationalized Domain Names) and generating a certificate for those, you can either encode those into "punycode" form by yourself, or let the client do that for you. Please note that for the conversion to work properly you need to have correct locale settings on your system. For Linux-based systems you can check that with the "locale" command, for Windows make sure that "System locale" in the Control Panel is set correctly.

EAB (EXTERNAL ACCOUNT BINDING) SUPPORT

Some ACME-compatible Certificate Authorities manage their accounts differently from how ACME accounts are normally created, but link those to an ACME account through so-called External Account Binding. In essence, you would need to get 2 additional parameters from those CAs and use those on the command line. Those parameters are the "Key ID" (eab-kid) and "HMAC Key" (eab-hmac-key).

Please note that the same EAB credentials, depending on the CA, might be allowed to be used for multiple ACME accounts or just one.

ALTERNATIVE CERTIFICATES SUPPORT

Let's Encrypt recently started offering "alternative" certificates via the "alternate links" mechanism. When your certificate is requested, LE returns just one such link at the moment of writing, where an intemediate certificate is signed by "ISRG Root X1, Internet Security Research Group" rather than "DST Root CA X3, Digital Signature Trust Co.". You can fetch that alternative certificate instead of the "default" one using the --alternative option with a number corresponding to the order in which that alternative certificate was listed. So for the first alternative certificate it will be:

    le.pl ... --alternative 1

RENEWALS

To RENEW your existing certificate use the same command line as you used for issuing the certificate, with one additional parameter:

   --renew XX, where XX is the number of days left until certificate expiration.

If client detects that it is XX or fewer days left until certificate expiration, then (and only then) the renewal process will be run, so the script can be safely put into crontab to run on a daily basis if needed.

The amount of days left is checked by either of two methods:

  • If the certificate (which name is used with --crt parameter) is available locally, then it will be loaded and checked.
  • If the certificate is not available locally (for example if you moved it to another server), then an attempt to connect to the domains listed in --domains or CSR will be made until the first successful response is received. The peer certificate will be then checked for expiration.

CONTACT DETAILS UPDATES

If you would like to receive expiration notifications for your domain, you can specify --email parameter and an appropriate email address during the initial registration of the account. Later, shall you want to change your email or specify more than one, you can use --update-contacts parameter to update your contact information. For example:

le.pl --key account.key --update-contacts "[email protected], [email protected]" --live

To reset your contact details, please specify "none" as a value, as follows:

le.pl --key account.key --update-contacts "none" --live

PLUGINS

Both the library and the client can be easily extended with custom plugins to handle Let's Encrypt challenges (both pre- and post-verification). See Crypt::LE::Challenge::Simple module as an example of such plugin.

The client application can also be easily extended with modules handling process completion. See Crypt::LE::Complete::Simple module as an example of such plugin.

Client options related to plugins are:

  • --handle-with
  • --handle-params
  • --handle-as
  • --complete-with
  • --complete-params

Please note that parameters for --handle-params and --complete-params are expected to be valid JSON documents or to point to files containing valid JSON documents (the latter is a preferable method).

Example of running the client with plugins (you can modify the source code of the provided Crypt::LE::Challenge::Simple and Crypt::LE::Complete::Simple):

le.pl --key account.key --email "[email protected]" --csr domain.csr --csr-key domain.key --crt domain.crt --domains "www.domain.ext,domain.ext" --generate-missing --handle-with Crypt::LE::Challenge::Simple --complete-with Crypt::LE::Complete::Simple

Note: you can use the same plugin to cover both the challenge/verification and the completion process, as long as it has appropriately named methods defined. You can also point directly to a Perl module file rather than specify a name of the module.

This will work even on Windows, without any need to install anything - having just the binary file of the client and the plugin file is sufficient.

For example, if you have your le64.exe client and then created or downloaded the plugin code (see Plugins/DNS.pm for example) into the same directory, you can use it like this:

le64.exe -key account.key -domains test.com -csr test.csr -csr-key test.key -crt test.crt -generate-missing -handle-with DNS.pm -handle-as dns

All comand line parameters are passed to the methods of the plugin, along with the information about the challenge requirements and the verification results. For example, if you have defined handle_challenge_dns method, it will receive the challenge data and the parameters data. The challenge data will contain all the necessary details, including "domain", "host" and "record" values. In this case the "host" would be the same as the "domain", except the wildcard part removed (if it was present). To illustrate:

  • If the "domain" is test.com, then the "host" is test.com;
  • If the "domain is "*.test.com", then the "host" is test.com;

So you would need to set _acme-challenge record in your "host" zone with the value of the "record".

In a similar way, for the HTTP verification, the method handle_challenge_http would have access to "file", which contains the name of the file to be created, and the "text", which contains the content of that file.

Please note that before v0.32 the parameters passed with --handle-params and --complete-params were accessible directly as keys of the parameters passed to the method. However, starting from v0.32 they are passed under their own key along with all the command line parameters. So if you have passed something like { "name": 123 } as JSON for --handle-params, then previously in your methos you would access that "name" as follows:

my $value = $params->{'name'};

Now you need to access it as follows:

my $value = $params->{'handle-params'}->{'name'};

This is a potentially breaking change if you used custom handlers and were passing additional custom parameters from the command line of the client, but it is necessary to make all command line parameters accessible to plugins and avoid overlapping the keys.

Plugins in multiuser environment

It is important to remember that the client code allows plugins to be used. While this makes the client rather flexible in terms of possible automation, it should be kept in mind that you should not be running it from a privileged user (and you do not need to), especially in the multiuser environment. As with any other application that can extend the functionality either by plugins or by executing some commands/hooks, it is never a good idea to make it writable by anyone else or make it run with the privileges it does not actually need. You can almost always achieve the resuts you need without resorting to making your application (or the script that runs it) running as a root or a privileged user - for example to allow reloading the web server on completion you can just configure sudo to allow that reload to a specific user, etc.

CUSTOM LOGGING

Client uses Log::Log4perl module for logging. You can easily configure it to log into file, database, syslog, etc. Logger object is available to plugins which are called from the client and to the library itself. Below is an example of a logging configuration file to log both to screen and into le.log file:

 log4perl.rootLogger=DEBUG, File, Screen
 log4perl.appender.File = Log::Log4perl::Appender::File
 log4perl.appender.File.filename = le.log
 log4perl.appender.File.mode = append
 log4perl.appender.File.layout = PatternLayout
 log4perl.appender.File.layout.ConversionPattern = %d [%p] %m%n
 log4perl.appender.File.utf8 = 1
 log4perl.appender.Screen = Log::Log4perl::Appender::Screen
 log4perl.appender.Screen.layout = PatternLayout
 log4perl.appender.Screen.layout.ConversionPattern = %d [%p] %m%n
 log4perl.appender.Screen.utf8 = 1

Save the configuration into some file and then run le.pl with --log-config parameter specifying that configuration file name, for those settings to take effect.

CUSTOM EXIT CODES

By default the client application produces a limited set of exit codes - 1 on help or unknown parameters and 255 in case of other errors. Additionally the case of attempting a renewal too early is not considered an error. This behaviour can be changed to assign custom exit codes to different errors (including setting an error code for an early renewal).

If you wish to change an exit code for a particular error, you need to find the associated message first and then assign some code via a config file. For example, say you are receiving an error message saying "Could not read the certificate file." and you want to assign an error code of 200 to it. If you you add --debug flag to the command line, that same error message would look as "[ CERTIFICATE_FILE_READ ] Could not read the certificate file." If now you create a configuration file as shown below, running the same command as before with --config name_of_your_configuration_file will change the exit code for that error to 200:

[errors]
CERTIFICATE_FILE_READ = 200

PROXY SUPPORT

In the rare case of connecting through a proxy, you can instruct the client to use one by setting HTTPS_PROXY environment variable in the form of https://user:[email protected]/ (user:pass@ part is only needed if proxy requires basic auth).

SUPPORT AND DOCUMENTATION

After installing, you can find documentation for this module with the perldoc command.

perldoc Crypt::LE

You can also look for information at:

For feedback see:

NOTES

Crypt::LE has been initially created over weekend, when I noticed that some of my previously bought certificates are about to expire soon enough. The initial goal was to make this work, make it easy to use and possibly remove the need to use openssl command line. It may contain some (hopefully minor) bugs, so feel free to submit a bug report.

If you'd like to contribute a custom plugin, for example to support automatic DNS records creation and removal via API of certain DNS providers (or your registrar), feel free to create a module under Crypt::LE::Challenge:: namespace and either upload it to CPAN or submit a pull request.

In the former case please specify a dependency from Crypt::LE of at least version 0.11 in your Makefile.

In the latter case please be aware that your module might be uploaded to CPAN later (unless you object) and might be uploaded separately rather than as a part of Crypt::LE (this might happen if you are using dependencies not necessarily required for the rest of Crypt::LE package).

You can also contribute the completion-handling modules under Crypt::LE::Complete:: namespace, for example to scp the domain key and certificate to another host or to send an email about successful certificate renewal.

LICENSE AND COPYRIGHT

Copyright (C) 2016-2023 Alexander Yezhov

This program is free software; you can redistribute it and/or modify it under the terms of the the Artistic License (2.0). You may obtain a copy of the full license at:

http://www.perlfoundation.org/artistic_license_2_0

Any use, modification, and distribution of the Standard or Modified Versions is governed by this Artistic License. By using, modifying or distributing the Package, you accept this license. Do not use, modify, or distribute the Package, if you do not accept this license.

If your Modified Version has been derived from a Modified Version made by someone other than you, you are nevertheless required to ensure that your Modified Version complies with the requirements of this license.

This license does not grant you the right to use any trademark, service mark, tradename, or logo of the Copyright Holder.

This license includes the non-exclusive, worldwide, free-of-charge patent license to make, have made, use, offer to sell, sell, import and otherwise transfer the Package with respect to any patent claims licensable by the Copyright Holder that are necessarily infringed by the Package. If you institute patent litigation (including a cross-claim or counterclaim) against any party alleging that the Package constitutes direct or contributory patent infringement, then this Artistic License to you shall terminate on the date that such litigation is filed.

Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

crypt-le's People

Contributors

do-know avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

crypt-le's Issues

Exporting PFX produces error : PKCS12.xs:50: OpenSSL error: Unknown Error at Crypt/LE.pm Line 1493

Platform : Windows Server 2012R2
LE Client : version 0.31

command line being used:
le64.exe --key .\keys\account.key.txt --csr .\keys\request.csr --csr-key .\keys\domain.key --crt .\keys\cert.crt --domains "*.fqdn.com" --handle-as dns -api 2 --generate-missing --export-pfx "password"

Produces the following output in the log (and onscreen)
2018/03/18 18:18:47 [INFO] [ ZeroSSL Crypt::LE client v0.31 started. ]
2018/03/18 18:18:47 [INFO] Loading an account key from .\keys\account.key.txt
2018/03/18 18:18:47 [INFO] Loading a CSR from .\keys\request.csr
2018/03/18 18:18:49 [INFO] Registering the account key
2018/03/18 18:18:49 [INFO] The key is already registered. ID:
2018/03/18 18:18:50 [INFO] Received domain certificate, no validation required at this time.
2018/03/18 18:18:50 [INFO] Requesting issuer's certificate.
2018/03/18 18:18:50 [INFO] Saving the full certificate chain to .\keys\cert.crt.
2018/03/18 18:18:50 [INFO] Exporting certificate to .\keys\cert.pfx.
2018/03/18 18:18:50 [ERROR] Error exporting pfx: PKCS12.xs:54: OpenSSL error: Unknown error at Crypt/LE.pm line 1493.

If you run it without the --export-pfx, it all works perfectly fine, generates the certs, and all ready to go.

Machine does not have openSSL installed - its a WIndows machine - do I need it for this part to function?

verifcation remains valid for 60 days?

The zerossl.com site says:
"Do I need to do the verification again when I renew?
The verification results are valid, at the time of writing, for 60 days. If you renew within that period, you should not need to re-verify."
https://zerossl.com/ssl-faq.html

If I understand correctly, if I renew my cert within 60 days of the last renewal, I won't need to perform the challenge to get the new cert. Is that correct?

So, my cmd line would look something like?:
le64.exe --key LE_acct_key.txt --csr CSR.txt --csr-key domain_key.txt --crt cert.pem --generate-missing --domains "MyDomain.com" --renew 65 --live

different IDs if live or not

I get different registered IDs depending on if I use --live switch or not.

le64.exe --key LE_acct_key.txt --update-contacts "[email protected]"
--> The key is already registered. ID: 12345

le64.exe --key LE_acct_key.txt --update-contacts "[email protected]" --live
--> The key is already registered. ID: 67890

Log DNS challenge details to logger before invoking handler

Hello,

I've been working with how to execute a DNS challenge on windows without installing the perl modules. The problem comes that the challange handler executes as a sub-process and while waiting for input you can't get the output text from the process. If you could add logger messages for the DNS challenge that logs the DNS details then we could use it to setup the DNS records before sending a STDIN command back to the process.

Quirks in the command line parameters

Hello! This is similar to Issues #9 and #10, but since they're closed, I decided to create a new issue.

When setting a path to the -path parameter with double quotes, a space is added to the end of the path, making it invalid. EG: "F:\www\.well-known\acme-challenge" turns into "F:\www\.well-known\acme-challenge ".

Also, the -generate-missing parameter needs to go before the -key, -csr, -csr-key, -crt parameters, or else the command fails.

After some trial and error the command succeeded, so these were just annoyances rather than big problems.

Here's an annotated log with the commands as I was inputting them. Hope it helps.
https://pastebin.com/UE83WWLQ

Thanks

Question: SAN cert for wildcard and another domain

Quick question: is it possible to issue a single SAN certificate valid for a wildcard domain along a different domain?

--domains "*.some.domain, some.domain, another.domain" --handle-as dns --api 2

Will this work?

Revoke problem

Hello,
I am trying to revoke some certificates, but I am giving following error:

immagine

Can you please help me?

I am using le64 executable, version 0.28.

Proxy Support

Does Crypt-LE support proxies? It does not appear to respect the proxy settings configured on the system and tries to do a direct outbound connection to LetsEncrypt. I wasn't able to find any documentation on proxy support or additional flags in --help.

feature request: get verified domains

Instead of tracking the failed domains myself it would be handy to provide a subroutine which returns all successfully verified domains (or all failed). Your package is already doing this, so I see no reason to duplicate the code. Right now I'm evaluating/looping over LE->{domains} but this will break if you'll change the internal format someday.

Could not finalize an order

I am receiving the following error (subject line) when requesting a certificate using the Live site. I have no issues requesting a certificate using the test API. I have tried generating new RSA keys (account.key and mydomain.key) as well as removing the CSR and CRT. Am I missing something? Has Let's Encrypt blocked the wildcard domain I am trying to register?

image

Is this project alive?

There's been little activity on the project in the last months.

Could the main developer clarify if he intends/expects to keep working on it and keep it fresh (builds with up-to-date libraries, at least), and in general what its expectations for its future are?

I don't mean to complain, it's just that this is an aspect that needs to be clear before relying on such a delicate component for a company's production servers.

Crypt-LE return codes (Linux)

Hi,

Please forgive the (possibly) stupid question, is it possible to catch a return code depending on whether or not the certificate is renewed? I'm just scripting using Crypt-LE and I'd like to be able to break in my code if the renewal time hasn't expired.

Cheers!

Extended IDN support

Extended support in the client to automatically translate appropriate domains into punycode on both Linux and Windows (without non-core dependencies).

Why is it recommended to use OpenSSL to create the keys?

The documentation at https://zerossl.com/usage.html says:

Even though le.pl can create your keys for you, it is recommended to create them in advance, using the following commands:

  • To generate an account key - openssl genrsa -out account.key 4096
  • To generate a domain key - openssl genrsa -out mydomain.key 2048

What's the reason for this?

I'm not familiar with Perl, but the library used for the le.pl's internal generation of the keys (SSLeay) seems to be using OpenSSL internally, so it appears that there should be no difference in security. Am I wrong?

le32.exe doesn't have the correct PE version metadata

All of the PE metadata is missing for le32.exe and probably le64.exe as well. Ideally at least the version and product name would be specified. Without this data, the file looks suspicious and makes it much harder to tell which version is currently being used.

In Windows Explorer:

screen shot 2017-07-25 at 2 23 36 pm

In the File Properties:

screen shot 2017-07-25 at 2 19 34 pm

Other issues: #10 , #9

Suport for ecdsa

le.pl by default creates RSA keys, it would be nice to be able to create ECDSA keys as an option

Is PoP (proof of possesions challenge ) implemented in LE64.exe?

Hi all,

I have account.key and domain.csr file from previous cert generation, so as I understand from docs these files can be used in PoP challenge method.
But when I run LE64.exe only with --key and --csr parameters, I still need to provide files in my webroot to proof my control over the domain.
On the other side when I use online form on https://zerossl.com/, I can provide only account.key and domain.csr file and I get new certificate for my domain without the HTTP-01 challenge.

What I am doing wrong with LE64.exe or should I use https://zerossl.com/ for PoP challenge every 90days?

HTTP verification on custom port

Hello, there is a way to renew certifficate using http verrification but specify witch another port reather than default 443 ?

Thank you.

error codes

I'm using le64 on Win10. I'd like to set an error code for when the renewal does not happen when using the option --renew XX. The instructions say to use --debug to get the exact error string, but I don't get one. This is all I get:
2019/06/30 17:18:46 Checking certificate for expiration (local file).
2019/06/30 17:18:46 Too early for renewal, certificate expires in 43 days.

How can I set an error code for this condition?

After I can specify an error code, how does it throw it? In a batch file, will it just print it? (My apologies if this part is more of a general batch processing question.)

I can't just run it until it succeeds because I have file processing before and after the renewal happens, that depends on the success of the renewal.

Invalid response when dowloading/reading file from IIS

Enviroment:

IIS is on azure in version 8.5.96000.16384
IIS has mime for file without extensions as text/plain
le64 Windows Libraries (actual version: 0.35)

Scenario:

  1. Use this command:
    le64 --email "xxxx@xxxxx" --domains "xxxxx.cloudapp.azure.com" --generate-missing --crt xxxxx.crt --csr xxxx.crt --csr-key xxxx.crt --key xxxxx.crt --debug --handle-as http --unli
    nk --path xxxxx.well-know\acme-challange
  2. See this nice error: Invalid response
    ""\r\n<html xmlns="http"

So... lib creating a challange file and I can read it in postman (RAW view showing only file content, not content wrapping on html codes)
Ok..maybe postman doing some magic... so I installed a curl client for Windows and it again show ony file content.

This error event occurs even I use a le.pl
This is a strange behavior comparing to postman or curl.

PFX not supported

Hi,
I am getting this error with the installed version of the client.

Error:

2018/04/19 20:04:10 Error exporting pfx: PFX export is not supported (requires s
pecific build of PKCS12 library for Windows).

mixed up domains

I recently attempted to issue a cert for seven wildcards. This has worked fine before with five but now I'm getting error messages that imply the domains are being mixed up. ccppuu from LE confirmed that my client (zerossl client docker) was asking for the right stuff but was printing out the wrong domain name

Failed to receive the challenge. Method not allowed

C:\Crypt-LE-0.34\lib>le64 --key ltsncrpt_acc.key --csr out_server.csr --csr-key our_server.key --crt our_server.crt --domains "mail.spec-cb.ru" --generate-missing --unlink --path C:\www.well-known\acme-challenge

2019/12/05 18:56:54 [ ZeroSSL Crypt::LE client v0.34 started. ]
2019/12/05 18:56:54 Generating a new account key
2019/12/05 18:56:56 Saving generated account key into ltsncrpt_acc.key
2019/12/05 18:56:56 Generating a new CSR for domains mail.spec-cb.ru
2019/12/05 18:56:56 New CSR will be based on a generated key
2019/12/05 18:56:56 Saving a new CSR into out_server.csr
2019/12/05 18:56:56 Saving a new CSR key into our_server.key
2019/12/05 18:56:57 Registering the account key
2019/12/05 18:56:57 The key has been successfully registered. ID: 11724438
2019/12/05 18:56:57 Make sure to check TOS at https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf
2019/12/05 18:56:58 Failed to receive the challenge. Method not allowed

what is the problem?

CSRs created elsewhere (or edited) and with an extra content in them cause an error on an attempt to finalize.

Crypt::LE has a problem processing long (23 domains with wildcards) cert requests.
It happens on all platforms with the recent v0.33, I modified le.pm slightly to demonstrate the problem

2019/10/22 04:34:42 Registering the account key
2019/10/22 04:34:43 The key is already registered. ID: unknown
2019/10/22 04:34:43 Current contact details: @.**
$VAR1 = {
'type' => 'urn:ietf:params:acme:error:malformed',
'status' => 400,
'detail' => 'Error parsing certificate request: asn1: structure error: length too large'
};
2019/10/22 04:34:48 Requesting domain certificate.
$VAR1 = {
'detail' => 'Error parsing certificate request: asn1: structure error: length too large',
'status' => 400,
'type' => 'urn:ietf:params:acme:error:malformed'
};
2019/10/22 04:34:49 Could not finalize an order 400.

it fails exactly here @ print Dumper($content):

            return $self->_status(ERROR, "Unknown order status: $content->{status}.");
        }
    } else {
        print Dumper($content);
        return $self->_status(AUTH_ERROR, "Could not finalize an order $status.");
    }

Crypt::LE cannot handle challenges if authrorizations are not in order with identifiers

Crypt::LE cannot handles challenges if the order of authrorizations do not match the order of identifiers in the new-order response (which might happens for multiple SAN names, in my case some with punycode encoding) with (at least with) DNS challenges.

The problem is that $domain

foreach my $domain (@{$self->{loaded_domains}}) {
does not match the authorization (when debug is enabled I see a different identifier in the "Requesting challenge for domain" response) and, thus, some domains might not be validatable at all, resulting in errors like:

Domain xn--soldatenausrstung-e3b.net has failed verification (status code 200).
DNS problem: NXDOMAIN looking up TXT for _acme-challenge.www.soldatenausruestung.de

Cross-ref: https://community.letsencrypt.org/t/dns-based-validation-fails-on-renew/59027?u=mrtux

All requests using API v2 result in "Could not finalize an order"

I'm switching my scripts over to API v2 for future-proofing and the ability to have wildcard certificates. Every request I make using API v2, whether it's a wildcard or not results in the message "Could not finalize an order."

I'm using my own DNS challenge/complete modules, both of which report a success for the domain verification and appear to be functioning perfectly.

Am I missing something obvious? I've tried from behind different IP addresses and using completely different domains, result is always the same.

Example command I'm running (Windows) is:

perl le.pl --key "C:\scripts\letsencrypt\account.key" --csr "C:\scripts\letsencrypt\example.domain.com.csr" --csr-key "C:\scripts\letsencrypt\example.domain.com.key" --crt "C:\scripts\letsencrypt\example.domain.com.crt" --domains "example.domain.com" --generate-missing --handle-as dns --handle-with Crypt::LE::Challenge::Cpanel --complete-with Crypt::LE::Complete::Cpanel --handle-params "C:\scripts\letsencrypt\settings.json" --complete-params "C:\scripts\letsencrypt\settings.json" --issue-code 100 --api 2

Log:

2019/03/25 16:49:00 [ ZeroSSL Crypt::LE client v0.32 started. ]
2019/03/25 16:49:00 Loading an account key from C:\scripts\letsencrypt\account.key
2019/03/25 16:49:00 Generating a new CSR for domains example.domain.com
2019/03/25 16:49:00 New CSR will be based on a generated key
2019/03/25 16:49:01 Saving a new CSR into C:\scripts\letsencrypt\example.domain.com.csr
2019/03/25 16:49:01 Saving a new CSR key into C:\scripts\letsencrypt\example.domain.com.key
2019/03/25 16:49:02 Registering the account key
2019/03/25 16:49:03 The key is already registered. ID: 8691228
2019/03/25 16:49:05 Processing the 'dns' challenge for 'example.domain.com' with Crypt::LE::Challenge::Cpanel
2019/03/25 16:49:41 Processing the 'dns' verification for 'example.domain.com' with Crypt::LE::Challenge::Cpanel
Domain verification results for 'example.domain.com': success.
You can now delete '_acme-challenge.example.domain.com' DNS record
2019/03/25 16:49:41 Requesting domain certificate.
2019/03/25 16:49:42 Could not finalize an order.

JWS has an invalid anti-replay nonce:

Trying to get wildcard certificate issued

2018/03/31 15:59:49 [ ZeroSSL Crypt::LE client v0.31 started. ] 2018/03/31 15:59:49 Loading an account key from keys/account.key 2018/03/31 15:59:49 Loading a CSR from keys/domain_com.csr 2018/03/31 15:59:52 Registering the account key 2018/03/31 15:59:53 The key has been successfully registered. ID: 32189279 2018/03/31 15:59:53 Make sure to check TOS at https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf 2018/03/31 15:59:53 Current contact details: [email protected] Challenge for ‘*.domain.com’ requires the following DNS record to be created: Host: _acme-challenge.domain.com, type: TXT, value: CvkvXCdKqh6f7HF0kKRvN1ylF0HB-8m6Cj9T1DNluFg Wait for DNS to update by checking it with the command: nslookup -q=TXT _acme-challenge.domain.com When you see a text record returned, press

Record created, day after we try to carry on
2018/04/01 10:17:01 Processing the ‘dns’ verification for ‘.domain.com’ 2018/04/01 10:17:01 Domain verification results for '.domain.com’: error. JWS has an invalid anti-replay nonce: “b5Wu6G baghKpDdzs0a1op8rECg_hG3DNa5cK9bfkFqs” 2018/04/01 10:17:01 You can now delete ‘_acme-challenge.domain.com’ DNS record 2018/04/01 10:17:01 All verifications failed

One is supposed to use --renew option, but that fails with
2018/04/01 10:17:29 [ ZeroSSL Crypt::LE client v0.31 started. ] 2018/04/01 10:17:29 Loading an account key from keys/account.key 2018/04/01 10:17:29 Loading a CSR from keys/domain_com.csr 2018/04/01 10:17:29 Checking certificate for expiration (website connection). 2018/04/01 10:17:29 Checking *.domain.com 2018/04/01 10:17:29 Could not get the certificate expiration value, cannot renew.

Ofcourse there is NO certificate yet, so nothing can be checked!

Any idea what is going on?

DNS verification on renewal?

Hi,

Kudos to the dev(s)! This is such a useful & reliable tool.

Quick question: does a wildcard certificate renewal require DNS verification as well?

I'm hoping to automate the renewal process on our server, but initial TXT records won't always exist, so does the tool/LetsEncrypt reuse the existing account/CSR keys, or does it require new TXT records for verification, in which case automation may be a bit harder I guess?

Silent mode

Please add silent mode where it's easy to configure renew to be completely silent unless it fails for some reason.

can't get -renew to work

I get an exception when using the -renew option.
Using -renew-check myweb.com
or
-renew-check https://myweb.com
also fails.
What are the possible causes? Is this because my router doesn't support loopback?

C:\apps\Icecast\ssl_info>le64.exe --key LE_acct_key.txt --csr stream_CSR.txt --csr-key domain_key.txt --crt stream_cert_2019May14.pem --path C:\apps\Icecast\web.well-known\acme-challenge --generate-missing --domains "myweb.com" --renew 40 --debug
2019/05/14 19:31:59 [ ZeroSSL Crypt::LE client v0.32 started. ]
2019/05/14 19:31:59 Loading an account key from LE_acct_key.txt
2019/05/14 19:31:59 Account key loaded.
2019/05/14 19:31:59 Generating a new CSR for domains myweb.com
2019/05/14 19:31:59 New CSR will be based on a generated key
2019/05/14 19:32:01 CSR generated.
2019/05/14 19:32:01 Saving a new CSR into stream_CSR.txt
2019/05/14 19:32:01 Saving a new CSR key into domain_key.txt
2019/05/14 19:32:01 Checking certificate for expiration (website connection).
2019/05/14 19:32:01 Checking myweb.com
2019/05/14 19:32:11 Connection error: 599 Internal Exception
2019/05/14 19:32:11 Could not get the certificate expiration value, cannot renew.

StdOut does not get properly redirected

Hello,

I am trying to integrate LE32 to a legacy windows system that does not have support for ACMESharp.
I intended to run LE32 in a small .Net app of mine to handle the process (I am using the windows binaries version).

But I have an problem that stdout never get's filled with the information unless the LE process completes (since I am using dns challenge it is a problem).

Looking at the process structure, I see that starting the LE32 process spawns a subprocess. Is it possible that thestdout doet get properly or does not flush often enough? Or am I missing something trivial alltogether ?

Regards,

http domain verification failures on SAN (multihost) certs

I need to generate a multi-domain SAN certificate.

The challenge files for ALL domains are successfully created in --path but the process of verification checks each domain/path not the single -path specified on the command line...

Hope this makes sense and there is a way around it.

Thanks

fix for DNS.pm

The sample code in DNS.pm needs a change:

  • in line 49 the $challenge->{host} should be $results->{host}
  • also in this line, the passing of the {record} is not needed
  • but instead a /f must be added to the dnscmd command line to avoid interactive prompting

In total, the line should look like this:
my $rv = system('dnscmd', '/recorddelete', $results->{host}, '_acme-challenge', 'TXT', '/f');

feature request: allow setting domains

Right now the function flow is generating the CSR before verifying the domains. However domains might be rejected during verification, which would require generating a new CSR. It would be handy to (optionally) reverse the flow by providing an official subroutine for setting the internal LE->{'domains'} hash ref.

PS: very nice package

Not Found file

le64.exe --key account.key --csr mydomain.csr --csr-key mydomain.key --crt mydomain.crt --domains "mydomain" --path C:/xampp/htdocs/mydomain/.well-known/acme-challenge -generate-missing -curve default -live
2019/04/30 12:44:14 [ ZeroSSL Crypt::LE client v0.33 started. ]
2019/04/30 12:44:14 Loading an account key from account.key
2019/04/30 12:44:14 Loading a CSR from mydomain.csr
2019/04/30 12:44:15 Registering the account key
2019/04/30 12:44:16 The key is already registered. ID: myid
2019/04/30 12:44:17 Successfully saved a challenge file 'C:/xampp/htdocs/mydomain/.well-known/acme-challenge/oZK3axC2Xw2CoAdlQFjl6mF1JNhJCIIfJivOaiY3is8'
for domain 'mydomain'
2019/04/30 12:44:20 Domain verification results for 'mydomain': error.
Invalid response from http://mydomain/.well-known/acme-challenge/oZK3axC2Xw2CoAdlQFjl6mF1JNhJCIIfJivOaiY3is8 [myip]:
"\n\n<title>404 Not Found</title>\n\n

Not Found

\n<p"
2019/04/30 12:44:20 You can now delete the 'C:/xampp/htdocs/mydomain/.well-known/acme-challenge/oZK3axC2Xw2CoAdlQFjl6mF1JNhJCIIfJivOaiY3is8' file.
2019/04/30 12:44:20 All verifications failed

image

Crypt-LE / le32.exe doesn't handle spaces in `path` very well.

Typically to handle spaces in paths in the command line, the pathname is surrounded by " but that didn't work.

I had to specify the path with \" at the start and end in order for it to be used properly.

This would NOT work: "C:\Program Files (x86)\ ..." and gave the error message: Path to save challenge files into should be a writable directory for: C:\Program

This would work: \"C:\Program Files (x86)\ ...\"

Please print detail when it failed

When a request failed, it would be good if it prints why it failed.
https://tools.ietf.org/html/draft-ietf-acme-acme-03#section-5.6

$VAR1 = {
          'success' => '',
          'protocol' => 'HTTP/1.1',
          'headers' => {
                         'boulder-request-id' => 'LBz...M9w',
                         'connection' => 'close',
                         'cache-control' => 'max-age=0, no-cache, no-store',
                         'date' => 'Tue, 16 Aug 2016 06:57:48 GMT',
                         'content-length' => '113',
                         'pragma' => 'no-cache',
                         'content-type' => 'application/problem+json',
                         'replay-nonce' => 'CfZ...fe4',
                         'boulder-requester' => '289567',
                         'server' => 'nginx',
                         'expires' => 'Tue, 16 Aug 2016 06:57:48 GMT'
                       },
          'status' => '400',
          'url' => 'https://acme-staging.api.letsencrypt.org/acme/new-authz',
          'content' => '{
  "type": "urn:acme:error:rejectedIdentifier",
  "detail": "Policy forbids issuing for name",
  "status": 400
}',
          'reason' => 'Bad Request'
        };

I didn't realized I was using blacklisted domain until I dump $resp in _request

Certificate fails live against API v2, but works against staging

I have got my scripting all set up, and have been testing using the staging server.

Authorisation initially set via DNS, and the DNS challenge was done (about 15 days ago) against test, and all good.
Can generate .CRT files, and export PFX (which is what i need for the UniFi controller on my Windows Server 2012R2 server.

However, when I switch to using live, instead of staging/test - I get the following in the log:

2018/04/02 12:38:00 [INFO] Loading an account key from C:\Program Files\ZeroSSL\keys\hostmaster_domain_com_au-account.key.txt
2018/04/02 12:38:00 [DEBUG] Account key loaded.
2018/04/02 12:38:00 [INFO] Loading a CSR from C:\Program Files\ZeroSSL\keys\__sub.domain.com.au.CSR
2018/04/02 12:38:00 [DEBUG] Loaded domain names from CSR: *.sub.domain.com.au
2018/04/02 12:38:00 [DEBUG] CSR loaded.
2018/04/02 12:38:00 [DEBUG] CSR key loaded
2018/04/02 12:38:03 [DEBUG] Directory loaded successfully.
2018/04/02 12:38:03 [INFO] Registering the account key
2018/04/02 12:38:03 [DEBUG] Key is already registered, reg path: https://acme-v02.api.letsencrypt.org/acme/acct/32250334.
2018/04/02 12:38:03 [DEBUG] TOS has changed, you may need to accept it again.
2018/04/02 12:38:03 [DEBUG] Account ID: 32250334
2018/04/02 12:38:03 [DEBUG] Registration success: TOS change status - 1, new registration flag - 0.
2018/04/02 12:38:03 [INFO] The key is already registered. ID: 32250334
2018/04/02 12:38:03 [INFO] Make sure to check TOS at https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf
2018/04/02 12:38:04 [DEBUG] Accepted TOS.
2018/04/02 12:38:04 [INFO] Current contact details: [email protected]
2018/04/02 12:38:04 [DEBUG] Could not finalize an order.
2018/04/02 12:38:04 [DEBUG] Requesting challenge for domain *.sub.domain.com.au.
2018/04/02 12:38:04 [DEBUG] Received challenges for *.sub.domain.com.au.
2018/04/02 12:38:04 [DEBUG] Requested challenges for 1 domain(s).

and it proceeds no further.

if I drop the --live from the command, it proceeds normally, and as expected.

This is the command I am using for the Live Environ -
'C:\Program Files\ZeroSSL\le64.exe' --key C:\Program Files\ZeroSSL\keys\hostmaster_domain_com_au-account.key.txt --csr C:\Program Files\ZeroSSL\keys__sub.domain.com.au.CSR --csr-key C:\Program Files\ZeroSSL\keys__sub.domain.com.au.raw.key --crt c:\program Files\ZeroSSL\Keys__sub.domain.com.au.crt --export-pfx "ai
rcontrolenterprise" --domains "*.sub.domain.com.au" --handle-as dns --api 2 --generate-missing --log-config "C:\Program Files\ZeroSSL\log.config" --debug --live

If i run the exact same command, but drop the --live, it works fine

`2018/04/02 13:21:55 [INFO] Loading an account key from C:\Program Files\ZeroSSL\keys\hostmaster_domain_com_au-account.key.txt
2018/04/02 13:21:55 [DEBUG] Account key loaded.
2018/04/02 13:21:55 [INFO] Loading a CSR from C:\Program Files\ZeroSSL\keys\__sub.domain.com.au.CSR
2018/04/02 13:21:55 [DEBUG] Loaded domain names from CSR: *.sub.domain.com.au
2018/04/02 13:21:55 [DEBUG] CSR loaded.
2018/04/02 13:21:55 [DEBUG] CSR key loaded
2018/04/02 13:21:57 [DEBUG] Directory loaded successfully.
2018/04/02 13:21:57 [INFO] Registering the account key
2018/04/02 13:21:57 [DEBUG] Key is already registered, reg path: https://acme-staging-v02.api.letsencrypt.org/acme/acct/2550622.
2018/04/02 13:21:57 [DEBUG] TOS has changed, you may need to accept it again.
2018/04/02 13:21:57 [DEBUG] Account ID: 2550622
2018/04/02 13:21:57 [DEBUG] Registration success: TOS change status - 1, new registration flag - 0.
2018/04/02 13:21:57 [INFO] The key is already registered. ID: 2550622
2018/04/02 13:21:57 [INFO] Make sure to check TOS at https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf
2018/04/02 13:21:58 [DEBUG] Accepted TOS.
2018/04/02 13:21:59 [DEBUG] The certificate is ready for download at https://acme-staging-v02.api.letsencrypt.org/acme/cert/fac3c802999cd3d7375525f8e8e00389d53c.
2018/04/02 13:21:59 [DEBUG] Certificate is separated from the chain.
2018/04/02 13:21:59 [DEBUG] Domain certificate has been received.
2018/04/02 13:21:59 [INFO] Received domain certificate, no validation required at this time.
2018/04/02 13:21:59 [INFO] Requesting issuer's certificate.
2018/04/02 13:21:59 [DEBUG] Issuer's certificate has been already received.
2018/04/02 13:21:59 [INFO] Saving the full certificate chain to c:\program Files\ZeroSSL\Keys\__sub.domain.com.au.crt.
2018/04/02 13:21:59 [INFO] Exporting certificate to c:\program Files\ZeroSSL\Keys\__sub.domain.com.au.pfx.
2018/04/02 13:21:59 [DEBUG] PFX exported to c:\program Files\ZeroSSL\Keys\__sub.domain.com.au.pfx.
2018/04/02 13:21:59 [INFO] ===> NOTE: You have been using the test server for this certificate. To issue a valid trusted certificate add --live option.
2018/04/02 13:21:59 [INFO] The job is done, enjoy your certificate! For feedback and bug reports contact us at [ https://ZeroSSL.com | https://Do-Know.com ]`

I am looking for ideas.

Server - Windows Server 2012R2
LE version - Windows Binary - 0.31

command line parameters seem to care about the order they are specified

when using le32.exe it seemed as though it cared what order the command line parameters were specified. I would add a new one to the end when it asked for something I wasn't specifying yet and it wouldn't work. I would move it into the order according to --help and then it would work.

This wasn't intuitive and should be better documented or changed to be more flexible.

documentation for -server option

Where can I find documentation or examples of how to use the server option?
-server <url|host> : Use custom server URL (optional).
What is it for? In what context do I use it?

I'm running Windows, so using le64.exe.

Custom directory handler support

I am using a self-hosted ACME Server by Nexus and I am testing Crypt-LE (ZeroSSL Crypt::LE client v0.35) under windows server 2016 with strawberry perl (5.30.1.1).

I suspect that if the parameter "server" is given, the path of the URL is ignored. Unfortunately I can't create a positive case, because I can't change the path. My assumption is based on the fact that the same behaviour happens if I call the URL via curl incorrectly.

C:\tmp>le.bat --server "https://pgwy.company.test/acme/directory" --key account.key --csr domain.csr --csr-key domain.key --domains "win.company.test" --
log-config logfile.conf --crt domain.crt --generate-missing
2020/03/13 18:26:03 [INFO] [ ZeroSSL Crypt::LE client v0.35 started. ]
2020/03/13 18:26:03 [INFO] Custom server URL 'https://pgwy.company.test/acme/directory' is used.
2020/03/13 18:26:03 [INFO] Loading an account key from account.key
2020/03/13 18:26:03 [INFO] Loading a CSR from domain.csr
2020/03/13 18:26:03 [ERROR] Could not load the resource directory: <!doctype html><html lang="en"><head><title>HTTP Status 501 – Not Implemented</title><style type="text/css">H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}</style></head><body><h1>HTTP Status 501 – Not Implemented</h1><hr class="line" /><p><b>Type</b> Status Report</p><p><b>Description</b> The server does not support the functionality required to fulfill the request.</p><hr class="line" /><h3>Apache Tomcat/7.0.96</h3></body></html>

Here an example in the same environment but called with curl.

-------------------------
positive case with curl
-------------------------
acme@wwwlinux:~$ curl https://pgwy.company.test/acme/directory
{"newNonce":"https://pgwy.company.test/acme/new-nonce","newAccount":"https://pgwy.company.test/acme/new-account","newOrder":"https://pgwy.company.test/acme/new-order","revokeCert":"https://pgwy.company.test/acme/revoke-cert","keyChange":"https://pgwy.company.test/acme/key-change","meta":{"externalAccountRequired":false}}

-------------------------
negative case with curl
-------------------------
acme@wwwlinux:~$ curl https://pgwy.company.test/directory
<!doctype html><html lang="en"><head><title>HTTP Status 501 – Not Implemented</title><style type="text/css">H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}</style></head><body><h1>HTTP Status 501 – Not Implemented</h1><hr class="line" /><p><b>Type</b> Status Report</p><p><b>Description</b> The server does not support the functionality required to fulfill the request.</p><hr class="line" /><h3>Apache Tomcat/7.0.96</h3></body></html>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.