this post was submitted on 21 Jan 2025
44 points (97.8% liked)

Selfhosted

41633 readers
529 users here now

A place to share alternatives to popular online services that can be self-hosted without giving up privacy or locking you into a service you don't control.

Rules:

  1. Be civil: we're here to support and learn from one another. Insults won't be tolerated. Flame wars are frowned upon.

  2. No spam posting.

  3. Posts have to be centered around self-hosting. There are other communities for discussing hardware or home computing. If it's not obvious why your post topic revolves around selfhosting, please include details to make it clear.

  4. Don't duplicate the full text of your blog or github here. Just post the link for folks to click.

  5. Submission headline should match the article title (don’t cherry-pick information from the title to fit your agenda).

  6. No trolling.

Resources:

Any issues on the community? Report it using the report flag.

Questions? DM the mods!

founded 2 years ago
MODERATORS
 

EDIT: Thanks everyone for your time and responses. To break as little as possible attempting to fix this I've opted to go with ZeroSSL's DNS process to acquire a new cert. I wish I could use this process for all of my certs as it was very quick and easy. Now I just have to figure out the error message lemmy is throwing about not being able to run scripts.

Thank you all for your time sincerely. I understand a lot more than I did last night.


Original Post

As the title says I'm unable to renew a cert on a self-hosted lemmy instance. A friend of mine just passed away and he had his hands all up in this and had it working like magic. I'm not an idiot and have done a ton of the legwork to get our server running and working - but lemmy specifically required a bit of fadanglin' to get working correctly. Unfortunately he's not here to ask for help, so I'm turning to you guys. I haven't had a problem with any of my other software such as nextcloud or pixelfed but for some reason lemmy just refuses to cooperate. I'm using acme.sh to renew the cert because that's what my buddy was using when he had set this all up. I'm running apache2 on a bare metal ubuntu server.

Here's my httpd-ssl.conf:

https://pastebin.com/YehfTPNV

Here's some recent output from my acme.sh/acme.log:

https://pastebin.com/PESVVNg4

Here's the terminal read out and what I'm attempting to execute:

https://pastebin.com/jfHfiaE0

If you can make any suggestions at all on what I might be missing or what may be configured incorrectly I'd greatly appreciate a nudge in the right direction as I'm ripping my hair out.

Thank you kindly for your time.

top 38 comments
sorted by: hot top controversial new old
[–] running_ragged 12 points 1 week ago (1 children)

Not sure if this is anything or not.

You pasted the httpd-ssl.conf file.

The script output is referencing httpd.conf

I think it’s sending the challenge request via port 80 and that might be where you’re looking in the wrong place.

[–] sol6_vi 2 points 1 week ago

Thanks I'm gonna check this out first thing. I thought that was weird but I'm not sure what in httpd.conf could be interfering with the process. I will give the file a better read through and see what I can come up with - it's a good starting point.

[–] [email protected] 7 points 1 week ago (2 children)

Hi, just a guess. But

The retryafter=86400 value is too large (> 600), will not retry anymore.

Seems to me like the call to your server in the verification step is failing.

Do you have port 80 blocked or stopping the call in another way ?

[–] sol6_vi 2 points 1 week ago (1 children)

The only thing I can think of that might be interfering is HSTS? I'm not sure how acme is accessed when a browser can only access a site with ssl. Perhaps HSTS is interfering with the cert process somehow?

[–] [email protected] 2 points 1 week ago (1 children)

The process makes file to read via http (not https), it’s just a nonce ( some random characters). Once their server reads that file, using the domain (and not the ip) and compares with what is expected, this shows you own the domain , and they give you a new ssl cert, modifying your server’s https configuration file (usually). And deletes the file it made .

[–] sol6_vi 1 points 1 week ago

Thanks for the breakdown.

[–] [email protected] 2 points 1 week ago

Would concur, that was the only thing I could find.

[–] [email protected] 5 points 1 week ago (1 children)

You've just reminded me to fix cert renewal on my instance. I'm using let's encrypt & their certbot with nginx and it is great.

Recently my nginx config got too complex, so nginx plugin stopped working correctly, because it wasn't able to inject the config for ACME challenge correctly anymore. The solution was to manually configure location /.well-known/acme-challange to read from a local directory and configure certbot to use a local webroot directory instead of fiddling with nginx config.

[–] sol6_vi 1 points 1 week ago

This is out of my skillset but I'm sure there's documentation online I can check out to give it a shot. We use this server for our (very) small business so I'm trying not to jack anything up worse than it is but it seems like something I could potentially tackle. Thank you.

[–] [email protected] 5 points 1 week ago (2 children)

I'm really surprised noone mentioned Caddy which handles all the SSL business for you. Not to mention an easier config :)

[–] [email protected] 3 points 1 week ago* (last edited 1 week ago) (1 children)

Caddy is awesome! I originally went for nginx proxy manager to manage my certs as it has a GUI. However, despite being text based, Caddy is so even easier to configure...

        email [email protected]
}

