selinux/policycoreutils
Paul Moore 0faee34ebd policycoreutils: secon: add support for setrans color information in prompt output
This patch adds support for displaying SELinux context information in
colors defined by mcstrans(8)/secolor.conf(5).  The new behavior is
enabled through the use of the "-C/--color" option and requires the
"-P" option also be specified.

The reason for this addition is that in some situations, notably MLS,
users find it helpful to add SELinux context information to their prompt:

	# example taken from the RHEL6 CC certification bash scripts
	SEROLE=`secon -rP 2>/dev/null`
	SEMLS=`secon -lP 2>/dev/null`
	PS1="[\u/$SEROLE/$SEMLS@\h \W]\\$ "
	export PS1

With the added functionality provided by this patch we can also display
the associated color information (note the addition of the "C" option):

	SEROLE=`secon -rP 2>/dev/null`
	SEMLS=`secon -lPC 2>/dev/null`
	PS1="[\u/$SEROLE/$SEMLS@\h \W]\\$ "
	export PS1

Note that in the example above only the MLS range is colored, but the
patch does provide support for all of the color information provided
by mcstransd/secolor.conf (user,role,type,range).

Finally, one quick word on the colors themselves; the secolor.conf
configuration file allows 32-bit colors but the ANSI color coding only
allows 8-bit colors so the colors displayed by secon using the "-C"
option will be a bit lossy.

Signed-off-by: Paul Moore <pmoore@redhat.com>
Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2013-02-05 20:14:46 -05:00
..
.tx policycoreutils: add po file configuration information 2013-02-05 20:14:38 -05:00
audit2allow policycoreutils: sepolgen: return and output constraint violation information 2012-09-12 15:08:56 -04:00
audit2why
gui policycoreutils: gui: system-config-selinux: do not use lokkit 2013-02-05 20:14:46 -05:00
load_policy policycoreutils: load_policy: make link at the destination directory 2013-02-01 12:09:58 -05:00
man
mcstrans policycoreutils: mcstrans: add -f to run in foreground 2012-06-28 13:29:23 -04:00
newrole policycoreutils: newrole: do not drop capabilities when newrole is run as root 2012-09-12 12:16:01 -04:00
po policycoreutils: po: stop running update-po on all 2013-02-05 20:14:39 -05:00
restorecond policycoreutils: restorecond: relabel all mount runtime files in the restorecond example config 2012-09-12 21:14:42 -04:00
run_init policycoreutils: run_init: If open_init_pty is not available then just use exec 2012-09-12 12:16:01 -04:00
sandbox policycoreutils: qualifier to shred content 2013-02-05 20:14:41 -05:00
scripts policycoreutils: setfiles: estimate percent progress 2013-02-01 12:08:51 -05:00
secon policycoreutils: secon: add support for setrans color information in prompt output 2013-02-05 20:14:46 -05:00
semanage policycoreutils: semanage: good error message is sepolgen python module missing 2013-02-05 20:14:42 -05:00
semodule policycoreutils: genhomedircon: dynamically create genhomedircon 2012-09-12 21:15:41 -04:00
semodule_deps
semodule_expand
semodule_link
semodule_package
sepolgen-ifgen
sepolicy policycoreutils: sepolicy: new command to unite small utilities 2013-02-05 20:14:28 -05:00
sestatus
setfiles policycoreutils: setfiles: print error if no default label found 2013-02-05 20:14:41 -05:00
setsebool polciycoreutils: setsebool: error when setting multiple options 2012-09-12 12:16:17 -04:00
.gitignore policycoreutils: add po file configuration information 2013-02-05 20:14:38 -05:00
ChangeLog Version bumps for upstream push 2012-09-13 10:33:58 -04:00
COPYING
Makefile policycoreutils: sepolicy: Update Makefiles and po files 2013-02-05 20:14:37 -05:00
VERSION Version bumps for upstream push 2012-09-13 10:33:58 -04:00