Commit graph

515 commits

Author SHA1 Message Date
Dan Walsh
ae1cedbac8 Handle audit2allow and audit2why with the same executable Remove audit2why directory and combine this into audit2allow directory 2013-10-24 13:58:39 -04:00
Dan Walsh
f7d40d920c We were asked to open output file for append rather then write. 2013-10-24 13:58:39 -04:00
Dan Walsh
69129b4983 Need to set the locale to current locale
Without this call the audit2allow -b command was failing in certain countries.
2013-10-24 13:58:39 -04:00
Dan Walsh
f8a46ac9b3 Update Translations 2013-10-24 13:58:39 -04:00
Dan Walsh
7eec00a5be Add selinux_current_policy_path, which returns the a pointer to the loaded policy
Also change audit2why to look at the loaded policy rather then searching on disk for
the policy file.  It is more likely that you are examining the running policy.
2013-10-24 13:58:38 -04:00
Dan Walsh
2af252621b Add missing man page for sefcontext_compile 2013-10-24 13:58:37 -04:00
Dan Walsh
2540b20096 Laurent Bigonville patch to fix various minor manpage issues and correct section numbering. 2013-10-24 13:58:37 -04:00
Dan Walsh
a8b3340288 Laurent Bigonville patch to allow overriding PATH Definitions in Makefiles 2013-10-24 13:58:37 -04:00
Dan Walsh
56b49ab711 Richard Haines patch that allows us discover constraint violation information
Basically we need this information to allow audit2allow/audit2why to better
describe which constraint is being broken.
2013-10-24 13:58:37 -04:00
Stephen Smalley
39b5a40295 Fix relabel target.
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2013-10-23 12:44:30 -04:00
Sven Vermeulen
d4209743e9 Open stdin as read/write
As per the discussion on the selinux development mailinglist, the tmux
application expects the stdin to be writeable. Although perhaps not the most
proper way, having newrole opening the descriptor in read/write keeps the
behaviour in line with what applications expect.

See also http://marc.info/?l=selinux&m=136518126930710&w=2

Signed-off-by: Sven Vermeulen <sven.vermeulen@siphos.be>
2013-10-16 15:24:22 -04:00
Sven Vermeulen
622ebe0994 Fix KeyError when using sepolicy transition
When calling "sepolicy transition", a KeyError exception occurred:

~# sepolicy transition -s sysadm_t -t portage_t
Traceback (most recent call last):
  File "/usr/bin/sepolicy-2.7", line 465, in <module>
    args.func(args)
  File "/usr/bin/sepolicy-2.7", line 309, in transition
    mytrans.output()
  File "/usr/lib64/python2.7/site-packages/sepolicy/transition.py", line 76, in output
    print self.out(self.source)
  File "/usr/lib64/python2.7/site-packages/sepolicy/transition.py", line 72, in out
    buf+= self.out(x, seen, "%s%s ... " % (header, name))
  File "/usr/lib64/python2.7/site-packages/sepolicy/transition.py", line 67, in out
    for t in self.sdict[name]["map"]:
KeyError: 'map'

By updating the code to first check if the "map" key is known to the dictionary
(and only then executing the mentioned code) this error is no longer prevalent:

~# sepolicy transition -s sysadm_t -t portage_t
sysadm_t @ portage_exec_t --> portage_t
sysadm_t ... dhcpc_t ... initrc_t ... puppet_t @ portage_exec_t --> portage_t
sysadm_t ... dhcpc_t ... initrc_t ... puppet_t ... portage_fetch_t @ portage_exec_t --> portage_t
sysadm_t ... dhcpc_t ... initrc_t ... crond_t @ portage_exec_t --> portage_t
sysadm_t ... dhcpc_t ... initrc_t ... crond_t ... system_cronjob_t @ portage_exec_t --> portage_t

Signed-off-by: Sven Vermeulen <sven.vermeulen@siphos.be>
2013-10-16 15:22:40 -04:00
Laurent Bigonville
c2824833a6 policycoreutils: Do not include LDFLAGS in CFLAGS when building sepolicy
For some reasons, -fpie and -fPIE are being set in LDFLAGS, this is
causing a FTBFS on Debian.

-fpie and -fPIE are anyway useless for libraries
2013-10-16 15:13:07 -04:00
Laurent Bigonville
3c20b742ca policycoreutils: init_policy() takes no arguments
Fix "function declaration isn't a prototype" error when
-Werror=strict-prototypes is set
2013-10-16 15:12:46 -04:00
Laurent Bigonville
0df52b1ecc policycoreutils: Fix semange alternative logging code
Fix semanage logging code when python-audit is not installed
2013-10-16 15:12:31 -04:00
Laurent Bigonville
84e085847d policycoreutils: Fix cases where hyphen were used as minus sign in manpages
And also other minor formating issues
2013-10-16 15:12:10 -04:00
Simon Ruderich
002280edbb policycoreutils: Allow overriding CFLAGS in setfiles and sestatus Makefiles
This is required to be able to pass hardening flags in Debian.
2013-10-16 15:03:16 -04:00
Russell Coker
d1c47e7d5a policycoreutils: Create correct man directory for run_init manpages 2013-10-16 15:02:57 -04:00
Laurent Bigonville
42bde9b2a6 Policycoreutils: Allow overriding INITDIR in restorecond Makefile 2013-10-16 15:01:07 -04:00
Eric Paris
e9410c9b06 VERSION BUMP FOR UPSTREAM PUSH 2013-02-05 20:22:02 -05:00
Eric Paris
5c0d7113de policycoreutils: sestatus: rewrite to shut up coverity
The code did:

len = strlen(string);
new_string = malloc(len);
strncpy(new_string, string, len - 1)

Which is perfectly legal, but it pissed off coverity because 99/100
times if you do new_string = malloc(strlen(string)) you are doing it
wrong (you didn't leave room for the nul).  I rewrote that area to just
use strdup and then to blank out the last character with a nul.  It's
clear what's going on and nothing looks 'tricky'.  It does cost us 1
byte of heap allocation.  I think we can live with that to have safer
looking string handling code.

Signed-off-by: Eric Paris <eparis@redhat.com>
2013-02-05 20:21:51 -05:00
Eric Paris
221e6d4665 policycoreutils: seunshare: do checking on setfsuid
setfsuid return codes were not being checked.  Add checks to make sure
we are switching from and to what we expect.  Bail (most places) if we
didn't switch successfully.

Signed-off-by: Eric Paris <eparis@redhat.com>
2013-02-05 20:14:51 -05:00
Eric Paris
0a5dc30456 policycoreutils: sandbox: seunshare: do not reassign realloc value
We were doing x = realloc(x, )  which is a big no no, since it leaks X
on allocation failure.  Found with static analysis tool from David
Malcolm.

Signed-off-by: Eric Paris <eparis@redhat.com>
2013-02-05 20:14:50 -05:00
Eric Paris
709e852aed policycoreutils: po: update translations
Signed-off-by: Eric Paris <eparis@redhat.com>
2013-02-05 20:14:49 -05:00
Dan Walsh
1730f7ca36 policycoreutils: fixfiles: relabel only after specific date
Turn verbose on for full relabel

Add check to see if / has a label, if not then force a full relabel.

Add ability to record OPTIONS into the the /.autorelabel file.

fixfiles -F onboot
writes out /.autorelabel with -F

fixfiles -B onboot
writes on /autorelaebl with -N BOOTDATE recorded.

The goal is to allow boot up sequence that sees /.autorelabel to hand any
options store in it, to fixfiles restore

OPTIONS=`cat /.autorelabel`
fixfiles $OPTIONS restore

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2013-02-05 20:14:49 -05:00
Dan Walsh
6697e4db8b policycoreutils: genhomedircon generation to allow spec file to pass in SEMODULE_PATH
Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2013-02-05 20:14:49 -05:00
Dan Walsh
88f2791330 policycoreutils: restorecond: Add /etc/udpatedb.conf to restorecond.conf
vmware is doing some nasty stuff with it

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2013-02-05 20:14:48 -05:00
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
Dan Walsh
e4bbd7cfa8 policycoreutils: gui: Checking in policy to support polgengui and sepolgen.
These are the tools that the Fedora team uses to build new policy.  sepolgen is a
console app that will take an executable and generate policy based on the RPM
specification and using nm -D to analyze the application.

We have found it very useful for generating quick policy to get the policy writer
working quickly.

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2012-09-12 12:16:10 -04:00
Eric Paris
c5721bdeeb policycoreutils: po: silence build process
Stop printing stuff on stderr when building the po translations.  (I'd
leave it alone if I knew how to put it on stdout)

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2012-09-12 12:16:09 -04:00
Eric Paris
9f78846a5f policycoreutils: translations: commit translations from Fedora community
The Fedora community has been working to translate a number of messages.
Commit those to the tree so all SELinux users can enjoy.

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2012-09-12 12:16:08 -04:00
Eric Paris
c026f5e2f1 policycoreutils: add .tx to gitignore
.tx is the transifex configuration directory which is used to pull the
latest translations from the transifex web site.

Signed-off-by: Eric Paris <eparis@redhat.com>
2012-09-12 12:16:05 -04:00
Dan Walsh
376d4def37 policycoreutils: semanage: allow enable/disable under -m
Fix --enable and --disable for modules to only work under -m options.
Without this patch you couldn't do -m and --enable.  We want that to
work.

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2012-09-12 12:16:05 -04:00
Martin Orr
af1c9091e3 policycoreutils: setfiles: Fix process_glob error handling
process_one_realpath returns 1 if it changed the context of the file but
process_glob treats all non-zero values as errors.  This results in
setfiles exiting with non-zero status even though it was successful.

Fix process_glob to only treat negative return values of
process_one_realpath as errors.

cf. http://bugs.debian.org/662990

Signed-off-by: Martin Orr <martin@martinorr.name>
Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2012-09-12 12:16:04 -04:00
Russell Coker
30ef7451bc policycoreutils: Make restorecon return 0 when a file has changed context with no error
restorecon should return 0 when a file has changed context with no
error. With the last version it's returning 1.

Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=662990

Signed-off-by: Laurent Bigonville <bigon@debian.org>
Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2012-09-12 12:16:04 -04:00
Dan Walsh
7e14d038c4 policycoreutils: Disable user restorecond by default
file_name trans should be good enough to handle this now, so why launch
it for every user?

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2012-09-12 12:16:03 -04:00
Dan Walsh
687ff489e6 policycoreutils: setfiles: do not syslog if no changes
Basically this change stops sysloging if the change did not actually
happen.

By default we do not modify a label if the type of the SELinug context
was unchanged, but we were sending a syslog message as if something had
changed.

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2012-09-12 12:16:03 -04:00
Dan Walsh
69d418551e policycoreutils: scripts: Don't syslog setfiles changes on a fixfiles restore
Fixfiles restore is called by auditrelabel, and was happening early in
the boot process, before the syslog system was up and running.  A bug
in systemd was causing relabels to take forever, while it waited for
the syslog's to complete.  This was fixed, but I still see no reason
to write thousands/millions of lines to syslog on a badly mislabled
machine and wanted this featured turned off.

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2012-09-12 12:16:02 -04:00
Dan Walsh
96cedba3e5 policycoreutils: restorecon: only update type by default
This patch allows us to use restorecon on MCS Separated File Systems or MLS
Environments,  Basically allows a user to check his type enforcement.

Signed-off-by: Dan Walsh <dwalsh@redhat.com>
Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2012-09-12 12:16:02 -04:00
Dan Walsh
e23c73a167 policycoreutils: newrole: do not drop capabilities when newrole is run as root
If you run newrole as root and it drops capabilities, the next shell
script does not have any capabilities and can not function.

newrole -L TopSecret

Would end up with a root shell and no capabilities.

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2012-09-12 12:16:01 -04:00
Eric Paris
d46e88abb6 policycoreutils: run_init: If open_init_pty is not available then just use exec
Sometimes using open_init_pty isn't possible.  So just call exec() if
that is the case.  We no longer ship open_init_pty in Fedora or RHEL6
since it was causing more problems then it was worth.  This fix makes
it optional to use the open_init_pty.

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2012-09-12 12:16:01 -04:00
Guido Trentalancia
f6b82ec701 policycoreutils: setfiles/restorecon minor improvements
- improves the manual page for both setfiles and restorecon (formatting
  including alphabetical re-ordering of options, undocumented options,
  references and a few cosmetic changes);
- de-hardcodes a couple of constants in the source files and makes a
  dynamic use of them to create the manual pages after the compilation
  and prior to the installation: more specifically the constants are the
  number of errors for the setfiles' validation process abort condition
  and the sensitivity of the progress meter for both programs (uses
  external programs grep and awk);
- improves the usage message for both programs and introduces a -h
  (aliased with currently existing -?) option where not already
  available;
- print out the usage message for restorecon when it is called without
  arguments;
- white-space/tab conversion to get proper indentation towards the end
  of the main source file.

[eparis add .gitignore]

Signed-off-by: Guido Trentalancia <guido@trentalancia.com>
Signed-off-by: Eric Paris <eparis@redhat.com>
2012-09-12 12:16:00 -04:00
Guido Trentalancia
876f5faede policycoreutils: genhomedircon: manual page improvements
The following patch aims to improve the manual page (section 8) for the
"genhomedircon" script (policycoreutils).

- remove probably redundant GNU licence notice;
- try to further clarify the functionality made available by the
  "genhomedircon" script as well as all the configurable options that
  control its execution and affect its behavior;
- extend the references section (SEE ALSO).

Signed-off-by: Guido Trentalancia <guido@trentalancia.com>
Signed-off-by: Eric Paris <eparis@redhat.com>
2012-09-12 12:16:00 -04:00
Eric Paris
f05a71b92d Version bumps for upstream push 2012-06-28 14:02:29 -04:00
Dan Walsh
0ea11e7315 sepolgen: Make use of setools optional within sepolgen
We still want to be able to use sepolgen even if setools isn't
installed.  Degrade functionality, but still work if it can't be found.

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwlash@redhat.com>
2012-06-28 13:29:23 -04:00
Eric Paris
d36ba198ba policycoreutils: semanage: locallist option does not take an argument
The locallist option was specified as --locallist= but it does not take
an option.  We also had --localist (notice the 'l' is missing) which
wasn't doing anything, so drop those.

Signed-off-by: Eric Paris <eparis@redhat.com>
2012-06-28 13:29:23 -04:00
Dan Walsh
14f81c15a5 policycoreutils: semanage: dontaudit off should work
The OBJECT was not being set early enough and thus would miss the checks
for things like deleteall and extract.  Move the setting of OBJECT where
it happens for everything else.

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2012-06-28 13:29:23 -04:00
Dan Walsh
7753c11341 policycoreutils: semanage: manpage update for -e
semanage fcontext -e man page update to make it easier to understand
what it does.

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2012-06-28 13:29:23 -04:00
Dan Walsh
b68435fbea policycoreutils: semanage: bash completion for modules should include -a,-m, -d
Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2012-06-28 13:29:23 -04:00
Dan Walsh
15f65f2e09 policycoreutils: semanage: fix man page range and level defaults
The range and level user options default to s0.  State that in the man
page.

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2012-06-28 13:29:23 -04:00
Dan Walsh
8ca93d6b9d policycoreutils: mcstrans: add -f to run in foreground
Add an -f option to run mcstransd in the foreground.  This will allow better
integration into systemd.

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2012-06-28 13:29:23 -04:00
Eric Paris
9eac5305c6 policycoreutils: resorecond: user: fix fd leak
We open and take a flock on the .restorecond file.  But we could leak
this file across exec.  Open O_CLOEXEC.

Signed-off-by: Eric Paris <eparis@redhat.com>
2012-06-28 13:29:23 -04:00
Dan Walsh
2f9fdc2781 policycoreutils: restorecond: Add -h option to get usage command
Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2012-06-28 13:29:23 -04:00
Eric Paris
e8888a7f16 polciycoreutils: restorecond: wrong options should exit with non-zero error code
Instead of all calls to the usage output resulting in a 0 return code we
should show the usage menu when something is wrong but we should return
non-zero.

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2012-06-28 13:29:23 -04:00
Eric Paris
7a86fe1a3d bump version and changelog for upstream push 2012-03-28 15:44:05 -04:00
Eric Paris
aa34f19543 policycoreutils: do not fail to install if unable to make load_policy lnk file
With the switch in Fedora to unify /bin to /usr/bin the link file
created for load_policy points back at itself.  This patch causes make
to continue even if the link fails.

Signed-off-by: Eric Paris <eparis@redhat.com>
2012-03-28 15:08:52 -04:00
Eric Paris
cb9a5c40af policycoreutils: remove empty po files
et, gl, and id .po files contained no translations.  This can cause
build errors.  Delete those puppies.

Signed-off-by: Eric Paris <eparis@redhat.com>
2012-03-28 14:54:50 -04:00
Eric Paris
54a83e18e2 policycoreutils: update .po files
update policycoreutils po files.  This should hopefully make the debian
build system a little happier.

Requested-by: Laurent Bigonville <bigon@debian.org>
Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2012-03-28 14:52:14 -04:00
Manoj Srivastava
c124df61ae policycoreutils: Only run setfiles if we found read-write filesystems to run it on
Only run setfiles if we have a R/W filesystem

Signed-off-by: Laurent Bigonville <bigon@debian.org>
Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2012-03-28 14:52:14 -04:00
Laurent Bigonville
2ad5471bd3 policycoreutils: fix ftbfs with hardening flags
We are now building our packages with -Werror=format-security enabled.
The attached patch fix the FTBFS. More patch related to this could
follow.

Signed-off-by: Laurent Bigonville <bigon@debian.org>
Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2012-03-28 14:52:14 -04:00
Martin Orr
72ea5dec7c policycoreutils: Fix infinite loop with inotify on 2.6.31 kernels
With kernel 2.6.31, restorecond uses 99% of my CPU.

This is because removing and readding the watch on utmp triggers inotify to
return an IN_IGNORED event for the old watch descriptor.  If the watch gets
allocated the same wd when it is readded, then restorecond thinks that utmp
has changed, so removes and readds the watch again, potentially looping.

With kernel <= 2.6.30, this never happened, because the kernel didn't reuse
watch descriptors.  So the IN_IGNORED event comes with a wd that is no
longer in use, and gets ignored.  But kernel 2.6.31 reuses the same watch
descriptor.  The kernel has been fixed to not reuse watch descriptors.
However as some kernels do reuse them, and its possible they may again,
this patch fixes that by ignoring inotify events whose only bit set is
IN_IGNORED.

Signed-off-by: Martin Orr <martin@martinorr.name>
Signed-off-by: Manoj Srivastava <srivasta@debian.org>
Signed-off-by: Laurent Bigonville <bigon@debian.org>
Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2012-03-28 14:52:14 -04:00
Dan Walsh
40b0cea919 policycoreutils: newrole: Use correct capng calls in newrole
Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2012-03-28 14:52:13 -04:00
Dan Walsh
e5a81c715f policycoreutils: Add bash-completion scripts for setsebool and semanage
Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2012-03-28 14:52:13 -04:00
Dan Walsh
1f0b5bd920 policycoreutils: seunshare: Only drop caps not the Bounding Set from seunshare
This means you can still run setuid programs, but don't need special
perms to run seunshare.

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2012-03-28 14:52:13 -04:00
Dan Walsh
ae04ac5055 policycoreutils: mcstrans: Version should have been bumped on last check in
The previous time upstream was released, there were changes to
MCSTrans, but the version was never updated, In order for us to
release these fixes to Fedora we needed to bump the version.

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2012-03-28 14:52:13 -04:00
Dan Walsh
a56e91742f policycoreutils: scripts: Update Makefiles to handle /usrmove
Move everything into /usr/* and just put links from /*.  The whole /usr
thing hasn't really worked in all situations for a long long time.  Just
accept that fact and move along.

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2012-03-28 14:52:13 -04:00
Dan Walsh
bc6a56ce20 policycoreutils: semanage: audit message to show what record(s) and item(s) have chaged
Also if the user specifies a store that is not the current store, we should not be sending audit messages.

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2012-03-28 14:52:13 -04:00
Dan Walsh
a0e538c208 policycoreutils: semanage: proper auditting of user changes for LSPP
semanage command was not reporting proper audit messages for the LSPP
certification.  Needed to report additional information such as prior
roles before and after update. Many other changes, were reviewed by
Steve Grubb to make sure were were doing proper auditing.

Should be reporting AUDIT_ROLE_ASSIGN instead of AUDIT_USER_ROLE_CHANGE.

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2012-03-28 14:52:13 -04:00
Dan Walsh
137604222a policycoreutils: restorecond: Stop using deprecated interfaces for g_io
g_io_channel_read is deprecated.  Use g_io_channel_read_chars instead.

Signed-off-by: Eric Paris <eparis@redhat.com>
2012-03-28 14:52:00 -04:00
Dan Walsh
d4064c954f policycoreutils: sandbox: Removing sandbox init script, should no longer be necessary
Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2012-03-28 08:39:08 -04:00
Dan Walsh
70c582f4e0 policycoreutils: sandbox: do not propogate inside mounts outside
Fix the handling of namespaces in seunshare/sandbox.
Currently mounting of directories within sandbox is propogating to the
parent namesspace.  This fix will basically isolate any mounting that
happens after the unshare from the parent namespace.

Signed-off-by: Eric Paris <eparis@redhat.com
Acked-by: Dan Walsh <dwalsh@redhat.com>
2012-03-28 08:39:07 -04:00
Eric Paris
339f8079d7 update VERSION and Changelog for public push 2011-12-21 12:46:04 -05:00
Eric Paris
bd26462036 policycoreutils: semanage: drop unused translation getopt
Remove handling for T: in getopt, this should have been
removed when we removed manage of translation

Signed-off-by: Eric Paris <eparis@redhat.com>
2011-12-21 12:35:05 -05:00
Dan Walsh
c4c0748091 policycoreutils: Fix Makefile to match other policycoreutils Makefiles
Include -W
Set LDLIBS consistently (include -L$(LIBDIR))
Don't explicitly call $(CC) let make do it.

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2011-12-21 12:35:05 -05:00
Dan Walsh
17fc79a5f6 policycoreutils: sandbox: Add back in . functions to sandbox.init script
In order to handle properly the display on boot the sandbox init
script has to source the functions file.

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2011-12-21 12:25:28 -05:00
Eric Paris
efdcd1e981 policycoreutils: Remove excess whitespace
Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2011-12-21 12:25:28 -05:00
Eric Paris
d65c02f066 bump version and changelog 2011-12-05 16:20:45 -05:00
Eric Paris
beb7dedf7b policycoreutils: add clean target to man Makefile
Empty clean target just so you can run make clean

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2011-12-05 16:11:21 -05:00
Richard Haines
6aec573f80 policycoreutils: Added SELinux config file man page.
Added new man page selinux_config(5) detailing the SELinux config file
format to new man/man5 directory plus Makefile.

Signed-off-by: Richard Haines <richard_c_haines@btinternet.com>
Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2011-12-05 16:11:20 -05:00
Richard Haines
3e870d7c9b policycoreutils: sestatus: Updated sestatus and man pages.
sestatus has been modified to present additional information: SELinux root
directory, MLS flag and the deny_unknow flag. The man page has been updated
to reflect these changes and an sestatus.conf(5) man page has also been added.

Signed-off-by: Richard Haines <richard_c_haines@btinternet.com>
Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2011-12-05 16:10:38 -05:00
Dan Walsh
c705f0f4d8 policycoreutils: semanage: change src,dst to target,substitute for equivalency
No real code change.  Just to make it clear what a src and dst means.

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2011-12-05 16:10:38 -05:00
Dan Walsh
b96d0fac86 policycoreutils: semanage: Make sure semanage fcontext -l -C prints even if local keys are not defined
Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2011-12-05 16:10:38 -05:00
Eric Paris
79bcfa7286 policycoreutils: semanage: check file equivalence rules for conflict
Check for conflict on equivalence when adding a file context.
If a user adds a file context that begins with an equivalence string, we
throw an exception.

/usr/sbin/semanage: File spec /usr/lib64/dan conflicts with equivalency rule '/usr/lib64 /usr/lib'; Try adding '/usr/lib/dan' instead

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2011-12-05 16:10:37 -05:00
Dan Walsh
7dd4e1eee1 policycoreutils: semanage: print local and dristo equiv rules
Print out the list of local and distribution file context equivalencies
rather than just local rules.

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2011-12-05 16:10:37 -05:00
Dan Walsh
c00affcc3e policycoreutils: sandbox: init script run twice is still successful
If sandbox init script is run multiple times to start it should still
return 0 rather than an error.  Things should still be set up.

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2011-12-05 16:10:37 -05:00
Eric Paris
6c2ad1ce52 policycoreutils: sandbox: only complain if sandbox unable to launch
Instead of force an arbitrary 100 category requirement, only bomb if
there is a problem.  Error out if there are 0 categories or if we cannot
find a free category in a reasonable number of attempts.

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2011-12-05 16:10:37 -05:00
Dan Walsh
d9376680bd policycoreutils: sandbox: do not try forever to find available category set
We calculate the number of available legit category sets for a given
user and then try to find one that many times.  If we don't find one,
bail out.

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2011-12-05 16:10:37 -05:00
Dan Walsh
78b077cd09 policycoreutils: sandbox: make sure the domain launching sandbox has at least 100 categories
100 is very high, but at least we know the chances of finding a valid
combination is high.

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2011-12-05 16:10:37 -05:00
Dan Walsh
7ece124c51 policycoreutils: sandbox: Allow user to specify the DPI value for X in a sandbox
Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2011-12-05 16:10:37 -05:00
Dan Walsh
a6065e5ab7 policycoreutils: po: Makefile use -p to preserve times to allow multilib simultatious installs of po files
Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2011-12-05 16:10:37 -05:00
Eric Paris
cfb2a06e39 policycoreutils: sandbox: move sandbox.conf.5 to just sandbox.5
Since this file lives in /etc/sysconfig/ it does not include a .conf
extention.  Thus the man page should not include a .conf in the
filename.

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2011-12-05 16:10:35 -05:00
Eric Paris
14e4b70b93 Bump Version and Changelog for commit 2011-11-03 15:26:36 -04:00
Dan Walsh
10fb8fdbb1 policycoreutils: restorecond: Add .local/share as a directory to watch
Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2011-11-02 16:22:06 -04:00
Dan Walsh
b9b7bddb28 policycoreutils: setfiles: fix use before initialized
There are code paths where ret can be returned without being initialized

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2011-11-02 16:22:06 -04:00
Dan Walsh
24b31a9da5 policycoreutils: semodule: Document semodule -p in man page
Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2011-11-02 16:22:06 -04:00
Eric Paris
e018eec325 policycoreutils: setfiles: close /proc/mounts file when finished
When testing for mount points to exclude we read /proc/mounts.  Close
this file when we are finished reading it.

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2011-11-02 16:22:06 -04:00
Eric Paris
d5475a909a policycoreutils: make use of the new realpath_not_final function
Instead of coding the exact same thing and calling it symlink_realpath
use the function exported by libselinux.

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2011-11-02 16:22:06 -04:00
Dan Walsh
1486820665 policycoreutils: semanage: Add -o description to the semanage man page
Just a bit of documentation.

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2011-11-02 16:22:06 -04:00
Stephen Smalley
5e50b01fa4 policycoreutils: fix sandbox Makefile to support DESTDIR
Fix sandbox Makefile so that make DESTDIR=~/out install works again.

Signed-off-by:  Stephen Smalley <sds@tycho.nsa.gov>
Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2011-11-02 16:22:06 -04:00
Guido Trentalancia
88234671ed policycoreutils: semodule_package: remove semodule_unpackage on clean
semodule_unpackage was not being removed on clean.  Simple Makefile fix.

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2011-11-02 16:22:05 -04:00
Eric Paris
e134013ab7 policycoreutils: sandbox: introduce package name and language stuff
Add support for translations to the sandbox utility.

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2011-11-02 16:22:05 -04:00
Dan Walsh
4a145b76d0 policycoreutils: restorecond: make restorecond -u exit when terminal closes
Make restorecond -u watch the terminal io channel for and exit indicator
and then exit itself if it is not being run from dbus.  If being run
from dbus, dbus takes care of the session cleanup.

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2011-11-02 16:22:05 -04:00
Dan Walsh
9961ca6499 policycoreutils: restorecon: Always check return code on asprintf
Do not assume it is always a success and error gracefully when it isn't.

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2011-11-02 16:22:05 -04:00
Eric Paris
48681bb49c policycoreutils: restorecond: make restorecond dbuss-able
Basically this patch makes restorecond a dbus session service that can
be run in the users session to watch the creation of files in the
homedir.  Most of the changes are just to get it to run as a dbus
session and then to allow it to read its own config.

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2011-11-02 16:22:05 -04:00
Eric Paris
672eb80648 policycoreutils: semanage: set modified correctly
I think I was trying to allow an admin to set a bunch of booleans
from a file, but I later added -i and -o options, which would seem to
be a better way to handle many changes at once.

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2011-11-02 16:22:05 -04:00
Eric Paris
a67cd948c4 policycoreutils: semanage: missing modify=True
Basically we want to trigger a modify of booleans record if the user
specifies --on or --off on a boolean.

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2011-11-02 16:22:05 -04:00
Eric Paris
9ef48acb37 policycoreutils: semanage: update local boolean settings is dealing with localstore
If someone modifies the boolean settings using semanage, we would
expect them to be reflected on the local system.  This change would
change the active settings IFF you are changing the currently running
system.

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2011-11-02 16:22:05 -04:00
Eric Paris
1c15c8b537 policycoreutils: fixfiles: label /root but not /var/lib/BackupPC
This patch removes /root from the excluded dirs.

This also adds /var/lib/BackupPC to list of directories to ignore
labeling.  Mainly because this directory tends to be Huge and causes a
huge spike in the amount of time it takes to relabel.  Especially if
there is a relabel caused by a policy update.

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2011-11-02 16:22:05 -04:00
Eric Paris
9cc0749a73 policycoreutils: audit2allow: use audit2why internally
Rather than do things ourselves, use audit2why.

Signed-off-by: Eric Paris <eparis@redhat.com>
2011-11-02 16:22:05 -04:00
Dan Walsh
5c2a0d143d policycoreutils: sandbox: Maintain the LANG environment into the sandbox
When running an app within a sandbox, the application currently
switches to no LANG.  This patch will cause the sandboxed app to use
the users LANG.

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2011-11-02 16:22:05 -04:00
Steve Lawrence
2f68def633 libsepol: Move ebitmap_* functions from mcstrans to libsepol
This patches moves some ebitmap functions (and, xor, not, etc.) from
mcstrans into libsepol, where they really belong and could be used by
other applications (e.g. CIL)

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2011-11-02 15:37:11 -04:00
Eric Paris
468bff0952 tree: Makefiles: syntax, convert all ${VAR} to $(VAR)
This is purely personal preference.  Most of the Makefiles use $() for
Makefile variables, but a couple of places use ${}.  Since this obscured
some later Makefile changes I figured I'd just make them all the same up
front.

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2011-11-02 15:37:08 -04:00
Eric Paris
5054b9019a bump version and changelog 2011-09-27 13:54:19 -04:00
Eric Paris
cfdfe498b7 policycoreutils: semanage: fix indentation error in seobject
Some versions of python are reporting an indentation error when trying
to use this file.  Fix the whitespace messup.

Signed-off-by: Eric Paris <eparis@redhat.com>
2011-09-27 13:52:16 -04:00
Eric Paris
418dbc70e8 Bump version and changelog for all components. 2011-09-16 15:34:36 -04:00
Dan Walsh
7a653efffc policycoreutils: sandbox: do not load unused generic init functions
Change sandbox init script to not load functions any longer, we don't use them

Signed-off-by: Dan Walsh <dwalsh@redhat.com>
Signed-off-by: Eric Paris <eparis@redhat.com>
2011-09-16 11:54:04 -04:00
Guido Trentalancia
eb695e5a56 whole tree: default make target to all not install
Change the default "make" target for the libraries from "install" to
"all" in the makefiles.

Signed-off-by: Guido Trentalancia <guido@trentalancia.com>
Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2011-09-16 11:54:04 -04:00
Dan Walsh
9df5601b60 .gitignore: More files to ignore
add .pyc and the new unpackage to git ignore

Signed-off-by: Dan Walsh <dwalsh@redhat.com>
Signed-off-by: Eric Paris <eparis@redhat.com>
2011-09-16 11:54:04 -04:00
Dan Walsh
42a523c0bd policycoreutils: semanage: Catch RuntimeErrors, that can be generated when SELinux is disabled
Exit cleanly instead of python getting angry when SELinux is disabled.

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2011-09-16 11:54:03 -04:00
Dan Walsh
b1331909a0 policycoreutils: sepolgen: audit2allow is mistakakenly not allowing valid module names
module names must begin with a letter, optionally followed by letters,
numbers, "-", "_", "."\n'  some of these were being denied.

Signed-off-by: Eric Paris <eparis@redhat.com>
Signed-off-by: Dan Walsh <dwalsh@redhat.com>
2011-09-16 11:54:03 -04:00
Dan Walsh
adbd558c1c policycoreutils: semanage: Dont print heading if no items selected
If you tell semanage to list the contents of an object and the list is
empty, we should not print the header.

Signed-off-by: Eric Paris <eparis@redhat.com>
Signed-off-by: Dan Walsh <dwalsh@redhat.com>
2011-09-16 11:54:03 -04:00
Dan Walsh
90469f7f75 policycoreutils: semanage: show running and disk setting for booleans
Basically this patch will show the booleans current state in the system and
the state on disk.

Signed-off-by: Dan Walsh <dwalsh@redhat.com>
2011-09-16 11:54:02 -04:00
Harry Ciao
e4bc1b223d libsepol: libsemanage: policycoreutils: Create a new preserve_tunables flag in sepol_handle_t.
By default only the effective branch of a tunable conditional would be
expanded and written to raw policy, while all needless unused branches
would be discarded.

Add a new option '-P' or "--preserve_tunables" to the semodule program.
By default it is 0, if set to 1 then the above preserve_tunables flag
in the sepol_handle_t would be set to 1 accordingly.

Signed-off-by: Harry Ciao <qingtao.cao@windriver.com>
Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2011-09-16 11:54:02 -04:00
Dan Walsh
216f456401 policycoreutils: sandbox: cntrl-c should kill entire process control group
Change the signal handler to handle ctrl-C and exit properly

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2011-09-16 11:54:00 -04:00
Dan Walsh
e8575bf497 policycoreutils: sandbox: add level based kill option
add kill option to seunshare to kill all processes that are still running
with the execcon MCS label.

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2011-09-16 11:54:00 -04:00
Eric Paris
f37a6a71cb policycoreutils: sandbox: do not bind mount so much
pam_namespace and sandbox both do the bind mounts internally now.  No
reason to force this on everyone.  Hopefully the sandbox init script
will be disappearing with systemd doing this by default.

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2011-09-16 11:54:00 -04:00
Eric Paris
31edb319af policycoreutils: sandbox: rewrite /tmp handling
seunshare now creates a runtime temporary directory owned by root and
with the sticky bit set properly.  Files from the user-specified directory
are copied to the runtime directory and the changes synced back (using rsync)
at the end of the seunshare run.

This is hoped to address CVE-2011-1011

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2011-09-16 11:53:46 -04:00
Eric Paris
4347a5c01d policycoreutils: sandbox: add sandbox cgroup support
Add cgroup support

Signed-off-by: Eric Paris <eparis@redhat.com>
2011-09-15 19:20:44 -04:00
Eric Paris
3e532cffac policycoreutils: sandbox: add -Wall and -Werror to makefile
Just like everything else we should be erroring out on warnings.

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2011-09-15 19:20:43 -04:00
Dan Walsh
1d54976d73 policycoreutils: setfiles: do not wrap * output at 80 characters
Russell Coker pointed out most displays are no 80 chars so we should just
put out * and let the terminal wrap itself.

Signed-off-by: Dan Walsh <dwalsh@redhat.com>
Acked-by: Eric Paris <eparis@redhat.com>
2011-09-15 19:20:43 -04:00
Dan Walsh
f23e078018 policycoreutils: setfiles: Fix potential crash using dereferenced ftsent
If fts_read() fails for any reason ftsent will be NULL.  Previously we
would have reported the error and then continued processing.  Now we
report the error and stop using the NULL pointer.

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2011-09-15 19:20:43 -04:00
Eric Paris
a2db3f2df8 policycoreutils: setfiles: switch from stat to stat64
When we converted from nftw to fts we had to remove the automatic large
file support had to be removed.  Thus we switch from stat to stat64 on
all archs.

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2011-09-15 19:20:42 -04:00
Eric Paris
f14912ee6e policycoreutils: audit2allow: sepolgen-ifgen use the attr helper
This patch adds support to actually use the new sepolgen-ifgen attr
helper.  We included the helper which generates attribute information
but this patch makes use of it.

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2011-09-15 19:20:42 -04:00
Eric Paris
f4ecef50b2 policycoreutils: audit2allow: use alternate policy file
Add a --policy option to audit2allow to make it use an
alternate use specified policy instead of the running
policy.

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2011-09-15 17:19:20 -04:00
Eric Paris
5a2173519c policycoreutils: sepolgen-ifgen: new attr-helper does something
This program is used by sepolgen-ifgen to get the access for all of the
attributes in the policy so that it can resolve the typeattribute statements
in the interfaces.

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2011-09-15 17:19:20 -04:00
Eric Paris
1f8cf403be update changelog and versions for 2011-08-26 2011-08-26 15:11:58 -04:00
Dan Walsh
ddc5063c16 policycoreutils: setfiles: Fix process_glob to handle error situations properly
Rather than error when a glob does not match return success as this is
not a problem.

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Eric Paris <eparis@redhat.com>
2011-08-26 14:31:57 -04:00
Dan Walsh
a0e2e16878 policycoreutils: sandbox: Allow seunshare to run as root
Signed-off-by: Dan Walsh <dwalsh@redhat.com>
2011-08-26 14:31:56 -04:00
Dan Walsh
37644bfa93 policycoreutils: sandbox: trap sigterm to make sure sandbox exits with the proper exit code
Acked-by: Dan Walsh <dwalsh@redhat.com>
2011-08-26 14:31:55 -04:00
Dan Walsh
83e6416bca policycoreutils: sandbox: pass DPI from the desktop
Fix sandbox to pass DPI from the desktop to the sandbox program.

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2011-08-26 14:31:54 -04:00
Eric Paris
f6558d9cec policycoreutils: sandbox: seunshare: introduce helper spawn_command
Introduce a helper which will spawn children and wait for them to exit
so we don't have to keep writing that code over and over.

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2011-08-26 14:31:50 -04:00
Eric Paris
bf22cff3ea policycoreutils: sandbox: seunshare: introduce new filesystem helpers
These are just simple new helpers which make it easy to check uid, gid,
if two stat results are the same and things like that.

Signed-off-by: Eric Paris <eparis@redhat.com>
2011-08-26 14:28:25 -04:00
Dan Walsh
149afc688a policycoreutils: sandbox: add -C option to not drop all capabilities
Some sandbox might want to be able to run a suid app.  Add the -C option
to allow capabilities to stay in the bounding set, and thus be allowed
inside the sandbox.

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2011-08-26 14:28:23 -04:00
Eric Paris
d6c09608cd policycoreutils: sandbox: split seunshare caps dropping
Split drop_capabilities into drop_privs, which does the same thing, and
drop_caps, which only drops caps but doesn't affect the uid.

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2011-08-26 14:28:22 -04:00
Eric Paris
64b7a309c5 policycoreutils: sandbox: use dbus-launch
Instead of directly calling, use dbus-launch.

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2011-08-26 14:28:19 -04:00
Eric Paris
26ff83cf87 policycoreutils: sandbox: numerous simple updates to sandbox
Little things like better error messages, usage text, code duplication
and the like.

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2011-08-26 14:28:18 -04:00
Eric Paris
da7ae7951c policycoreutils: sandbox: do not require selinux context
seunshare can be used on non-selinux systems.  It can also be used
without transition to a new context.  Thus we should not require that a
context be set.

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2011-08-26 14:28:16 -04:00
Eric Paris
3c5abbc341 policycoreutils: sandbox: Makefile: new man pages
we have man pages which aren't being instelled with make install.  We
also do not include -Werror -Wall -Wextra in the build like we do with
other packages, so include those.

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2011-08-26 14:28:14 -04:00
Eric Paris
baf4d59407 policycoreutils: sandbox: rename dir to srcdir
Just a simple variable rename to make it clear what it does.

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2011-08-26 14:28:12 -04:00
Eric Paris
d725841239 policycoreutils: sandbox: allow users specify sandbox window size
This allows users to create sandbox windows of a specified size on the
command line.

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2011-08-26 14:28:11 -04:00
Eric Paris
74bb5c01d6 policycoreutils: sandbox: check for paths up front
When launching a sandbox x environment we should check up front to make
sure that the seunshare and sandboxsh files exist and bail politely if
they do not exist.

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2011-08-26 14:28:09 -04:00