mirror of
https://github.com/therootcompany/greenlock-express.js.git
synced 2025-02-23 13:18:04 +00:00
approveDomains equivalent in version 4 #35
Loading…
x
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Hi,
I'm looking for an equivalent the the approveDomains hook function that was available in version 2, in the latest version.
I'll be needing to dynamically approve or decline the creation of certificates at runtime. How would I do this with the current version?
I see there is an API for adding domains, but I'm unclear how that would work at runtime. Perhaps if I can see an example of an equivalent setup to the approveDomains hook function using this?
My usecase is almost identical to this walkthrough, which recommends the old approveDomains hook: https://blog.checklyhq.com/setting-up-ssl-with-letsencrypt-for-saas-customers/
Thanks very much!
See https://git.rootprojects.org/root/greenlock-express.js#user-content-easy-to-customize
Specifically https://git.rootprojects.org/root/greenlock-manager-test.js
You need to create a file that exposes a
get
andset
function with the desired behavior for connecting to a database, etc.If all you do is run this:
Then you get a minimal set of callbacks that pass the tests (as well as a test file
node manager.test.js
). Modify them as desired to work with your database.If you don't want to get that fancy, then just use the default file plugin.
Anonymous domain registration is no longer supported because it leads to security vulnerabilities.
Hi,
Thanks for your response.
Using the default file plugin, is it possible to use the JS API to add domains into greenlock.d at the time of request?
E.g. Request comes in -> Application JS determines whether domain is a valid customer -> if valid, add to greenlock.d using JS API and thus issue cert?
Or would a custom manager be required for this behaviour?
Thanks.
It would be nice to have Anonymous domain registration because in my use case I am just redirecting the root domains to www. It's a pain to put thousands of domains into a json file for this use case.
@jlaird + @whiskeywizard: just create a manager file and replace the dummy
get
function with one that checks to see if the domain is allowed. The 2 or 3 callbacks you define for the manager are what fulfill the API.https://git.rootprojects.org/root/greenlock-manager-test.js
Is this answer still valid? I am trying to write a custom manager that approves domains based on what we have in our database but greenlock-express on startup calls the
find
method and expects and exhaustive list.get
doesn't seem to be used at all. Iffind
doesn't return anything on startup no new certs can be issued:Is the way forward to have
find
return a set of all existing certs + valid domains without a cert? Or is there some config I am missing?.greenlockrc
looks like thisThe manager is the default implementation taken from https://git.rootprojects.org/root/greenlock-manager-test.js
with
get
returning a hard coded list of sites as described herehttps://git.rootprojects.org/root/greenlock.js/src/branch/master/MIGRATION_GUIDE.md#user-content-customer-manager-the-lazy-way
I'm also having a really hard time figuring out the migration path from using approveDomains in v2 to the latest v4 version.
The most useful part of approveDomains was that you could dynamically check if a domain was valid and allow greenlock to handle the rest of the provisioning.
It looks like if you want to dynamically check domains in v4, at a minimum, you also have to also implement storing the renewAt and deletedAt values as well as returning all possible domains through find(). Is that correct?
Hi,
Been a while since I last attempted to get this working, and running into the same issue described by @valzam above.
@solderjs Any advice would be appreciated.|
Thanks.
@whiskeywizard I spent a while trying to solve this without success.
It doesn't look like manager.get is used at all. If you start with https://git.rootprojects.org/root/greenlock-manager.js/src/branch/master/manager.js and implement the manager.find() method, you can sort of replicate what approveDomains did.
However, it turns out there's another issue. The Greenlock core appears to cache rejected lookups for an hour. I couldn't find a way to override this. This becomes a real issue in this use-case because if you have someone trying to map across a domain. If they (or a spider) tries to access the domain after the CNAME, but before adding it to your system, then the domain will not load for at least another hour.
It doesn't look like mapping custom domains using a callback is a supported use-case for Greenlock at the moment.
I ended up switching over to Caddy which does support this and it can be enabled with a much more simple config file. For reference here's my Caddyfile which does the same thing you'd looking for;