Compare commits

...

32 Commits
master ... f19

Author SHA1 Message Date
Miroslav Grepl e2585817b9 * Wed Apr 7 2014 Miroslav Grepl <mgrepl@redhat.com> - 2.1.14-46.8
- seunshare: Use setcurrent before setexec from luto@amacapital.net
2014-05-07 16:36:28 +02:00
Miroslav Grepl 4e76fa053c Fix typo in spec file 2014-02-03 14:44:56 +01:00
Miroslav Grepl 7b5f7410d8 * Mon Jan 3 2013 Miroslav Grepl <mgrepl@redhat.com> - 2.1.14-46.7
- policycoreutils-python should require checkpolicy
2014-02-03 14:19:02 +01:00
Dan Walsh c8944cf0c5 Fix sandbox to work properly with seunshare using file capabilties. 2013-10-04 09:26:36 -04:00
Dan Walsh 700fcd7d59 Move audit2allow back into policycoreutils-python package
- Fix semanage logging to syslog
- Fix setsebool error handling
- Fix fixfiles scripts to work as documentet
2013-09-04 08:43:02 -04:00
Dan Walsh 0378c32552 Move audit2allow back into policycoreutils-python package
- Fix semanage logging to syslog
- Fix setsebool error handling
- Fix fixfiles scripts to work as documentet
2013-09-04 08:40:20 -04:00
Dan Walsh ecf5132b5c Allow hostname to use all inherited ttys 2013-08-28 15:23:43 -04:00
Dan Walsh f81e3d0371 Fix generation of booleans in man pages 2013-06-21 21:07:19 -04:00
Dan Walsh 1a1b575f7a Update Translations
- Remove requires for systemd-sysv
- Move systemd-units require to restorecond section
- More sepolicy interfaces for gui
- Fixes for semanage -i and semanage -o
- Remove --version  flage from sandbox
2013-06-21 07:58:39 -04:00
Dan Walsh c6021285eb Update Translations
- Remove requires for systemd-sysv
- Move systemd-units require to restorecond section
- More sepolicy interfaces for gui
- Fixes for semanage -i and semanage -o
- Remove --version  flage from sandbox
2013-06-21 07:58:25 -04:00
Dan Walsh 7c656bbb66 Fix sepolicy generate --confined_admin to generate tunables
- Add new interface to generate entrypoints for use with new gui
2013-06-06 14:07:12 -04:00
Dan Walsh a4276d4030 Fix audit2allow -o to open file for append
- Fix the name of the spec file generated in the build script
2013-06-04 10:59:45 -04:00
Dan Walsh 6334ae4e3b Fix the name of the spec file generated in the build script 2013-05-26 07:04:46 -04:00
Dan Walsh 04a21e14f5 Fix the name of the spec file generated in the build script 2013-05-26 07:01:45 -04:00
Dan Walsh 55520d61bb Fix sandbox to always use sandbox_file_t, so generated policy will work.
- Update Translations
2013-05-21 10:24:55 -04:00
Dan Walsh 72cc2c98e2 Need to handle gziped policy.xml as well as not compressed. 2013-05-14 15:54:34 -04:00
Dan Walsh 893a20e39a Add support for Xephyr -resizable, so sandbox can now resize window
- Add support for compressed policy.xml
- Miroslav Grepl patch to allow sepolicy interface on individual interface fil
- Also add capability to test interfaces for correctness.
2013-05-14 08:22:26 -04:00
Dan Walsh 62c82285f2 Only require selinux-policy-devel for policycoreutils-devel, this will shrink the size of the livecd. 2013-05-13 10:21:04 -04:00
Dan Walsh 0d5bdb0982 Run sepolgen-ifgen in audit2allow and sepolicy generate, if needed, first time
- Add  Sven Vermeulen  patches to cleanup man pages
2013-05-12 06:08:08 -04:00
Dan Walsh f3516b164f No longer run sepolgen-ifgen at install time.
- Run sepolgen-ifgen in audit2allow and sepolicy generate, if needed.
- Update Translations
2013-05-10 09:34:20 -04:00
Dan Walsh a1622cbdfc Fix exceptionion hanling in audit2allow -o
- Generate Man pages for everydomain, not just ones with exec_t entrypoints
- sepolicy comunicate should return ValueError not TypeError
- Trim header line in sepolicy manpage to use less space
- Add missing options to restorecon man page
2013-04-22 10:04:14 -04:00
Dan Walsh e19e89cc2d Update translations
- Add patch by Miroslav Grepl to add compile test for sepolicy interface command.
2013-04-10 16:47:09 -04:00
Dan Walsh 3425b4c3dc Update translations
- Add patch inspired by Miroslav Grepl to add extended information for sepolicy interface command.
2013-04-09 13:12:43 -04:00
Dan Walsh 153f8e3865 Update translations
- Add missing man pages and fixup existing man pages
2013-04-08 15:31:30 -04:00
Dan Walsh 96c084f7c3 Move sepolicy to policycoreutils-devel pacage, since most of it is used for devel
- Apply Miroslav Grepl Patches for sepolicy
-- Fix generate mutually groups option handling
-- EUSER is used for existing policy
-- customize options can be used together with admin_domain option
-- Fix manpage.py to generate correct man pages for SELinux users
-- Fix policy *.te file generated by customize+writepaths options
-- Fix install script for confined_admin option
2013-04-03 11:26:49 -04:00
Dan Walsh 93ba232940 Add buildrequires for OpenBox to prevent me from accidently building into RHEL7
- Add support for returning alias data to sepolicy.info python bindings
2013-03-28 13:47:58 -04:00
Dan Walsh ea6e803673 Fix audit2allow output to better align analysys with the allow rules
- Apply Miroslav Grepl patch to clean up sepolicy generate usage
- Apply Miroslav Grepl patch to fixupt handing of admin_user generation
- Update Tranlslations
2013-03-27 14:00:49 -04:00
Dan Walsh 05cf7b36dc Allow semanage fcontext -a -t "<<none>>" ... to work 2013-03-27 11:21:21 -04:00
Dan Walsh d052bda88a Can not unshare IPC in sandbox, since it blows up Xephyr
- Remove bogus error message sandbox about reseting setfsuid
2013-03-25 09:22:31 -04:00
Dan Walsh 9ef13ad6bc sepolgen-ifgen needs to handle filename transition rules containing ":" 2013-03-21 10:52:38 -04:00
Dan Walsh f5c1b2817f sepolicy manpage:
-   use nroff instead of man2html
-   Remove checking for name of person who created the man page
- audit2allow
-   Fix output to show the level that is different.
2013-03-19 17:00:22 -04:00
Dan Walsh 38c288127b Fix newrole to not drop capabilities from the bounding set.
- Stop dropping capabilities from its children.
- Add better error messages.
- Change location of bash_completion files to /usr/share/bash-completion/compl
2013-03-14 17:59:03 -04:00
5 changed files with 257712 additions and 508 deletions

View File

@ -0,0 +1,62 @@
From 4f9823d2f21473f42ddf12fd8d4ea01cf95b564a Mon Sep 17 00:00:00 2001
From: Andy Lutomirski <luto@amacapital.net>
Date: Wed, 30 Apr 2014 21:59:37 -0700
Subject: [PATCH] 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>
---
policycoreutils/sandbox/seunshare.c | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
diff --git a/policycoreutils/sandbox/seunshare.c b/policycoreutils/sandbox/seunshare.c
index 35e5a5e..529b6a6 100644
--- a/policycoreutils/sandbox/seunshare.c
+++ b/policycoreutils/sandbox/seunshare.c
@@ -1032,17 +1032,25 @@ int main(int argc, char **argv) {
goto childerr;
}
- /* selinux context */
- if (execcon && setexeccon(execcon) != 0) {
- fprintf(stderr, _("Could not set exec context to %s. %s\n"), execcon, strerror(errno));
- goto childerr;
- }
-
if (chdir(pwd->pw_dir)) {
perror(_("Failed to change dir to homedir"));
goto childerr;
}
setsid();
+
+ /* selinux context */
+ if (execcon) {
+ /* try dyntransition, since no_new_privs can interfere
+ * with setexeccon */
+ if (setcon(execcon) != 0) {
+ /* failed; fall back to setexeccon */
+ if (setexeccon(execcon) != 0) {
+ fprintf(stderr, _("Could not set exec context to %s. %s\n"), execcon, strerror(errno));
+ goto childerr;
+ }
+ }
+ }
+
execv(argv[optind], argv + optind);
fprintf(stderr, _("Failed to execute command %s: %s\n"), argv[optind], strerror(errno));
childerr:
--
1.9.0

7767
policycoreutils-f20.patch Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,13 +1,131 @@
diff --git a/sepolgen/src/sepolgen/audit.py b/sepolgen/src/sepolgen/audit.py
index d636091..9ca35a7 100644
index d636091..56919be 100644
--- a/sepolgen/src/sepolgen/audit.py
+++ b/sepolgen/src/sepolgen/audit.py
@@ -259,7 +259,7 @@ class AVCMessage(AuditMessage):
@@ -259,13 +259,13 @@ class AVCMessage(AuditMessage):
raise ValueError("Error during access vector computation")
if self.type == audit2why.CONSTRAINT:
- self.data = []
+ self.data = [ self.data ]
if self.scontext.user != self.tcontext.user:
self.data.append("user")
- self.data.append("user")
+ self.data.append(("user (%s)" % self.scontext.user, 'user (%s)' % self.tcontext.user))
if self.scontext.role != self.tcontext.role and self.tcontext.role != "object_r":
- self.data.append("role")
+ self.data.append(("role (%s)" % self.scontext.role, 'role (%s)' % self.tcontext.role))
if self.scontext.level != self.tcontext.level:
- self.data.append("level")
+ self.data.append(("level (%s)" % self.scontext.level, 'level (%s)' % self.tcontext.level))
avcdict[(scontext, tcontext, self.tclass, access_tuple)] = (self.type, self.data)
diff --git a/sepolgen/src/sepolgen/policygen.py b/sepolgen/src/sepolgen/policygen.py
index cc9f8ea..ce643e5 100644
--- a/sepolgen/src/sepolgen/policygen.py
+++ b/sepolgen/src/sepolgen/policygen.py
@@ -161,21 +161,21 @@ class PolicyGenerator:
if self.explain:
rule.comment = str(refpolicy.Comment(explain_access(av, verbosity=self.explain)))
if av.type == audit2why.ALLOW:
- rule.comment += "#!!!! This avc is allowed in the current policy\n"
+ rule.comment += "\n#!!!! This avc is allowed in the current policy"
if av.type == audit2why.DONTAUDIT:
- rule.comment += "#!!!! This avc has a dontaudit rule in the current policy\n"
+ rule.comment += "\n#!!!! This avc has a dontaudit rule in the current policy"
if av.type == audit2why.BOOLEAN:
if len(av.data) > 1:
- rule.comment += "#!!!! This avc can be allowed using one of the these booleans:\n# %s\n" % ", ".join(map(lambda x: x[0], av.data))
+ rule.comment += "\n#!!!! This avc can be allowed using one of the these booleans:\n# %s" % ", ".join(map(lambda x: x[0], av.data))
else:
- rule.comment += "#!!!! This avc can be allowed using the boolean '%s'\n" % av.data[0][0]
+ rule.comment += "\n#!!!! This avc can be allowed using the boolean '%s'" % av.data[0][0]
if av.type == audit2why.CONSTRAINT:
- rule.comment += "#!!!! This avc is a constraint violation. You will need to add an attribute to either the source or target type to make it work.\n"
- rule.comment += "#Constraint rule: "
- for reason in av.data:
- rule.comment += "\n#\tPossible cause source context and target context '%s' differ\b" % reason
+ rule.comment += "\n#!!!! This avc is a constraint violation. You would need to modify the attributes of either the source or target types to allow this access.\n"
+ rule.comment += "#Constraint rule: \n\t" + av.data[0]
+ for reason in av.data[1:]:
+ rule.comment += "#\tPossible cause is the source %s and target %s are different." % reason
try:
if ( av.type == audit2why.TERULE and
@@ -189,9 +189,9 @@ class PolicyGenerator:
if i not in self.domains:
types.append(i)
if len(types) == 1:
- rule.comment += "#!!!! The source type '%s' can write to a '%s' of the following type:\n# %s\n" % ( av.src_type, av.obj_class, ", ".join(types))
+ rule.comment += "\n#!!!! The source type '%s' can write to a '%s' of the following type:\n# %s\n" % ( av.src_type, av.obj_class, ", ".join(types))
elif len(types) >= 1:
- rule.comment += "#!!!! The source type '%s' can write to a '%s' of the following types:\n# %s\n" % ( av.src_type, av.obj_class, ", ".join(types))
+ rule.comment += "\n#!!!! The source type '%s' can write to a '%s' of the following types:\n# %s\n" % ( av.src_type, av.obj_class, ", ".join(types))
except:
pass
self.module.children.append(rule)
diff --git a/sepolgen/src/sepolgen/refparser.py b/sepolgen/src/sepolgen/refparser.py
index 7b76261..a05d9d1 100644
--- a/sepolgen/src/sepolgen/refparser.py
+++ b/sepolgen/src/sepolgen/refparser.py
@@ -65,6 +65,7 @@ tokens = (
'BAR',
'EXPL',
'EQUAL',
+ 'FILENAME',
'IDENTIFIER',
'NUMBER',
'PATH',
@@ -249,11 +250,17 @@ def t_refpolicywarn(t):
t.lexer.lineno += 1
def t_IDENTIFIER(t):
- r'[a-zA-Z_\$\"][a-zA-Z0-9_\-\+\.\$\*\"~]*'
+ r'[a-zA-Z_\$][a-zA-Z0-9_\-\+\.\$\*~]*'
# Handle any keywords
t.type = reserved.get(t.value,'IDENTIFIER')
return t
+def t_FILENAME(t):
+ r'\"[a-zA-Z0-9_\-\+\.\$\*~ :]+\"'
+ # Handle any keywords
+ t.type = reserved.get(t.value,'FILENAME')
+ return t
+
def t_comment(t):
r'\#.*\n'
# Ignore all comments
@@ -450,6 +457,7 @@ def p_interface_call_param(p):
| nested_id_set
| TRUE
| FALSE
+ | FILENAME
'''
# Intentionally let single identifiers pass through
# List means set, non-list identifier
@@ -461,6 +469,7 @@ def p_interface_call_param(p):
def p_interface_call_param_list(p):
'''interface_call_param_list : interface_call_param
| interface_call_param_list COMMA interface_call_param
+ | interface_call_param_list COMMA interface_call_param COMMA interface_call_param_list
'''
if len(p) == 2:
p[0] = [p[1]]
@@ -787,6 +796,7 @@ def p_avrule_def(p):
def p_typerule_def(p):
'''typerule_def : TYPE_TRANSITION names names COLON names IDENTIFIER SEMI
+ | TYPE_TRANSITION names names COLON names IDENTIFIER FILENAME SEMI
| TYPE_TRANSITION names names COLON names IDENTIFIER IDENTIFIER SEMI
| TYPE_CHANGE names names COLON names IDENTIFIER SEMI
| TYPE_MEMBER names names COLON names IDENTIFIER SEMI
@@ -800,6 +810,7 @@ def p_typerule_def(p):
t.tgt_types = p[3]
t.obj_classes = p[5]
t.dest_type = p[6]
+ t.file_name = p[7]
p[0] = t
def p_bool(p):

File diff suppressed because it is too large Load Diff