Commit Graph

338 Commits

Author SHA1 Message Date
Eric Paris 3e4ab5e506 policycoreutils: genhomedircon: regenerate genhomedircon more often
The semodule_path file, inside scripts, which is used to tell the
Makefile where genhomedircon should point to find semodule, was not
being updated.  This patch makes sure we update this file every time
something builds, thus genhomedircon doesn't point to some wild out of
data file location.

Signed-off-by: Eric Paris <eparis@redhat.com>
2013-02-05 20:14:48 -05:00
Dan Walsh b2de32675a policycoreutils: gui: If you are not able to read enforcemode set it to False
Signed-off-by: Eric Paris <eparis@redhat.com>
2013-02-05 20:14:47 -05:00
Dan Walsh f27af4a6fb policycoreutils: restorecond: remove /etc/mtab from default list
/etc/mtab points to /proc/mounts in modern systems.  Remove the entry to
try to update its label.

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2013-02-05 20:14:46 -05:00
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
Dan Walsh 017d35aad4 policycoreutils: gui: system-config-selinux: do not use lokkit
We should be able to make changed to /etc/selinux/config without using lokkit

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2013-02-05 20:14:46 -05:00
Dan Walsh da867f68b2 policycoreutils: semanage: good error message is sepolgen python module missing
We only need the sepolgen python module if we are setting up permissive
types.  As this has been removed from the core code in Fedora/RHEL we
include a better user error message pointing them how to find the
required module.

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2013-02-05 20:14:42 -05:00
Eric Paris c247992d38 policycoreutils: semanage: list logins file entries in semanage login -l
If there are entries in /etc/selinux/[POLICY]/logins they should be
included in the semange login -l output.  So do so!

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2013-02-05 20:14:42 -05:00
Dan Walsh 36f1ccbb57 policycoreutils: setfiles: print error if no default label found
If a user requested a label be reset but no default label is specified,
give a useful error message.  Do not print the message if this is a
recursive restore, and that is very common.

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2013-02-05 20:14:41 -05:00
Dan Walsh dd6c619ccb policycoreutils: gui: system-config-selinux: Catch no DISPLAY= error
Better error/crash if run without DISPLAY set.

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2013-02-05 20:14:41 -05:00
rhatdan 8904ffe4de policycoreutils: semanage: man: roles instead of role
The man page shows --role as an option, but the real option is --roles.
Fix the man page.

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2013-02-05 20:14:41 -05:00
rhatdan 4369fbf740 policycoreutils: semanage: Fix handling of boolean_sub names when using the -F flag
Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2013-02-05 20:14:41 -05:00
rhatdan 9786fde981 policycoreutils: qualifier to shred content
Add a new sandbox option to run /usr/bin/shred on all files in the temp
directories before they are deleted.

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2013-02-05 20:14:41 -05:00
rhatdan 067a436cf5 policycoreutils: sandbox: Copy /var/tmp to /tmp as they are the same inside
Since /tmp and /var/tmp get mounted over each other in sandbox we should
take the data from both.

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2013-02-05 20:14:40 -05:00
rhatdan 45b324e27b policycoreutils: gui: Start using Popen, instead of os.spawnl
Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2013-02-05 20:14:40 -05:00
Eric Paris 9ab6c92276 policycoreutils: semanage: seobject verify policy types before allowing you to assign them.
We should check that a type is a valid before assigning it with
semanage.  Aka we should just that a type is a port type before assigning it
to a port, or a valid user type before assigning it to a user.

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2013-02-05 20:14:39 -05:00
Eric Paris 11e995791d policycoreutils: po: stop running update-po on all
update-po  is a mechanism for sucking the latest english translations
out of the source code, but it ALWAYS updates all of the po files with things
like the last time the update-po was run even if there are no changes. This
results in having to do git checkins any time you run make at the top level.

Since so few people interact with the Translators I believe this should
be done on demand when they think it is time to get new translations.

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2013-02-05 20:14:39 -05:00
Eric Paris 1683203efd policycoreutils: add po file configuration information
Add po file configuration information.

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2013-02-05 20:14:38 -05:00
rhatdan 71df1ec308 policycoreutils: semanage: use sepolicy for boolean dictionary
Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2013-02-05 20:14:38 -05:00
rhatdan ef4836b258 policycoreutils: gui: sepolgen: use sepolicy to generate
Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2013-02-05 20:14:38 -05:00
Dan Walsh e2de21c872 policycoreutils: gui: switch to use sepolicy
Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2013-02-05 20:14:38 -05:00
Eric Paris e9ddd965d4 policycoreutils: sandbox: use sepolicy to look for sandbox_t
Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2013-02-05 20:14:38 -05:00
rhatdan eef048fc97 policycoreutils: sepolicy: Update Makefiles and po files
Start building and translating the nice new sepolicy.

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2013-02-05 20:14:37 -05:00
Eric Paris 1dce0bf16d policycoreutils: sepolicy: new command to unite small utilities
Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2013-02-05 20:14:28 -05:00
Eric Paris aed9430bba policycoreutils: Rebuild polgen.glade with glade-3
Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2013-02-01 12:12:37 -05:00
rhatdan 4c25c40cfa policycoreutils: load_policy: make link at the destination directory
Pay attention to DESTDIR and friends, don't just use /sbin/

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2013-02-01 12:09:58 -05:00
John Reiser 960d6ee879 policycoreutils: setfiles: estimate percent progress
This patch started with work from John Reiser patch to estimate the
percent progress for restorecon/setfiles.

It has a lot of changes since then, to make it only happen on full
relabel, overwrite itself, shows 10ths of %, and does a lot better and
more useful job of estimation.  We get all of the inodes on all mounted
FS.  Since the number of inodes is not fixed and only an estimate I added
5% to the inode number, and forced the number to never go over 100.

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2013-02-01 12:08:51 -05:00
Eric Paris fec715a6f2 policycoreutils: po: remove bad selinux.tbl line from Makefile
selinux.tbl is a Fedora translation file that doesn't make sense in
policycoreutils.  Until we figure out how to deal with it, I'm not going
to push it.  But I accidentally included it in the update-po make
target.  Remove it from the make target.

Signed-off-by: Eric Paris <eparis@redhat.com>
2012-09-14 13:41:22 -04:00
Eric Paris 8638197342 Version bumps for upstream push 2012-09-13 10:33:58 -04:00
Guido Trentalancia 46ce32a6ee policycoreutils: genhomedircon: dynamically create genhomedircon
It dynamically creates the policycoreutils "genhomedircon"
script during the build process in order not to hard-code
the full path to the semodule executable, as in general the
latter could reside in non-standard SBINDIR/USRSBINDIR
locations.

It might not be very stylish or it might appear cumbersome,
but at least the script should not break as easily as the
current static one.

The patch also edits the Makefile for the scripts so that
LOCALEDIR correctly uses $(PREFIX) rather than an absolute
path.

Signed-off-by: Guido Trentalancia <guido@trentalancia.com>
Signed-off-by: Eric Paris <eparis@redhat.com>
2012-09-12 21:15:41 -04:00
Guido Trentalancia 46b60eee89 policycoreutils: restorecond: relabel all mount runtime files in the restorecond example config
Ship a restorecond.conf file that relabels all mount runtime files under /etc and
not just /etc/mtab.

Mount also uses /etc/mtab~[0-9]{0,20} lock files (the number corresponds to the
PID) and the /etc/mtab.tmp temporary file.

The above refers to mount from util-linux-2.21.2 from kernel.org. See mount -vvv
for the location of such files.

A patch is also available for the reference policy to fix this issue.

