1 .\" Copyright (c) 2000, 2003 Robert N. M. Watson
2 .\" Copyright (c) 2008-2012 James Gritton
3 .\" All rights reserved.
5 .\" Redistribution and use in source and binary forms, with or without
6 .\" modification, are permitted provided that the following conditions
8 .\" 1. Redistributions of source code must retain the above copyright
9 .\" notice, this list of conditions and the following disclaimer.
10 .\" 2. Redistributions in binary form must reproduce the above copyright
11 .\" notice, this list of conditions and the following disclaimer in the
12 .\" documentation and/or other materials provided with the distribution.
14 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 .Nd "manage system jails"
41 .Ar param Ns = Ns Ar value ...
42 .Op Cm command Ns = Ns Ar command ...
53 .Op Cm * | Ar jail ...
60 .Op Fl s Ar securelevel
61 .Op Ar path hostname [ Ar ip Ns [ Ns Ar ,... Ns ]] Ar command ...
65 utility creates new jails, or modifies or removes existing jails.
66 A jail is specified via parameters on the command line, or in the
70 At least one of the options
76 These options are used alone or in combination describe the operation to
78 .Bl -tag -width indent
85 parameters (if specified) on the command line,
87 must not refer to an existing jail.
89 Modify an existing jail.
94 parameters must exist and refer to an existing jail.
95 Some parameters may not be changed on a running jail.
99 specified by jid or name.
100 All jailed processes are killed, and all children of this jail are also
103 Restart an existing jail.
104 The jail is first removed and then re-created, as if
108 were run in succession.
110 Create a jail if it does not exist, or modify the jail if it does exist.
112 Modify an existing jail.
113 The jail may be restarted if necessary to modify parameters than could
114 not otherwise be changed.
116 Create a jail if it doesn't exist, or modify (and possibly restart) the
117 jail if it does exist.
120 Other available options are:
121 .Bl -tag -width indent
123 Allow making changes to a dying jail, equivalent to the
126 .It Fl f Ar conf_file
127 Use configuration file
129 instead of the default
136 and add all IP addresses returned by the resolver
137 to the list of addresses for this prison.
138 This is equivalent to the
142 Output (only) the jail identifier of the newly created jail(s).
149 file, containing parameters used to start the jail.
151 Run commands in a clean environment.
152 This is deprecated and is equivalent to the exec.clean parameter.
155 This is deprecated and is equivalent to the
159 Limit the number of commands from
161 that can run simultaneously.
163 Suppress the message printed whenever a jail is created, modified or removed.
164 Only error messages will be printed.
168 option that removes an existing jail without using the configuration file.
169 No removal-related parameters for this jail will be used - the jail will
171 .It Fl s Ar securelevel
174 MIB entry to the specified value inside the newly created jail.
175 This is deprecated and is equivalent to the
179 The user name from host environment as whom jailed commands should run.
180 This is deprecated and is equivalent to the
183 .Va exec.system_jail_user
186 The user name from jailed environment as whom jailed commands should run.
187 This is deprecated and is equivalent to the
191 Print a message on every operation, such as running commands and
192 mounting filesystems.
195 If no arguments are given after the options, the operation (except
196 remove) will be performed on all jails specified in the
199 A single argument of a jail name will operate only on the specified jail.
204 options can also remove running jails that aren't in the
206 file, specified by name or jid.
210 is a wildcard that will operate on all jails, regardless of whether
213 this is the surest way for
216 If hierarchical jails exist, a partial-matching wildcard definition may
218 For example, an argument of
220 would apply to jails with names like
225 A jail may be specified with parameters directly on the command line.
228 file will not be used.
229 For backward compatibility, the command line may also have four fixed
230 parameters, without names:
236 This mode will always create a new jail, and the
240 options don't apply (and must not exist).
244 file, or on the command line, are generally in
247 Some parameters are boolean, and do not have a value but are set by the
248 name alone with or without a
254 They can also be given the values
258 Other parameters may have more than one value, specified as a
259 comma-separated list or with
261 in the configuration file (see
267 utility recognizes two classes of parameters. There are the true jail
268 parameters that are passed to the kernel when the jail is created,
271 and can (usually) be changed with
273 Then there are pseudo-parameters that are only used by
277 Jails have a set a core parameters, and kernel modules can add their own
279 The current set of available parameters can be retrieved via
280 .Dq Nm sysctl Fl d Va security.jail.param .
281 Any parameters not set will be given default values, often based on the
283 The core parameters are:
284 .Bl -tag -width indent
287 This will be assigned automatically to a new jail (or can be explicitly
288 set), and can be used to identify the jail for later modification, or
295 This is an arbitrary string that identifies a jail (except it may not
300 it can be passed to later
308 is supplied, a default is assumed that is the same as the
312 parameter is implied by the
314 file format, and need not be explicitly set when using the configuration
317 The directory which is to be the root of the prison.
318 Any commands run inside the prison, either by
322 are run from this directory.
324 A list of IPv4 addresses assigned to the prison.
325 If this is set, the jail is restricted to using only these addresses.
326 Any attempts to use other addresses fail, and attempts to use wildcard
327 addresses silently use the jailed address instead.
328 For IPv4 the first address given will be kept used as the source address
329 in case source address selection on unbound sockets cannot find a better
331 It is only possible to start multiple jails with the same IP address,
332 if none of the jails has more than this single overlapping IP address
335 A boolean option to change the formerly mentioned behaviour and disable
336 IPv4 source address selection for the prison in favour of the primary
337 IPv4 address of the jail.
338 Source address selection is enabled by default for all jails and the
340 setting of a parent jail is not inherited for any child jails.
342 Control the availability of IPv4 addresses.
345 to allow unrestricted access to all system addresses,
347 to restrict addresses via
351 to stop the jail from using IPv4 entirely.
354 parameter implies a value of
356 .It Va ip6.addr , Va ip6.saddrsel , Va ip6
357 A set of IPv6 options for the prison, the counterparts to
364 Create the prison with its own virtual network stack,
365 with its own network interfaces, addresses, routing table, etc.
366 The kernel must have been compiled with the
368 for this to be available.
371 to use the system network stack, possibly with restricted IP addresses,
374 to create a new network stack.
376 The hostname of the prison.
377 Other similar parameters are
378 .Va host.domainname ,
383 Set the origin of hostname and related information.
386 to use the system information and
388 for the jail to use the information from the above fields.
389 Setting any of the above fields implies a value of
392 The value of the jail's
395 A jail never has a lower securelevel than the default system, but by
396 setting this parameter it may have a higher one.
397 If the system securelevel is changed, any jail securelevels will be at
400 The number of the devfs ruleset that is enforced for mounting devfs in
402 A value of zero (default) means no ruleset is enforced.
403 Descendant jails inherit the parent jail's devfs ruleset enforcement.
404 Mounting devfs inside a jail is possible only if the
407 .Va allow.mount.devfs
408 permissions are effective and
410 is set to a value lower than 2.
411 Devfs rules and rulesets cannot be viewed or modified from inside a jail.
413 NOTE: It is important that only appropriate device nodes in devfs be
414 exposed to a jail; access to disk devices in the jail may permit processes
415 in the jail to bypass the jail sandboxing by modifying files outside of
419 for information on how to use devfs rules to limit access to entries
420 in the per-jail devfs.
421 A simple devfs ruleset for jails is available as ruleset #4 in
422 .Pa /etc/defaults/devfs.rules .
424 The number of child jails allowed to be created by this jail (or by
425 other jails under this jail).
426 This limit is zero by default, indicating the jail is not allowed to
429 .Sx "Hierarchical Jails"
430 section for more information.
432 The number of descendents of this jail, including its own child jails
433 and any jails created under them.
434 .It Va enforce_statfs
435 This determines which information processes in a jail are able to get
437 It affects the behaviour of the following syscalls:
443 (as well as similar compatibility syscalls).
444 When set to 0, all mount points are available without any restrictions.
445 When set to 1, only mount points below the jail's chroot directory are
447 In addition to that, the path to the jail's chroot directory is removed
448 from the front of their pathnames.
449 When set to 2 (default), above syscalls can operate only on a mount-point
450 where the jail's chroot directory is located.
452 Setting this boolean parameter allows a jail to exist without any
454 Normally, a command is run as part of jail creation, and then the jail
455 is destroyed as its last process exits.
456 A new jail must have either the
462 pseudo-parameter set.
464 The ID of the cpuset associated with this jail (read-only).
466 This is true if the jail is in the process of shutting down (read-only).
470 of the parent of this jail, or zero if this is a top-level jail
473 Some restrictions of the jail environment may be set on a per-jail
475 With the exception of
476 .Va allow.set_hostname ,
477 these boolean parameters are off by default.
478 .Bl -tag -width indent
479 .It Va allow.set_hostname
480 The jail's hostname may be changed via
485 A process within the jail has access to System V IPC primitives.
486 In the current jail implementation, System V primitives share a single
487 namespace across the host and jail environments, meaning that processes
488 within a jail would be able to communicate with (and potentially interfere
489 with) processes outside of the jail, and in other jails.
490 .It Va allow.raw_sockets
491 The prison root is allowed to create raw sockets.
492 Setting this parameter allows utilities like
496 to operate inside the prison.
497 If this is set, the source IP addresses are enforced to comply
498 with the IP address bound to the jail, regardless of whether or not
501 flag has been set on the socket.
502 Since raw sockets can be used to configure and interact with various
503 network subsystems, extra caution should be used where privileged access
504 to jails is given out to untrusted parties.
506 Normally, privileged users inside a jail are treated as unprivileged by
508 When this parameter is set, such users are treated as privileged, and
509 may manipulate system file flags subject to the usual constraints on
510 .Va kern.securelevel .
512 privileged users inside the jail will be able to mount and unmount file
513 system types marked as jail-friendly.
516 command can be used to find file system types available for mount from
518 This permission is effective only if
520 is set to a value lower than 2.
521 .It Va allow.mount.devfs
522 privileged users inside the jail will be able to mount and unmount the
524 This permission is effective only together with
528 is set to a value lower than 2.
529 Please consider restricting the devfs ruleset with the
532 .It Va allow.mount.nullfs
533 privileged users inside the jail will be able to mount and unmount the
535 This permission is effective only together with
539 is set to a value lower than 2.
540 .It Va allow.mount.procfs
541 privileged users inside the jail will be able to mount and unmount the
543 This permission is effective only together with
547 is set to a value lower than 2.
548 .It Va allow.mount.zfs
549 privileged users inside the jail will be able to mount and unmount the
551 This permission is effective only together with
555 is set to a value lower than 2.
558 for information on how to configure the ZFS filesystem to operate from
561 The prison root may administer quotas on the jail's filesystem(s).
562 This includes filesystems that the jail may share with other jails or
563 with non-jailed parts of the system.
564 .It Va allow.socket_af
565 Sockets within a jail are normally restricted to IPv4, IPv6, local
566 (UNIX), and route. This allows access to other protocol stacks that
567 have not had jail functionality added to them.
571 There are pseudo-parameters that aren't passed to the kernel, but are
574 to set up the prison environment, often by running specified commands
575 when jails are created or removed.
578 command parameters are
580 command lines that are run in either the system or prison environment.
581 They may be given multiple values, which run would the specified
582 commands in sequence.
583 All commands must succeed (return a zero exit status), or the jail will
584 not be created or removed.
586 The pseudo-parameters are:
587 .Bl -tag -width indent
589 Command(s) to run in the system environment before a prison is created.
591 Command(s) to run in the prison environment when a jail is created.
592 A typical command to run is
597 for use when specifying a prison directly on the command line.
598 Unlike other parameters whose value is a single string,
600 uses the remainder of the
602 command line as its own arguments.
603 .It Va exec.poststart
604 Command(s) to run in the system environment after a jail is created,
607 commands have completed.
609 Command(s) to run in the system environment before a jail is removed.
611 Command(s) to run in the prison environment before a jail is removed,
614 commands have completed.
615 A typical command to run is
616 .Dq sh /etc/rc.shutdown .
618 Command(s) to run in the system environment after a jail is removed.
620 Run commands in a clean environment.
621 The environment is discarded except for
622 .Ev HOME , SHELL , TERM
628 are set to the target login's default values.
630 is set to the target login.
632 is imported from the current environment.
633 The environment variables from the login class capability database for the
634 target login are also set.
635 .It Va exec.jail_user
636 The user to run commands as, when running in the prison environment.
637 The default is to run the commands as the current user.
638 .It Va exec.system_jail_user
639 This boolean option looks for the
643 file, instead of in the prison's file.
644 .It Va exec.system_user
645 The user to run commands as, when running in the system environment.
646 The default is to run the commands as the current user.
648 The maximum amount of time to wait for a command to complete.
649 If a command is still running after this many seconds have passed,
650 the jail not be created or removed.
651 .It Va exec.consolelog
652 A file to direct command output (stdout and stderr) to.
654 The FIB (routing table) to set when running commands inside the prison.
656 The maximum amount of time to wait for a prison's processes to exit
659 signal (which happens after the
661 commands have completed).
662 After this many seconds have passed, the prison will be removed, which
663 will kill any remaining processes.
664 If this is set to zero, no
666 is sent and the prison is immediately removed.
667 The default is 10 seconds.
669 A network interface to add the prison's IP addresses
674 An alias for each address will be added to the interface before the
675 prison is created, and will be removed from the interface after the
678 In addition to the IP addresses that are passed to the kernel, and
679 interface and/or a netmask may also be specified, in the form
680 .Dq Ar interface Ns | Ns Ar ip-address Ns / Ns Ar netmask .
681 If an interface is given before the IP address, an alias for the address
682 will be added to that interface, as it is with the
684 parameter. If a netmask in either dotted-quad or CIDR form is given
685 after IP address, it will be used when adding the IP alias.
687 In addition to the IP addresses that are passed to the kernel,
688 and interface and/or a prefix may also be specified, in the form
689 .Dq Ar interface Ns | Ns Ar ip-address Ns / Ns Ar prefix .
690 .It Va vnet.interface
691 A network interface to give to a vnet-enabled jail after is it created.
692 The interface will automatically be returned when the jail is removed.
696 parameter and add all IP addresses returned by the resolver
697 to the list of addresses
702 This may affect default address selection for outgoing IPv4 connections
704 The address first returned by the resolver for each address family
705 will be used as primary address.
707 A filesystem to mount before creating the jail (and to unmount after
708 removing it), given as a single
714 format file containing filesystems to mount before creating a jail.
718 filesystem on the chrooted /dev directory, and apply the ruleset in the
720 parameter (or a default of ruleset 4: devfsrules_jail)
721 to restrict the devices visible inside the prison.
723 Allow making changes to a
727 Specify a jail (or jails) that this jail depends on.
728 Any such jails must be fully created, up to the last
730 command, before any action will taken to create this jail.
731 When jails are removed the opposite is true:
732 this jail must be fully removed, up to the last
734 command, before the jail(s) it depends on are stopped.
737 Jails are typically set up using one of two philosophies: either to
738 constrain a specific application (possibly running with privilege), or
740 .Dq "virtual system image"
741 running a variety of daemons and services.
742 In both cases, a fairly complete file system install of
745 required, so as to provide the necessary command line tools, daemons,
746 libraries, application configuration files, etc.
747 However, for a virtual server configuration, a fair amount of
748 additional work is required so as to configure the
751 This manual page documents the configuration steps necessary to support
752 either of these steps, although the configuration steps may be
753 refined based on local requirements.
754 .Ss "Setting up a Jail Directory Tree"
755 To set up a jail directory tree containing an entire
757 distribution, the following
759 command script can be used:
764 make world DESTDIR=$D
765 make distribution DESTDIR=$D
768 In many cases this example would put far more in the jail than needed.
769 In the other extreme case a jail might contain only one file:
770 the executable to be run in the jail.
772 We recommend experimentation and caution that it is a lot easier to
775 jail and remove things until it stops working,
776 than it is to start with a
778 jail and add things until it works.
779 .Ss "Setting Up a Jail"
780 Do what was described in
781 .Sx "Setting Up a Jail Directory Tree"
782 to build the jail directory tree.
783 For the sake of this example, we will
784 assume you built it in
785 .Pa /data/jail/testjail ,
788 Substitute below as needed with your
789 own directory, IP address, and hostname.
790 .Ss "Setting up the Host Environment"
791 First, you will want to set up your real system's environment to be
793 For consistency, we will refer to the parent box as the
794 .Dq "host environment" ,
795 and to the jailed virtual machine as the
796 .Dq "jail environment" .
797 Since jail is implemented using IP aliases, one of the first things to do
798 is to disable IP services on the host system that listen on all local
799 IP addresses for a service.
800 If a network service is present in the host environment that binds all
801 available IP addresses rather than specific IP addresses, it may service
802 requests sent to jail IP addresses if the jail did not bind the port.
805 to only listen on the
806 appropriate IP address, and so forth.
809 in the host environment:
810 .Bd -literal -offset indent
812 inetd_flags="-wW -a 192.0.2.23"
817 is the native IP address for the host system, in this example.
818 Daemons that run out of
820 can be easily set to use only the specified host IP address.
822 will need to be manually configured\(emfor some this is possible through
825 flags entries; for others it is necessary to modify per-application
826 configuration files, or to recompile the applications.
827 The following frequently deployed services must have their individual
828 configuration files modified to limit the application to listening
829 to a specific IP address:
833 it is necessary to modify
834 .Pa /etc/ssh/sshd_config .
838 it is necessary to modify
839 .Pa /etc/mail/sendmail.cf .
843 it is necessary to modify
844 .Pa /etc/namedb/named.conf .
846 In addition, a number of services must be recompiled in order to run
847 them in the host environment.
848 This includes most applications providing services using
855 In general, applications for which it is not possible to specify which
856 IP address to bind should not be run in the host environment unless they
857 should also service requests sent to jail IP addresses.
859 NFS from the host environment may also cause confusion, and cannot be
860 easily reconfigured to use only specific IPs, as some NFS services are
861 hosted directly from the kernel.
862 Any third-party network software running
863 in the host environment should also be checked and configured so that it
864 does not bind all IP addresses, which would result in those services' also
865 appearing to be offered by the jail environments.
868 these daemons have been disabled or fixed in the host environment, it is
869 best to reboot so that all daemons are in a known state, to reduce the
870 potential for confusion later (such as finding that when you send mail
871 to a jail, and its sendmail is down, the mail is delivered to the host,
873 .Ss "Configuring the Jail"
874 Start any jail for the first time without configuring the network
875 interface so that you can clean it up a little and set up accounts.
877 with any machine (virtual or not) you will need to set a root password, time
879 Some of these steps apply only if you intend to run a full virtual server
880 inside the jail; others apply both for constraining a particular application
881 or for running a virtual server.
883 Start a shell in the jail:
884 .Bd -literal -offset indent
885 jail -c path=/data/jail/testjail mount.devfs host.hostname=testhostname \\
886 ip4.addr=192.0.2.100 command=/bin/sh
889 Assuming no errors, you will end up with a shell prompt within the jail.
891 .Pa /usr/sbin/sysinstall
892 and do the post-install configuration to set various configuration options,
893 or perform these actions manually by editing
897 .Bl -bullet -offset indent -compact
901 so that name resolution within the jail will work correctly
909 Set a root password, probably different from the real host system
913 Add accounts for users in the jail environment
915 Install any packages the environment requires
918 You may also want to perform any package-specific configuration (web servers,
919 SSH servers, etc), patch up
921 so it logs as you would like, etc.
922 If you are not using a virtual server, you may wish to modify
924 in the host environment to listen on the syslog socket in the jail
925 environment; in this example, the syslog socket would be stored in
926 .Pa /data/jail/testjail/var/run/log .
928 Exit from the shell, and the jail will be shut down.
929 .Ss "Starting the Jail"
930 You are now ready to restart the jail and bring up the environment with
931 all of its daemons and other programs.
932 Create an entry for the jail in
934 .Bd -literal -offset indent
936 path = /tmp/jail/testjail;
938 host.hostname = testhostname;
939 ip4.addr = 192.0.2.100;
941 exec.start = "/bin/sh /etc/rc";
942 exec.stop = "/bin/sh /etc/rc.shutdown";
946 To start a virtual server environment,
948 is run to launch various daemons and services, and
950 is run to shut them down when the jail is removed.
951 If you are running a single application in the jail,
952 substitute the command used to start the application for
953 .Dq /bin/sh /etc/rc ;
954 there may be some script available to cleanly shut down the application,
955 or it may be sufficient to go without a stop command, and have
961 Start the jail by running:
962 .Bd -literal -offset indent
966 A few warnings may be produced; however, it should all work properly.
967 You should be able to see
970 and other processes running within the jail using
974 flag appearing beside jailed processes.
975 To see an active list of jails, use the
978 You should also be able to
980 to the hostname or IP address of the jailed environment, and log
981 in using the accounts you created previously.
983 It is possible to have jails started at boot time.
988 for more information.
989 .Ss "Managing the Jail"
990 Normal machine shutdown commands, such as
995 cannot be used successfully within the jail.
996 To kill all processes from within a jail, you may use one of the
997 following commands, depending on what you want to accomplish:
998 .Bd -literal -offset indent
1007 signals to all processes in the jail - be careful not to run this from
1008 the host environment!
1009 Once all of the jail's processes have died, unless the jail was created
1012 parameter, the jail will be removed.
1014 the intended use of the jail, you may also want to run
1015 .Pa /etc/rc.shutdown
1016 from within the jail.
1018 To shut down the jail from the outside, simply remove it with
1021 which will run any commands specified by
1027 to any remaining jailed processes.
1030 .Pa /proc/ Ns Ar pid Ns Pa /status
1031 file contains, as its last field, the name of the jail in which the
1034 to indicate that the process is not running within a jail.
1037 command also shows a
1039 flag for processes in a jail.
1041 You can also list/kill processes based on their jail ID.
1042 To show processes and their jail ID, use the following command:
1044 .Dl "ps ax -o pid,jid,args"
1046 To show and then kill processes in jail number 3 use the following commands:
1047 .Bd -literal -offset indent
1054 .Ss "Jails and File Systems"
1055 It is not possible to
1059 any file system inside a jail unless the file system is marked
1060 jail-friendly, the jail's
1062 parameter is set and the jail's
1064 parameter is lower than 2.
1066 Multiple jails sharing the same file system can influence each other.
1067 For example a user in one jail can fill the file system also
1068 leaving no space for processes in the other jail.
1071 to prevent this will not work either as the file system quotas
1072 are not aware of jails but only look at the user and group IDs.
1073 This means the same user ID in two jails share the same file
1075 One would need to use one file system per jail to make this work.
1076 .Ss "Sysctl MIB Entries"
1078 .Va security.jail.jailed
1079 can be used to determine if a process is running inside a jail (value
1080 is one) or not (value is zero).
1083 .Va security.jail.max_af_ips
1084 determines how may address per address family a prison may have.
1087 Some MIB variables have per-jail settings.
1088 Changes to these variables by a jailed process do not effect the host
1089 environment, only the jail environment.
1091 .Va kern.securelevel ,
1093 .Va kern.domainname ,
1097 .Ss "Hierarchical Jails"
1100 parameter, processes within a jail may be able to create jails of their own.
1101 These child jails are kept in a hierarchy, with jails only able to see and/or
1102 modify the jails they created (or those jails' children).
1103 Each jail has a read-only
1105 parameter, containing the
1107 of the jail that created it; a
1109 of 0 indicates the jail is a child of the current jail (or is a top-level
1110 jail if the current process isn't jailed).
1112 Jailed processes are not allowed to confer greater permissions than they
1113 themselves are given, e.g. if a jail is created with
1115 it is not able to create a jail with
1118 Similarly, such restrictions as
1122 may not be bypassed in child jails.
1124 A child jail may in turn create its own child jails if its own
1126 parameter is set (remember it is zero by default).
1127 These jails are visible to and can be modified by their parent and all
1130 Jail names reflect this hierarchy, with a full name being an MIB-type string
1132 For example, if a base system process creates a jail
1134 and a process under that jail creates another jail
1136 then the second jail will be seen as
1138 in the base system (though it is only seen as
1140 to any processes inside jail
1142 Jids on the other hand exist in a single space, and each jail must have a
1145 Like the names, a child jail's
1147 appears relative to its creator's own
1149 This is by virtue of the child jail being created in the chrooted
1150 environment of the first jail.
1184 Hierarchical/extensible jails were introduced in
1186 The configuration file was introduced in
1190 The jail feature was written by
1191 .An Poul-Henning Kamp
1193 .Pa http://www.rndassociates.com/
1194 who contributed it to
1198 wrote the extended documentation, found a few bugs, added
1199 a few new features, and cleaned up the userland jail environment.
1202 added multi-IP jail support for IPv4 and IPv6 based on a patch
1204 .An Pawel Jakub Dawidek
1208 added the extensible jail parameters, hierarchical jails,
1209 and the configuration file.
1211 It might be a good idea to add an
1212 address alias flag such that daemons listening on all IPs
1214 will not bind on that address, which would facilitate building a safe
1215 host environment such that host daemons do not impose on services offered
1217 Currently, the simplest answer is to minimize services
1218 offered on the host, possibly limiting it to services offered from
1220 which is easily configurable.
1222 Great care should be taken when managing directories visible within the jail.
1223 For example, if a jailed process has its current working directory set to a
1224 directory that is moved out of the jail's chroot, then the process may gain
1225 access to the file space outside of the jail.
1226 It is recommended that directories always be copied, rather than moved, out