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
2
votes
1 answer

FreeBSD Jail Authentication and Commands

I have setup a jail on FreeBSD-8.2 following the manual. After the setup, I copied these files rc.conf, /etc/passwd from base to jail. And this is what I did in order: jexec id passwd (to change the jail root password) jexec id adduser (i added a…
jmc
  • 69
  • 2
2
votes
1 answer

SFTP jail & Keeping file ownership the same / File owner per folder

I want to setup a jailed SFTP account for a subfolder of another user's home folder, but want the owner of everything in that subfolder to stay the same, including new files and folders uploaded and created by the sftp user, while still allowing…
Dragonshadow
  • 23
  • 1
  • 4
2
votes
1 answer

sftp jail user. error in winscp

I have a configuration where specific users can log-in only in sftp and not ssh. Also the users are jailed in specific directories. Lets say the user name is stefanos and his rooted directory is /vhosts/wild.domain.com/ The directory is mounted with…
2
votes
1 answer

Debian: ip/network changes within chroot/jail

I've Debian Squeeze running and setup a chroot environment (/jail) with debootstrap. As seen in a tutorial, I mounted the following: proc on /jail/proc type proc (rw) devpts on /jail/dev/pts type devpts (rw) Within the jail, i've running an…
casper
  • 519
  • 2
  • 6
  • 12
2
votes
1 answer

Security implications of mount --bind in a chroot environment

Assume you have a chroot environment where you need a resource - an application or a library - which resides on the host (external to the chroot). Which are the security implications (if any) of performing a mount --bind (from the host to the…
Roberto Aloi
  • 575
  • 2
  • 5
  • 14
2
votes
1 answer

Jail user to only read/write into their user directory

I'm running a Ubuntu server and wanted to know if there was a way to only allow a user (connecting via FTP and SSH) read and write access to their own /home/user/ directory and not let them read or write to anything else? Thanks for your help! :)
user58059
2
votes
1 answer

Use netns to bind programs to specific IP addresses

I have an IP address on my server, say, 192.168.0.3, I want to share in a net namespace, so to run apps there which will only be able to communicate to the internet using that 192.168.0.3. I can "kind" of get it working with the macvlan device…
Avenger
  • 21
  • 2
1
vote
1 answer

Within FreeBSD jail – setting global environment vars

I need to set a systemwide environment variable (i.e. NODE_ENV=production) in a FreeBSD jail. I did try setting it in /etc/profile, but when I sourced it root@www:/ # source /etc/profile I got export: Command not found. It works on the host…
LongHike
  • 157
  • 1
  • 6
1
vote
0 answers

BSD jail availability in the event of NFS server failure

I have some BSD systems where I am considering the use of jails for processes that should be isolated from the rest of the system. The host system has some NFS mounts, and there is the issue that in the event of an NFS server failure, a NFS client…
camelccc
  • 255
  • 1
  • 15
1
vote
1 answer

ezjail: "partially completed upgrade"

I just updated FreeBSD to 10.2 and after trying to update my jails through ezjail I get the following : ezjail-admin update -u Looking up update.FreeBSD.org mirrors... 5 mirrors found. Fetching metadata signature for 10.2-RELEASE from…
basbebe
  • 313
  • 2
  • 16
1
vote
1 answer

What are the correct Linux permissions inside chroot jail with userspec

I am trying to setup a chroot jail, then I did: which binary ldd /bin/binary Then I did: cp /lib64/{libs} $jail/lib64 cp /usr/lib64/{libs} $jail/usr/lib64 PS: During this setup, I discovered that /lib64 needs special permissions r-x, only r--…
Weber K.
  • 131
  • 8
1
vote
2 answers

Shutting down host from within jail

I've created a jail with ssh using Finch-Freebsd on a NAS4FREE and added a local non super user to access the jail via ssh. I want to be able to grant this user limited shell access specifically to shut down the jail and in turn commence a shutdown…
Kendall
  • 247
  • 2
  • 4
  • 13
1
vote
2 answers

Fail2ban MTA=Postfix Setting in Jail Config giving Error

In /etc/fail2ban/jail.local, when I have the MTA setting to Postfix, Fail2Ban is showing an error and is unable to start. [DEFAULT] ignoreip = 127.0.0.1/8 bantime = 1800 maxretry = 4 destemail =…
Neel
  • 1,441
  • 7
  • 21
  • 35
1
vote
1 answer

FreeBSD jail and patch-levels

I am a newbie server manager and trying jails. It's too hard to configure it. So I decided to use ezjail utility. It seems working, but I got an issue. When I installed my FreeBSD box, it was 9.0-RELEASE. After I upgrade it, it became…
Eonil
  • 10,459
  • 16
  • 36
  • 54
1
vote
1 answer

How to configure jailed apache to be accessible on the network

I have jailed apache on freebsd on a private network with ip address 192.168.100.174, I have another apache server running on the host but it is configured to listen on its other IP addresses but this. Now what more do I need do to make the jailed…
jgtumusiime
  • 213
  • 2
  • 4
  • 11