-
Notifications
You must be signed in to change notification settings - Fork 365
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
Issue & configure Let's Encrypt certificates #29
Comments
Note that currently working on configuration file reloading feature, which has the ability to reload TLS config without restarting the server. This means that after each command run, the server can send a SIG_HUP to itself if it running, and TLS certificates will be reloaded. |
I think the configuration file should include the whitelisted hosts/domains and the certificates should be served/fetched/verified automatically much like the net/http implementation
I think |
Thanks for feedback. Well then, perhaps it can be automatically setup if all conditions are met:
For storage of Let's encrypt certs: would a dot folder be ok? |
There are likely a couple caveats. I think LE only permits requests for certs from servers listening on 'web ports', eg. :443, so the A Name record for the domain should be pointed at the IP address that the mail server is running on. This cert could then be used by the mail server, I imagine, without an difficulties. I imagine the safest, and least breaking, way to do this would be adding options in the config file for ACME configuration(eg. Email address, agreeToTOS, ACME url etc), the user would then leave I tried to implement a simple example within your package (a couple functions in config.go); not sure why but anything I try to print or log is simply ignored or suppressed. I imagine this has to do with the cobra cli app, but I am not sure how. Lemme know, if you know why my functions seem to be ignored. Schmorrison |
Hi, thanks for doing some research. For logging, have you tried setting the log_file to "stderr" or "stdout" in the config? Also, try starting with the -v flag. FYI, as a convention, config values should be treated as read only, and only can be modified via the config file. That is because the config could be re-loaded at any time, there could be a race condition. To modify a config value, one must modify the file first and then either send a SIGHUP or call readConfig func, and then emit the config change events. See serve.go to see how it's done. As for placeholders, would prefer not to use placeholders. The server should try to get the certs automatically as much as possible, as long as the above conditions are met. #29 (comment) Email and 'agree to tos' are needed for account creation? Yes, these would need to be added to the main config, if an account is required. So it looks like the problem is with how to do "Identifier Validation Challenges". https://github.com/letsencrypt/acme-spec/blob/master/draft-barnes-acme.md#identifier-validation-challenges Yes, For HTTP based, it looks like it must bind to :443 or :80, which would not be possible, since almost certainly, there would be other servers bound to that port. So, the alternative is to use DNS based? We can model on how Caddy does it, for DNS https://caddyserver.com/docs/automatic-https Maybe sometime in the future, it may be good to propose an SMTP based "Identifier Validation Challenge" to the Lets Encrypt people? For MTAs, the DNS validation is already half-there in the form of an MX records, all they need to do is send an email with the challenge. They don't need to register an account, an email address can be synonymous with an account. Say if they send it to postmaster@example.com then our MTA would parse it. That would make it just as easy to get certificates for MTAs as it is for HTTP servers |
Another alternative would be to use a tool called certbot from https://certbot.eff.org/ |
Thanks flashmob. I was using Also, duly noted on the config conventions. So it sounds like the preferred way would be writing a wrapper package for certbot. Using it to request certs manually, then update the config and send a SIGHUP. Then on server startup, with the certificates correctly mapped in the config file, check if the certs are about to expire, and if they are then renew them and send a SIGHUP. I am sure you are aware, but this will still require having port :443 available for the |
Thanks for the info. It is now becoming clearer that bunding an Acme client in go-guerrilla may be too much (at least for now). It may bring in some technical debt, especially to support all the various DNS providers, which probably change all the time. So it seems like certbot does a lot of the heavy lifting. Also, it conforms to the Unix philosophy of "Make each program do one thing well". With certbot, there is no need to check if the certs are about to expire. Just put Cerbot supports the following challenges: tls-sni-01 (port 443), http (port 80), and dns. So yes, unless DNS based challenge is used, certbot must be able to have access to the webroot for that web server. Btw, certbot is used for go-guerrilla deployment on Guerrillamail.com but we don't have a plugin for it, so some things are manual. Here is how we deploy it with Nginx. In /etc/nginx/sites-available/default we add the following to the default server block:
Then run this command:
where In summary, a solution using certbot would be acceptable to claim the bounty, just needs to be a bit less manual : -) So deliverables to claim the bounty would be:
What do you think? (edit: grammar) |
Well I will keep it in mind, but unfortunately I have not used Python nearly enough to feel confident writing a plugin. I'm all up for claiming a bounty, but after this discussion I do not believe this is the one. |
Having a look at Python, it has a lot of similarity to Go, so if you know Go it may be easy to learn Python. That said, the above are not absolute requirements. In the end, the contributor for this feature can decide on what to implement and how to do it. It should have been clarified that the above specifies the minim that would be accepted. In summary,
Although we have not fully discussed the scope of a DNS based challenge. Perhaps the minimal solution that could work here is you could start go-guerrilla with --agree option which would then prompt the user to set an A/AAA record for their domain, press any key to continue. Then a goroutine could try the challenge and update the config file once the challenge passed. In that case, there would be a manual step involved. Others, such as Caddy server are able to remove the manual step by using external APsi, however, for us, this requirement may be too much to do on first version. Therefore, if a DNS change requires a manual step then that would be acceptable. Also, what do you think if we drafted a proposal to the Let's Encrypt people to support an new MX record based challenge? It seems like LE is HTTPS centric, an MX record based challenge would be great for SMTP and possibly even POP. Maybe @ginkoob has some thoughts on this? |
Been thinking about this, and while I'm not able to spend enough time to learn Python to write a plugin. I am able to continue thinking about the best way to implement it in Go. For example, if they know they are doing a DNS challenge; then first, they need to see the challenge value; then update the DNS record manually at their name server; then continue the challenge. It is not immediately clear to me how to execute this outside the main routine as you suggested. It occurs to me that it could be significantly easier to write, if the user knows which type of challenge they are doing for certificates, and can configure that. If they want to do the "golang.org/x/crypto/acme/autocert" then:
If they have configured a webroot of a running server:
In all challenge types, probably:
In the case of a "acme/autocert" or webroot, after informing go-guerilla about the desired challenge, it certainly would be possible to execute in a separate goroutine, but if the challenge fails; what is the best way to inform the user? I'm sure there are a number of incoherent thoughts in there. I want to spend some time this weekend maybe working on this. schmorrison |
Yes, it all boils down to how the user will do the challenge. You can add extra config options to CmdConfig, eg, what challenge method to use, where is the web-root, folder to store certificates, LE account email, accept to the LE TOS, etc. Your configureAcme should update the config with new settings. If the configureAcme function changed the config file, i.e it installed a certificate, then you would need to reload the config. ie. The tricky part may be to get it to work with auto-config reloading (see That said, the code in serve.go is about change after huge refactor - but if you keep the changes around in serve.go and acme processing stuff in a separate file, that should minimise merge conflicts. See the new branch that's about to get merged (pending review) here #71 |
Duly noted flashmob. I'll let you know if I have any questions. |
Ok, sorry a bit in a hurry now and made a few mistakes and omitted a few details - made some edits above. Cheers. |
@flashmob is the bounty on this issue still active? |
@rahulgi Yes! There's been no activity on this for a while - so you're welcome to take over. |
Why do need a plugin for certbot? I used deploy hook and I hope that everything will be fine) |
Going to shelve this feature from the roadmap. Rationale: It seems If this feature is re-visited in the future, perhaps it can use the "DNS-01 challenge" using this library https://github.com/go-acme/lego |
@flashmob what is the status on Lets Encrypt? Free certificate is always good, better if built in, no need to use any other scripts to do some hacks. I think Lego is being used by Traefik, and it seems like a solid choice, if there are any vendor changes, just bump lego version and keep on going. |
It doesn't need to be built in, since there are other tools that do the job
of handling "lets encrypt" certificates , namely the Cerbot ACME client.
Therefore, that issue was cancelled.
…On Fri, 16 Oct 2020, 09:57 Alexandre Vicenzi, ***@***.***> wrote:
@flashmob <https://github.com/flashmob> what is the status on Lets
Encrypt? Free certificate is always good, better if built in, no need to
use any other scripts to do some hacks.
I think Lego is being used by Traefik, and it seems like a solid choice,
if there are any vendor changes, just bump lego version and keep on going.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#29 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAE6MP36HOTX3ZBAVJVPCADSK6K7PANCNFSM4C2KDKLQ>
.
|
Btw, to further explain, this project's goal is to be useful more as a
library than stand-alone software. Therefore, it's best not to introduce
any new dependencies or features that are already available outside. If
say, LE support was added directly to go-guerrilla then we would need to
import the go-acme library. It would be better to start an external
project, import both go-guerrilla and go-acme and then put the two
together. (Although it would probably be easier to just use the stand-alone
Certbot client, of course).
…On Fri, 16 Oct 2020 at 10:30, Adam M ***@***.***> wrote:
It doesn't need to be built in, since there are other tools that do the
job of handling "lets encrypt" certificates , namely the Cerbot ACME
client. Therefore, that issue was cancelled.
On Fri, 16 Oct 2020, 09:57 Alexandre Vicenzi, ***@***.***>
wrote:
> @flashmob <https://github.com/flashmob> what is the status on Lets
> Encrypt? Free certificate is always good, better if built in, no need to
> use any other scripts to do some hacks.
>
> I think Lego is being used by Traefik, and it seems like a solid choice,
> if there are any vendor changes, just bump lego version and keep on going.
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub
> <#29 (comment)>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AAE6MP36HOTX3ZBAVJVPCADSK6K7PANCNFSM4C2KDKLQ>
> .
>
|
I have been using Caddy for my routing, and as a bonus it handles SSL certs via LE automatically if required. |
Let’s Encrypt and the golang.org/x/crypto/acme/autocert package’s GetCertificate function.
Requirements:
./guerrillad certificate <server-interface> new
to issue a new cert & add to config. (using the primary_mail_host as as the FQDN./guerrillad certificate <server-interface> renew
to renew./guerrillad certificate renew
to renew all certificatesThe text was updated successfully, but these errors were encountered: