Commit Graph

860 Commits

Author SHA1 Message Date
Dan Walsh
417fc54d78 Fix customized of fcontext and booleans to return proper transaction code 2013-10-24 13:58:40 -04:00
Dan Walsh
6f24fe24f6 Make sure file equivalance target and source do not end with a / 2013-10-24 13:58:40 -04:00
Dan Walsh
9d815b2dbb <<none>> should be a valid type to be used with the semanage fcontext call
Users want to add labels like

semanage fcontext -t <<none>> '/foobar(/.*)?'

This fix allows this to work.
2013-10-24 13:58:40 -04:00
Dan Walsh
a9bf18c4a5 Return the level when looking at the customized changes of users.
If someone specifies an initial level other then s0, we want to catch this and
report it in customized.
2013-10-24 13:58:40 -04:00
Dan Walsh
3dafb1046d Add deleteall customizations field for modules.
Basically if a user asks to delete all module custmization, this will remove all
disabled modules.
2013-10-24 13:58:40 -04:00
Dan Walsh
ffe0052ad8 If a user specifies a module to add that does not exist print error.
Currently we wait for libsemange to give us a random error, this gives a clean
error
2013-10-24 13:58:40 -04:00
Dan Walsh
51a490b152 Only list disabled modules if the user ask for locallist on modules 2013-10-24 13:58:40 -04:00
Dan Walsh
7f70a2bf94 Add customized calls for modules to list disabled modules 2013-10-24 13:58:40 -04:00
Dan Walsh
8d7f15a95a Fix bug in logger.
If you do not use auding, the syslog calls blows up because of this bug.
2013-10-24 13:58:40 -04:00
Dan Walsh
3c1d51c01a Add new FILE_STRING constands
Basically sepolicy is going to use single letters to indicate file types, need
to setup a dictionary to go back and forth between full names and short names.
2013-10-24 13:58:40 -04:00
Dan Walsh
b15a87f254 Cleanup handling of translations code 2013-10-24 13:58:40 -04:00
Dan Walsh
1886d463c6 Fix lots of bugs in the bash completion script.
Fixes include handling of roles.
Types
handling of impore/export commands.
2013-10-24 13:58:40 -04:00
Dan Walsh
c1f763e293 Convert semanage command to use argparse
This is the current way to do getopt handling in python. Really cleans up the
code and makes semanage command -h work nicely.
2013-10-24 13:58:40 -04:00
Dan Walsh
9aea9f3a4d Add test script for testing semanage functionality.
This script should be run before all commits of changes to the semanage
command to make sure you do not have any regressions.
2013-10-24 13:58:40 -04:00
Dan Walsh
1925e1e91d Break the semanage man page into different man pages per category.
This adds a lot of new man pages but cleans up the descriptions and makes it
much easier to handle.
2013-10-24 13:58:40 -04:00
Dan Walsh
a9dfbeeb72 bash completsion scripts have moved.
This patch moves the semanage bash completion script to the new location.
2013-10-24 13:58:39 -04:00
Dan Walsh
91d0de4adf genhomedircon is no longer a script, but a link to semodule 2013-10-24 13:58:39 -04:00
Dan Walsh
790ae0a0e2 Fix spelling 2013-10-24 13:58:39 -04:00
Dan Walsh
2910ca2185 Lots of fixes for fixfiles
Fix check for seclabel flag.
Restorecon commands should always use FORCEFLAG command if passed in.
Found a bug in handling of regex difference
All restorecon commands should use the exclude file path call.
Only cleanup /tmp on a Full Relabel, not a Check.
Set BOOTIME flag in /.autorelabel file, so that we can only relabel
files created since this time.  Should speed up relabel.
2013-10-24 13:58:39 -04:00
Dan Walsh
e63a8fa875 Give people who use run_init or newrole an indicator to make it not ask for passwords 2013-10-24 13:58:39 -04:00
Dan Walsh
f2051b20fa Handle cleanup of locks properly 2013-10-24 13:58:39 -04:00
Dan Walsh
53ccfb3b4d Add support for systemd service for restorecond 2013-10-24 13:58:39 -04:00
Dan Walsh
f1a5a0ad6c Fix spelling mistake 2013-10-24 13:58:39 -04:00
Dan Walsh
e4488ecd87 Allow users to have homedir as a symbolic link but mount on the homedir
Also do not error out on setfsuid if errno == success.  This breaks on systems
that use file capabilities rather then on setuid apps.
2013-10-24 13:58:39 -04:00
Dan Walsh
a387e158f5 Xephry now supports resizable flag 2013-10-24 13:58:39 -04:00
Dan Walsh
9e0c737307 Swith to using openbox for window manager rather then matchbox
openbox has an upstream where matchbox is dead.

Also remove VERSION string since not used.
sandbox_file_t is only file type allowed.
2013-10-24 13:58:39 -04:00
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
8137b9392c Fix test matching to use proper constants 2013-10-24 13:58:38 -04:00
Dan Walsh
17cc87e56b sepolgen did not work with filename transitions.
This patch adds support for it.
2013-10-24 13:58:38 -04:00
Dan Walsh
3223746ba8 fix bug in calls to attributes 2013-10-24 13:58:38 -04:00
Dan Walsh
6f84cfd00c If you are pushing data onto the list that already exists, then return success.
Do not push the data in a second time.
2013-10-24 13:58:38 -04:00
Dan Walsh
56d9d20a64 Pull auditing into libsemanage.
In the past we wrote audit into the semanage tool chain.  But if a tool like useradd
called dirreclty into libsemanage we did not get auditing.  Now useradd calls directly,
so we need this patch.

Another fix in this patch is to default the login mappings MLS to the selected SELinux User.
If a caller just specified the name staff_u, then the code will look up the range of staff_u
and apply it to the mapping.
2013-10-24 13:58:38 -04:00
Dan Walsh
b14294c01f Remove the policy.kern after policy is build and replace with symbolic link.
We want to shink the space required by selinux-policy for small cloud images.
This file has no purpose after policy is built.
2013-10-24 13:58:38 -04:00
Dan Walsh
1fbb15eb11 Add Laurent Bigonville fix to look at MAX_UID as well as MIN_UID in genhomedircon 2013-10-24 13:58:38 -04:00
Dan Walsh
874a976470 Fix handling of temporary file in sefcontext_compile.c
This way if something goes wrong regex file will not be corrupt.
2013-10-24 13:58:38 -04:00
Dan Walsh
c32da69e01 Fixes for procattr calls to handle cache properly.
We were asked not to link to libpthread but to use gcc internals.
We were not handling properly the fact that a cache was UNSET, and this
patch fixes this.
2013-10-24 13:58:38 -04:00
Dan Walsh
9639f5d9a8 Add decent constants for python for return of getenforce call. 2013-10-24 13:58:38 -04:00
Dan Walsh
22671378f1 Fix label substituion to work with the equiv path of "/"
Software collections are setting up equiv directories to the root directory.
2013-10-24 13:58:38 -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
403f2cfeb8 Change get_context_list to return an error rather then guess at a match.
In the past pam_selinux would return a bogus login context if the login program
was running with the wrong context.  If you ran sshd as unconfined_t
you might get the login user loggin in as pam_oddjob_mkhomedir_t or some other bogus
type.  This change fixes the code to return an error if it can not return a good
match.
2013-10-24 13:58:38 -04:00
Dan Walsh
f1598dff7e Support udev-197 and higher
The errno value was not set, causing wrong return notifications and
failing to have udev label things correctly.

See https://bugzilla.redhat.com/show_bug.cgi?id=909826#c24 and
see https://bugs.gentoo.org/show_bug.cgi?id=462626

Signed-off-by: Sven Vermeulen <sven.vermeulen@siphos.be>
2013-10-24 13:58:37 -04:00
Dan Walsh
fd56c5230c Separate out the calling of local subs and dist subs in selabel_sub
We want to allow users to setup their substitions to run fist and then run
the distro subs second.  This fixes the problem where a user defines
a sub like /usr/local/foobar and we ignore it.  We need this for
software collections which is setting up local subs of /opt/src/foobar/root /
2013-10-24 13:58:37 -04:00
Dan Walsh
51d9a078c2 Patch to change *setfilecon to not return ENOSUP if context matches.
Tools like cp -A try to maintain the context of a program and call *setfilecon,
currently if the file system does not support XAttrs we return ENOSUPP.  We have
been requested to check if the context that is being set is the same to not return this
error.  So if I try to set the label on an nfs share to system_u:object_r:nfs_t:s0 and I get
ENOSUPP, it will not return an error.
2013-10-24 13:58:37 -04:00
Dan Walsh
756013edc5 This patch fixes python parsing.
Eliminates a potential memory leaks.
2013-10-24 13:58:37 -04:00
Dan Walsh
851266c180 define SELINUX_TRANS_DIR in selinux.h
I wanted to separate this directory out in order for a new patch to mcstransd to watch
this directory for newly created files, which it could then translate.

The idea is libvirt would write to /var/run/setrans/c0:c1,c2 with the contents of vm1, then
setrans could translate the processes to show system_u:system_r:svirt_t:vm1
2013-10-24 13:58:37 -04:00
Dan Walsh
ce2a8848ad Add selinux_systemd_contexts_path
systemd has some internal contexts like generated systemd unit files
that we want to allow it to check against processes trying to manage them.
2013-10-24 13:58:37 -04:00
Dan Walsh
7fe6036ca5 Add selinux_set_policy_root sets an alternate policy root directory path
This allows us to specify under which the compiled policy file and context configuration
files exist. We can use this with matchpathcon to check the labels under alternate policies,
and we can use it for sepolicy manpage to build manpages during policy build.
2013-10-24 13:58:37 -04:00