Skip to content
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

[Feature Request] To add automatic letsencrypt DNS-01 challenge just like caddy web server #29

Open
diyism opened this issue Nov 25, 2023 · 4 comments
Assignees

Comments

@diyism
Copy link

diyism commented Nov 25, 2023

The biggest selling point of caddy web server is the automatic letsencrypt DNS-01 challenge,
the configuration of Caddyfile is very simple:

{
    servers {
        protocols h3
    }
    acme_dns cloudflare <api token>
}

:443, mysite.com:443 {
  respond / "Hello, world!"
  
}

So I'm expecting this in fullmoon.

@pkulchenko pkulchenko self-assigned this Nov 25, 2023
@pkulchenko
Copy link
Owner

I've definitely considered this, but it's likely that HTTP-01 challenge is implemented first (https://letsencrypt.org/docs/challenge-types/). Things are not going to be simple for a couple of reasons: (1) if you look at Caddy's implementation of the cert management, there is a lot of things that need to be handled (with some of them implemented by other libraries, which are not going to be available here), and (2) some of the crypto methods needed to generate certificate-signing-request, signing requests, and a couple of other things (well described here: https://github.com/alexpeattie/letsencrypt-fromscratch#d-option-2-completing-the-dns-01-challenge) need to be added to redbean to allow them to be used from fullmoon.

@diyism
Copy link
Author

diyism commented Nov 25, 2023

I found a lua repo that support http-01: https://github.com/fffonion/lua-resty-acme

@pkulchenko
Copy link
Owner

Yes, but it depends on lua-resty-openssl, which in turn depends on both Lua JIT/FFI (not supported in redbean) and openssl library (not available in redbean either, which is using MbedTLS). It's still useful to have, as it implements the actual packaging. request/response, and the challenge logic, but the underlying crypto methods it uses, still need to be implemented in redbean.

@pkulchenko
Copy link
Owner

Here is the list of openssl calls from ACME.pm that shows relevant OpenSSL function that may need to be implemented using MbedTLS:

capturex('openssl', ('genrsa', '-out', $_, KEY_SIZE));
capturex('openssl', ('rsa', '-text', '-in', $self->{domain}{account}, '-noout', '-modulus'));
capturex('openssl', ('rsa', '-in', $self->{domain}{account}, '-pubout')));
capturex('openssl', ('dgst', '-sha256', '-binary', '-sign', $self->{domain}{account}, $stf->filename))
capturex('openssl', ('req', '-new', '-outform', 'DER', '-key', $self->{domain}{key}, '-config', $oct->filename, '-out', $self->{req}{csr}));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants