Question - SSL and jails

Shrdlu

Dabbler
Joined
Mar 23, 2019
Messages
20
Hello all,

I am about to set up DuckDNS and an SSL with LetsEncrypt for my NextCloud install. I am using this guide.

Now i understand that the DuckDNS is done as a cron job within freenas it self. But why is the SSL done within the jail? Could it be done by freenas to provide SSL for all connections, or does each jail need a seperate SSL?

If each jail needs its own SSL is this because each jail has its own IP on my network?

Thanks
 

Kcaj

Contributor
Joined
Jan 2, 2020
Messages
100
Im a tad confused with your questions

Can you just read this and then reask any questions...

Edit:
  • Are you just trying to encrypt between public internet (browser) and nextcloud?
  • Can you just use a self signed cert?
  • Normally you issue certificates to a hostname, though an IP can be used but it would be a public IP not your private IP (no point using dDNS then)

Now i understand that the DuckDNS is done as a cron job within freenas it self.
You could also run a cron in a jail or anywhere on your private network which has the same public IP as your jail...
 
Last edited:

KevDog

Patron
Joined
Nov 26, 2016
Messages
462
Arg,

Not enough explanation -- but in general Nextcloud is usually run behind a reverse proxy such as nginx or apache (or any other reverse proxy). The reverse proxy usually handles the certificate management. I'm assuming you'll want to open the reverse proxy for a public connection, so if this is the case an SSL cert is needed for the reverse proxy.
 

Shrdlu

Dabbler
Joined
Mar 23, 2019
Messages
20
Thanks for the replies, and sorry for being confusing. I guess im just trying to understand how DDNS and SSL work in freenas/jails compared to a synology setup.

I have FreeNas running with Plex but would like to add nextcloud. The server will be used for sharing/access/syncing files around my home network but also while away from home with my laptop and phone. Plex already has its own DDNS and SSL built in. Therefore i need to create these for NextCloud and any future apps I might add. So...

Method
a) Set up DuckDNS - Done as a cron job in freenas using this guide
b) Set up LetsEncrypt - Done within the NextCloud jail using this guide

Questions
1) Now this means that all connections to to my DuckDNS (NextCloud or any other jail/app) will have SSL? Or does each jail need set up for SSL?
2) What is the benifit of running the SSL in FreeNas using this guide?
 

KevDog

Patron
Joined
Nov 26, 2016
Messages
462
@Shrdlu

When you speak of SSL being built in -- I don't know what that means. Why I say that is because for your domain you need proper SSL certs issued by a CA. A very popular SSL certificate agency used here in the forums and elsewhere is Lets Encrypt since they will allow you to obtain proper SSL certs for your domain for free.

You can use DuckDNS however I'll bet that its possible you can use the dynamic updater client built into FreeNAS or your router if you prefer another option.

As a side note and take this only as a recommendation -- I'm assuming you have your only personal domain name rather than a free domain as offered by no-ip.com or another service. I use Cloudflare as my domain name resolver (DNS resolver). Cloudflare is free and in addition it integrates really well with acme and Let's Encrypt in the process of obtaining and renewing your SSL certs. It's an option however it's very flexible

In terms of setting up Nextcloud -- don't use the plugin jail. I'm aware @danb35 has a script in these forums how to setup nextcloud and many users have setup Nextcloud in this manner with success. In setting up my Nextcloud jail I used the instructions from this website: https://www.samueldowling.com/2018/...n-freenas-iocage-jail-with-hardened-security/
I thought the installation steps were well explained and I learned a lot about setting up things. This guide unfortunately uses aws53 for its DNS resolver however the steps are similar for cloudflare -- you might have to google those. In addition @danb35 has another script that allows for acme to be run as a cron job to automate cert renewals. One of the downsides of using Let's Encrypt is although the certs are free, they need to be renewed every 3 months. It's probably best to automate this process unless you are really good at remembering things in a timely manner (two qualities I lack).

Each jail doesn't specifically need its own SSL cert -- you could set it up this way however that's two locations with certs that you'll need to remember to update. Another alternative is to set up one reverse proxy where all the certs are managed and then the reverse proxy would handle the SSL authentication and then proxy or forward the connection to the appropriate virtual host on the back end. The proxy could forward to your Plex setup and also forward to your Nextcloud setup. The certificates for your Plex and Nextcloud could be both installed and kept on the jail running your reverse proxy. Additional jails could then be setup to run plex and nextcloud.

There are unfortunately many ways to skin the cat. It just depends what you want to do. I can't say one setup is necessarily better or worse than another -- it's just a setup you think is easy to maintain and utilize. I like the jail-reverse proxy setup since all you need to do is open 80 or just 443 on your router to expose (if you need external access) so its just one entry point you need to manage. It's possible however to do it other ways. Here's another read for you about reverse proxies in case this concept is new to you:
 

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504
One of the downsides of using Let's Encrypt is although the certs are free, they need to be renewed every 3 months. It's probably best to automate this process
(bold added by me). This is how Let's Encrypt is intended to operate. If you don't have, and can't figure out, a way to automate the renewal process (including deploying the renewed certs), you should seriously consider using a different CA.

Edit: And if a reverse proxy is being considered, look here as well:
 
Last edited:

Kcaj

Contributor
Joined
Jan 2, 2020
Messages
100
The server will be used for sharing/access/syncing files around my home network but also while away from home with my laptop and phone.

Slightly off topic, but have you considered setting up a VPN to allow for remote access to your home network instead?

If you dont need "trusted" SSL certificates (for example if you are not trying to offer a public service) then consider just using self signed certificate.
 

KevDog

Patron
Joined
Nov 26, 2016
Messages
462
@Shrdlu

I guess Plex solved them -- however its really just kind of a hack.
 
Top