Questions tagged [jail]

Jails improve on the concept of the traditional chroot environment in several ways. In a traditional chroot environment, processes are only limited in the part of the file system they can access.

One of the tools which can be used to enhance the security of a FreeBSD system is jails.

Jails have been available since FreeBSD 4.X and continue to be enhanced in their usefulness, performance, reliability, and security.

Jails build upon the chroot(2) concept, which is used to change the root directory of a set of processes, creating a safe environment, separate from the rest of the system. Processes created in the chrooted environment can not access files or resources outside of it. For that reason, compromising a service running in a chrooted environment should not allow the attacker to compromise the entire system.

However, a chroot has several limitations. It is suited to easy tasks which do not require much flexibility or complex, advanced features. Over time many ways have been found to escape from a chrooted environment, making it a less than ideal solution for securing services.

Jails improve on the concept of the traditional chroot environment in several ways. In a traditional chroot environment, processes are only limited in the part of the file system they can access. The rest of the system resources, system users, running processes, and the networking subsystem are shared by the chrooted processes and the processes of the host system.

Jails expand this model by virtualizing access to the file system, the set of users, and the networking subsystem. More fine-grained controls are available for tuning the access of a jailed environment. Jails can be considered as a type of operating system-level virtualization.

A jail is characterized by four elements:

A directory subtree: the starting point from which a jail is entered. Once inside the jail, a process is not permitted to escape outside of this subtree.

A hostname: which will be used by the jail.

An IP address: which is assigned to the jail. The IP address of a jail is often an alias address for an existing network interface.

A command: the path name of an executable to run inside the jail. The path is relative to the root directory of the jail environment.

Jails have their own set of users and their own root account which are limited to the jail environment.

The root account of a jail is not allowed to perform operations to the system outside of the associated jail environment.

More:

114 questions
3
votes
2 answers

Pubkey SSH fails with "we did not send a packet, disable method" in freebsd jail

I have a FreeBSD VPS with 2 jails, each setup with ezjail (I know now that this is largely deprecated, but didn't at the time). $ jls JID IP Address Hostname Path 1 172.16.1.1 wwwserver …
bronzehedwick
  • 81
  • 1
  • 1
  • 6
3
votes
1 answer

FreeBSD jail routing issue

I have the following setup with FreeBSD jails and VNET which is supposed to grow into a DNS core net lab setup. The jailhost and the jails are running FreeBSD 12.1. The jails are connected by epair interfaces. The BRAS jail which is supposed to act…
2
votes
2 answers

A simple, step-by-step way of setting up of "jailed" SFTP-only accounts

I feel like I've gone through every SFTP/Chroot tutorial on the Internet, and not found what I am looking for (or, at least, none of them have produced the right results). Here's my specifics: I will be creating a lot of individual user accounts…
nucleon
  • 233
  • 2
  • 9
2
votes
1 answer

Apache virtual hosts in jail enviroment

I have a linux server with a chroot user jail environment. Users files are kept under /jail/username/httpdocs and are currently resolvable under http://IPADDRESS/~username I need users to be able to setup their own virtualhost config rather than…
Lurch
  • 121
  • 3
2
votes
1 answer

Is ssh chroot enough to allow shell access?

I'm planning to offer a backup service with limited ssh access. The best solution i've thought of so far would be to use chroot and allow access only to certain commands like: cd,mkdir,mv,rm,rsync,sftp etc, and mount the home directories as…
VelDev
  • 57
  • 1
  • 8
2
votes
1 answer

FreeBSD jail as gateway

I am trying to set up a jail that will serve as a default gateway for some of my external clients. I have a VIMAGE jail that has a dedicated IP address in my local network which I want to use as a gateway for my clients. The reason that I am doing…
Alexey Raga
  • 121
  • 2
2
votes
1 answer

Recommended way to run CentOS 7 on a host FreeBSD: VM or jailed environment?

I need to deploy either a CentOS VM or a jailed instance on a FreeBSD server (10.3). The solutions devised: - run it through VirtualBox (headless) - use bhyve I thought about a third alternative: using a jailed environment and running CentOS 7 on…
TechShaman
  • 23
  • 5
2
votes
2 answers

gethostbyname failure and network timeouts in jail

I have a FreeBSD DigitalOcean droplet in which I followed this guide exactly for setting up a jail. The problem is I cannot get reliable network connectivity inside the jail. Doing curl https://www.google.com/ I get a ~1 minute delay when trying to…
Lander
  • 151
  • 6
2
votes
2 answers

FreeBSD & Jails: Send mail through Postfix in Jail

I have FreeBSD 10.2 and I'm using several Jails, one of them has Postfix installed. I want my other jails and my host system to use the local Postfix installation in the Jail. They should use sendmail to submit their mails to the Postfix Jail. What…
basbebe
  • 313
  • 2
  • 16
2
votes
1 answer

What is the best method of installing programs into a chroot / jail?

On a Debian based system... I have created a minimal chroot/jail using a script similar to the one at https://github.com/pmenhart/make_chroot_jail/blob/master/make_chroot_jail.sh with the goal of creating a jail that can basically do nothing other…
Phil
  • 157
  • 2
  • 7
2
votes
1 answer

Nginx: Tags in Syslog output on wrong position

I'm trying to output the logs of several Nginx servers in FreeBSD jails to the jails' host. I'm using FreeBSD 10 syslog and Nginx 1.7.10. In Nginx (in this case the hostname is web) I have set: access_log syslog:server=127.0.0.1:514…
basbebe
  • 313
  • 2
  • 16
2
votes
0 answers

Jail PHP to OpenBasedir or Document Root Debian

I have a VServer running with Debian Squeeze Debian Squeeze / Apache2 / FastCGI / MySQL / Froxlor. The administration of Customers, Domains and FTP Accounts are performed using Froxlor. Following problem: If I install an application like Roundcube…
Rubberducker
  • 121
  • 3
2
votes
1 answer

Adding a command to all existing Jailkit jails

I am running Jailkit on my server and need to add Mercurial (command hg) to all existing and future Jailkit jails. From what I understand, creating a new jail with jk_init and a profile that includes hg will only make it available in new jails. How…
Paul Peelen
  • 289
  • 2
  • 16
2
votes
2 answers

FreeBSD jails access

I want to run an application inside jail so that allowed users can only connect to the jailed environment (application) and nothing else on my box. But they need to be able to connect to the jail over the network and I have only 1 public ip which is…
hari
  • 270
  • 1
  • 4
  • 17
2
votes
1 answer

MySQL performance on FreeBSD after moving db files from /var

I was running out of space on /var so I moved my db dir to /usr and noticed a significate decrease in performance. In addition I noticed that performance is much slower as well under any Jailed systems, I'm assuming because they are also on /usr.…