No description
Find a file
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
checkpolicy checkpolicy: libsepol: implement default type policy syntax 2013-02-05 20:14:46 -05:00
libselinux libselinux: Change boooleans.subs to booleans.subs_dist. 2013-02-05 20:14:46 -05:00
libsemanage libsemanage: fixes from coverity 2013-02-05 20:14:45 -05:00
libsepol checkpolicy: libsepol: implement default type policy syntax 2013-02-05 20:14:46 -05:00
policycoreutils policycoreutils: secon: add support for setrans color information in prompt output 2013-02-05 20:14:46 -05:00
scripts release script 2009-03-12 01:23:32 -04:00
sepolgen sepolgen: audit.py: Handle times in foreign locals for audit2allow -b 2013-02-05 20:14:40 -05:00
.gitignore global: gitignore: add a couple of more editor backup filetypes 2013-02-01 12:14:57 -05:00
Makefile libselinux: additional makefile support for rubywrap 2012-06-28 11:21:16 -04:00