-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GSoC 2017: Support for "Let's Encrypt" ACME protocol #1959
Conversation
1. Remove trailing whitespace 2. Remove Macros 3. Handle all erroneous response codes the same way 4. Add specs Also don't return nonces anymore when the http response is negative.
Encapsulate some dangerous calls with try catch.
…nction rather than hardcoding
1. A communications module that handles all requets/responses and other low level stuff that have to do with the ACME CA 2. A head module that will do all the useful stuff
Also changed some specs
@angelhof so intermediate certificates should be hard coded or what? Can't we get them via ACME protocol? I see in the I-D that the ACME server may return several certificates (I guess including intermediate ones). |
@zinid There is no need to hardcode them, we could get the intermediate certifcate everytime we need it from https://letsencrypt.org/certs/lets-encrypt-x3-cross-signed.pem.txt . |
@angelhof but the code becomes Let's Encrypt only, so this is not ACME anymore. |
Is it an issue of the LE ACME server implementation? |
Ok it can be done. I will implement it. So the certificates that we save should contain the whole certificate-chain right? |
Yes, just store them inside the same file (the order doesn't matter). |
@zinid There is a problem, when I save the end certificate, the issuer certificate, and the private key for the end certificate in a pem file and try to add it,
|
Are you sure there is a private key? |
Also, I don't have such problem, I just have the warning about unknown CA (due to missing intermediate cert). |
This problem appeared now that I am trying to include the issuer certificate in the pem file.
|
Well I really cannot say what's going on without seeing these PEMs. Maybe private key is not for this certfile? What happens if you change the order? |
I changed the order and nothing happens. If you want to have a look I could make a new pull request with the code so that you can check it out. |
Can't you just mail me this PEM file privately at ekhramtsov@process-one.net? |
I got the PEM file, I'm checking. acme:
ca_url: "https://acme-staging.api.letsencrypt.org" I have an error:
|
I found a problem with private key mismatch: that's because the certfile you receive is not signed by the intermediate certfile provided, because it's signed by "CN = h2ppy h2cker fake CA", but intermediate certfile is issued for "CN = happy hacker fake CA". |
Can you please publish the patch somewhere? I will check with real domains. |
It is this branch https://github.com/angelhof/ejabberd/tree/acme_keep_issuer_cert |
Sigh, I need now to mess with your branches? |
I can make a pr if you prefer |
Is it so hard to publish |
No matter, I got the idea from your branch's commits. |
OK, your fixes make it work with real domains, thank you. |
Another problem:
|
This is fixed by this:
|
Indeed, thank you very much! |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Ejabberd support for "Let's Encrypt" ACME protocol
This is the final pull request for this: https://summerofcode.withgoogle.com/projects/#5214033996152832 GSoC 2017 project.
Project Outline
This project implements support for the "Let's Encrypt" ACME protocol. It is a protocol that allows for certificates to be acquired in an easy, automated way, without any human intervention. So the main functionality of the implementation is acquiring and managing the aforementioned certificates. Below I will describe in detail all the functionality that this project implements.
Detailed Description
There are two typical scenarios that the client has to support:
Despite being described thoroughly in the latest ACME draft: https://tools.ietf.org/html/draft-ietf-acme-acme-07 I will try to give a brief overview of those two scenarios.
In order to acquire a certificate for a domain, a client has to:
In order to revoke a certificate, the client has to just send a revocation request.
Knowing the above I decided to implement 4 commands that the user can use in order to acquire, manage and inspect certificates for their domains.
Get Certificate
This is the most essential command that the client uses. It acquires a certificate for all hosts specified in the configuration file or for a specific set of hosts that the user requests. This command basically follows all the steps of the first scenario above.
Renew Certificate
The renew_certificate command renews all managed certificates that are 30 days (or closer) to expiration. This command should be scheduled for execution every day or so, in order to make sure that all certificates are up to date.
List Certificates
This command pretty prints all managed certificates in plain or verbose mode. Specifically, in plain mode, it prints their domain, SANS, expiration date and path. In verbose it prints the domain, SANs, expiration date and certificate/key.
Revoke Certificate
This command revokes a managed certificate for a specified domain. This command should be used when there exists serious concern that a certificate/key has been compromised.
Structural Description
The implementation is split in 3 modules that are clearly separated from each other.
acme_challenge
This module deals with solving the challenges that the CA issues. The only challenge type that is currently supported is "http-01". If more challenge types are to be supported they should be included in this module.
ejabberd_acme_comm
This module contains functions that implement all necessary http requests to the ACME CA. Its purpose is to facilitate the ACME client implementation by separating the handling/validating/parsing of all the requests from the application logic.
ejabberd_acme
This is the main module of the project. It contains implementations of all the aforementioned commands and the certificate management. It only contains application logic and calls functions from ejabberd_acme_comm in order to communicate with the CA.
Example Usage
An example scenario would be to first execute
And then have a script be scheduled to run the following command every day or so
Known Issues / Things left to do
The implementation offers basic support of the ACME protocol. However it is not complete and has some known issues. I will try to include all of the issues and future tasks here.
Issues
The main issue is that I haven't tested the client on the real "Let's Encrypt" ACME CA because I don't have control of any domain. That is why I have only tested the implementation with a local CA by redirecting all domains to localhost. Because of that I am not sure whether everything works correctly on the real CA.
Future Tasks
Any feedback on this project is greatly appreciated.