-
-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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
--always-force-new-domain-key should pre-generate the future domain key pair #3096
Comments
Please note, with DNS-01 challenge, it also would be fairly trivial for acme.sh to implement the DANE roll-over procedure and manage shared trust anchor TLSA records itself via the already configured DNS API interface. acme.sh could maintain Current + Next shared trust anchor TLSA records (user configurable), e.g. All that sysadmins would have to do for different TLS servers that use the acme.sh provided certificate is set up CNAMEs pointing to the shared trust anchor TLSA record that acme.sh maintains. This would be a nice-to-have cherry on top, leveraging all the work that has gone into acme.sh DNS API integrations, saving sysadmins from having to figure out how to work their corresponding DNS API themselves with But the key to this all is to start pre-generating future keys in the first place. |
The pre-generating is ok, but all the current dns api hooks are just to add/remove TXT record, they are not able to process TLSA record. |
please try with the
There is a new env variable Let me know if this is what you want. |
Thanks @Neilpang I've tested it out and the general gist of it works, but needs some minor polish. Please see attached the patch with the following minor polish updates:
I've tested it successfully with a
I've also identified some major security issues throughout existing code and raised a separate issue #3127 for it, which also affects this code - so you might want to use this branch for fixing them as well. Outstanding |
Also would be good to export The hooks could do validation of TLSA records against:
to make sure nothing got broken during/after Example use case - it would be useful prior to generating a new certificate to run a pre-hook to check if a TLSA record matching the pre-generated next key already exists. If it doesn't exist, the pre-hook could:
Similarly deployment hook can be used to validate that everything is as it should be and nothing got broken. I didn't look at all of them until now, and raised a new issue #3128 about hook variables passing inconsistency that needs to be fixed. |
After some further testing - there's an issue. The key files get rotated even when cert issuance fails. The pre-generation of new key should be happening after a successful cert issuance. |
@Delicates I'm not that good at shell scripting/programming, so not capable of doing this myself, yet eagerly waiting to automate TLSA generation/population, too. 😅 |
@Neilpang Really nice feature, do you plan to merge it into the master branch? |
@rdemendoza I need more time to check it. |
@Neilpang Almost 1 year later - do you see any chance of getting that "more time to check it" within the next couple of weeks or at least months? |
I have also updated to the TLSA branche. "/root/.acme.sh"/acme.sh --cron --home "/root/.acme.sh" --force |
maybe something could be achieved with this new tool https://letsdns.org/index.html, could be called within a hook. |
Sorry guys, I will check it soon. |
Eagerly awaiting your checks, @Neilpang 😉 |
@Neilpang Since the linked Wiki page isn't that much of an explanation regarding actual usage, can you please extend it? I do get that the additional command line argument generates the new key & puts it into a file. |
The way I do it is with a custom script through cron (every month) that:
|
After 2 years I have finally moved from my own patched version to the latest master acme.sh and noticed the following problem: @Neilpang On the initial certificate issuance, out of all variables passed to Also, looking at the logs, it seems the next key still gets pre-generated prior to successful certificate renewal, so I'm guessing the nasty key-loss issue I pointed out in my last message above remains? |
@bolemo Thanks for the further help, but I still got some questions:
If the answer to the last question above would be true, then I'd be lucky, because the deploy hook I need to run already includes restarting Nginx. 😎 Really looking forward to your answers! 😍 |
Hello @Eagle3386
|
@bolemo Awesome & almost near the finish line now, thanks! 👏🏻 Regarding your answers:
Honestly, I thought Neil would give us something like a new |
The entire process looks like something that should be implemented in acme.sh directly. Why is this not the case? It would be great to have a |
@StrangePeanut That's pretty much what I said in my comment right above your one. 😅👍🏻 @Neilpang Any willingness to improve the situation here? Pretty please?! 🥹😍 |
Technically, acme.sh could automate pushing the DANE records, at least for all the DNS providers it already supports (as it already has API functions). @Eagle3386, until acme.sh automates dane, if it ever does, you have no choice but to deal with ArtFiles API yourself, seems it is the only work left from you for this to work In your case. |
Nice play on my "headache thing", therefore 😄. But while we all wait for that to happen one day, can you please tell me (read: us Linux shell newbies) how I (we) can "call back" from such a "hook script" back into |
Well, reread my post here. I don't use acme.sh directly and I don't use any hook.
I am sure it can be done with little change with a post hook like --deployhook (using acme.sh primarily and it is acme.sh that calls a custom hook script to deal with TLSA…)
You said you already use successfully a deploy hook to restart your nginx. So it seems all you have to do is add in that existing deploy hook script the code to push TLSA to your DNS provider. |
To reply to this more specifically, I don’t believe you can call back the acme.sh DNS API plugin yourself, as I don’t think they are able to deal with DANE specific TLSA records (what I was mentioning earlier about 160 x headaches). |
@bolemo Thanks so much, this helped a lot! Last question: given your 2nd scheme of running everything (where TLSA is done via hook script), are those variables containing username & password for the DNS API available in that very hook script? |
You are welcome!
This is a very good question. In my case, before I call
So when using However, once they are set in
That would add the content of |
Any success @Eagle3386 ? |
Didn't have time due to private life tasks of higher priority. Planning on trying this in the next couple of weeks & will report back ASAP. |
@Eagle3386, thanks so much for looking into it! I had attempted to get a quick-and-dirty patch on PR #4087 — merging an old I still have the old code... somewhere :) ... but I'm the first one to admit being a terrible amateurish programmer with little or no knowledge of what I'm doing :) Nevertheless, whatever I did back then did work. Imagine to my surprise after @Neilpang closed that PR saying that it was "fixed", I let the auto-updater run by itself, and after a few months, I suddenly realised that all my emails were bouncing with invalid key validation errors... AFAIK, right now, we just get an extra private key for the upcoming rotation cycle, which is just ⅓ of the job: a new public key needs to be created as well, and, using the DNS API, a TLSA record with the fingerprint needs to be published. So there is really a bit more that needs to be done. Also note that I'm extremely limited in the number of external DNS providers (and their APIs) that I have access to; as such, my own patches were only tested on Cloudflare. They might not work elsewhere, especially on providers which don't give access to TLSA records from their APIs. Such providers will unfortunately have to be left out of this scenario (and let their users put some pressure to support it!). Nevertheless, I believe that a working solution that works for many providers is better than the current state-of-the-art, where it doesn't work with any of them, unless, of course, you either patch the code yourself, or create the external scripts as hooks as described earlier in this (now long!) thread. |
For anyone interested using Cloudflare, I made a single binary tool in Go that takes in a current and next EC private key (generated by acme.sh) and automatically updates the TLSA records for a given domain using the Cloudflare API. I use it for my own mail server and it gives me a 100% score on Internet.nl's email test. https://github.com/nixigaj/cf-tlsa-acmesh |
--always-force-new-domain-key
should pre-generate the future (next) domain key pair after the new certificate is provisioned, so that--reloadcmd
can update TLSA records in advance of obtaining future certificates as part of the Current + Next DANE roll-over procedure.Pre-generated keys (if they exist) should be used for all future
--always-force-new-domain-key
certificate provisioning.Key rotation requires future planning for DANE TLSA roll-over to account for DNS propagation delays and TLSA records TTL.
See slides 20-21 from the 2018 ICANN61 presentation by Viktor Dukhovni.
The Current + Next DANE roll-over procedure is:
The text was updated successfully, but these errors were encountered: