Commit Graph

21 Commits

Author SHA1 Message Date
Philip Paeps
cdafc85119 Add [-J jid_file] option to write out a JidFile, similar to a PidFile,
containing the jailid, path, hostname, ip and the command used to start
the jail.

PR:		misc/89883
Submitted by:	L. Jason Godsey <lannygodsey -at- yahoo.com>
Reviewed by:	phk
MFC after:	1 week
2005-12-03 17:32:39 +00:00
Xin LI
d1df3fcd3f Initialize lcap and pwd to NULL. This allows a WARNS=6 clean build,
hence bump it to 6.

Note that the last commit message was not quite accurate.  While the
assumption exists in the code, it's not possible to have an
uninitialized p there because if lflag is set when username is NULL
then execution would be terminated earlier.
2004-11-17 10:01:48 +00:00
Xin LI
95751846f1 The code path in main() dealing with lflag assumes that p was
initialized with NULL, while it is not.  So let's initialize
it.
2004-11-17 09:52:10 +00:00
Stefan Farfeleder
950cc39559 Pass an array of gid_t rather than an array of int to getgroups().
PR:	56646
2004-10-02 11:40:48 +00:00
Maxim Konovalov
5b242e8c08 o Add -l option to jail(8) similar to su(1): before running jail'ed
program under specific user's credentials, clean the environment and
set only a few variables.

PR:		bin/70024
Submitted by:	demon
MFC after:	1 month
2004-08-15 08:21:50 +00:00
Pawel Jakub Dawidek
232a681888 Prepare jail(8) utility for new functionality which will limit
seeing status of mounted file system for jailed processes.
Pass full path of jail's root directory to the kernel. mount(8) utility is
doing the same thing already.
2004-06-27 10:10:16 +00:00
Maxim Konovalov
927b481001 o Implement -U flag: run command as user which exists only in jail.
o getpwnam(3) returns NULL and does not set errno when the user does
  not exist.  Bail out with "no such user" instead of "Unknown error: 0".

PR:		bin/67262
Submitted by:	demon (-U flag)
MFC after:	3 weeks
2004-05-29 18:39:27 +00:00
Philippe Charnier
54ede02d10 add FBSDID 2003-07-06 12:44:11 +00:00
Mike Barcroft
25639ca722 Force output of jail ID (if necessary) before excuting the command,
otherwise redirection of stdout to a file using block buffering will
not complete in time.
2003-04-21 17:20:48 +00:00
Mike Barcroft
ebf5d9bc2c o Add jls(8) for listing active jails.
o Add jexec(8) to execute a command in an existing jail.
o Add -j option for killall(1) to kill all processes in a specified
  jail.
o Add -i option to jail(8) to output jail ID of newly created jail.
2003-04-09 03:04:12 +00:00
Maxim Konovalov
0389572f96 Free login_cap(3) resources after usage.
Submitted by:	demon
2003-04-07 10:16:37 +00:00
Maxim Konovalov
b026ec0eb8 o Fix error messages formatting, style.
Prodded by:	bde
Reviewed by:	bde
2003-04-02 09:20:08 +00:00
Maxim Konovalov
d6131f4b8e o Add -u <username> flag to jail(8): set user context before exec.
PR:		bin/44320
Submitted by:	Mike Matsnev <mike@po.cs.msu.su>
Reviewed by:	-current
MFC after:	6 weeks
2003-03-27 12:16:58 +00:00
Dag-Erling Smørgrav
d397408818 Usage style sweep: spell "usage" with a small 'u'.
Also change one case of blatant __progname abuse (several more remain)
This commit does not touch anything in src/{contrib,crypto,gnu}/.
2002-04-22 13:44:47 +00:00
Dima Dorfman
3876038a6f Add missing includes and sort includes. 2001-06-24 20:28:19 +00:00
Dima Dorfman
2694efd413 Include missing header files which define functions for which gcc has
builtints (e.g., exit, strcmp).
2001-06-24 20:25:23 +00:00
Poul-Henning Kamp
7248ef86e0 Add a version number field to the jail(2) argument so that future changes
can be handled intelligently.

WARNING:  you will need to reinstall #includes and recompile jail(8).
1999-09-19 08:36:37 +00:00
Peter Wemm
97d92980a9 $Id$ -> $FreeBSD$ 1999-08-28 01:35:59 +00:00
Poul-Henning Kamp
c020621f03 Various cosmetics.
Submitted by:	Rudolf Cejka <cejkar@dcse.fee.vutbr.cz>
Reviewed by:	phk
1999-05-05 19:23:45 +00:00
Poul-Henning Kamp
ce5c1cd1ff Fix various bogons.
Submitted by:	Rudolf Cejka <cejkar@dcse.fee.vutbr.cz>
Reviewed by:	phk
1999-05-04 18:20:53 +00:00
Poul-Henning Kamp
75c1354190 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