FreeBSD jail
The jail mechanism is an implementation of
History
The need for the FreeBSD jails came from a small shared-environment hosting provider's (R&D Associates, Inc.'s owner, Derrick T. Woolworth) desire to establish a clean, clear-cut separation between their own services and those of their customers, mainly for security and ease of administration (jail(8)). Instead of adding a new layer of fine-grained configuration options, the solution adopted by Poul-Henning Kamp was to compartmentalize the system – both its files and its resources – in such a way that only the right people are given access to the right compartments.[4]
Jails were first introduced in FreeBSD version 4.0, that was released on March 14, 2000[5] Most of the original functionality is supported on DragonFly, and several of the new features have been ported as well.
.Goals
This section needs additional citations for verification. (January 2011) |
FreeBSD jails mainly aim at three goals:
- Virtualization: Each jail is a virtual environment running on the host machine with its own files, processes, user and superuser accounts. From within a jailed process, the environment is almost indistinguishable from a real system.
- Security: Each jail is sealed from the others, thus providing an additional level of security.
- Ease of delegation: The limited scope of a jail allows system administrators to delegate several tasks which require superuser access without handing out complete control over the system.
Unlike
security.jail.allow_raw_sockets
sysctlThe jail(8) utility and jail(2)
Virtualization
With jail it is possible to create environments, each having its own set of utilities installed and its own configuration. Jails permit software packages to view the system egoistically, as if each package had the machine to itself. Jails can also have their own, independent, jailed superusers.[6]
The FreeBSD jail does not however achieve true virtualization; it does not allow the virtual machines to run different kernel versions than that of the base system. All jails share the same kernel. There is no support for clustering or process migration.
Security
FreeBSD jails are an effective way to increase the security of a server because of the separation between the jailed environment and the rest of the system (the other jails and the base system).
FreeBSD jails are limited in the following ways:[6]
- Jailed processes cannot interact with processes in a different jail, or on the main host. For example, the ps command will only show the processes running in the jail.
- Modifying the running kernel by direct access and loading modules is prohibited. Modifying most sysctls and the securelevel is prohibited.
- Modifying the network configuration, including interfaces, interface or IP addresses, and the routing table, is prohibited. Accessing divert and routing sockets are also prohibited. Additionally, raw sockets are disabled by default. A jail is bound only to specific IP addresses and firewall rules cannot be changed. With the introduction of VNET(virtual network stack), the jails are free to modify their Network Configuration (including interfaces, IP addresses, etc.), provided the vnet is enabled for the jail.
- Mounting and unmounting filesystems is prohibited. Jails cannot access files above their root directory (i.e. a jail is chroot'ed).
- Jailed processes cannot create device nodes.
See also
- Comparison of platform virtualization software
- Operating system-level virtualization
- chroot
- bhyve
- vkernel
- vnet
- Hypervisor
References
- Prentice Hall Professional. Retrieved 2019-03-06.
- ^ "jail(2) — create and manage system jails". FreeBSD, DragonFly BSD.
- "jail, jail_get, jail_set, jail_remove, jail_attach -- create and manage system jails". FreeBSD Manual Pages.
- "jail -- imprison current process and future descendants". DragonFly On-Line Manual Pages.
- ^ "jail(8) — manage system jails". FreeBSD, DragonFly BSD.
- "jail -- manage system jails". FreeBSD Manual Pages.
- "jail - imprison process and its descendants". DragonFly On-Line Manual Pages.
- ^ Kamp, Poul-Henning; N. M. Watson, Robert (2000). "Jails: Confining the omnipotent root" (PDF). PHKs Bikeshed. Retrieved 15 June 2016.
- ^ "FreeBSD 4.0 Announcement". FreeBSD Project. 14 March 2000. Retrieved 3 October 2019.
- ^ a b "Chapter 16. Jails". FreeBSD Documentation Portal. Retrieved 13 December 2022.
Further reading
- Lucas, Michael W. (2019). FreeBSD Mastery: Jails. Tilted Windmill Press. ISBN 978-1-64235-023-4.