Signed-off-by: Guido Trentalancia <guido@trentalancia.com>
Signed-off-by: Eric Paris <eparis@redhat.com>
2012-09-12 21:14:42 -04:00
Guido Trentalancia b8067636b6 policycoreutils: semanage: skip comments while reading external configuration files
Fix fcontextRecords() in policycoreutils/semanage/seobject.py so
that semanage does not produce an error in fcontext mode when
the file_contexts.subs_dist file contains comments (prefixed by #).

Properly skip blank lines.

Treat both white space and tab as valid separators for the above
mentioned policy configuration file (v2). Minimum number of
changes (v2bis).

Signed-off-by: Guido Trentalancia <guido@trentalancia.com>
Reported-by: Sven Vermeulen <sven.vermeulen@siphos.be>
Signed-off-by: Eric Paris <eparis@redhat.com>
2012-09-12 21:11:28 -04:00
Eric Paris 628bcc69e2 policycoreutils: sepolgen: return and output constraint violation information
update sepolgen to return constraint violation information.  Then output
that information in audit2allow.

Signed-off-by: Eric Paris <eparis@redhat.com>
2012-09-12 15:08:56 -04:00
Dan Walsh 30db6f423b policycoreutils: sandbox: Make sure Xephyr never listens on tcp ports
Signed-off-by: Eric Paris <eparis@redhat.com>
2012-09-12 14:30:22 -04:00
Dan Walsh 3babdf190b policycoreutils: semanage: use boolean subs.
This fixes a problem in xguest which is using the old
name of the boolean an blowing up on install.

Signed-off-by: Eric Paris <eparis@redhat.com>
2012-09-12 12:16:19 -04:00
Dan Walsh e4f0a20ee1 polciycoreutils: setsebool: error when setting multiple options
If one were to use multiple options such as both -P and -N we would have
problems.  The issue is that for some reason instead of looking at
optind (the first non-option) we were looking at argc-optind.  These
happen to be the same if there are 0 or 1 options, but doesn't work with
more than 1 option.

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2012-09-12 12:16:17 -04:00
Dan Walsh cef1d08d1e policycoreutils: fixfiles: tell restorecon to ignore missing paths
Restorecon should default to ignore missing files.

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2012-09-12 12:16:17 -04:00
Dan Walsh f6595e357f policycoreutils: setfiles: return errors when bad paths are given
Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2012-09-12 12:16:16 -04:00
Dan Walsh 39d6b469ba policycoreutils: gui: Fix missing error function
And change to not use = with setsebool, purely cosmetic

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2012-09-12 12:16:16 -04:00
Dan Walsh ff78e21ef8 policycoreutils: gui: polgen: follow symlinks and get the real path to the executable to be confined
Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2012-09-12 12:16:15 -04:00
Dan Walsh f627d9a8ce policycoreutils: gui: polgen: sort selinux types of user controls
Just cosmetic.  Make them all line up the same way in case anyone ever
looks at the code.

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2012-09-12 12:16:15 -04:00
Dan Walsh 7ae7858a6b policycoreutils: semodule: Add -N qualifier to no reload kernel policy
This makes semodule consistent with other commands to no reload the
policy into the kernel after the given change.

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2012-09-12 12:16:15 -04:00
Dan Walsh 413b4933ee policycoreutils: setsebool: -N should not reload policy on changes
Fix setsebool to use -N to not reload policy into the kernel optional on
permanant changes.

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2012-09-12 12:16:14 -04:00
Dan Walsh 82415fa1b0 policycoreutils: sandbox: manpage update to describe standard types
add some definition to the standard types available for sandboxes so
users have a way to know about them and what they are intended to be
used for.

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2012-09-12 12:16:14 -04:00
Dan Walsh e5962bb179 policycoreutils: semanage: option to not load new policy into kernel after changes
Add -N, --noreload option to semanage to prevent reloading policy into
the kernel after a change.

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2012-09-12 12:16:13 -04:00
Dan Walsh cf87e75d45 policycoreutils: return equivalency records in fcontext customized
fcontext customized was not returning the customized equivalency records.  This
patches fixes this.

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2012-09-12 12:16:13 -04:00
Dan Walsh c48b7fe336 policycoreutils: gui: remove lockdown wizard
Future systems will not support html in a pygtk window as webkit is
going away.  I decided to add the full set of gui tools and then remove
the one I don't want to support just in case someone wants to resurrect
this at some point.

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2012-09-12 12:16:12 -04:00
Dan Walsh c5cf981869 policycoreutils: Add Makefiles to support new gui code
We added new gui programs, but not Makefiles to build/install them.

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2012-09-12 12:16:12 -04:00
Dan Walsh 514af85b89 policycoreutils: gui: system-config-selinux gui
These are the python files that make up the system-config-selinux gui, used to implement
most of the functionality of the semanage command line plus some configuration.

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2012-09-12 12:16:11 -04:00
Dan Walsh e34e28b150 policycoreutils: gui: for exploring booleans
This is a booleans lockdown gui, that can be used for exploring and locking
down booleans.

Signed-off-by: Eric Paris <eparis@redhat.com>
2012-09-12 12:16:11 -04:00
Miroslav Grepl 71f68548a5 policycoreutils: gui: polgen: search for systemd subpackage when generating policy
A number of packages have a systemd subpackage.  Look for those when
doing the file list of a package to generate its policy.

Signed-off-by: Eric Paris <eparis@redhat.com>
2012-09-12 12:16:10 -04:00