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 .\" ----------------------------------------------------------------------------
15 .Nm jail , jail_attach
16 .Nd imprison current process and future descendants
23 .Fn jail "struct jail *jail"
25 .Fn jail_attach "int jid"
29 system call sets up a jail and locks the current process in it.
31 The argument is a pointer to a structure describing the prison:
32 .Bd -literal -offset indent
46 defines the version of the API in use.
48 is defined for the current version.
52 pointer should be set to the directory which is to be the root of the
57 pointer can be set to the hostname of the prison.
59 from the inside of the prison.
63 pointer is an optional name that can be assigned to the jail
64 for example for managment purposes.
70 give the numbers of IPv4 and IPv6 addresses that will be passed
71 via their respective pointers.
77 pointers can be set to an arrays of IPv4 and IPv6 addresses to be assigned to
78 the prison, or NULL if none.
79 IPv4 addresses must be in network byte order.
83 system call attaches the current process to an existing jail,
89 returns a non-negative integer, termed the jail identifier (JID).
90 It returns \-1 on failure, and sets
92 to indicate the error.
96 Once a process has been put in a prison, it and its descendants cannot escape
99 Inside the prison, the concept of
103 it can be assumed that nothing can be mangled from inside a prison which
104 does not exist entirely inside that prison.
105 For instance the directory
108 can be manipulated all the ways a root can normally do it, including
110 but new device special nodes cannot be created because they reference
111 shared resources (the device drivers in the kernel).
114 for a process is the greater of the global
116 or, if present, the per-jail
119 All IP activity will be forced to happen to/from the IP number specified,
120 which should be an alias on one of the network interfaces.
121 All connections to/from the loopback address
125 for IPv6) will be changed to be to/from the primary address
126 of the jail for the given address family.
128 It is possible to identify a process as jailed by examining
129 .Dq Li /proc/<pid>/status :
130 it will show a field near the end of the line, either as
131 a single hyphen for a process at large, or the hostname currently
132 set for the prison for jailed processes.
140 The version number of the argument is not correct.
147 internally, so it can fail for all the same reasons.
150 manual page for details.
157 system call appeared in
161 system call appeared in
164 The jail feature was written by
165 .An Poul-Henning Kamp
167 .Dq Li http://www.rndassociates.com/
168 who contributed it to