2 .\"----------------------------------------------------------------------------
3 .\""THE BEER-WARE LICENSE" (Revision 42):
4 .\"<phk@FreeBSD.ORG> wrote this file. As long as you retain this notice you
5 .\"can do whatever you want with this stuff. If we meet some day, and you think
6 .\"this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
7 .\"----------------------------------------------------------------------------
9 .\"$FreeBSD: src/lib/libc/sys/jail.2,v 1.10.2.10 2002/12/12 05:26:38 trhodes Exp $
10 .\"$DragonFly: src/lib/libc/sys/jail.2,v 1.11 2007/11/21 19:12:40 swildner Exp $
17 .Nd imprison current process and future descendants
24 .Fn jail "struct jail *jail"
28 system call sets up a jail and locks the current process in it.
30 The argument is a pointer to a structure describing the prison:
31 .Bd -literal -offset indent
37 struct sockaddr_storage *ips;
42 defines the version of the API in use. It should be set to 1 at this time.
46 pointer should be set to the directory which is to be the root of the
51 pointer can be set to the hostname of the prison. This can be changed
52 from the inside of the prison.
55 is the number of IP addresses that are on ips.
59 pointer contains the IP addresses assigned to the jail.
61 Once a process has been put in a prison, it and its descendants cannot escape
63 A process can be attached to a prison by calling
66 Inside the prison, the concept of "superuser" is very diluted. In general,
67 it can be assumed that nothing can be mangled from inside a prison which
68 does not exist entirely inside that prison. For instance the directory
71 can be manipulated all the ways a root can normally do it, including
73 but new device special nodes cannot be created because they reference
74 shared resources (the device drivers in the kernel).
76 All IP activity will be forced to happen to/from the IP numbers specified,
77 which should be an alias on one or more of the network interfaces.
79 It is possible to identify a process as jailed by examining
80 .Dq Li /proc/<pid>/status :
81 it will show a field near the end of the line, either as
82 a single hyphen for a process at large, or the hostname currently
83 set for the prison for jailed processes.
87 ca be used to identify all active jails.
91 returns a non-negative integer, termed the jail identifier (JID).
92 It returns -1 on failure, and sets
94 to indicate the error.
98 system call will fail if:
101 The version number of the argument is not correct.
108 internally, so it can fail for all the same reasons.
111 manual page for details.
122 function call appeared in
125 The jail feature was written by
126 .An Poul-Henning Kamp
128 .Dq Pa http://www.rndassociates.com/
129 who contributed it to