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:

115 questions
41
votes
1 answer

I am going to chop the FreeBSD automounter into little pieces and boil them in oil

I am trying to expose a hierarchy of home directories to a number of FreeBSD jails. The home directories are configured such that each is a unique ZFS dataset. The jails are used for development work and hence are created and destroyed on a…
larsks
  • 41,276
  • 13
  • 117
  • 170
31
votes
1 answer

Fail2ban jail.local vs jail.conf

Does jail.local file act as an override to jail.conf or as a replacement to jail.conf? When I was learning about Fail2Ban from tutorials, most of them usually say either to copy jail.conf to jail.local and make the edits there and some of them says…
Neel
  • 1,421
  • 7
  • 21
  • 35
28
votes
1 answer

SFTP: file symlinks in a jailed (chrooted) directory

I'm trying to set up sftp so that a few trusted people can access/edit/create some files. I have jailed a user into their home directory (/home/name) but have run into a problem. I want for them to also be able to access other parts of the VPS…
dukevin
  • 1,610
  • 3
  • 18
  • 25
22
votes
1 answer

FreeBSD Jails or Docker instances

What are the main differences between jails on FreeBSD and Docker on Linux? Is one considerably more secure or more performant than the other? Jails are way older than Docker instances so the code itself could be considered more secure. But Jails…
Simba
  • 335
  • 1
  • 2
  • 12
19
votes
5 answers

OpenSSH anything like 'internal-sftp' but for SCP?

I'm running Debian stable and I'm looking to establish the following environment for users in my 'sftponly' group: jailed can transfer with SFTP can transfer with SCP cannot login interactively with SSH From my experimentation and research, it…
brianjcohen
  • 291
  • 1
  • 2
  • 3
14
votes
1 answer

How can I start a shell inside a jail on FreeBSD?

I have access to a a previously set up FreeBSD box with a number of jails on it. One of the jails is an SQL server, and does not have ssh enabled on it. How can I gain access to a shell on that jail from the host machine? (I have root rights on it.)
Redconnection
  • 297
  • 1
  • 3
  • 6
11
votes
2 answers

How can I determine what permissions my user is missing for receiving a ZFS dataset?

I have a FreeNAS (11.1-U1) and a FreeBSD (11.1-RELEASE-p6) machine. On the FreeNAS I'd like to zfs receive recursive snapshots as a non-root user with delegated privileges. This appears to work well for most of the child-datasets. But iocage's data…
sloh
  • 161
  • 8
10
votes
1 answer

SSH_ORIGINAL_COMMAND variable not getting set

I am working with two servers, both of which run FreeBSD 8.4-RELEASE-p1 and OpenSSH_6.1p1. Both servers' ssh_config files, located in /etc/ssh, are identical. Both servers are configured to allow users to remote into a jailed environment using…
dtg
  • 201
  • 2
  • 3
9
votes
3 answers

use LXC under heavier virtualization (Xen, KVM,Hyper-V,VMVare)

Is it possible to use LXC under heavier virtualization (Xen DomU, KVM, Hyper-V, VMVare) ? I would like to use it as security (isolation) tool, the ability to limit resource consumption is not priority for me. I am only interested if it can be done…
Stepan
  • 2,089
  • 3
  • 15
  • 8
6
votes
2 answers

Migrate FreeBSD Jails to Linux

we are running some jails in FreeBSD 10 and the decision has been made to decommission the FreeBSD server and migrate all the jails to Linux environment Red Hat 6 or 7. Is there a straight forward way of migrating BSD jails to linux -- as containers…
sandeep.s85
  • 2,059
  • 1
  • 18
  • 26
6
votes
1 answer

FreeBSD Jail with Loopback IP, IPFW, and natd - Outbound connections fail from jail

I've got a FreeBSD 9.0 server. It has several jails, but they all have this same issue. They can not initiate connections to the outside world. They communicate with each other and the host fine. relevant rc.conf settings: firewall_enable="YES" …
Chris S
  • 77,337
  • 11
  • 120
  • 212
6
votes
3 answers

Is there a tool for managing FreeBSD jails that knows about ZFS?

ZFS under FreeBSD lets one assign filesystems to a jail, such that an account in the jail with the appropriate privileges can access the filesystem, create new subordinate filesystems, and so forth. At least with 8-STABLE, these features are not…
larsks
  • 41,276
  • 13
  • 117
  • 170
5
votes
0 answers

FreeBSD networking setup for multiple jails - interface clones or aliases

While setting up multiple jails on a FreeBSD machine, I also (naturally) need to set up the networking for each jail. It seems to me there are two ways of achieving the same goal setting up multiple cloned interfaces or setting up multiple aliases…
dakini
  • 325
  • 3
  • 13
5
votes
2 answers

How to Create Jailed Users?

My servers run CentOS: Nginx + PHP-FPM (PHP via Fast-CGI). Every site is on its own VirtualHost. Currently both Nginx and PHP-FPM run under root. I know this is bad practice, and there is no reason for any of the sites to have access to files…
Miko
  • 1,709
  • 4
  • 22
  • 28
4
votes
0 answers

How to mount a fuse-sshfs file system inside a FreeBSD-12.0p10 jail

I wish to mount a remote data source locally as a fuse file system. This is listed as supported by lsvfs: lsvfs Filesystem Num Refs Flags -------------------------------- ---------- ----- --------------- devfs …
James B. Byrne
  • 317
  • 4
  • 14
1
2 3 4 5 6 7 8