Failed authorization procedure. DOMAIN.com (http-01): urn:acme:error:unauthorized :: The client lacks sufficient authorization :: Invalid response from http://DOMAIN.com/.well-known/acme-challenge/pnZ6e6CK4x7IL5r_bIUGfnd36Zp4Yo4W1IlpqdN_Vpo [xx.xx.xx.xx]: 404
IMPORTANT NOTES:
- The following errors were reported by the server:
Domain: DOMAIN.com
Type: unauthorized
Detail: Invalid response from http://DOMAIN.com/.well-known/acme-
challenge/pnZ6e6CK4x7IL5r_bIUGfnd36Zp4Yo4W1IlpqdN_Vpo
[xx.xx.xx.xx]: 404
To fix these errors, please make sure that your domain name was
entered correctly and the DNS A record(s) for that domain
contain(s) the right IP address.
If you create a file (such as “test”) in /home/USERNAME/public_html/.well-known/acme-challenge/test with plain text content ( “worked” ) … can you then reach it from elsewhere on the internet at DOMAIN/.well-known/acme-challenge/test ?
Are you certain inotify is working as expected? (Happy to test with a working client setup if you want to share how you’re doing it.)
I did some debugging of the webroot plugin source. This is the part that’s saving the challenge files:
def _perform_single(self, achall):
response, validation = achall.response_and_validation()
root_path = self.full_roots[achall.domain]
validation_path = self._get_validation_path(root_path, achall)
logger.debug("Attempting to save validation to %s", validation_path)
# Change permissions to be world-readable, owner-writable (GH #1795)
old_umask = os.umask(0o022)
try:
with open(validation_path, "w") as validation_file:
validation_file.write(validation.encode())
finally:
os.umask(old_umask)
self.performed[root_path].add(achall)
return response
That log line (Attempting to save validation to ...) is included in your log as well. There’s no code path that wouldn’t lead to the file being written, and if there’s an error while storing the file, you’d see an exception (like OSError: [Errno 2] No such file or directory: ..., or whatever the error is).
So the files are being created, but they’re empty?
Have you checked your system logs for anything interesting? I suppose something like SELinux/AppArmor could be interfering, though I’m not sure why this wouldn’t at least trigger an exception.
I’ve checked again now and found out that files are written with a content then removed again in a second, as @tialaramex stated above.
Message is 404 not found, which is happening because the files are created with root UID and GID, but the website is working as a user, so I guess this is the issue, but how to fix it?
Caught race condition abuser. attacker: 560, victim: 0 open file owner: 0, open file: /home/USERNAME/public_html/.well-known/acme-challenge/SihjQnu4sOO-bTXEaasRAsQUsWngUMtsvZJyc-BPSXY
Because the files are created with root and the handler is SuPHP so files created have to be made with user permissions not root permissions, any ideas?