this post was submitted on 04 Oct 2023
39 points (88.2% liked)

Selfhosted

39435 readers
1 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
 

Hey everyone,

Just a quick question, let's encrypt, what is it and how can I take advantage of its services?

For a bit of background I'm trying to setup KanIDM and the need for a ca certificate is needed, I was told to use let's encrypt to create it.

Just looking for knowledge.

Thanks!

top 22 comments
sorted by: hot top controversial new old
[–] [email protected] 22 points 1 year ago* (last edited 1 year ago)

When you go to just about any web site, your browser sets up an encrypted connection between you and the server so that anything you do on the web site can't be observed by sniffing the traffic.

Let's Encrypt is a suite of software developed by the Electronic Frontier Foundation to bring this security to anyone with a website (or anyone with a webservice, really). What Let's Encrypt provides you is a fully trusted certificate chain. As a result of making the certificate free for anyone (and I mean anyone) can use, the certificate is only valid for 90 days.

You can purchase a trusted certificate that lasts longer but renewal is so easy that unless you need a higher "reputation" cert, it's not worth it. Fun fact: cia.gov uses LE certificates!

Not sure what KanIDM is but they are probably having you use an LE certificate to create a secure connection between clients and servers. It's free and pretty easy to set up.

Optionally, if you're technically savvy, you can set up your own Certificate Authority and distribute it on your own. This gives you full control over your certificate linage but my guess is you won't get the benefits of it.

[–] [email protected] 14 points 1 year ago (4 children)

Use Caddy as a web server and forget about setting up certificates forever. This masterpiece will take care of it.

[–] [email protected] 5 points 1 year ago

I had been using Nginx and LetsEncrypt for years and while it worked well most of the time, sometimes it was a bit of a pain, especially due to the verbosity of the Nginx config file. I was using both of them in docker containers and that requires you to have 3 specific environmental variables set for each container.

I tried using Traefik, and while concise, it was still a bit confusing.

I finally decided to give Caddy a try a few months back after hearing about it for years. I'm disappointed that I didn't try it sooner because it's so freaking simple to use. I rewrote my entire docker-compose file to use it because it's that simple. I love how it takes literally 3 lines to create a SSL secured reverse proxy.

[–] [email protected] 4 points 1 year ago (1 children)

Kanidm wants to directly have access to the letsencrypt cert. It refuses to even serve over HTTP, or put any traffic over it since that could allow potentially bad configurations. It has a really stringent policy surrounding how opinionated it is about security.

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

Do they know about reverse proxies?

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

Yeah. There's reasoning for why they do it on their docs, but the reasoning iirc is kanidm is a security critical resource, and it aims to not even allow any kind of insecure configuration. Even on the local network. All traffic to and from kanidm should be encrypted with TLS. I think they let you use self signed certs though?

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

Thanks for mentioning Caddy. 'Will consider that for my next project.

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

You're welcome :) If you have any questions, feel free to contact me.

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

Love caddy. Took a little bit for me to understand but it’s an amazing tool. I barely use a fraction of its capabilities.

[–] [email protected] 4 points 1 year ago

I had been using Nginx for years until I finally switched to Caddy a few months ago, I'm disappointed in myself that I didn't check it out sooner lol. Caddy is to Nginx like what Nginx is to Apache.

I have like 15 reverse proxies setup and it takes the same amount of code that about 4 or 5 would take in Nginx.

[–] [email protected] 3 points 1 year ago

Thanks for the feedback on Caddy. 'Will consider that for my next project.

[–] [email protected] 10 points 1 year ago

Puts the S in HTTPS. Free. Get an ACME client for your service. https://acmeclients.com

[–] [email protected] 9 points 1 year ago* (last edited 1 year ago)

Acronyms, initialisms, abbreviations, contractions, and other phrases which expand to something larger, that I've seen in this thread:

Fewer Letters More Letters
DNS Domain Name Service/System
HTTP Hypertext Transfer Protocol, the Web
HTTPS HTTP over SSL
IP Internet Protocol
SSL Secure Sockets Layer, for transparent encryption
TLS Transport Layer Security, supersedes SSL
nginx Popular HTTP server

[Thread #185 for this sub, first seen 4th Oct 2023, 16:45] [FAQ] [Full list] [Contact] [Source code]

[–] [email protected] 5 points 1 year ago

A reverse proxy like nginx can automatically implement it for you. Probably the easiest way of generating and using your own SSL with let's encrypt is a reverse proxy.

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

Its a internet service/company that wants to make HTTPS available for everyone. Because of security reasons. You can create an Lets Encrypt Account, Register your servers DNS in any DNS service out there and then link your server to your Lets Encrypt Account. Then you can get SSL cert for your DNS Record/your server. I think it is valid for 90 days. You can renew the cert when there are 30 days left i think. So its free SSL for your webserver connection. This is a realy basic explanation but i think to understand what it does its enough ;) Hope this helps - If not, feel free to ask more :)

Edit: your webserver must be accessible from the www

[–] [email protected] 3 points 1 year ago

If you own a domain name, you can point that domain name at your IP, and Let’s Encrypt’s cryptbot program can help you get a free TLS certificate to host all your stuff over https.

With certain setups it can be renewed automatically, otherwise the certificate lasts 90 days, and renewal only takes a few minutes.

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

I'm going to cast another vote for a reverse proxy, such as NginxProxyManager. It's really easy to set everything up, and they're usually very easy to run in Docker/Podman.

One thing to note: if you end up with a domain with mandatory HSTS, you'll have to use DNS-based certificate generation rather than HTTP based, since unencrypted HTTP is blocked (chicken/egg problem to get HTTPS working). It's not hard, but you have to be aware of that limitation.

[–] [email protected] 4 points 1 year ago (1 children)

As someone that used Nginx for close to decade, Caddy is about 10x simpler with the same features. It takes a bit to wrap your head around if you're used to coming from an "old-school" webserver and proxy like Apache or Nginx though. One of the greatest things about Caddy is that it does SSL by default, so there's no need to have stanzas in each section saying "listen on 80 and 443, but if you get a connection on 80 redirect it to 443" and another one saying "enable SSL for this (sub)domain". Creating a reverse proxy in Caddy literally takes three lines and consists of FQDN { reverse_proxy internal-endpoint-name:portNumber }

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

I'm actually almost completely unfamiliar with Nginx, short of a few hours of tinkering. NginxProxyManager is a direct competitor to Caddy, with a graphical interface, SSL cert creation and auto-renew, etc. I'm not going to say to switch from Caddy, since there's probably no major benefit, but it's much nicer than trying to figure out Nginx reverse proxies by hand.

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

I don't know KanIDM specifically so take this with a grain of salt.

Let's Encrypt only provides server certificates. The kind used to secure a connection (HTTPS, IMAPS, etc). KanIDM might require a Certificate Authority (CA) certificate to issue Client Certificates (used for authentication like MIME-S, WPA Enterprise, etc). Let's Encrypt cannot be used for this purpose.

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

Kanidm doesn't require a CA, it just requires a cert for serving https (and it enforces https - it refuses to even serve over HTTP). I think that was just the OP not quite understanding the conceptual ideas at play.

[–] [email protected] 1 points 1 year ago

I've been using it for a few years (on a mail server and some websites) and am really happy. It's worth looking into.