Commit graph

515 commits

Author SHA1 Message Date
Jason Dana
2ff279e21e policycoreutils: semanage: update to new source policy infrastructure
- Remove version references
- Use new methods for enabling/disabling modules
- Add support to set priority when adding/removing modules
- Modify module --list output to include priority and language extension
- Update permissiveRecords call to support cil policy

Signed-off-by: Steve Lawrence <slawrence@tresys.com>
Signed-off-by: Jason Dana <jdana@tresys.com>
2014-08-26 08:03:31 -04:00
Yuli Khodorkovskiy
e599a43184 policycoreutils: deprecate base/upgrade/version in semodule
Providing --upgrade or --base will now just call --install, and display
a deprecation message to the user. Additionally, because CIL has no
concept of version numbers, this removes the version output from --list.

Signed-off-by: Yuli Khodorkovskiy <ykhodorkovskiy@tresys.com>
2014-08-26 08:02:16 -04:00
Steve Lawrence
6e085368f1 policycoreutils: semodule: add back support for alternative root paths
Removed in commits:
- Revert "policycoreutils: semodule: support for alternative root paths"

Signed-off-by: Steve Lawrence <slawrence@tresys.com>
2014-08-26 08:02:16 -04:00
Caleb Case
031ee84821 semodule: add priority, enabled, and extended listing
This updates the semodule tool with the ability to set the priority for
commands, to enable/disable modules, and extended module listing options
for displaying extra module information (e.g., priority, enabled status,
and language extension).

[semodule priority]

-X --priority set the priority for following operations

Notes:

* This sets the priority for the following operations.

* It can be used any number of times with its effect continuing until
  the next priority is specified.

* The default priority is used if no priority has yet been specified.

Impact on current operations:

* Install module

  * Without priority - Install at default priority.

  * With priority - Install at specified priority.

  * New warning when overriding (issued by libsemanage).

* Upgrade module

  * Without priority - Upgrade at default priority (current upgrade
    semantics apply).

  * With priority - Upgrade at specified priority (current upgrade
    semantics apply).

  * New warning when overriding (issued by libsemanage).

* Remove module

  * Without priority - Remove a module at the default if exists.

  * With priority - Remove at that priority.

  * New info messages (issued by libsemanage):

    * If no modules exist at the given priority but do exist at other
      priorities, give an info message listing the modules and priority.

    * If a new module at a lower priority will become active print a
      message.

    * If the last module with this name is being removed print a
      message.

* Base

  * The name of base module on install is fixed to "_base" (performed by
    libsemanage).

  * Without priority - Install at default priority.

  * With priority - Install at specified priority.

  * New warning when overriding (issued by libsemanage).

* List modules

  * See listing changes below.

Examples:

semodule -i foo.pp

semodule -X 500 -i foo.pp

[semodule enable/disable]

Add enable/disable status:

-e   --enable   enable the module (at all priorities)
-d   --disable  disable the module (at all priorities)

Notes:

* Base modules are always enabled and cannot have their enabled/disabled
  status changed.

* New error when disabling a base module (from libsemanage).

* New warning when enabling a base module (from libsemanage).

Impact on current operations:

* Install module

  * If a module with that name is already installed, then the enabled
    status will remain the same after installing the new module.

  * New warning when installing a module which will be disabled by
    existing enabled status (from libsemanage).

* Upgrade module

  * If a module with that name is already installed, then the enabled
    status will remain the same after installing the new module.

  * New warning when installing a module which will be disabled by
    existing enabled status (from libsemanage).

* Remove module

  * When the last module with a given name is removed (no more exist at
    other priorities) then the enabled status is forgotten.

* Base

  * Base modules are always installed enabled and remain so (can't be
    disabled).

* List modules

  * See listing changes below.

Examples:

semodule -e foo

semodule -d foo

[semodule list]

-l		--list		list modules as if by -lstandard

-lstandard	--list=standard	list name and version of highest priority,
				enabled, non-base modules sorted alphabetical
				by name

-lfull		--list=full	list all fields of all modules columnated
				sorted high priority to low, within priority
				alphabetical by name

Impact on current operations:

* List modules

  * Default listing stays the same.

  * New long options for 'standard' and 'full'.

Examples:

semodule -l
semodule -lstandard
semodule --list=standard

alsa 1.7.1
apm 1.9.1
apt 1.5.2
authlogin 2.0.0
avahi 1.10.3
bluetooth 3.1.3
...

semodule -lfull
semodule --list=full

600 alsa      1.7.1 disabled pp
400 _base     1.0.0          pp
400 alsa      1.7.1 disabled pp
400 apm       1.9.1          pp
400 apt       1.5.2          pp
400 authlogin 2.0.0          pp
...
100 alsa      1.7.1 disabled pp

Signed-off-by: Chad Sellers <csellers@tresys.com>
2014-08-26 08:02:16 -04:00
Caleb Case
565ea9832e semanage: move permissive module creation to /tmp
semanage currently uses /var/lib/selinux/tmp to create permissive
modules. However, with the move to /var, the same tmp directory is used
for building policy binaries, causing a conflict. This patch creates a
random temporary directory in /tmp and moves permissive module creation
to that directory, avoiding the directory conflict.

This patch also imports shutil for rmtree to easily delete all created
temporary files.

Signed-off-by: Chad Sellers <csellers@tresys.com>
2014-08-26 08:02:16 -04:00
Steve Lawrence
5ac1e98ab2 Revert "policycoreutils: semodule: support for alternative root paths"
This reverts commit 5e096d9ceb.

Conflicts:

	policycoreutils/semodule/semodule.c
2014-08-26 08:02:16 -04:00
Steve Lawrence
30a2df81eb Revert "Last attempt at upstreaming semodule_disable patch."
This reverts commit 654dcb897e.

Conflicts:

	policycoreutils/semodule/semodule.c
2014-08-26 08:02:16 -04:00
Stephen Smalley
76913d8adb Deprecate use of flask.h and av_permissions.h.
Also remove all internal uses by libselinux.
This requires deleting the old class/perm string lookup tables
and compatibility code for kernels that predate the /sys/fs/selinux/class
tree, i.e. Linux < 2.6.23.

This also fixes a longstanding bug in the stringrep code; it was allocating
NVECTORS (number of vectors in the legacy av_perm_to_string table, i.e.
the total number of legacy permissions) entries in the per-class perms array
rather than MAXVECTORS (the maximum number of permissions in any
access vector).  Ho hum.  I already fixed this in Android but forgot it
here.

Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2014-07-09 13:49:18 -04:00
Andy Lutomirski
74d27a9733 seunshare: Try to use setcurrent before setexec
If seunshare uses PR_SET_NO_NEW_PRIVS, which certain versions of
libcap-ng set, setexeccon will cause execve to fail.  This also
makes setting selinux context the very last action taken by
seunshare prior to exec, as it may otherwise cause things to fail.

Note that this won't work without adjusting the system policy to
allow this use of setcurrent.  This rule appears to work:

    allow unconfined_t sandbox_t:process dyntransition;

although a better rule would probably relax the unconfined_t
restriction.

Signed-off-by: Andy Lutomirski <luto@amacapital.net>
2014-05-12 14:14:45 -04:00
Dan Walsh
de0795a12e Remove handling of cgroups from sandbox
It never worked correctly and this should be handled with an
API to systemd going forward.
2014-05-12 14:14:42 -04:00
Dan Walsh
6ee0299ab7 Update XDG_RUNTIME_DIR directory 2014-05-12 14:14:39 -04:00
Stephen Smalley
1e6482134b Bump version and update ChangeLog for release.
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2014-05-06 13:30:27 -04:00
Stephen Smalley
35b3c259a7 2.3-rc1 (release candidate 1).
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2014-03-25 13:24:44 -04:00
Stephen Smalley
5ba8c79721 Merge branch 'master' into next
Conflicts:
	policycoreutils/ChangeLog
2013-12-09 16:10:24 -05:00
Stephen Smalley
582c2d0199 policycoreutils 2.2.5 - yet another bug fix for non-MLS systems.
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2013-12-09 16:06:27 -05:00
Sven Vermeulen
7d921ed797 Ignore selevel/serange if MLS is disabled
Currently, the selevel/serange values (which are often set on a default
's0' value) are used for ports, users, contexts and logins. This breaks
non-MLS setups.

This patch will only call the necessary mls functions if mls is actually
enabled.

Signed-off-by: Sven Vermeulen <sven.vermeulen@siphos.be>
2013-12-09 16:04:44 -05:00
Stephen Smalley
f89377f243 Merge branch 'master' into next
Conflicts:
	policycoreutils/ChangeLog
2013-11-26 14:07:49 -05:00
Stephen Smalley
1bca9b5964 policycoreutils 2.2.4 - bug fix for non-MLS systems.
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2013-11-26 14:04:09 -05:00
Stephen Smalley
5d2b8d49ec Revert "If users of seobject set serange or seuser to "", we need to override."
This reverts commit 5102ed4cb8.
This breaks non-MLS systems.

Reported-by: Sven Vermeulen <sven.vermeulen@siphos.be>
2013-11-26 14:01:18 -05:00
Stephen Smalley
8d2dc72445 Updated policycoreutils ChangeLog for next.
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2013-11-13 11:09:41 -05:00
Dan Walsh
f03dc51262 Add -P semodule option to man page 2013-11-13 11:07:23 -05:00
Dan Walsh
5fe159bfdd selinux_current_policy_path will return none on a disabled SELinux system 2013-11-13 11:07:21 -05:00
Dan Walsh
7315245750 Add new icons for sepolicy gui 2013-11-13 11:07:17 -05:00
Stephen Smalley
11fa7dfc01 Merge branch 'master' into next
Conflicts:
	policycoreutils/ChangeLog
2013-11-13 11:06:54 -05:00
Stephen Smalley
feb6f9ffdd Bump policycoreutils version to 2.2.3.
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2013-11-13 11:06:05 -05:00
Dan Walsh
e8718ef514 Make sure we do the polkit check on all dbus interfaces.
Change policy kit to only allow access on the console.
2013-11-13 11:00:29 -05:00
Dan Walsh
ef102bf81a Call proper dbus function
Signed-off-by: Dan Walsh <dwalsh@redhat.com>
2013-11-13 11:00:18 -05:00
Stephen Smalley
7eb719b383 Update policycoreutils ChangeLog.
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2013-11-08 15:56:18 -05:00
Dan Walsh
e6c6dc3464 Add message to tell user to install sandbox policy package.
Sandbox policy is huge do to macro expansion.  We do not install this by default
but sandbox command can fail without it installed.  This patch prints a message to the
user to install the package.

Signed-off-by: Dan Walsh <dwalsh@redhat.com>
2013-11-08 15:52:50 -05:00
Dan Walsh
84bffc43a7 Cleanup whitespace
Signed-off-by: Dan Walsh <dwalsh@redhat.com>
2013-11-08 15:52:11 -05:00
Dan Walsh
d5116bd45b Add support to return sesitivities and cats for python bindings.
Signed-off-by: Dan Walsh <dwalsh@redhat.com>
2013-11-08 15:51:52 -05:00
Dan Walsh
d3b4dbf299 Fix up desktop files to match current standards
Encoding is depracated
Keywords is depracated

Signed-off-by: Dan Walsh <dwalsh@redhat.com>
2013-11-08 15:50:59 -05:00
Dan Walsh
261a8a8385 Add domain to short list of domains, when -t and -d used together
Signed-off-by: Dan Walsh <dwalsh@redhat.com>
2013-11-08 15:50:38 -05:00
Dan Walsh
dc866db4dc Only return writeable files that are enabled
Signed-off-by: Dan Walsh <dwalsh@redhat.com>
2013-11-08 15:49:33 -05:00
Dan Walsh
635e803e1c Call proper dbus function
Signed-off-by: Dan Walsh <dwalsh@redhat.com>
2013-11-08 15:49:03 -05:00
Stephen Smalley
9ff98faa91 Update policycoreutils ChangeLog.
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2013-11-06 09:38:03 -05:00
Laurent Bigonville
2e93833b1b Minor manpages improvements 2013-11-06 09:36:33 -05:00
Laurent Bigonville
1524e15303 Improve restorecond systemd unit file
Use Type=forking and pass PIDFile option, this allows better tracking of
the livecycle of the daemon.

Only attempt to start the daemon if selinux is enabled.

Drop After=syslog.target, syslog is socket activated anyway
2013-11-06 09:36:28 -05:00
Laurent Bigonville
28d63799d0 Add systemd unit file for mcstrans daemon 2013-11-06 09:36:24 -05:00
Stephen Smalley
f0f1ff4470 Bump policycoreutils version for semanage import default encoding bug fix.
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2013-11-06 09:29:05 -05:00
Daniel J Walsh
a2b443b214 Patch to remove default encoding patch.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

The default encoding patch, was never upstreamed.  default_encoding module
switched python2 to always use unicode.  Potentially in some languages
semanage will blow up when errors are reported.

The need for this patch is going away in python3, which should be the default
in Fedora 21/22.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.15 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEARECAAYFAlJ5DT4ACgkQrlYvE4MpobMvrgCfcEvZY4q7F17q9dbYJrHJXpae
Ut8AoM2TP99Ca0/lJAjoMTGsqr50P35/
=BHTe
-----END PGP SIGNATURE-----
2013-11-06 09:27:17 -05:00
Stephen Smalley
ac74dde4ae Bump policycoreutils version for sepolicy generate bug fix.
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2013-10-31 12:16:30 -04:00
Dan Walsh
b33b4f42d5 Make yum/extract_rpms optional so that apt based systems can use tool 2013-10-31 12:11:04 -04:00
Dan Walsh
e27d51b17e Add test suite for audit2allow and sepolgen_ifgen 2013-10-31 11:05:28 -04:00
Stephen Smalley
7c4bb77999 Version bump for release.
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2013-10-30 12:45:19 -04:00
Stephen Smalley
8e5d465335 Update ChangeLog files.
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2013-10-30 12:42:05 -04:00
Stephen Smalley
4b41f10db9 Merge branch 'constraintnames' 2013-10-30 11:56:36 -04:00
Stephen Smalley
e40b6ede5f Drop semodule_path; obsoleted by elimination of genhomedircon script.
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2013-10-29 12:21:02 -04:00
Dan Walsh
3ddff86b8f Have audit2allow output additional constraint information 2013-10-29 08:49:52 -04:00
Dan Walsh
e3b1bb1ab7 Make sure userdel cleans up after itself in test 2013-10-28 17:04:45 -04:00
Dan Walsh
959a4e3177 Catch IOError errors within audit2allow 2013-10-28 17:04:36 -04:00
Dan Walsh
e3048525ad Michal Trunecka patch to allow restorecon to accept paths with {}
The restorecon is unable to resolve paths using braced expressions like this: /sbin/

./restorecon:  lstat(/sbin/ip{6,}tables*) failed:  No such file or directory

The problem is that restorecon calls glob function without GLOB_BRACE flag, which en
2013-10-25 16:12:40 -04:00
Stephen Smalley
a08010023b Update ChangeLogs and bump VERSIONs to an intermediate value.
2.1.99 is just a placeholder to distinguish it from the prior release.
2.2 will be the released version.  Switching to 2-component versions.

Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2013-10-25 15:14:23 -04:00
Stephen Smalley
56258807ea Revert "Richard Haines patch that allows us discover constraint violation information"
This reverts commit 56b49ab711.

Conflicts:
	libselinux/src/audit2why.c
2013-10-25 13:53:03 -04:00
Stephen Smalley
99b070d5fc Merge branch 'fedora' into master-merge 2013-10-25 09:26:32 -04:00
Dan Walsh
cc131892c7 Need to delete all managed objects before readding them 2013-10-25 09:26:21 -04:00
Dan Walsh
4f63201788 semanage user customized should use -L not -l
Fixes semanage extract/import problem.
2013-10-25 09:26:18 -04:00
Stephen Smalley
f458b76076 Merge branch 'fedora' into master-merge
Conflicts:
	libselinux/src/Makefile
	libselinux/src/selinux_config.c
	policycoreutils/audit2allow/audit2allow.1
	policycoreutils/scripts/fixfiles.8
	policycoreutils/semanage/semanage.8
	policycoreutils/sepolicy/Makefile
	policycoreutils/sepolicy/sepolicy/transition.py
	policycoreutils/setsebool/setsebool.8
2013-10-24 15:24:17 -04:00
Stephen Smalley
50eedb1e1f Ignore genhomedircon link. 2013-10-24 15:11:01 -04:00
Dan Walsh
fc965a99c6 Remove test_booleans_l from test, it is bogus 2013-10-24 15:10:55 -04:00
Dan Walsh
6020fb0b1e Use power of 2 for STAR_COUNT 2013-10-24 13:58:41 -04:00
Dan Walsh
48663d5ca3 Need to document -o filename in usage statement 2013-10-24 13:58:41 -04:00
Dan Walsh
ca030ec85b setfiles should always return -1 on failures.
Scripts that are looking for -1 failures were getting confused by 1 and > 1 erros.
We should be consistant on the error status.
2013-10-24 13:58:41 -04:00
Dan Walsh
62c0cd6194 setsebool does not do a good job of reporting missing booleans.
This patch will clearly tell the user that he tried to set a boolean that does not exist.
2013-10-24 13:58:41 -04:00
Dan Walsh
1fd22fc498 Make setsebool be less verbose. 2013-10-24 13:58:41 -04:00
Dan Walsh
e6a1298e54 These are massive changes involved in building new GUI.
Too difficult to break out into seperate patches at this point.
Since almost no other groups are using sepolicy yet, I will push together.
2013-10-24 13:58:41 -04:00
Dan Walsh
43c9e8c7e2 Fix error when policy does not match the system. 2013-10-24 13:58:40 -04:00
Dan Walsh
d0b1e420e7 seinfo needs to work if mls is disabled.
This patch stops seinfo from failing when MLS disabled.
2013-10-24 13:58:40 -04:00
Dan Walsh
cc3df76279 Return the type aliases.
We wanted this information in sepolicy.
2013-10-24 13:58:40 -04:00
Dan Walsh
85d76c1671 Add new test suite for sepolicy tool set.
This test should be run before we do any builds to make sure there are
no regressions
2013-10-24 13:58:40 -04:00
Dan Walsh
0ebf819eb9 Add org.selinux.config.selinux.policy for use with policykit and pk_exec 2013-10-24 13:58:40 -04:00
Dan Walsh
678de8fda2 Change polgengui to use latest interfaces availabel in sepolicy toolchain. 2013-10-24 13:58:40 -04:00
Dan Walsh
953d4b6683 Mv some of the setup we were doing in the policycoreutils.spec file into the main code
Basically add an icon, setup the desktop environment, setup system-config-selinux to run
via pkexec.
2013-10-24 13:58:40 -04:00
Dan Walsh
5102ed4cb8 If users of seobject set serange or seuser to "", we need to override.
Do not want bad data getting into the system
2013-10-24 13:58:40 -04:00
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