Letsencrypt says connection refused?

Richard G

Verified User
Joined
Jul 6, 2008
Messages
12,554
Location
Maastricht
I'm trying to create a ssl certificate for my hostname like state in.

But this is the result every time:
Code:
Challenge status: invalid. Challenge error: "type": "http-01",  "status": "invalid",  "error": {    "type": "urn:ietf:params:acme:error:connection",    "detail": "Fetching http://vps.someserver.nl/.well-known/acme-challenge/6iSIHA9NvESt3QRkqLfCyuQQxJoqIm7F1Nc3yjrhkFc: Connection refused",    "status": 400  . Exiting...

Previously it was complaining about a missing A record. So I created an A record for the hostname.
When visiting http://vps.someserver.nl it's showing "apache is functioning normally" but indeed a /.well-known/acme-chellenge/6xxxx etc. can not be found.

It's not a firewall issue, no firewall installed yet, iptables is all open.

I don't know what's going wrong I always did it this way and never had issues before.
 
I went a bit further and tried debugging like mentioned here:
https://help.directadmin.com/item.php?id=646

But it seems that it is working when using someserver.nl but not when using vps.someserver.nl so it works on domain name, but not on hostname.

So I tried the curl option mentioned on that page and that looks fine.
Code:
/usr/local/bin/curl -I -L -k -X GET http://vps.someserver.nl/.well-known/acme-challenge/test.txt
HTTP/1.1 200 OK
Date: Sat, 27 Jul 2019 21:16:29 GMT
Server: Apache/2
Last-Modified: Sat, 27 Jul 2019 21:12:05 GMT
ETag: "5-58eb01c67866e"
Accept-Ranges: bytes
Content-Length: 5
Vary: User-Agent
Content-Type: text/plain

But I want to create a certificate for my hostname, which is vps.someserver.nl and it's not working.
 
Found the cause.

The provider is changing /etc/hostname every time.

So I set a kernel hostname, so the hostname is correct, but /etc/hostname is showing a wrong hostname every time.
I'll look in to how to fix this.

Edit: Fixed it by changing hostname @reboot in cron.
 
Last edited:
You might need to change the hostname on the server dashboard, it is usually a name of a VPS which you set on a page where you pay for your VPS (stop/restart) etc.
 
Thank you Alex, but that was not possible. Strato does not allow to change the hostname so there is also no option for it on the dashboard.
My way to fix things was the only way to do it unfortunately.
 
I already used chattr +i /etc/sysconfig/network beacuse that file was overwritten every time too.

Indeed I could also have used chattr for the resolve.conf file. Maybe I'm going to change that also.
 
Yep, I already checked that, but only /etc/hostname and /etc/sysconfig/network got overwritten. So only 2 files needed protection.
It's just odd that one can not change the hostname via the hoster's dashboard.

I was mistaken in my previous message and ment /etc/hostname because resolv.conf does not get overwritten. You can disable this in the dashboard that it will be overwritten.
 
Back
Top