jails Jail for each "service" in residential scenario?

For my residential situation I have been using Proxmox with various FreeBSD and Linux VMs which has been running totally fine but I just don't like the Proxmox layer and potential security issues that it may present now or in the near future. It has way too much going on and I only use a tiny fraction of it's features therefore I think my exposure is unnecessarily high. I would like to essentially take each service that each VM is running and run them each in their own individual jail with FreeBSD on the bare metal.

Services for my home (none of which will be publically accessible but will be accessible via VPN while I travel):
  • www/nextcloud (for phone photos backup)
  • net/samba425 file sharing (for the scanner and general sharing of files across LAN)
  • archivers/py-borgbackup and net/rsync (using ssh) (for incremental backups)
  • security/vaultwarden (for Bitwarden password server)
  • I do run Home Assistant on a raspberry pi but I don't think I'll be able to get this working turnkey with FreeBSD (atleast long term) unless someone says otherwise.
  • Eventually I would like to share DVD/blu-ray movies across the LAN to TVs and iPads. Not sure what port would satisfy this for serving video content.
  • Any other services that you frequently see in a residential scenario?
Should I do each of these in their own jails so that I can silo the network activities and processes? Pros and cons with the added complexity?
 
I don't like too many extra installs (jails, VMs). Too much to update all the time. Too easy for one to slip updates without me noticing.
 
  • Like
Reactions: dkh
I'm on the other end of the spectrum... I run each core service in its own jail (a few VMs sprinkled in, too). No risk of painful or confusing interaction between multiple services in a single jail... they just chug along faithfully running their lone service per jail. FreeBSD isn't Arch Linux. Update frequency is not troublingly excessive, imo. I've never had a more stable environment than I do now (knock on wood).
 
I don't like too many extra installs (jails, VMs). Too much to update all the time. Too easy for one to slip updates without me noticing.
So you are in the single instance of FreeBSD and load it up with any service needed without using jails, VM, etc?

I’ve thought about going that route too because I don’t have a ton of services and more importantly none of them are mission critical. However, I like the concept of siloing services even if the overhead is a bit more.
 
I run a mix of jails and virtual machines. If a port exists for freebsd, it goes in a jail. 19 of these currently. I also have about five virtual machines for services like frigate, jellyfin, handbrake and immich with ml-container where an nVidia GPU is passed through for cuda etc. Others where podman is the only real option. And Internet facing services get their own VM on separate vlan.
 
I used to have a single node to host all the services. Then migrated every service into a thick jail (full userland + jail service based on FreeBSD-set-minimal-jail) but with manual setup/configuration.

In the end, I migrated everything to Ansible as it started to take time to manage the cluster. Ansible rebuilds the cluster in minutes (as opposed to manual setup in O(h)). When 15.2 is released, I just rebuild the cluster and start fresh.
 
FWIW, Home Assistant also runs in a python virtual env (venv), even if Home assistant don't recommend it. Disclaimer: I don't run my Home Assistant on FreeBSD, so I don't know if everything will work out of the box.
 
Conveinence vs exposure.

If all of these services are truly staying on your internal network, I think it becomes effort to manage.
If you have a single system that is hosting all the jails/vms providing the services, is there a real difference to running them all on the host? Overall load on the host will likely be about the same, but the management of each service may be easier if jailed/vms.

I really don't know the answer for any individual situation. Just tossing in my 2 cents which will be worth 1.037 cents by the time you read this.
 
Conveinence vs exposure.

If all of these services are truly staying on your internal network, I think it becomes effort to manage.
If you have a single system that is hosting all the jails/vms providing the services, is there a real difference to running them all on the host? Overall load on the host will likely be about the same, but the management of each service may be easier if jailed/vms.

I really don't know the answer for any individual situation. Just tossing in my 2 cents which will be worth 1.037 cents by the time you read this.
I think that is an OK solution for many. It becomes more complicated if the services interface via different VLANs. I use Frigate as my NVR, and my IP cameras are on a separate VLAN without internet connection. IOT devices with a need for internet goes on a separate VLAN and so on. I like to keep the services I have that interface with all these separate from my main LAN, and I have the server itself (the host) on a separate management VLAN along with switches and router. All this is relatively easy with bridges, VMs and VNET jails, but it does require some logic in how you manage everything.
 
pkg -j jailname upgrade lets you update packages in a jail from the host, and thin jails (shared base via nullfs or ZFS clones) mean the base system only has to be patched once. It doesn't remove the overhead, but it's a lot less than with VMs.
 
pkg -j jailname upgrade lets you update packages in a jail from the host, and thin jails (shared base via nullfs or ZFS clones) mean the base system only has to be patched once. It doesn't remove the overhead, but it's a lot less than with VMs.
Even though many FreeBSD tools support -j jid flag (e.g. pkg(8), ifconfig(8), etc.) I prefer to run these from inside of the jail: one place, one shell history - very helpful to review what and how happened in the past.
 
Even though many FreeBSD tools support -j jid flag (e.g. pkg(8), ifconfig(8), etc.) I prefer to run these from inside of the jail: one place, one shell history - very helpful to review what and how happened in the past.
Would a good idea be to have an updater user that you su into when doing any jail maintenance so that all updates/maintenance shell history for all jails is conveniently in one user whose sole purpose is updating/maintaining jails, VMs, etc?
 
I used to have a single node to host all the services. Then migrated every service into a thick jail (full userland + jail service based on FreeBSD-set-minimal-jail) but with manual setup/configuration.

In the end, I migrated everything to Ansible as it started to take time to manage the cluster. Ansible rebuilds the cluster in minutes (as opposed to manual setup in O(h)). When 15.2 is released, I just rebuild the cluster and start fresh.
Do you have any good places to research or write ups on how to use Ansible as you described? I'm very interested in doing the same thing as my situations about the same as yours.
 
This looks absolutely awesome. I’ll take it for a spin on a machine I have laying around the lab. It seems like a FreeBSD version of Proxmox which is very much preferred. My main concern is that it is so new that I suspect it is vibe coded and/or won’t keep up with changes in the future. Any input on your own usage, how long, any affiliation with the project, etc?
 
I run all my services in separate jails. Not just Nextcloud in a jail, but each component Nextcloud depends on runs in it's own jail (web server, database, redis, php-fpm, etc. all in separate jails). That way, even if the web server is compromised (nginx2root for example), the damage is limited to just it's jail, where I have disabled root access and made the entire file system read-only, and nosuid. This sounds like a massive pain to setup and maintain, however I make it simple by using simple scripts and config files to manage the services, and they all share the host OS (thin jail) so I only need to update the host OS to update all the jails (unless I have jail-specific software, which I need to update separately). The setup and scripts are documented here if you are curious:

https://fossil.tobykurien.com/bws
 
Do you have any good places to research or write ups on how to use Ansible as you described? I'm very interested in doing the same thing as my situations about the same as yours.
  • Ansible docs
  • Search engine
  • GitHub search
I found myself in the same boat around May: too much of manual Ops. It was lovely to type commands but started to take too much time and 15.1 was around the corner.

It took me a while to get used to Ansible since I don't have prior experience in DevOps space and cluster automation.

So, I started fresh back in June. I went through Ansible docs just to begin, started to write tasks (i.e. the instructions Ansible follows), then started to group these into roles, roles into playbooks, master playbooks, wrote a few plugins and modules in Python, added local collection, etc.

It's lots of fun: build, break, build again. Iterate over the process with golden combo: boot environments + Ansible.

IMHO, the effort was totally worth it. It's one of the things that change life for good.
 
Back
Top