Skip to contentSkip to conversation

selinux branch: new program: runcon

PATCH Jim Meyering 3 participants 4 messages Feb 2, 2007 – Feb 7, 2007 SELinux security module

lore
Share & tools
lore
#0 lore raw

Here's the delta:

---
 AUTHORS            |    1 +
 ChangeLog-selinux  |   11 +++
 README             |   10 +-
 man/Makefile.am    |    4 +-
 man/runcon.x       |   14 +++
 po/ChangeLog       |    4 +
 po/POTFILES.in     |    1 +
 src/Makefile.am    |    4 +-
 src/runcon.c       |  249 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/help-version |    3 +-
 10 files changed, 293 insertions(+), 8 deletions(-)
 create mode 100644 man/runcon.x
 create mode 100644 src/runcon.c
AUTHORS +1 -0
index 11e02c5..9a8b2c9 100644
@@ -61,6 +61,7 @@ pwd: Jim Meyering
 readlink: Dmitry V. Levin
 rm: Paul Rubin, David MacKenzie, Richard Stallman, Jim Meyering
 rmdir: David MacKenzie
+runcon: Russell Coker
 seq: Ulrich Drepper
 sha1sum: Ulrich Drepper, Scott Miller, David Madore
 sha224sum: Ulrich Drepper, Scott Miller, David Madore
ChangeLog-selinux +11 -0
index 7a27296..63df994 100644
@@ -1,3 +1,14 @@
+2007-02-02  Jim Meyering  <[email protected]>
+
+	* src/runcon.c: New program.
+	* src/Makefile.am (bin_PROGRAMS): Add runcon.
+	(runcon_LDADD): Define.
+	* README: Add runcon to the list of programs.
+	* AUTHORS: Add this: runcon: Russell Coker
+	* tests/help-version: Add runcon as an exception.
+	* man/Makefile.am (dist_man_MANS): Add runcon.1.
+	(runcon.1): New dependency.
+
 2007-01-31  Jim Meyering  <[email protected]>
 
 	mkfifo, mknod: Accept new "-Z, --context=C" option.
README +5 -5
index ad22de5..ef04add 100644
@@ -10,11 +10,11 @@ The programs that can be built with this package are:
   [ base64 basename cat chcon chgrp chmod chown chroot cksum comm cp
   csplit cut date dd df dir dircolors dirname du echo env expand expr
   factor false fmt fold ginstall groups head hostid hostname id join
-  kill link ln logname ls md5sum mkdir mkfifo mknod mv nice nl nohup od
-  paste pathchk pinky pr printenv printf ptx pwd readlink rm rmdir seq
-  sha1sum sha224sum sha256sum sha384sum sha512sum shred shuf sleep sort
-  split stat stty su sum sync tac tail tee test touch tr true tsort tty
-  uname unexpand uniq unlink uptime users vdir wc who whoami yes
+  kill link ln logname ls md5sum mkdir mkfifo mknod mv nice nl nohup
+  od paste pathchk pinky pr printenv printf ptx pwd readlink rm rmdir
+  runcon seq sha1sum sha224sum sha256sum sha384sum sha512sum shred shuf
+  sleep sort split stat stty su sum sync tac tail tee test touch tr true
+  tsort tty uname unexpand uniq unlink uptime users vdir wc who whoami yes
 
 See the file NEWS for a list of major changes in the current release.
 
man/Makefile.am +3 -1
index 1047b10..c9a74f6 100644
@@ -25,7 +25,8 @@ dist_man_MANS = \
   link.1 ln.1 logname.1 \
   ls.1 md5sum.1 mkdir.1 mkfifo.1 mknod.1 mv.1 nl.1 nohup.1 od.1 \
   paste.1 pathchk.1 pr.1 printenv.1 printf.1 ptx.1 pwd.1 readlink.1 \
-  rm.1 rmdir.1 seq.1 sha1sum.1 sha224sum.1 sha256sum.1 sha384sum.1 sha512sum.1 \
+  rm.1 rmdir.1 runcon.1 seq.1 \
+  sha1sum.1 sha224sum.1 sha256sum.1 sha384sum.1 sha512sum.1 \
   shred.1 shuf.1 sleep.1 sort.1 split.1 stat.1 \
   su.1 sum.1 sync.1 tac.1 tail.1 tee.1 test.1 touch.1 tr.1 true.1 tsort.1 \
   tty.1 unexpand.1 uniq.1 unlink.1 vdir.1 wc.1 \
@@ -105,6 +106,7 @@ pwd.1:		$(common_dep)	$(srcdir)/pwd.x		../src/pwd.c
 readlink.1:	$(common_dep)	$(srcdir)/readlink.x	../src/readlink.c
 rm.1:		$(common_dep)	$(srcdir)/rm.x		../src/rm.c
 rmdir.1:	$(common_dep)	$(srcdir)/rmdir.x	../src/rmdir.c
+runcon.1:	$(common_dep)	$(srcdir)/runcon.x	../src/runcon.c
 seq.1:		$(common_dep)	$(srcdir)/seq.x		../src/seq.c
 sha1sum.1:	$(common_dep)	$(srcdir)/sha1sum.x	../src/md5sum.c
 sha224sum.1:	$(common_dep)	$(srcdir)/sha224sum.x	../src/md5sum.c
man/runcon.x new file +14 -0
new file mode 100644
index 0000000..d2df13e
@@ -0,0 +1,14 @@
+[NAME]
+runcon \- run command with specified security context
+[DESCRIPTION]
+Run COMMAND with completely-specified CONTEXT, or with current or
+transitioned security context modified by one or more of LEVEL,
+ROLE, TYPE, and USER.
+.PP
+If none of \fI-c\fR, \fI-t\fR, \fI-u\fR, \fI-r\fR, or \fI-l\fR, is specified,
+the first argument is used as the complete context.  Any additional
+arguments after \fICOMMAND\fR are interpreted as arguments to the
+command.
+.PP
+Note that only carefully-chosen contexts are likely to successfully
+run.
po/ChangeLog +4 -0
index ad54a09..709c42e 100644
@@ -1,3 +1,7 @@
+2007-02-02  Jim Meyering  <[email protected]>
+
+	* POTFILES.in: Add src/runcon.c.
+
 2007-01-13  Jim Meyering  <[email protected]>
 
 	* POTFILES.in: Add src/chcon.c.
po/POTFILES.in +1 -0
index 8592947..c9679f1 100644
@@ -91,6 +91,7 @@ src/readlink.c
 src/remove.c
 src/rm.c
 src/rmdir.c
+src/runcon.c
 src/seq.c
 src/setuidgid.c
 src/shred.c
src/Makefile.am +3 -1
index ca9d968..670d51b 100644
@@ -26,7 +26,8 @@ bin_PROGRAMS = [ chcon chgrp chown chmod cp dd dircolors du \
   nl od paste pr ptx sha1sum sha224sum sha256sum sha384sum sha512sum \
   shuf sort split sum tac tail tr tsort unexpand uniq wc \
   basename date dirname echo env expr factor false \
-  hostname id kill logname pathchk printenv printf pwd seq sleep tee \
+  hostname id kill logname pathchk printenv printf pwd \
+  runcon seq sleep tee \
   test true tty whoami yes \
   base64 \
   $(OPTIONAL_BIN_PROGS) $(DF_PROG)
@@ -67,6 +68,7 @@ mkdir_LDADD = $(LDADD) $(LIB_SELINUX)
 mkfifo_LDADD = $(LDADD) $(LIB_SELINUX)
 mknod_LDADD = $(LDADD) $(LIB_SELINUX)
 mv_LDADD = $(LDADD) $(LIB_EACCESS) $(LIB_SELINUX)
+runcon_LDADD = $(LDADD) $(LIB_SELINUX)
 pathchk_LDADD = $(LDADD) $(LIB_EACCESS)
 rm_LDADD = $(LDADD) $(LIB_EACCESS)
 test_LDADD = $(LDADD) $(LIB_EACCESS)
src/runcon.c new file +249 -0

249 lines not on this page · raw message

tests/help-version +2 -1
index d3c9bfb..3dea4d1 100755
@@ -72,6 +72,7 @@ for lang in C fr da; do
     # Skip `test'; it doesn't accept --help or --version.
     test $i = test && continue;
     test $i = chcon && continue;
+    test $i = runcon && continue;
 
     # false fails even when invoked with --help or --version.
     if test $i = false; then
@@ -197,7 +198,7 @@ lbracket_args=": ]"
 
 for i in $all_programs; do
   # Skip these.
-  case $i in chroot|stty|tty|false|chcon) continue;; esac
+  case $i in chroot|stty|tty|false|chcon|runcon) continue;; esac
 
   rm -rf $tmp_in $tmp_in2 $tmp_dir $tmp_out
   echo > $tmp_in

--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.

#1 lore raw
Quoted 1 line · Jim Meyering

+runcon: Russell Coker

I didn't write runcon, probably one of the NSA guys deserves credit for that. But it's been hacked on by enough people that correct and detailed attribution may be difficult.

It might be best to just have a section for attributing people who worked on the SE Linux utilities and patches. It'll save the effort of tracking exactly who wrote what - and I doubt that anyone will be fighting about which little patch should have their name on it.

Signature · 9 lines
[email protected]
http://etbe.blogspot.com/          My Blog

http://www.coker.com.au/sponsorship.html Sponsoring Free Software development

--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.
#2 lore raw
Quoted 11 lines · Russell Coker
Quoted 1 line · Jim Meyering

+runcon: Russell Coker

I didn't write runcon, probably one of the NSA guys deserves credit for that. But it's been hacked on by enough people that correct and detailed attribution may be difficult.

It might be best to just have a section for attributing people who worked on the SE Linux utilities and patches. It'll save the effort of tracking exactly who wrote what - and I doubt that anyone will be fighting about which little patch should have their name on it.

IIRC, runcon was originally called "runas", and was first written by someone from SCC, originally as a patch against the old sh-utils. Russell ported the old fileutils and sh-utils patches over to coreutils for Debian. Dan Walsh ported runas (and most of the other selinux userland patches) to use the new SELinux API in Linux 2.6, renaming it to runcon at that time at my suggestion to make its purpose clearer. TCS patched it to support the -c option (compute transition).

Signature · 8 lines
Stephen Smalley
National Security Agency


--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.
#3 lore raw
Quoted 7 lines · Stephen Smalley
Quoted 6 lines · Russell Coker
Quoted 1 line · Jim Meyering

+runcon: Russell Coker

I didn't write runcon, probably one of the NSA guys deserves credit for that. But it's been hacked on by enough people that correct and detailed attribution may be difficult.

We can certainly list a few more.

Quoted 4 lines
Quoted 4 lines

It might be best to just have a section for attributing people who worked on the SE Linux utilities and patches. It'll save the effort of tracking exactly who wrote what - and I doubt that anyone will be fighting about which little patch should have their name on it.

Good idea.
Can you give me a list of names?
I'll be happy to add that to the ChangeLog.

Quoted 7 lines

IIRC, runcon was originally called "runas", and was first written by someone from SCC, originally as a patch against the old sh-utils. Russell ported the old fileutils and sh-utils patches over to coreutils for Debian. Dan Walsh ported runas (and most of the other selinux userland patches) to use the new SELinux API in Linux 2.6, renaming it to runcon at that time at my suggestion to make its purpose clearer. TCS patched it to support the -c option (compute transition).

Thanks to both of you for the clarification.
Does anyone know the name of the original "runas" author? For now, I'll adjust the runcon authorship to say Russell Coker and Dan Walsh. Additions welcome.

--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.