jellyfin.mydomain.net {
        reverse_proxy 192.168.0.1:8096
}```


That's all there is to it. Caddy does the heavy lifting.
[–] [email protected] 3 points 1 week ago

I don't think you even need to configure the email.

If I recall correctly emails are optional for Let's Encrypt but Caddy are partnered with ZeroSSL who do require emails so you're encouraged to provide one.

[–] sol6_vi 2 points 1 week ago (1 children)

How hard would it be to switch in your experience... I'd love something this simple. Nervous to tear stuff down though.

[–] [email protected] 2 points 1 week ago* (last edited 1 week ago) (1 children)

I dont think its hard :)

Can you post your apache config?

Ive been so long on Caddy i havent touched Apache or nginx for ages. But i'm pretty sure i or someone else can help you convert your config :)

[–] sol6_vi 2 points 1 week ago (1 children)

I appreciate the offer. If I get stuck I'll dump it. If it's as straight forward as everyone says I should be able to pull it off it looks so easy. Don't want to make others do my work for me unduly.

[–] [email protected] 2 points 1 week ago* (last edited 1 week ago) (2 children)

Oh my god.. i completely overlooked the config in your original message!!

Un any case, look at this: https://join-lemmy.org/docs/administration/caddy.html

Someone done the work, and they would be glad if you made use of it :)

And if you start with: lemmy.domain.tld:81 {

You can even have it run on a different port, so you can test it without risking your apache config.

[–] sol6_vi 2 points 1 week ago

This is brilliant thank you. This is going to save me dozens of hours.

[–] sol6_vi 2 points 1 week ago (1 children)

Only thing I'm having trouble with so far is handling a line like this > <FilesMatch \.php$> # Apache 2.4.10+ can proxy to unix socket SetHandler "proxy:unix:///run/php74-fpm.sock|fcgi://localhost/" </FilesMatch> Not really sure how caddy handles this.

[–] [email protected] 2 points 1 week ago (1 children)

Look here: https://caddyserver.com/docs/caddyfile/directives/php_fastcgi

I'm not near a computer right now, but tomorrow i can show an example of my nextcloud setup. Its also php with Caddy :)

[–] sol6_vi 2 points 1 week ago (1 children)

thank you for taking the time to share, I actually moved over to nginx.... all over the place >_> a few people have made it pretty clear I'm going to overwhelm caddy quickly with the number of different domains and sites we host so I'm starting over with nginx now.

[–] [email protected] 2 points 1 week ago (1 children)

I have 11 sites and numerous sub sites behind a single Caddy server. I dont know how you would "overwelm" Caddy?

Never the less, good luck :)

[–] sol6_vi 2 points 1 week ago

I'm at the whim of the community lol I don't have a lot of my own experiences to rely on - just trying to make educated guesses. I have a few sites I'd like to host at home and I'll definitely be using caddy for that going forward it was super easy.

[–] sol6_vi 3 points 1 week ago

Just popping in this morning to thank everyone for their suggestions overnight. I have some stuff to look at now when I get to the office this morning. Can't respond to every comment at the moment but I will. Just wanted to say thanks.

[–] iopq 2 points 1 week ago (1 children)

You can just try zeroSSL. Either add a DNS record they give you or host the file they give you, it's much simpler

[–] sol6_vi 1 points 1 week ago

This sounds like a good backup plan and I'll probably definitely have to resort to trying it - thank you for the suggestion.

[–] [email protected] 2 points 1 week ago (1 children)

Are you using cloudflare to proxy the server? If so, just download a 10-year certificate and don’t worry about renewing short term ones.

[–] sol6_vi 1 points 1 week ago (1 children)

Unfortunately no, though that sounds very nice.

[–] [email protected] 3 points 1 week ago (1 children)

Ah, you should perhaps look into using Cloudflare or a similar service. Not for the certificate, but because if somebody took a dislike to your instance, they could easily DDoS you off the internet. The decade long certificate is just icing on the top.

[–] sol6_vi 1 points 1 week ago

Certainly will look into it thanks for the heads up!

[–] [email protected] 1 points 1 week ago (1 children)

Are you using cloud flare?

[–] sol6_vi 1 points 1 week ago
[–] just_another_person 0 points 1 week ago (1 children)

What's in the acme.log file in the last line there?

[–] sol6_vi 1 points 1 week ago (1 children)

Are you referring to the 'does not contain DNS'? Or the 'apache,/' because both are a bit confusing to me honestly

[–] just_another_person 1 points 1 week ago

'cat /root/.acme.sh/acme.log'

[–] [email protected] -2 points 1 week ago (1 children)

Why use Apache over Nginx?

[–] sol6_vi 10 points 1 week ago (1 children)

My friend chose it, he was old school. I don't personally have a preference between the two but we use this server for our small business so I haven't really wanted to risk messing everything up to switch when it's (mostly) currently functional.

[–] roofuskit 1 points 1 week ago (1 children)

Woah, you have a Lemmy instance hosted on the server for your small business? That just doesn't sit well with me. I hope the server going down would not halt your income.

[–] sol6_vi 2 points 1 week ago

We are a community oriented business and I really hate the big tech companies controlling the fate of my company. Lemmy seemed like one of a few easy alternative platforms where we were free from being stuck under the thumb of a tech giant or a ban away from loosing our members.