Closed MemoryLeak55 closed 2 years ago
This is a great feature. We need it too.
If the request comes in over SSL, then the only way to respond to it (without causing the browser to show a certificate error) is using a cert that matches the request host. If the server's response uses a cert that doesn't match, then the browser will show a certificate error.
Is there any way to run a script so that we can get alerted via another channel like Telegram or Slack?
Yes, you'd just place your notification code in the if not has_cert then
block in your sample code above. You can do whatever you want there on the server side — you just won't be able to successfully respond to the client's https request without a valid cert.
Thanks. In the query above the OP says the call failed. Any idea why that would the case?
I don't know the internals well enough to know why that would fail, but you could put your notification functionality in the allow_domain
function just before you return false
. e.g.:
auto_ssl:set("allow_domain", function(domain, auto_ssl, ssl_options, renewal)
local domain_not_allowed = ...
if domain_not_allowed
notify_us_on_slack(domain)
return false
end
end
ok, thanks
You can use lua redis package (reuse one provided with resty-auto-ssl) or other db provider, and check there, i've done similar things, it's not a lot of work, but seem to have lost the config i used 2-3 years ago
Hi,
I've got a setup where we are doing some custom whitelabling of our service via detection of hostname. I've already setup the allow_domain function to query a database to determine if I want to issue a cert of the hostname of the incoming request, and it works wonderfully.
Now, I'd like to add some functionality if possible. I would like for a way to "catch" when auto ssl isn't being used. This would be in the circumstance where there is no stored cert in the storage adapter, and that we won't issue a lets encrypt cert because it's not in the whitelist (so allow_domain has returned false)
In this circumstance, instead of defaulting back to certs defined by
ssl_certificate
andssl_certificate_key
in openresty and continuing with processing, I would like to return a static page that says, "domain not authorized" and stop any further processing.I hope this makes sense, any help is appreciated! I've been looking through docs but I've not seen a clear way to implement such a functionality.
EDIT: I think has_certificate might do exactly what I need. I'm not sure how I missed that
EDIT2:
I've tried the following implementation in a
server
blockAnd get the following error in my errror.log
Any idea why the call to has_certificate is failing?