mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Serge Hallyn <serue@us.ibm.com>
To: akpm@osdl.org
Cc: Chris Wright <chrisw@osdl.org>,
	linux-kernel@vger.kernel.org, serue@us.ibm.com
Subject: Re: [patch 3/3] lsm: add bsdjail documentation
Date: Wed, 06 Oct 2004 15:25:58 -0500	[thread overview]
Message-ID: <1097094358.6939.13.camel@serge.austin.ibm.com> (raw)
In-Reply-To: <1097094103.6939.5.camel@serge.austin.ibm.com>


Attached is a patch carrying the documentation for the bsdjail LSM.

Please apply.

Signed-off-by: Serge E. Hallyn <serue@us.ibm.com>

diff -Nrup linux-2.6.9-rc3-bk6/Documentation/bsdjail.txt linux-2.6.9-rc3-bk6-jail/Documentation/bsdjail.txt
--- linux-2.6.9-rc3-bk6/Documentation/bsdjail.txt	1969-12-31 18:00:00.000000000 -0600
+++ linux-2.6.9-rc3-bk6-jail/Documentation/bsdjail.txt	2004-10-06 10:51:46.000000000 -0500
@@ -0,0 +1,99 @@
+BSD Jail Linux Security Module
+Serge E. Hallyn <serue@us.ibm.com>
+
+Description:
+
+Implements a subset of the BSD Jail functionality as a Linux LSM.
+What is currently implemented:
+
+  If a proces is in a jail, it:
+
+    1. Is locked under a chroot (as are all children) which is not
+         vulnerable to the well-known chdir(..)(etc)chroot(.) escape.
+    2. Cannot mount or umount
+    3. Cannot send signals outside of jail
+    4. Cannot ptrace processes outside of jail
+    5. Cannot create devices
+    6. Cannot renice processes
+    7. Cannot load or unload modules
+    8. Cannot change network settings
+    9. May be assigned a specific ip address which will be used
+         for all it's socket binds.
+   10. Cannot see contents of /proc/<pid> entries of processes not in the
+         same jail.  (We hide their existence for convenience's sake, but
+         their existance can still be detected using, for instance, statfs)
+   11. Has no CAP_SYS_RAWIO capability (no ioperm/iopl)
+   12. May not share IPC resources with processes outside its own jail.
+   13. May find it's valid network address (if restricted) under
+       /proc/$$/attr/current.
+
+WARNINGS:
+The security of this module is very much dependent on the security
+of the rest of the system.  You must carefully think through your
+use of the system.
+
+Some examples:
+	1. If you leave /dev/hda1 in the jail, processes in the
+	jail can access that filesystem (i.e. /sbin/debugfs).
+	2. If you provide root access within a jail, this can of
+	course be used to setuid binaries in the jail.  Combined
+	with an unjailed regular user account, this gives jailed
+	users unjailed root access.  (thanks to Brad Spender for
+	pointing this out).  To protect against this, use jails
+	in private namespaces, with the jail filesystems mounted
+	ONLY within the jail namespaces.  For instance:
+
+$ # (Make sure /dev/hdc5 is not mounted anywhere)
+$ new_namespace_shell /bin/bash
+$ mount /dev/hdc5 /opt
+$ mount -t proc proc /opt/proc
+$ echo -n "root /opt" > /proc/$$/attr/exec
+$ echo -n "ip 9.53.94.111" > /proc/$$/attr/exec
+$ exec /bin/sh
+$ sshd
+$ apachectl start
+$ exit
+
+How to use:
+    1. modprobe bsdjail
+    [ 1.5 /sbin/ifconfig eth0:0 2.2.2.2;
+      1.6 /sbin/route add -host 2.2.2.2 dev eth0:0
+      (optional) ]
+    2. Make sure the root filesystem (ie /dev/hdc5) is not mounted
+       anywhere else.
+    3. exec_private_namespace /bin/sh
+    4. mount /dev/hdc5 /opt
+    5. mount -t proc proc /opt/proc
+    6. echo -n "root /opt" > /proc/$$/attr/exec
+       echo -n "ip 2.2.2.2" > /proc/$$/attr/exec (optional)
+    7. exec /bin/sh
+    8. sshd
+    9. exit
+
+The new shell will now run in a private jail on the filesystem on
+/dev/hdc5. If proc has been mounted under /dev/hdc5, then a "ps -auxw"
+under the jailed shell will show only entries for processes started under
+that jail.
+
+If a private IP was specified for the jail, then 
+		cat /proc/$$/attr/current
+will show the address for the private network device.  Other network
+devices will be visible through /sbin/ifconfig -a, but not usable.
+
+If the reading process is not in a jail, then
+		cat /proc/$$/attr/current
+returns information about the root and ip * for the target process,
+or "Not Jailed" if the target process is not jailed.
+
+Cat /proc/$$/attr/exec gives a list of the valid keywords to cat into
+/proc/$$/attr/exec when starting a jail.
+
+Current valid keywords for creating a jail are:
+
+     root: Root of jail's fs
+     ip: Ip addr for this jail
+     nrtask: Number of tasks in this jail
+     nice: The nice level for this jail.  (maybe should be min/max?)
+     slice: Max timeslice per process
+     data: Max size of DATA segment per process
+     memlock: Max size of memory which can be locked per process



  parent reply	other threads:[~2004-10-06 19:20 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-06 20:21 (patch 1/3) lsm: add control over /proc/<pid> visibility Serge Hallyn
2004-10-06 20:24 ` [patch 1/3] lsm: add bsdjail module Serge Hallyn
2004-10-06 23:26   ` Andrew Morton
2004-10-07  4:08     ` Serge E. Hallyn
2004-10-07  6:18       ` James Morris
2004-10-07  6:22         ` Andrew Morton
2004-10-07 16:06           ` Chris Wright
2004-10-07 18:40             ` Andrew Morton
2004-10-07 18:52               ` Chris Wright
2004-10-07 20:56                 ` Serge E. Hallyn
2004-10-10  6:24                 ` Herbert Poetzl
2004-10-07 12:06     ` Alan Cox
2004-10-07 19:01     ` [patch 2/3] " Serge E. Hallyn
2004-10-07 19:42       ` Chris Wright
2004-10-07 20:05         ` Andrew Morton
2004-10-08 18:05         ` Serge E. Hallyn
2004-10-10 10:41       ` Christoph Hellwig
2004-10-10 11:31         ` Serge E. Hallyn
2004-10-10 11:34           ` Christoph Hellwig
2004-10-11 13:47         ` Alan Cox
2004-10-12  7:00           ` Herbert Poetzl
2004-10-12  9:00             ` Christoph Hellwig
2004-10-12 12:27               ` Herbert Poetzl
2004-10-20 15:36                 ` Christoph Hellwig
2004-10-20 19:18                   ` Herbert Poetzl
2004-10-12 13:11           ` Serge E. Hallyn
2004-10-12 14:15             ` Christoph Hellwig
2004-10-12 22:35             ` Ulrich Drepper
2004-10-13  0:58               ` Serge E. Hallyn
2004-10-13  1:09                 ` Ulrich Drepper
2004-10-13  1:22                   ` Serge E. Hallyn
2004-10-13 15:26                     ` Stephen Smalley
2004-10-13  1:11               ` Chris Wright
2004-10-13 14:25               ` Stephen Smalley
2004-10-06 20:25 ` Serge Hallyn [this message]
2004-10-07 22:17   ` lsm: add bsdjail documentation Matthias Urlichs
2004-10-08 20:02     ` Serge E. Hallyn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1097094358.6939.13.camel@serge.austin.ibm.com \
    --to=serue@us.ibm.com \
    --cc=akpm@osdl.org \
    --cc=chrisw@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®