Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

certbot cannot verify domain and connection refused

I am trying to generate certificate for my domain. I can ping my domain but still getting error. I have added inbound firewall rule to my digital ocean server to accept port 80 on ipv4 and ipv6 as well. Not sure what is wrong. [Note: my nginx server is not running as I cannot get the certificate]

https://community.letsencrypt.org/t/invalid-response-404-nginx-docker-container/102525

My domain is: www.1040nra.com

I ran this command: sudo certbot certonly --staging --webroot -w /root/dt-app-data/ -d 1040nra.com -d www.1040nra.com

It produced this output:

Obtaining a new certificate
Performing the following challenges:
http-01 challenge for 1040nra.com
http-01 challenge for www.1040nra.com
Using the webroot path /root/dt-app-data for all unmatched domains.
Waiting for verification…
Cleaning up challenges
Failed authorization procedure. 1040nra.com (http-01): urn:ietf:params:acme:error:connection :: The server could not connect to the client to verify the domain :: Fetching http://1040nra.com/.well-known/acme-challenge/22AD-KFmF62z373CPiUKzk6dlr-0s5wMOmnmrziMqd4: Connection refused, www.1040nra.com (http-01): urn:ietf:params:acme:error:connection :: The server could not connect to the client to verify the domain :: Fetching http://www.1040nra.com/.well-known/acme-challenge/ba-jjDhBUZJ9fHLofGfDYSVV5a-ETlX26A64A-2Yu0s: Connection refused

IMPORTANT NOTES:

The following errors were reported by the server:

Domain: 1040nra.com
Type: connection
Detail: Fetching
http://1040nra.com/.well-known/acme-challenge/22AD-KFmF62z373CPiUKzk6dlr-0s5wMOmnmrziMqd4:
Connection refused

Domain: www.1040nra.com
Type: connection
Detail: Fetching
http://www.1040nra.com/.well-known/acme-challenge/ba-jjDhBUZJ9fHLofGfDYSVV5a-ETlX26A64A-2Yu0s:
Connection refused

To fix these errors, please make sure that your domain name was
entered correctly and the DNS A/AAAA record(s) for that domain
contain(s) the right IP address. Additionally, please check that
your computer has a publicly routable IP address and that no
firewalls are preventing the server from communicating with the
client. If you’re using the webroot plugin, you should also verify
that you are serving files from the webroot path you provided.
My web server is (include version):

The operating system my web server runs on is (include version): ubuntu 18.04

like image 580
ksernow Avatar asked Sep 21 '19 22:09

ksernow


2 Answers

You seem to have solved the problem yourself.

This is because the certbot domain cannot verify the DNS A record.

Make sure your domain address is directed to your server's ip address.

If you made the dns change 'recently', it may take some time to delete the old ip address.

https://www.whatsmydns.net/

Check here, there should only be one IP address and this should be your server's IP address.

like image 113
Anılhan Hasceviz Avatar answered Sep 22 '22 13:09

Anılhan Hasceviz


Make sure 80 & 443 port allow after running below command

sudo ufw status

If 443 is not allow then run below command for allowing 443 port:

sudo ufw allow https
like image 33
Shìpu Ahamed Avatar answered Sep 21 '22 13:09

Shìpu Ahamed