Commit graph

305 commits

Author SHA1 Message Date
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