2009-04-29 16:02:52 +00:00
|
|
|
.\" Copyright (c) 1999 Poul-Henning Kamp.
|
2009-04-29 21:14:15 +00:00
|
|
|
.\" Copyright (c) 2009 James Gritton.
|
2009-04-29 16:02:52 +00:00
|
|
|
.\" All rights reserved.
|
This Implements the mumbled about "Jail" feature.
This is a seriously beefed up chroot kind of thing. The process
is jailed along the same lines as a chroot does it, but with
additional tough restrictions imposed on what the superuser can do.
For all I know, it is safe to hand over the root bit inside a
prison to the customer living in that prison, this is what
it was developed for in fact: "real virtual servers".
Each prison has an ip number associated with it, which all IP
communications will be coerced to use and each prison has its own
hostname.
Needless to say, you need more RAM this way, but the advantage is
that each customer can run their own particular version of apache
and not stomp on the toes of their neighbors.
It generally does what one would expect, but setting up a jail
still takes a little knowledge.
A few notes:
I have no scripts for setting up a jail, don't ask me for them.
The IP number should be an alias on one of the interfaces.
mount a /proc in each jail, it will make ps more useable.
/proc/<pid>/status tells the hostname of the prison for
jailed processes.
Quotas are only sensible if you have a mountpoint per prison.
There are no privisions for stopping resource-hogging.
Some "#ifdef INET" and similar may be missing (send patches!)
If somebody wants to take it from here and develop it into
more of a "virtual machine" they should be most welcome!
Tools, comments, patches & documentation most welcome.
Have fun...
Sponsored by: http://www.rndassociates.com/
Run for almost a year by: http://www.servetheweb.com/
1999-04-28 11:38:52 +00:00
|
|
|
.\"
|
2009-04-29 16:02:52 +00:00
|
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
|
|
.\" modification, are permitted provided that the following conditions
|
|
|
|
.\" are met:
|
|
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer.
|
|
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
|
|
.\" documentation and/or other materials provided with the distribution.
|
|
|
|
.\"
|
|
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
|
|
|
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
.\" SUCH DAMAGE.
|
This Implements the mumbled about "Jail" feature.
This is a seriously beefed up chroot kind of thing. The process
is jailed along the same lines as a chroot does it, but with
additional tough restrictions imposed on what the superuser can do.
For all I know, it is safe to hand over the root bit inside a
prison to the customer living in that prison, this is what
it was developed for in fact: "real virtual servers".
Each prison has an ip number associated with it, which all IP
communications will be coerced to use and each prison has its own
hostname.
Needless to say, you need more RAM this way, but the advantage is
that each customer can run their own particular version of apache
and not stomp on the toes of their neighbors.
It generally does what one would expect, but setting up a jail
still takes a little knowledge.
A few notes:
I have no scripts for setting up a jail, don't ask me for them.
The IP number should be an alias on one of the interfaces.
mount a /proc in each jail, it will make ps more useable.
/proc/<pid>/status tells the hostname of the prison for
jailed processes.
Quotas are only sensible if you have a mountpoint per prison.
There are no privisions for stopping resource-hogging.
Some "#ifdef INET" and similar may be missing (send patches!)
If somebody wants to take it from here and develop it into
more of a "virtual machine" they should be most welcome!
Tools, comments, patches & documentation most welcome.
Have fun...
Sponsored by: http://www.rndassociates.com/
Run for almost a year by: http://www.servetheweb.com/
1999-04-28 11:38:52 +00:00
|
|
|
.\"
|
2005-02-09 18:07:17 +00:00
|
|
|
.\" $FreeBSD$
|
This Implements the mumbled about "Jail" feature.
This is a seriously beefed up chroot kind of thing. The process
is jailed along the same lines as a chroot does it, but with
additional tough restrictions imposed on what the superuser can do.
For all I know, it is safe to hand over the root bit inside a
prison to the customer living in that prison, this is what
it was developed for in fact: "real virtual servers".
Each prison has an ip number associated with it, which all IP
communications will be coerced to use and each prison has its own
hostname.
Needless to say, you need more RAM this way, but the advantage is
that each customer can run their own particular version of apache
and not stomp on the toes of their neighbors.
It generally does what one would expect, but setting up a jail
still takes a little knowledge.
A few notes:
I have no scripts for setting up a jail, don't ask me for them.
The IP number should be an alias on one of the interfaces.
mount a /proc in each jail, it will make ps more useable.
/proc/<pid>/status tells the hostname of the prison for
jailed processes.
Quotas are only sensible if you have a mountpoint per prison.
There are no privisions for stopping resource-hogging.
Some "#ifdef INET" and similar may be missing (send patches!)
If somebody wants to take it from here and develop it into
more of a "virtual machine" they should be most welcome!
Tools, comments, patches & documentation most welcome.
Have fun...
Sponsored by: http://www.rndassociates.com/
Run for almost a year by: http://www.servetheweb.com/
1999-04-28 11:38:52 +00:00
|
|
|
.\"
|
2009-05-27 14:11:23 +00:00
|
|
|
.Dd May 27, 2009
|
This Implements the mumbled about "Jail" feature.
This is a seriously beefed up chroot kind of thing. The process
is jailed along the same lines as a chroot does it, but with
additional tough restrictions imposed on what the superuser can do.
For all I know, it is safe to hand over the root bit inside a
prison to the customer living in that prison, this is what
it was developed for in fact: "real virtual servers".
Each prison has an ip number associated with it, which all IP
communications will be coerced to use and each prison has its own
hostname.
Needless to say, you need more RAM this way, but the advantage is
that each customer can run their own particular version of apache
and not stomp on the toes of their neighbors.
It generally does what one would expect, but setting up a jail
still takes a little knowledge.
A few notes:
I have no scripts for setting up a jail, don't ask me for them.
The IP number should be an alias on one of the interfaces.
mount a /proc in each jail, it will make ps more useable.
/proc/<pid>/status tells the hostname of the prison for
jailed processes.
Quotas are only sensible if you have a mountpoint per prison.
There are no privisions for stopping resource-hogging.
Some "#ifdef INET" and similar may be missing (send patches!)
If somebody wants to take it from here and develop it into
more of a "virtual machine" they should be most welcome!
Tools, comments, patches & documentation most welcome.
Have fun...
Sponsored by: http://www.rndassociates.com/
Run for almost a year by: http://www.servetheweb.com/
1999-04-28 11:38:52 +00:00
|
|
|
.Dt JAIL 2
|
2001-07-10 13:41:46 +00:00
|
|
|
.Os
|
This Implements the mumbled about "Jail" feature.
This is a seriously beefed up chroot kind of thing. The process
is jailed along the same lines as a chroot does it, but with
additional tough restrictions imposed on what the superuser can do.
For all I know, it is safe to hand over the root bit inside a
prison to the customer living in that prison, this is what
it was developed for in fact: "real virtual servers".
Each prison has an ip number associated with it, which all IP
communications will be coerced to use and each prison has its own
hostname.
Needless to say, you need more RAM this way, but the advantage is
that each customer can run their own particular version of apache
and not stomp on the toes of their neighbors.
It generally does what one would expect, but setting up a jail
still takes a little knowledge.
A few notes:
I have no scripts for setting up a jail, don't ask me for them.
The IP number should be an alias on one of the interfaces.
mount a /proc in each jail, it will make ps more useable.
/proc/<pid>/status tells the hostname of the prison for
jailed processes.
Quotas are only sensible if you have a mountpoint per prison.
There are no privisions for stopping resource-hogging.
Some "#ifdef INET" and similar may be missing (send patches!)
If somebody wants to take it from here and develop it into
more of a "virtual machine" they should be most welcome!
Tools, comments, patches & documentation most welcome.
Have fun...
Sponsored by: http://www.rndassociates.com/
Run for almost a year by: http://www.servetheweb.com/
1999-04-28 11:38:52 +00:00
|
|
|
.Sh NAME
|
2009-04-29 21:14:15 +00:00
|
|
|
.Nm jail ,
|
|
|
|
.Nm jail_get ,
|
|
|
|
.Nm jail_set ,
|
|
|
|
.Nm jail_remove ,
|
|
|
|
.Nm jail_attach
|
|
|
|
.Nd create and manage system jails
|
2000-04-21 09:42:15 +00:00
|
|
|
.Sh LIBRARY
|
|
|
|
.Lb libc
|
This Implements the mumbled about "Jail" feature.
This is a seriously beefed up chroot kind of thing. The process
is jailed along the same lines as a chroot does it, but with
additional tough restrictions imposed on what the superuser can do.
For all I know, it is safe to hand over the root bit inside a
prison to the customer living in that prison, this is what
it was developed for in fact: "real virtual servers".
Each prison has an ip number associated with it, which all IP
communications will be coerced to use and each prison has its own
hostname.
Needless to say, you need more RAM this way, but the advantage is
that each customer can run their own particular version of apache
and not stomp on the toes of their neighbors.
It generally does what one would expect, but setting up a jail
still takes a little knowledge.
A few notes:
I have no scripts for setting up a jail, don't ask me for them.
The IP number should be an alias on one of the interfaces.
mount a /proc in each jail, it will make ps more useable.
/proc/<pid>/status tells the hostname of the prison for
jailed processes.
Quotas are only sensible if you have a mountpoint per prison.
There are no privisions for stopping resource-hogging.
Some "#ifdef INET" and similar may be missing (send patches!)
If somebody wants to take it from here and develop it into
more of a "virtual machine" they should be most welcome!
Tools, comments, patches & documentation most welcome.
Have fun...
Sponsored by: http://www.rndassociates.com/
Run for almost a year by: http://www.servetheweb.com/
1999-04-28 11:38:52 +00:00
|
|
|
.Sh SYNOPSIS
|
2003-04-09 02:55:18 +00:00
|
|
|
.In sys/param.h
|
2001-10-01 16:09:29 +00:00
|
|
|
.In sys/jail.h
|
This Implements the mumbled about "Jail" feature.
This is a seriously beefed up chroot kind of thing. The process
is jailed along the same lines as a chroot does it, but with
additional tough restrictions imposed on what the superuser can do.
For all I know, it is safe to hand over the root bit inside a
prison to the customer living in that prison, this is what
it was developed for in fact: "real virtual servers".
Each prison has an ip number associated with it, which all IP
communications will be coerced to use and each prison has its own
hostname.
Needless to say, you need more RAM this way, but the advantage is
that each customer can run their own particular version of apache
and not stomp on the toes of their neighbors.
It generally does what one would expect, but setting up a jail
still takes a little knowledge.
A few notes:
I have no scripts for setting up a jail, don't ask me for them.
The IP number should be an alias on one of the interfaces.
mount a /proc in each jail, it will make ps more useable.
/proc/<pid>/status tells the hostname of the prison for
jailed processes.
Quotas are only sensible if you have a mountpoint per prison.
There are no privisions for stopping resource-hogging.
Some "#ifdef INET" and similar may be missing (send patches!)
If somebody wants to take it from here and develop it into
more of a "virtual machine" they should be most welcome!
Tools, comments, patches & documentation most welcome.
Have fun...
Sponsored by: http://www.rndassociates.com/
Run for almost a year by: http://www.servetheweb.com/
1999-04-28 11:38:52 +00:00
|
|
|
.Ft int
|
1999-05-16 10:51:52 +00:00
|
|
|
.Fn jail "struct jail *jail"
|
2003-04-09 02:55:18 +00:00
|
|
|
.Ft int
|
|
|
|
.Fn jail_attach "int jid"
|
2009-04-29 21:14:15 +00:00
|
|
|
.Ft int
|
|
|
|
.Fn jail_remove "int jid"
|
|
|
|
.In sys/uio.h
|
|
|
|
.Ft int
|
|
|
|
.Fn jail_get "struct iovec *iov" "u_int niov" "int flags"
|
|
|
|
.Ft int
|
|
|
|
.Fn jail_set "struct iovec *iov" "u_int niov" "int flags"
|
This Implements the mumbled about "Jail" feature.
This is a seriously beefed up chroot kind of thing. The process
is jailed along the same lines as a chroot does it, but with
additional tough restrictions imposed on what the superuser can do.
For all I know, it is safe to hand over the root bit inside a
prison to the customer living in that prison, this is what
it was developed for in fact: "real virtual servers".
Each prison has an ip number associated with it, which all IP
communications will be coerced to use and each prison has its own
hostname.
Needless to say, you need more RAM this way, but the advantage is
that each customer can run their own particular version of apache
and not stomp on the toes of their neighbors.
It generally does what one would expect, but setting up a jail
still takes a little knowledge.
A few notes:
I have no scripts for setting up a jail, don't ask me for them.
The IP number should be an alias on one of the interfaces.
mount a /proc in each jail, it will make ps more useable.
/proc/<pid>/status tells the hostname of the prison for
jailed processes.
Quotas are only sensible if you have a mountpoint per prison.
There are no privisions for stopping resource-hogging.
Some "#ifdef INET" and similar may be missing (send patches!)
If somebody wants to take it from here and develop it into
more of a "virtual machine" they should be most welcome!
Tools, comments, patches & documentation most welcome.
Have fun...
Sponsored by: http://www.rndassociates.com/
Run for almost a year by: http://www.servetheweb.com/
1999-04-28 11:38:52 +00:00
|
|
|
.Sh DESCRIPTION
|
|
|
|
The
|
2002-12-18 09:22:32 +00:00
|
|
|
.Fn jail
|
This Implements the mumbled about "Jail" feature.
This is a seriously beefed up chroot kind of thing. The process
is jailed along the same lines as a chroot does it, but with
additional tough restrictions imposed on what the superuser can do.
For all I know, it is safe to hand over the root bit inside a
prison to the customer living in that prison, this is what
it was developed for in fact: "real virtual servers".
Each prison has an ip number associated with it, which all IP
communications will be coerced to use and each prison has its own
hostname.
Needless to say, you need more RAM this way, but the advantage is
that each customer can run their own particular version of apache
and not stomp on the toes of their neighbors.
It generally does what one would expect, but setting up a jail
still takes a little knowledge.
A few notes:
I have no scripts for setting up a jail, don't ask me for them.
The IP number should be an alias on one of the interfaces.
mount a /proc in each jail, it will make ps more useable.
/proc/<pid>/status tells the hostname of the prison for
jailed processes.
Quotas are only sensible if you have a mountpoint per prison.
There are no privisions for stopping resource-hogging.
Some "#ifdef INET" and similar may be missing (send patches!)
If somebody wants to take it from here and develop it into
more of a "virtual machine" they should be most welcome!
Tools, comments, patches & documentation most welcome.
Have fun...
Sponsored by: http://www.rndassociates.com/
Run for almost a year by: http://www.servetheweb.com/
1999-04-28 11:38:52 +00:00
|
|
|
system call sets up a jail and locks the current process in it.
|
|
|
|
.Pp
|
|
|
|
The argument is a pointer to a structure describing the prison:
|
|
|
|
.Bd -literal -offset indent
|
|
|
|
struct jail {
|
1999-09-19 08:36:03 +00:00
|
|
|
u_int32_t version;
|
MFp4:
Bring in updated jail support from bz_jail branch.
This enhances the current jail implementation to permit multiple
addresses per jail. In addtion to IPv4, IPv6 is supported as well.
Due to updated checks it is even possible to have jails without
an IP address at all, which basically gives one a chroot with
restricted process view, no networking,..
SCTP support was updated and supports IPv6 in jails as well.
Cpuset support permits jails to be bound to specific processor
sets after creation.
Jails can have an unrestricted (no duplicate protection, etc.) name
in addition to the hostname. The jail name cannot be changed from
within a jail and is considered to be used for management purposes
or as audit-token in the future.
DDB 'show jails' command was added to aid debugging.
Proper compat support permits 32bit jail binaries to be used on 64bit
systems to manage jails. Also backward compatibility was preserved where
possible: for jail v1 syscalls, as well as with user space management
utilities.
Both jail as well as prison version were updated for the new features.
A gap was intentionally left as the intermediate versions had been
used by various patches floating around the last years.
Bump __FreeBSD_version for the afore mentioned and in kernel changes.
Special thanks to:
- Pawel Jakub Dawidek (pjd) for his multi-IPv4 patches
and Olivier Houchard (cognet) for initial single-IPv6 patches.
- Jeff Roberson (jeff) and Randall Stewart (rrs) for their
help, ideas and review on cpuset and SCTP support.
- Robert Watson (rwatson) for lots and lots of help, discussions,
suggestions and review of most of the patch at various stages.
- John Baldwin (jhb) for his help.
- Simon L. Nielsen (simon) as early adopter testing changes
on cluster machines as well as all the testers and people
who provided feedback the last months on freebsd-jail and
other channels.
- My employer, CK Software GmbH, for the support so I could work on this.
Reviewed by: (see above)
MFC after: 3 months (this is just so that I get the mail)
X-MFC Before: 7.2-RELEASE if possible
2008-11-29 14:32:14 +00:00
|
|
|
char *path;
|
|
|
|
char *hostname;
|
|
|
|
char *jailname;
|
|
|
|
unsigned int ip4s;
|
|
|
|
unsigned int ip6s;
|
|
|
|
struct in_addr *ip4;
|
|
|
|
struct in6_addr *ip6;
|
This Implements the mumbled about "Jail" feature.
This is a seriously beefed up chroot kind of thing. The process
is jailed along the same lines as a chroot does it, but with
additional tough restrictions imposed on what the superuser can do.
For all I know, it is safe to hand over the root bit inside a
prison to the customer living in that prison, this is what
it was developed for in fact: "real virtual servers".
Each prison has an ip number associated with it, which all IP
communications will be coerced to use and each prison has its own
hostname.
Needless to say, you need more RAM this way, but the advantage is
that each customer can run their own particular version of apache
and not stomp on the toes of their neighbors.
It generally does what one would expect, but setting up a jail
still takes a little knowledge.
A few notes:
I have no scripts for setting up a jail, don't ask me for them.
The IP number should be an alias on one of the interfaces.
mount a /proc in each jail, it will make ps more useable.
/proc/<pid>/status tells the hostname of the prison for
jailed processes.
Quotas are only sensible if you have a mountpoint per prison.
There are no privisions for stopping resource-hogging.
Some "#ifdef INET" and similar may be missing (send patches!)
If somebody wants to take it from here and develop it into
more of a "virtual machine" they should be most welcome!
Tools, comments, patches & documentation most welcome.
Have fun...
Sponsored by: http://www.rndassociates.com/
Run for almost a year by: http://www.servetheweb.com/
1999-04-28 11:38:52 +00:00
|
|
|
};
|
|
|
|
.Ed
|
|
|
|
.Pp
|
1999-09-19 08:36:03 +00:00
|
|
|
.Dq Li version
|
2003-11-11 18:31:36 +00:00
|
|
|
defines the version of the API in use.
|
MFp4:
Bring in updated jail support from bz_jail branch.
This enhances the current jail implementation to permit multiple
addresses per jail. In addtion to IPv4, IPv6 is supported as well.
Due to updated checks it is even possible to have jails without
an IP address at all, which basically gives one a chroot with
restricted process view, no networking,..
SCTP support was updated and supports IPv6 in jails as well.
Cpuset support permits jails to be bound to specific processor
sets after creation.
Jails can have an unrestricted (no duplicate protection, etc.) name
in addition to the hostname. The jail name cannot be changed from
within a jail and is considered to be used for management purposes
or as audit-token in the future.
DDB 'show jails' command was added to aid debugging.
Proper compat support permits 32bit jail binaries to be used on 64bit
systems to manage jails. Also backward compatibility was preserved where
possible: for jail v1 syscalls, as well as with user space management
utilities.
Both jail as well as prison version were updated for the new features.
A gap was intentionally left as the intermediate versions had been
used by various patches floating around the last years.
Bump __FreeBSD_version for the afore mentioned and in kernel changes.
Special thanks to:
- Pawel Jakub Dawidek (pjd) for his multi-IPv4 patches
and Olivier Houchard (cognet) for initial single-IPv6 patches.
- Jeff Roberson (jeff) and Randall Stewart (rrs) for their
help, ideas and review on cpuset and SCTP support.
- Robert Watson (rwatson) for lots and lots of help, discussions,
suggestions and review of most of the patch at various stages.
- John Baldwin (jhb) for his help.
- Simon L. Nielsen (simon) as early adopter testing changes
on cluster machines as well as all the testers and people
who provided feedback the last months on freebsd-jail and
other channels.
- My employer, CK Software GmbH, for the support so I could work on this.
Reviewed by: (see above)
MFC after: 3 months (this is just so that I get the mail)
X-MFC Before: 7.2-RELEASE if possible
2008-11-29 14:32:14 +00:00
|
|
|
.Dv JAIL_API_VERSION
|
|
|
|
is defined for the current version.
|
1999-09-19 08:36:03 +00:00
|
|
|
.Pp
|
This Implements the mumbled about "Jail" feature.
This is a seriously beefed up chroot kind of thing. The process
is jailed along the same lines as a chroot does it, but with
additional tough restrictions imposed on what the superuser can do.
For all I know, it is safe to hand over the root bit inside a
prison to the customer living in that prison, this is what
it was developed for in fact: "real virtual servers".
Each prison has an ip number associated with it, which all IP
communications will be coerced to use and each prison has its own
hostname.
Needless to say, you need more RAM this way, but the advantage is
that each customer can run their own particular version of apache
and not stomp on the toes of their neighbors.
It generally does what one would expect, but setting up a jail
still takes a little knowledge.
A few notes:
I have no scripts for setting up a jail, don't ask me for them.
The IP number should be an alias on one of the interfaces.
mount a /proc in each jail, it will make ps more useable.
/proc/<pid>/status tells the hostname of the prison for
jailed processes.
Quotas are only sensible if you have a mountpoint per prison.
There are no privisions for stopping resource-hogging.
Some "#ifdef INET" and similar may be missing (send patches!)
If somebody wants to take it from here and develop it into
more of a "virtual machine" they should be most welcome!
Tools, comments, patches & documentation most welcome.
Have fun...
Sponsored by: http://www.rndassociates.com/
Run for almost a year by: http://www.servetheweb.com/
1999-04-28 11:38:52 +00:00
|
|
|
The
|
|
|
|
.Dq Li path
|
|
|
|
pointer should be set to the directory which is to be the root of the
|
|
|
|
prison.
|
|
|
|
.Pp
|
|
|
|
The
|
|
|
|
.Dq Li hostname
|
2003-11-11 18:31:36 +00:00
|
|
|
pointer can be set to the hostname of the prison.
|
|
|
|
This can be changed
|
This Implements the mumbled about "Jail" feature.
This is a seriously beefed up chroot kind of thing. The process
is jailed along the same lines as a chroot does it, but with
additional tough restrictions imposed on what the superuser can do.
For all I know, it is safe to hand over the root bit inside a
prison to the customer living in that prison, this is what
it was developed for in fact: "real virtual servers".
Each prison has an ip number associated with it, which all IP
communications will be coerced to use and each prison has its own
hostname.
Needless to say, you need more RAM this way, but the advantage is
that each customer can run their own particular version of apache
and not stomp on the toes of their neighbors.
It generally does what one would expect, but setting up a jail
still takes a little knowledge.
A few notes:
I have no scripts for setting up a jail, don't ask me for them.
The IP number should be an alias on one of the interfaces.
mount a /proc in each jail, it will make ps more useable.
/proc/<pid>/status tells the hostname of the prison for
jailed processes.
Quotas are only sensible if you have a mountpoint per prison.
There are no privisions for stopping resource-hogging.
Some "#ifdef INET" and similar may be missing (send patches!)
If somebody wants to take it from here and develop it into
more of a "virtual machine" they should be most welcome!
Tools, comments, patches & documentation most welcome.
Have fun...
Sponsored by: http://www.rndassociates.com/
Run for almost a year by: http://www.servetheweb.com/
1999-04-28 11:38:52 +00:00
|
|
|
from the inside of the prison.
|
|
|
|
.Pp
|
|
|
|
The
|
MFp4:
Bring in updated jail support from bz_jail branch.
This enhances the current jail implementation to permit multiple
addresses per jail. In addtion to IPv4, IPv6 is supported as well.
Due to updated checks it is even possible to have jails without
an IP address at all, which basically gives one a chroot with
restricted process view, no networking,..
SCTP support was updated and supports IPv6 in jails as well.
Cpuset support permits jails to be bound to specific processor
sets after creation.
Jails can have an unrestricted (no duplicate protection, etc.) name
in addition to the hostname. The jail name cannot be changed from
within a jail and is considered to be used for management purposes
or as audit-token in the future.
DDB 'show jails' command was added to aid debugging.
Proper compat support permits 32bit jail binaries to be used on 64bit
systems to manage jails. Also backward compatibility was preserved where
possible: for jail v1 syscalls, as well as with user space management
utilities.
Both jail as well as prison version were updated for the new features.
A gap was intentionally left as the intermediate versions had been
used by various patches floating around the last years.
Bump __FreeBSD_version for the afore mentioned and in kernel changes.
Special thanks to:
- Pawel Jakub Dawidek (pjd) for his multi-IPv4 patches
and Olivier Houchard (cognet) for initial single-IPv6 patches.
- Jeff Roberson (jeff) and Randall Stewart (rrs) for their
help, ideas and review on cpuset and SCTP support.
- Robert Watson (rwatson) for lots and lots of help, discussions,
suggestions and review of most of the patch at various stages.
- John Baldwin (jhb) for his help.
- Simon L. Nielsen (simon) as early adopter testing changes
on cluster machines as well as all the testers and people
who provided feedback the last months on freebsd-jail and
other channels.
- My employer, CK Software GmbH, for the support so I could work on this.
Reviewed by: (see above)
MFC after: 3 months (this is just so that I get the mail)
X-MFC Before: 7.2-RELEASE if possible
2008-11-29 14:32:14 +00:00
|
|
|
.Dq Li jailname
|
|
|
|
pointer is an optional name that can be assigned to the jail
|
|
|
|
for example for managment purposes.
|
|
|
|
.Pp
|
|
|
|
The
|
|
|
|
.Dq Li ip4s
|
|
|
|
and
|
|
|
|
.Dq Li ip6s
|
|
|
|
give the numbers of IPv4 and IPv6 addresses that will be passed
|
|
|
|
via their respective pointers.
|
|
|
|
.Pp
|
|
|
|
The
|
|
|
|
.Dq Li ip4
|
|
|
|
and
|
|
|
|
.Dq Li ip6
|
|
|
|
pointers can be set to an arrays of IPv4 and IPv6 addresses to be assigned to
|
|
|
|
the prison, or NULL if none.
|
|
|
|
IPv4 addresses must be in network byte order.
|
2003-04-09 02:55:18 +00:00
|
|
|
.Pp
|
2009-04-29 21:14:15 +00:00
|
|
|
This is equivalent to the
|
|
|
|
.Fn jail_set
|
|
|
|
system call (see below), with the parameters
|
|
|
|
.Va path ,
|
|
|
|
.Va host.hostname ,
|
|
|
|
.Va name ,
|
|
|
|
.Va ip4.addr ,
|
|
|
|
and
|
|
|
|
.Va ip6.addr ,
|
|
|
|
and with the
|
|
|
|
.Dv JAIL_ATTACH
|
|
|
|
flag.
|
|
|
|
.Pp
|
|
|
|
The
|
|
|
|
.Fn jail_set
|
|
|
|
system call creates a new jail, or modifies an existing one, and optionally
|
|
|
|
locks the current process in it.
|
|
|
|
Jail parameters are passed as an array of name-value pairs in the array
|
|
|
|
.Fa iov ,
|
|
|
|
containing
|
|
|
|
.Fa niov
|
|
|
|
elements.
|
|
|
|
Parameter names are a null-terminated string, and values may be strings,
|
|
|
|
integers, or other arbitrary data.
|
|
|
|
Some parameters are boolean, and do not have a value (their length is zero)
|
|
|
|
but are set by the name alone with or without a
|
|
|
|
.Dq no
|
|
|
|
prefix, e.g.
|
|
|
|
.Va persist
|
|
|
|
or
|
|
|
|
.Va nopersist .
|
|
|
|
Any parameters not set will be given default values, generally based on
|
|
|
|
the current environment.
|
|
|
|
.Pp
|
|
|
|
Jails have a set of core parameters, and modules can add their own jail
|
|
|
|
parameters.
|
|
|
|
The current set of available parameters, and their formats, can be
|
|
|
|
retrieved via the
|
|
|
|
.Va security.jail.param
|
|
|
|
sysctl MIB entry.
|
|
|
|
Notable parameters include those mentioned in the
|
|
|
|
.Fn jail
|
|
|
|
description above, as well as
|
|
|
|
.Va jid
|
|
|
|
and
|
|
|
|
.Va name ,
|
|
|
|
which identify the jail being created or modified.
|
|
|
|
See
|
|
|
|
.Xr jail 8
|
|
|
|
for more information on the core jail parameters.
|
|
|
|
.Pp
|
|
|
|
The
|
|
|
|
.Fa flags
|
|
|
|
arguments consists of one or more of the following flags:
|
|
|
|
.Bl -tag -width indent
|
|
|
|
.It Dv JAIL_CREATE
|
|
|
|
Create a new jail.
|
|
|
|
If a
|
|
|
|
.Va jid
|
|
|
|
or
|
|
|
|
.Va name
|
|
|
|
parameters exists, they must not refer to an existing jail.
|
|
|
|
.It Dv JAIL_UPDATE
|
|
|
|
Modify an existing jail.
|
|
|
|
One of the
|
|
|
|
.Va jid
|
|
|
|
or
|
|
|
|
.Va name
|
|
|
|
parameters must exist, and must refer to an existing jail.
|
|
|
|
If both
|
|
|
|
.Dv JAIL_CREATE
|
|
|
|
and
|
|
|
|
.Dv JAIL_UPDATE
|
|
|
|
are set, a jail will be created if it does not yet exist, and modified if it
|
|
|
|
does exist.
|
|
|
|
.It Dv JAIL_ATTACH
|
|
|
|
In addition to creating or modifying the jail, attach the current process to
|
|
|
|
it, as with the
|
|
|
|
.Fn jail_attach
|
|
|
|
system call.
|
|
|
|
.It Dv JAIL_DYING
|
|
|
|
Allow setting a jail that is in the process of being removed.
|
|
|
|
.El
|
|
|
|
.Pp
|
|
|
|
The
|
|
|
|
.Fn jail_get
|
|
|
|
system call retrieves jail parameters, using the same name-value list as
|
|
|
|
.Fn jail_set
|
|
|
|
in the
|
|
|
|
.Fa iov
|
|
|
|
and
|
|
|
|
.Fa niov
|
|
|
|
arguments.
|
|
|
|
The jail to read can be specified by either
|
|
|
|
.Va jid
|
|
|
|
or
|
|
|
|
.Va name
|
|
|
|
by including those parameters in the list.
|
|
|
|
If they are included but are not intended to be the search key, they
|
|
|
|
should be cleared (zero and the empty string respectively).
|
|
|
|
.Pp
|
|
|
|
The special parameter
|
|
|
|
.Va lastjid
|
|
|
|
can be used to retrieve a list of all jails.
|
|
|
|
It will fetch the jail with the jid above and closest to the passed value.
|
|
|
|
The first jail (usually but not always jid 1) can be found by passing a
|
|
|
|
.Va lastjid
|
|
|
|
of zero.
|
|
|
|
.Pp
|
|
|
|
The
|
|
|
|
.Fa flags
|
|
|
|
arguments consists of one or more following flags:
|
|
|
|
.Bl -tag -width indent
|
|
|
|
.It Dv JAIL_DYING
|
|
|
|
Allow getting a jail that is in the process of being removed.
|
|
|
|
.El
|
|
|
|
.Pp
|
2003-04-09 02:55:18 +00:00
|
|
|
The
|
|
|
|
.Fn jail_attach
|
|
|
|
system call attaches the current process to an existing jail,
|
|
|
|
identified by
|
2003-05-22 13:02:28 +00:00
|
|
|
.Fa jid .
|
2009-04-29 21:14:15 +00:00
|
|
|
.Pp
|
|
|
|
The
|
|
|
|
.Fn jail_remove
|
|
|
|
system call removes the jail identified by
|
|
|
|
.Fa jid .
|
|
|
|
It will kill all processes belonging to the jail, and remove any children
|
|
|
|
of that jail.
|
2003-04-09 02:55:18 +00:00
|
|
|
.Sh RETURN VALUES
|
|
|
|
If successful,
|
2009-04-29 21:14:15 +00:00
|
|
|
.Fn jail ,
|
|
|
|
.Fn jail_set ,
|
|
|
|
and
|
|
|
|
.Fn jail_get
|
|
|
|
return a non-negative integer, termed the jail identifier (JID).
|
|
|
|
They return \-1 on failure, and set
|
2003-04-09 02:55:18 +00:00
|
|
|
.Va errno
|
|
|
|
to indicate the error.
|
|
|
|
.Pp
|
2009-04-29 21:14:15 +00:00
|
|
|
.Rv -std jail_attach jail_remove
|
2001-08-27 09:34:39 +00:00
|
|
|
.Sh PRISON?
|
2004-06-21 18:57:32 +00:00
|
|
|
Once a process has been put in a prison, it and its descendants cannot escape
|
2003-04-09 02:55:18 +00:00
|
|
|
the prison.
|
This Implements the mumbled about "Jail" feature.
This is a seriously beefed up chroot kind of thing. The process
is jailed along the same lines as a chroot does it, but with
additional tough restrictions imposed on what the superuser can do.
For all I know, it is safe to hand over the root bit inside a
prison to the customer living in that prison, this is what
it was developed for in fact: "real virtual servers".
Each prison has an ip number associated with it, which all IP
communications will be coerced to use and each prison has its own
hostname.
Needless to say, you need more RAM this way, but the advantage is
that each customer can run their own particular version of apache
and not stomp on the toes of their neighbors.
It generally does what one would expect, but setting up a jail
still takes a little knowledge.
A few notes:
I have no scripts for setting up a jail, don't ask me for them.
The IP number should be an alias on one of the interfaces.
mount a /proc in each jail, it will make ps more useable.
/proc/<pid>/status tells the hostname of the prison for
jailed processes.
Quotas are only sensible if you have a mountpoint per prison.
There are no privisions for stopping resource-hogging.
Some "#ifdef INET" and similar may be missing (send patches!)
If somebody wants to take it from here and develop it into
more of a "virtual machine" they should be most welcome!
Tools, comments, patches & documentation most welcome.
Have fun...
Sponsored by: http://www.rndassociates.com/
Run for almost a year by: http://www.servetheweb.com/
1999-04-28 11:38:52 +00:00
|
|
|
.Pp
|
2003-11-11 18:31:36 +00:00
|
|
|
Inside the prison, the concept of
|
|
|
|
.Dq superuser
|
|
|
|
is very diluted.
|
|
|
|
In general,
|
1999-06-17 23:43:35 +00:00
|
|
|
it can be assumed that nothing can be mangled from inside a prison which
|
2003-11-11 18:31:36 +00:00
|
|
|
does not exist entirely inside that prison.
|
|
|
|
For instance the directory
|
1999-07-09 21:35:37 +00:00
|
|
|
tree below
|
2001-07-15 07:53:42 +00:00
|
|
|
.Dq Li path
|
1999-07-09 21:35:37 +00:00
|
|
|
can be manipulated all the ways a root can normally do it, including
|
|
|
|
.Dq Li "rm -rf /*"
|
1999-12-21 11:55:44 +00:00
|
|
|
but new device special nodes cannot be created because they reference
|
1999-07-09 21:35:37 +00:00
|
|
|
shared resources (the device drivers in the kernel).
|
2003-11-11 18:21:20 +00:00
|
|
|
The effective
|
|
|
|
.Dq securelevel
|
|
|
|
for a process is the greater of the global
|
|
|
|
.Dq securelevel
|
|
|
|
or, if present, the per-jail
|
|
|
|
.Dq securelevel .
|
This Implements the mumbled about "Jail" feature.
This is a seriously beefed up chroot kind of thing. The process
is jailed along the same lines as a chroot does it, but with
additional tough restrictions imposed on what the superuser can do.
For all I know, it is safe to hand over the root bit inside a
prison to the customer living in that prison, this is what
it was developed for in fact: "real virtual servers".
Each prison has an ip number associated with it, which all IP
communications will be coerced to use and each prison has its own
hostname.
Needless to say, you need more RAM this way, but the advantage is
that each customer can run their own particular version of apache
and not stomp on the toes of their neighbors.
It generally does what one would expect, but setting up a jail
still takes a little knowledge.
A few notes:
I have no scripts for setting up a jail, don't ask me for them.
The IP number should be an alias on one of the interfaces.
mount a /proc in each jail, it will make ps more useable.
/proc/<pid>/status tells the hostname of the prison for
jailed processes.
Quotas are only sensible if you have a mountpoint per prison.
There are no privisions for stopping resource-hogging.
Some "#ifdef INET" and similar may be missing (send patches!)
If somebody wants to take it from here and develop it into
more of a "virtual machine" they should be most welcome!
Tools, comments, patches & documentation most welcome.
Have fun...
Sponsored by: http://www.rndassociates.com/
Run for almost a year by: http://www.servetheweb.com/
1999-04-28 11:38:52 +00:00
|
|
|
.Pp
|
|
|
|
All IP activity will be forced to happen to/from the IP number specified,
|
1999-07-09 21:35:37 +00:00
|
|
|
which should be an alias on one of the network interfaces.
|
2009-01-06 18:10:17 +00:00
|
|
|
All connections to/from the loopback address
|
|
|
|
.Pf ( Li 127.0.0.1
|
|
|
|
for IPv4,
|
|
|
|
.Li ::1
|
|
|
|
for IPv6) will be changed to be to/from the primary address
|
|
|
|
of the jail for the given address family.
|
This Implements the mumbled about "Jail" feature.
This is a seriously beefed up chroot kind of thing. The process
is jailed along the same lines as a chroot does it, but with
additional tough restrictions imposed on what the superuser can do.
For all I know, it is safe to hand over the root bit inside a
prison to the customer living in that prison, this is what
it was developed for in fact: "real virtual servers".
Each prison has an ip number associated with it, which all IP
communications will be coerced to use and each prison has its own
hostname.
Needless to say, you need more RAM this way, but the advantage is
that each customer can run their own particular version of apache
and not stomp on the toes of their neighbors.
It generally does what one would expect, but setting up a jail
still takes a little knowledge.
A few notes:
I have no scripts for setting up a jail, don't ask me for them.
The IP number should be an alias on one of the interfaces.
mount a /proc in each jail, it will make ps more useable.
/proc/<pid>/status tells the hostname of the prison for
jailed processes.
Quotas are only sensible if you have a mountpoint per prison.
There are no privisions for stopping resource-hogging.
Some "#ifdef INET" and similar may be missing (send patches!)
If somebody wants to take it from here and develop it into
more of a "virtual machine" they should be most welcome!
Tools, comments, patches & documentation most welcome.
Have fun...
Sponsored by: http://www.rndassociates.com/
Run for almost a year by: http://www.servetheweb.com/
1999-04-28 11:38:52 +00:00
|
|
|
.Pp
|
|
|
|
It is possible to identify a process as jailed by examining
|
|
|
|
.Dq Li /proc/<pid>/status :
|
|
|
|
it will show a field near the end of the line, either as
|
2009-05-27 14:11:23 +00:00
|
|
|
a single hyphen for a process at large, or the name currently
|
This Implements the mumbled about "Jail" feature.
This is a seriously beefed up chroot kind of thing. The process
is jailed along the same lines as a chroot does it, but with
additional tough restrictions imposed on what the superuser can do.
For all I know, it is safe to hand over the root bit inside a
prison to the customer living in that prison, this is what
it was developed for in fact: "real virtual servers".
Each prison has an ip number associated with it, which all IP
communications will be coerced to use and each prison has its own
hostname.
Needless to say, you need more RAM this way, but the advantage is
that each customer can run their own particular version of apache
and not stomp on the toes of their neighbors.
It generally does what one would expect, but setting up a jail
still takes a little knowledge.
A few notes:
I have no scripts for setting up a jail, don't ask me for them.
The IP number should be an alias on one of the interfaces.
mount a /proc in each jail, it will make ps more useable.
/proc/<pid>/status tells the hostname of the prison for
jailed processes.
Quotas are only sensible if you have a mountpoint per prison.
There are no privisions for stopping resource-hogging.
Some "#ifdef INET" and similar may be missing (send patches!)
If somebody wants to take it from here and develop it into
more of a "virtual machine" they should be most welcome!
Tools, comments, patches & documentation most welcome.
Have fun...
Sponsored by: http://www.rndassociates.com/
Run for almost a year by: http://www.servetheweb.com/
1999-04-28 11:38:52 +00:00
|
|
|
set for the prison for jailed processes.
|
|
|
|
.Sh ERRORS
|
2002-12-18 09:22:32 +00:00
|
|
|
The
|
1999-09-19 08:36:03 +00:00
|
|
|
.Fn jail
|
2002-12-18 09:22:32 +00:00
|
|
|
system call
|
1999-09-19 08:36:03 +00:00
|
|
|
will fail if:
|
2000-05-04 13:09:25 +00:00
|
|
|
.Bl -tag -width Er
|
2009-04-29 21:14:15 +00:00
|
|
|
.It Bq Er EPERM
|
2009-05-27 14:11:23 +00:00
|
|
|
This process is not allowed to create a jail, either because it is not
|
|
|
|
the super-user, or because it is in a jail where the
|
|
|
|
.Va allow.jails
|
|
|
|
parameter is not set.
|
2009-04-29 21:14:15 +00:00
|
|
|
.It Bq Er EFAULT
|
|
|
|
.Fa jail
|
|
|
|
points to an address outside the allocated address space of the process.
|
1999-09-19 08:36:03 +00:00
|
|
|
.It Bq Er EINVAL
|
|
|
|
The version number of the argument is not correct.
|
2008-08-03 21:56:58 +00:00
|
|
|
.It Bq Er EAGAIN
|
|
|
|
No free JID could be found.
|
1999-09-19 08:36:03 +00:00
|
|
|
.El
|
1999-12-21 11:19:32 +00:00
|
|
|
.Pp
|
2009-04-29 21:14:15 +00:00
|
|
|
The
|
|
|
|
.Fn jail_set
|
|
|
|
system call
|
|
|
|
will fail if:
|
|
|
|
.Bl -tag -width Er
|
|
|
|
.It Bq Er EPERM
|
2009-05-27 14:11:23 +00:00
|
|
|
This process is not allowed to create a jail, either because it is not
|
|
|
|
the super-user, or because it is in a jail where the
|
|
|
|
.Va allow.jails
|
|
|
|
parameter is not set.
|
2009-04-29 21:14:15 +00:00
|
|
|
.It Bq Er EPERM
|
|
|
|
A jail parameter was set to a less restrictive value then the current
|
|
|
|
environment.
|
|
|
|
.It Bq Er EFAULT
|
|
|
|
.Fa Iov ,
|
|
|
|
or one of the addresses contained within it,
|
|
|
|
points to an address outside the allocated address space of the process.
|
|
|
|
.It Bq Er ENOENT
|
|
|
|
The jail referred to by a
|
|
|
|
.Va jid
|
|
|
|
or
|
|
|
|
.Va name
|
|
|
|
parameter does not exist, and the
|
|
|
|
.Dv JAIL_CREATE
|
|
|
|
flag is not set.
|
2009-05-27 14:11:23 +00:00
|
|
|
.It Bq Er ENOENT
|
|
|
|
The jail referred to by a
|
|
|
|
.Va jid
|
|
|
|
is not accessible by the process, because the process is in a different
|
|
|
|
jail.
|
2009-04-29 21:14:15 +00:00
|
|
|
.It Bq Er EEXIST
|
|
|
|
The jail referred to by a
|
|
|
|
.Va jid
|
|
|
|
or
|
|
|
|
.Va name
|
|
|
|
parameter exists, and the
|
|
|
|
.Dv JAIL_UPDATE
|
|
|
|
flag is not set.
|
|
|
|
.It Bq Er EINVAL
|
|
|
|
A supplied parameter is the wrong size.
|
|
|
|
.It Bq Er EINVAL
|
|
|
|
A supplied parameter is out of range.
|
|
|
|
.It Bq Er EINVAL
|
|
|
|
A supplied string parameter is not null-terminated.
|
|
|
|
.It Bq Er EINVAL
|
|
|
|
A supplied parameter name does not match any known parameters.
|
|
|
|
.It Bq Er EINVAL
|
|
|
|
One of the
|
|
|
|
.Dv JAIL_CREATE
|
|
|
|
or
|
|
|
|
.Dv JAIL_UPDATE
|
|
|
|
flags is not set.
|
|
|
|
.It Bq Er ENAMETOOLONG
|
|
|
|
A supplied string parameter is longer than allowed.
|
|
|
|
.It Bq Er EAGAIN
|
|
|
|
There are no jail IDs left.
|
|
|
|
.El
|
|
|
|
.Pp
|
|
|
|
The
|
|
|
|
.Fn jail_get
|
|
|
|
system call
|
|
|
|
will fail if:
|
|
|
|
.Bl -tag -width Er
|
|
|
|
.It Bq Er EFAULT
|
|
|
|
.Fa Iov ,
|
|
|
|
or one of the addresses contained within it,
|
|
|
|
points to an address outside the allocated address space of the process.
|
|
|
|
.It Bq Er ENOENT
|
|
|
|
The jail referred to by a
|
|
|
|
.Va jid
|
|
|
|
or
|
|
|
|
.Va name
|
|
|
|
parameter does not exist.
|
|
|
|
.It Bq Er ENOENT
|
2009-05-27 14:11:23 +00:00
|
|
|
The jail referred to by a
|
|
|
|
.Va jid
|
|
|
|
is not accessible by the process, because the process is in a different
|
|
|
|
jail.
|
|
|
|
.It Bq Er ENOENT
|
2009-04-29 21:14:15 +00:00
|
|
|
The
|
|
|
|
.Va lastjid
|
|
|
|
parameter is greater than the highest current jail ID.
|
|
|
|
.It Bq Er EINVAL
|
|
|
|
A supplied parameter is the wrong size.
|
|
|
|
.It Bq Er EINVAL
|
|
|
|
A supplied parameter name does not match any known parameters.
|
|
|
|
.El
|
|
|
|
.Pp
|
|
|
|
The
|
|
|
|
.Fn jail_attach
|
|
|
|
and
|
|
|
|
.Fn jail_remove
|
|
|
|
system calls
|
|
|
|
will fail if:
|
|
|
|
.Bl -tag -width Er
|
|
|
|
.It Bq Er EINVAL
|
|
|
|
The jail specified by
|
|
|
|
.Fa jid
|
|
|
|
does not exist.
|
|
|
|
.El
|
|
|
|
.Pp
|
1999-09-19 08:36:03 +00:00
|
|
|
Further
|
2009-04-29 21:14:15 +00:00
|
|
|
.Fn jail ,
|
|
|
|
.Fn jail_set ,
|
|
|
|
and
|
|
|
|
.Fn jail_attach
|
|
|
|
call
|
This Implements the mumbled about "Jail" feature.
This is a seriously beefed up chroot kind of thing. The process
is jailed along the same lines as a chroot does it, but with
additional tough restrictions imposed on what the superuser can do.
For all I know, it is safe to hand over the root bit inside a
prison to the customer living in that prison, this is what
it was developed for in fact: "real virtual servers".
Each prison has an ip number associated with it, which all IP
communications will be coerced to use and each prison has its own
hostname.
Needless to say, you need more RAM this way, but the advantage is
that each customer can run their own particular version of apache
and not stomp on the toes of their neighbors.
It generally does what one would expect, but setting up a jail
still takes a little knowledge.
A few notes:
I have no scripts for setting up a jail, don't ask me for them.
The IP number should be an alias on one of the interfaces.
mount a /proc in each jail, it will make ps more useable.
/proc/<pid>/status tells the hostname of the prison for
jailed processes.
Quotas are only sensible if you have a mountpoint per prison.
There are no privisions for stopping resource-hogging.
Some "#ifdef INET" and similar may be missing (send patches!)
If somebody wants to take it from here and develop it into
more of a "virtual machine" they should be most welcome!
Tools, comments, patches & documentation most welcome.
Have fun...
Sponsored by: http://www.rndassociates.com/
Run for almost a year by: http://www.servetheweb.com/
1999-04-28 11:38:52 +00:00
|
|
|
.Xr chroot 2
|
2002-05-26 05:24:53 +00:00
|
|
|
internally, so it can fail for all the same reasons.
|
This Implements the mumbled about "Jail" feature.
This is a seriously beefed up chroot kind of thing. The process
is jailed along the same lines as a chroot does it, but with
additional tough restrictions imposed on what the superuser can do.
For all I know, it is safe to hand over the root bit inside a
prison to the customer living in that prison, this is what
it was developed for in fact: "real virtual servers".
Each prison has an ip number associated with it, which all IP
communications will be coerced to use and each prison has its own
hostname.
Needless to say, you need more RAM this way, but the advantage is
that each customer can run their own particular version of apache
and not stomp on the toes of their neighbors.
It generally does what one would expect, but setting up a jail
still takes a little knowledge.
A few notes:
I have no scripts for setting up a jail, don't ask me for them.
The IP number should be an alias on one of the interfaces.
mount a /proc in each jail, it will make ps more useable.
/proc/<pid>/status tells the hostname of the prison for
jailed processes.
Quotas are only sensible if you have a mountpoint per prison.
There are no privisions for stopping resource-hogging.
Some "#ifdef INET" and similar may be missing (send patches!)
If somebody wants to take it from here and develop it into
more of a "virtual machine" they should be most welcome!
Tools, comments, patches & documentation most welcome.
Have fun...
Sponsored by: http://www.rndassociates.com/
Run for almost a year by: http://www.servetheweb.com/
1999-04-28 11:38:52 +00:00
|
|
|
Please consult the
|
|
|
|
.Xr chroot 2
|
|
|
|
manual page for details.
|
|
|
|
.Sh SEE ALSO
|
1999-08-15 09:51:25 +00:00
|
|
|
.Xr chdir 2 ,
|
2009-04-29 21:14:15 +00:00
|
|
|
.Xr chroot 2 ,
|
|
|
|
.Xr jail 8
|
This Implements the mumbled about "Jail" feature.
This is a seriously beefed up chroot kind of thing. The process
is jailed along the same lines as a chroot does it, but with
additional tough restrictions imposed on what the superuser can do.
For all I know, it is safe to hand over the root bit inside a
prison to the customer living in that prison, this is what
it was developed for in fact: "real virtual servers".
Each prison has an ip number associated with it, which all IP
communications will be coerced to use and each prison has its own
hostname.
Needless to say, you need more RAM this way, but the advantage is
that each customer can run their own particular version of apache
and not stomp on the toes of their neighbors.
It generally does what one would expect, but setting up a jail
still takes a little knowledge.
A few notes:
I have no scripts for setting up a jail, don't ask me for them.
The IP number should be an alias on one of the interfaces.
mount a /proc in each jail, it will make ps more useable.
/proc/<pid>/status tells the hostname of the prison for
jailed processes.
Quotas are only sensible if you have a mountpoint per prison.
There are no privisions for stopping resource-hogging.
Some "#ifdef INET" and similar may be missing (send patches!)
If somebody wants to take it from here and develop it into
more of a "virtual machine" they should be most welcome!
Tools, comments, patches & documentation most welcome.
Have fun...
Sponsored by: http://www.rndassociates.com/
Run for almost a year by: http://www.servetheweb.com/
1999-04-28 11:38:52 +00:00
|
|
|
.Sh HISTORY
|
|
|
|
The
|
|
|
|
.Fn jail
|
2002-12-18 09:22:32 +00:00
|
|
|
system call appeared in
|
This Implements the mumbled about "Jail" feature.
This is a seriously beefed up chroot kind of thing. The process
is jailed along the same lines as a chroot does it, but with
additional tough restrictions imposed on what the superuser can do.
For all I know, it is safe to hand over the root bit inside a
prison to the customer living in that prison, this is what
it was developed for in fact: "real virtual servers".
Each prison has an ip number associated with it, which all IP
communications will be coerced to use and each prison has its own
hostname.
Needless to say, you need more RAM this way, but the advantage is
that each customer can run their own particular version of apache
and not stomp on the toes of their neighbors.
It generally does what one would expect, but setting up a jail
still takes a little knowledge.
A few notes:
I have no scripts for setting up a jail, don't ask me for them.
The IP number should be an alias on one of the interfaces.
mount a /proc in each jail, it will make ps more useable.
/proc/<pid>/status tells the hostname of the prison for
jailed processes.
Quotas are only sensible if you have a mountpoint per prison.
There are no privisions for stopping resource-hogging.
Some "#ifdef INET" and similar may be missing (send patches!)
If somebody wants to take it from here and develop it into
more of a "virtual machine" they should be most welcome!
Tools, comments, patches & documentation most welcome.
Have fun...
Sponsored by: http://www.rndassociates.com/
Run for almost a year by: http://www.servetheweb.com/
1999-04-28 11:38:52 +00:00
|
|
|
.Fx 4.0 .
|
2003-04-09 02:55:18 +00:00
|
|
|
The
|
|
|
|
.Fn jail_attach
|
|
|
|
system call appeared in
|
|
|
|
.Fx 5.1 .
|
2009-04-29 21:14:15 +00:00
|
|
|
The
|
|
|
|
.Fn jail_set ,
|
|
|
|
.Fn jail_get ,
|
|
|
|
and
|
|
|
|
.Fn jail_remove
|
|
|
|
system calls appeared in
|
|
|
|
.Fx 8.0 .
|
1999-12-21 11:19:32 +00:00
|
|
|
.Sh AUTHORS
|
1999-08-15 09:51:25 +00:00
|
|
|
The jail feature was written by
|
|
|
|
.An Poul-Henning Kamp
|
|
|
|
for R&D Associates
|
This Implements the mumbled about "Jail" feature.
This is a seriously beefed up chroot kind of thing. The process
is jailed along the same lines as a chroot does it, but with
additional tough restrictions imposed on what the superuser can do.
For all I know, it is safe to hand over the root bit inside a
prison to the customer living in that prison, this is what
it was developed for in fact: "real virtual servers".
Each prison has an ip number associated with it, which all IP
communications will be coerced to use and each prison has its own
hostname.
Needless to say, you need more RAM this way, but the advantage is
that each customer can run their own particular version of apache
and not stomp on the toes of their neighbors.
It generally does what one would expect, but setting up a jail
still takes a little knowledge.
A few notes:
I have no scripts for setting up a jail, don't ask me for them.
The IP number should be an alias on one of the interfaces.
mount a /proc in each jail, it will make ps more useable.
/proc/<pid>/status tells the hostname of the prison for
jailed processes.
Quotas are only sensible if you have a mountpoint per prison.
There are no privisions for stopping resource-hogging.
Some "#ifdef INET" and similar may be missing (send patches!)
If somebody wants to take it from here and develop it into
more of a "virtual machine" they should be most welcome!
Tools, comments, patches & documentation most welcome.
Have fun...
Sponsored by: http://www.rndassociates.com/
Run for almost a year by: http://www.servetheweb.com/
1999-04-28 11:38:52 +00:00
|
|
|
.Dq Li http://www.rndassociates.com/
|
1999-09-05 06:47:01 +00:00
|
|
|
who contributed it to
|
|
|
|
.Fx .
|
2009-04-29 21:14:15 +00:00
|
|
|
.An James Gritton
|
2009-05-27 14:11:23 +00:00
|
|
|
added the extensible jail parameters and hierarchical jails.
|