diff options
author | Joe MacDonald <joe_macdonald@mentor.com> | 2014-11-05 13:29:24 -0500 |
---|---|---|
committer | Joe MacDonald <joe_macdonald@mentor.com> | 2014-11-05 13:29:24 -0500 |
commit | d17272269635af24c0b195b2e29f8db2ecd61fb9 (patch) | |
tree | b0a0cbfc7bdd3c76275891603a2989d47f0c70b0 | |
parent | a529386dc3103909326e86ce28d84b9c8c5b4b02 (diff) | |
parent | 713359e1b8f6794357edc280a826528a3811bcee (diff) | |
download | meta-selinux-d17272269635af24c0b195b2e29f8db2ecd61fb9.tar.gz |
Merge branch 'master-next'
Signed-off-by: Joe MacDonald <joe_macdonald@mentor.com>
-rw-r--r-- | conf/distro/oe-selinux.conf | 2 | ||||
-rw-r--r-- | recipes-security/refpolicy/refpolicy-2.20130424/Allow-ping-to-get-set-capabilities.patch | 32 | ||||
-rw-r--r-- | recipes-security/refpolicy/refpolicy-2.20130424/Allow-udev-the-block_suspend-capability.patch | 25 | ||||
-rw-r--r-- | recipes-security/refpolicy/refpolicy-2.20130424/filesystem-associate-tmpfs_t-shm-to-device_t-devtmpf.patch | 30 | ||||
-rw-r--r-- | recipes-security/refpolicy/refpolicy-2.20130424/hostname-do-not-audit-attempts-by-hostname-to-read-a.patch | 59 | ||||
-rw-r--r-- | recipes-security/refpolicy/refpolicy-2.20130424/poky-policy-fix-xconsole_device_t-as-a-dev_node.patch | 27 | ||||
-rw-r--r-- | recipes-security/refpolicy/refpolicy-2.20130424/sysnetwork-dhcpc-binds-socket-to-random-high-udp-por.patch | 41 | ||||
-rw-r--r-- | recipes-security/refpolicy/refpolicy-2.20140311/ftp-add-ftpd_t-to-mlsfilewrite.patch (renamed from recipes-security/refpolicy/refpolicy-2.20130424/ftp-add-ftpd_t-to-mlsfilewrite.patch) | 0 | ||||
-rw-r--r-- | recipes-security/refpolicy/refpolicy-2.20140311/poky-fc-clock.patch (renamed from recipes-security/refpolicy/refpolicy-2.20130424/poky-fc-clock.patch) | 0 | ||||
-rw-r--r-- | recipes-security/refpolicy/refpolicy-2.20140311/poky-fc-corecommands.patch (renamed from recipes-security/refpolicy/refpolicy-2.20130424/poky-fc-corecommands.patch) | 0 | ||||
-rw-r--r-- | recipes-security/refpolicy/refpolicy-2.20140311/poky-fc-dmesg.patch (renamed from recipes-security/refpolicy/refpolicy-2.20130424/poky-fc-dmesg.patch) | 0 | ||||
-rw-r--r-- | recipes-security/refpolicy/refpolicy-2.20140311/poky-fc-fix-bind.patch (renamed from recipes-security/refpolicy/refpolicy-2.20130424/poky-fc-fix-bind.patch) | 0 | ||||
-rw-r--r-- | recipes-security/refpolicy/refpolicy-2.20140311/poky-fc-fix-real-path_login.patch (renamed from recipes-security/refpolicy/refpolicy-2.20130424/poky-fc-fix-real-path_login.patch) | 0 | ||||
-rw-r--r-- | recipes-security/refpolicy/refpolicy-2.20140311/poky-fc-fix-real-path_resolv.conf.patch (renamed from recipes-security/refpolicy/refpolicy-2.20130424/poky-fc-fix-real-path_resolv.conf.patch) | 0 | ||||
-rw-r--r-- | recipes-security/refpolicy/refpolicy-2.20140311/poky-fc-fix-real-path_shadow.patch (renamed from recipes-security/refpolicy/refpolicy-2.20130424/poky-fc-fix-real-path_shadow.patch) | 0 | ||||
-rw-r--r-- | recipes-security/refpolicy/refpolicy-2.20140311/poky-fc-fix-real-path_su.patch (renamed from recipes-security/refpolicy/refpolicy-2.20130424/poky-fc-fix-real-path_su.patch) | 0 | ||||
-rw-r--r-- | recipes-security/refpolicy/refpolicy-2.20140311/poky-fc-fstools.patch (renamed from recipes-security/refpolicy/refpolicy-2.20130424/poky-fc-fstools.patch) | 39 | ||||
-rw-r--r-- | recipes-security/refpolicy/refpolicy-2.20140311/poky-fc-ftpwho-dir.patch (renamed from recipes-security/refpolicy/refpolicy-2.20130424/poky-fc-ftpwho-dir.patch) | 0 | ||||
-rw-r--r-- | recipes-security/refpolicy/refpolicy-2.20140311/poky-fc-iptables.patch (renamed from recipes-security/refpolicy/refpolicy-2.20130424/poky-fc-iptables.patch) | 0 | ||||
-rw-r--r-- | recipes-security/refpolicy/refpolicy-2.20140311/poky-fc-mta.patch (renamed from recipes-security/refpolicy/refpolicy-2.20130424/poky-fc-mta.patch) | 0 | ||||
-rw-r--r-- | recipes-security/refpolicy/refpolicy-2.20140311/poky-fc-netutils.patch (renamed from recipes-security/refpolicy/refpolicy-2.20130424/poky-fc-netutils.patch) | 0 | ||||
-rw-r--r-- | recipes-security/refpolicy/refpolicy-2.20140311/poky-fc-nscd.patch (renamed from recipes-security/refpolicy/refpolicy-2.20130424/poky-fc-nscd.patch) | 0 | ||||
-rw-r--r-- | recipes-security/refpolicy/refpolicy-2.20140311/poky-fc-rpm.patch (renamed from recipes-security/refpolicy/refpolicy-2.20130424/poky-fc-rpm.patch) | 0 | ||||
-rw-r--r-- | recipes-security/refpolicy/refpolicy-2.20140311/poky-fc-screen.patch (renamed from recipes-security/refpolicy/refpolicy-2.20130424/poky-fc-screen.patch) | 0 | ||||
-rw-r--r-- | recipes-security/refpolicy/refpolicy-2.20140311/poky-fc-ssh.patch (renamed from recipes-security/refpolicy/refpolicy-2.20130424/poky-fc-ssh.patch) | 0 | ||||
-rw-r--r-- | recipes-security/refpolicy/refpolicy-2.20140311/poky-fc-su.patch (renamed from recipes-security/refpolicy/refpolicy-2.20130424/poky-fc-su.patch) | 0 | ||||
-rw-r--r-- | recipes-security/refpolicy/refpolicy-2.20140311/poky-fc-subs_dist.patch (renamed from recipes-security/refpolicy/refpolicy-2.20130424/poky-fc-subs_dist.patch) | 17 | ||||
-rw-r--r-- | recipes-security/refpolicy/refpolicy-2.20140311/poky-fc-sysnetwork.patch (renamed from recipes-security/refpolicy/refpolicy-2.20130424/poky-fc-sysnetwork.patch) | 0 | ||||
-rw-r--r-- | recipes-security/refpolicy/refpolicy-2.20140311/poky-fc-udevd.patch (renamed from recipes-security/refpolicy/refpolicy-2.20130424/poky-fc-udevd.patch) | 0 | ||||
-rw-r--r-- | recipes-security/refpolicy/refpolicy-2.20140311/poky-fc-update-alternatives_hostname.patch (renamed from recipes-security/refpolicy/refpolicy-2.20130424/poky-fc-update-alternatives_hostname.patch) | 0 | ||||
-rw-r--r-- | recipes-security/refpolicy/refpolicy-2.20140311/poky-fc-update-alternatives_sysklogd.patch (renamed from recipes-security/refpolicy/refpolicy-2.20130424/poky-fc-update-alternatives_sysklogd.patch) | 0 | ||||
-rw-r--r-- | recipes-security/refpolicy/refpolicy-2.20140311/poky-fc-update-alternatives_sysvinit.patch (renamed from recipes-security/refpolicy/refpolicy-2.20130424/poky-fc-update-alternatives_sysvinit.patch) | 0 | ||||
-rw-r--r-- | recipes-security/refpolicy/refpolicy-2.20140311/poky-policy-add-rules-for-bsdpty_device_t.patch (renamed from recipes-security/refpolicy/refpolicy-2.20130424/poky-policy-add-rules-for-bsdpty_device_t.patch) | 0 | ||||
-rw-r--r-- | recipes-security/refpolicy/refpolicy-2.20140311/poky-policy-add-rules-for-syslogd_t-symlink.patch (renamed from recipes-security/refpolicy/refpolicy-2.20130424/poky-policy-add-rules-for-syslogd_t-symlink.patch) | 0 | ||||
-rw-r--r-- | recipes-security/refpolicy/refpolicy-2.20140311/poky-policy-add-rules-for-tmp-symlink.patch (renamed from recipes-security/refpolicy/refpolicy-2.20130424/poky-policy-add-rules-for-tmp-symlink.patch) | 0 | ||||
-rw-r--r-- | recipes-security/refpolicy/refpolicy-2.20140311/poky-policy-add-rules-for-var-cache-symlink.patch (renamed from recipes-security/refpolicy/refpolicy-2.20130424/poky-policy-add-rules-for-var-cache-symlink.patch) | 0 | ||||
-rw-r--r-- | recipes-security/refpolicy/refpolicy-2.20140311/poky-policy-add-rules-for-var-log-symlink-apache.patch (renamed from recipes-security/refpolicy/refpolicy-2.20130424/poky-policy-add-rules-for-var-log-symlink-apache.patch) | 0 | ||||
-rw-r--r-- | recipes-security/refpolicy/refpolicy-2.20140311/poky-policy-add-rules-for-var-log-symlink-audisp_remote_t.patch (renamed from recipes-security/refpolicy/refpolicy-2.20130424/poky-policy-add-rules-for-var-log-symlink-audisp_remote_t.patch) | 0 | ||||
-rw-r--r-- | recipes-security/refpolicy/refpolicy-2.20140311/poky-policy-add-rules-for-var-log-symlink.patch (renamed from recipes-security/refpolicy/refpolicy-2.20130424/poky-policy-add-rules-for-var-log-symlink.patch) | 0 | ||||
-rw-r--r-- | recipes-security/refpolicy/refpolicy-2.20140311/poky-policy-add-syslogd_t-to-trusted-object.patch (renamed from recipes-security/refpolicy/refpolicy-2.20130424/poky-policy-add-syslogd_t-to-trusted-object.patch) | 0 | ||||
-rw-r--r-- | recipes-security/refpolicy/refpolicy-2.20140311/poky-policy-allow-nfsd-to-exec-shell-commands.patch (renamed from recipes-security/refpolicy/refpolicy-2.20130424/poky-policy-allow-nfsd-to-exec-shell-commands.patch) | 0 | ||||
-rw-r--r-- | recipes-security/refpolicy/refpolicy-2.20140311/poky-policy-allow-setfiles_t-to-read-symlinks.patch (renamed from recipes-security/refpolicy/refpolicy-2.20130424/poky-policy-allow-setfiles_t-to-read-symlinks.patch) | 0 | ||||
-rw-r--r-- | recipes-security/refpolicy/refpolicy-2.20140311/poky-policy-allow-sysadm-to-run-rpcinfo.patch (renamed from recipes-security/refpolicy/refpolicy-2.20130424/poky-policy-allow-sysadm-to-run-rpcinfo.patch) | 0 | ||||
-rw-r--r-- | recipes-security/refpolicy/refpolicy-2.20140311/poky-policy-don-t-audit-tty_device_t.patch (renamed from recipes-security/refpolicy/refpolicy-2.20130424/poky-policy-don-t-audit-tty_device_t.patch) | 0 | ||||
-rw-r--r-- | recipes-security/refpolicy/refpolicy-2.20140311/poky-policy-fix-dmesg-to-use-dev-kmsg.patch (renamed from recipes-security/refpolicy/refpolicy-2.20130424/poky-policy-fix-dmesg-to-use-dev-kmsg.patch) | 0 | ||||
-rw-r--r-- | recipes-security/refpolicy/refpolicy-2.20140311/poky-policy-fix-new-SELINUXMNT-in-sys.patch (renamed from recipes-security/refpolicy/refpolicy-2.20130424/poky-policy-fix-new-SELINUXMNT-in-sys.patch) | 101 | ||||
-rw-r--r-- | recipes-security/refpolicy/refpolicy-2.20140311/poky-policy-fix-nfsd_t-to-mount_nfsd_fs_t.patch (renamed from recipes-security/refpolicy/refpolicy-2.20130424/poky-policy-fix-nfsd_t-to-mount_nfsd_fs_t.patch) | 26 | ||||
-rw-r--r-- | recipes-security/refpolicy/refpolicy-2.20140311/poky-policy-fix-setfiles-statvfs-get-file-count.patch (renamed from recipes-security/refpolicy/refpolicy-2.20130424/poky-policy-fix-setfiles-statvfs-get-file-count.patch) | 0 | ||||
-rw-r--r-- | recipes-security/refpolicy/refpolicy-2.20140311/poky-policy-fix-seutils-manage-config-files.patch (renamed from recipes-security/refpolicy/refpolicy-2.20130424/poky-policy-fix-seutils-manage-config-files.patch) | 0 | ||||
-rw-r--r-- | recipes-security/refpolicy/refpolicy-mcs_2.20140311.bb (renamed from recipes-security/refpolicy/refpolicy-mcs_2.20130424.bb) | 2 | ||||
-rw-r--r-- | recipes-security/refpolicy/refpolicy-minimum_2.20140311.bb (renamed from recipes-security/refpolicy/refpolicy-minimum_2.20130424.bb) | 24 | ||||
-rw-r--r-- | recipes-security/refpolicy/refpolicy-mls_2.20140311.bb (renamed from recipes-security/refpolicy/refpolicy-mls_2.20130424.bb) | 2 | ||||
-rw-r--r-- | recipes-security/refpolicy/refpolicy-standard_2.20140311.bb (renamed from recipes-security/refpolicy/refpolicy-standard_2.20130424.bb) | 2 | ||||
-rw-r--r-- | recipes-security/refpolicy/refpolicy-targeted/refpolicy-unconfined_u-default-user.patch | 68 | ||||
-rw-r--r-- | recipes-security/refpolicy/refpolicy-targeted_2.20140311.bb (renamed from recipes-security/refpolicy/refpolicy-targeted_2.20130424.bb) | 7 | ||||
-rw-r--r-- | recipes-security/refpolicy/refpolicy_2.20140311.inc (renamed from recipes-security/refpolicy/refpolicy_2.20130424.inc) | 18 | ||||
-rw-r--r-- | recipes-security/refpolicy/refpolicy_common.inc | 28 | ||||
-rw-r--r-- | recipes-security/selinux/checkpolicy.inc | 2 | ||||
-rw-r--r-- | recipes-security/selinux/checkpolicy_2.2.bb | 9 | ||||
-rw-r--r-- | recipes-security/selinux/checkpolicy_2.3.bb | 7 | ||||
-rw-r--r-- | recipes-security/selinux/libselinux_2.3.bb (renamed from recipes-security/selinux/libselinux_2.2.2.bb) | 8 | ||||
-rw-r--r-- | recipes-security/selinux/libsemanage_2.3.bb (renamed from recipes-security/selinux/libsemanage_2.2.bb) | 8 | ||||
-rw-r--r-- | recipes-security/selinux/libsepol_2.2.bb | 9 | ||||
-rw-r--r-- | recipes-security/selinux/libsepol_2.3.bb | 7 | ||||
-rw-r--r-- | recipes-security/selinux/policycoreutils.inc | 2 | ||||
-rw-r--r-- | recipes-security/selinux/policycoreutils_2.3.bb (renamed from recipes-security/selinux/policycoreutils_2.2.5.bb) | 8 | ||||
-rw-r--r-- | recipes-security/selinux/selinux_20140506.inc (renamed from recipes-security/selinux/selinux_20131030.inc) | 0 | ||||
-rw-r--r-- | recipes-security/selinux/selinux_git.inc | 2 | ||||
-rw-r--r-- | recipes-security/selinux/sepolgen_1.2.1.bb | 4 | ||||
-rw-r--r-- | recipes-security/setools/setools/setools-Changes-to-support-named-file_trans-rules.patch | 1511 | ||||
-rw-r--r-- | recipes-security/setools/setools/setools-replcon-correct-invalid-prototype-for-lsetfilecon_ra.patch | 34 | ||||
-rw-r--r-- | recipes-security/setools/setools_3.3.8.bb | 3 |
72 files changed, 207 insertions, 1957 deletions
diff --git a/conf/distro/oe-selinux.conf b/conf/distro/oe-selinux.conf index 5f4af87..6e55a32 100644 --- a/conf/distro/oe-selinux.conf +++ b/conf/distro/oe-selinux.conf | |||
@@ -1,4 +1,4 @@ | |||
1 | DISTRO = "oe-selinux" | 1 | DISTRO = "oe-selinux" |
2 | DISTROOVERRIDES .= ":selinux" | 2 | DISTROOVERRIDES .= ":selinux" |
3 | 3 | ||
4 | DISTRO_FEATURES_append = " acl xattr pam selinux compressed_policy" | 4 | DISTRO_FEATURES_append = " acl xattr pam selinux" |
diff --git a/recipes-security/refpolicy/refpolicy-2.20130424/Allow-ping-to-get-set-capabilities.patch b/recipes-security/refpolicy/refpolicy-2.20130424/Allow-ping-to-get-set-capabilities.patch deleted file mode 100644 index fced84a..0000000 --- a/recipes-security/refpolicy/refpolicy-2.20130424/Allow-ping-to-get-set-capabilities.patch +++ /dev/null | |||
@@ -1,32 +0,0 @@ | |||
1 | From 56c43144d7dcf5fec969c9aa9cb97679ccad50cc Mon Sep 17 00:00:00 2001 | ||
2 | From: Sven Vermeulen <sven.vermeulen@siphos.be> | ||
3 | Date: Wed, 25 Sep 2013 20:27:34 +0200 | ||
4 | Subject: [PATCH] Allow ping to get/set capabilities | ||
5 | |||
6 | When ping is installed with capabilities instead of being marked setuid, | ||
7 | then the ping_t domain needs to be allowed to getcap/setcap. | ||
8 | |||
9 | Reported-by: Luis Ressel <aranea@aixah.de> | ||
10 | Signed-off-by: Sven Vermeulen <sven.vermeulen@siphos.be> | ||
11 | |||
12 | Upstream-Status: backport | ||
13 | --- | ||
14 | policy/modules/admin/netutils.te | 2 ++ | ||
15 | 1 file changed, 2 insertions(+) | ||
16 | |||
17 | diff --git a/policy/modules/admin/netutils.te b/policy/modules/admin/netutils.te | ||
18 | index 557da97..cfe036a 100644 | ||
19 | --- a/policy/modules/admin/netutils.te | ||
20 | +++ b/policy/modules/admin/netutils.te | ||
21 | @@ -106,6 +106,8 @@ optional_policy(` | ||
22 | # | ||
23 | |||
24 | allow ping_t self:capability { setuid net_raw }; | ||
25 | +# When ping is installed with capabilities instead of setuid | ||
26 | +allow ping_t self:process { getcap setcap }; | ||
27 | dontaudit ping_t self:capability sys_tty_config; | ||
28 | allow ping_t self:tcp_socket create_socket_perms; | ||
29 | allow ping_t self:rawip_socket { create ioctl read write bind getopt setopt }; | ||
30 | -- | ||
31 | 1.7.10.4 | ||
32 | |||
diff --git a/recipes-security/refpolicy/refpolicy-2.20130424/Allow-udev-the-block_suspend-capability.patch b/recipes-security/refpolicy/refpolicy-2.20130424/Allow-udev-the-block_suspend-capability.patch deleted file mode 100644 index 3c6a979..0000000 --- a/recipes-security/refpolicy/refpolicy-2.20130424/Allow-udev-the-block_suspend-capability.patch +++ /dev/null | |||
@@ -1,25 +0,0 @@ | |||
1 | Allow udev the block_suspend capability | ||
2 | |||
3 | Upstream-Status: backport | ||
4 | upstream commit: 5905067f2acf710ffbb13ba32575e6316619ddd8 | ||
5 | |||
6 | Signed-off-by: Jackie Huang <jackie.huang@windriver.com> | ||
7 | --- | ||
8 | policy/modules/system/udev.te | 1 + | ||
9 | 1 file changed, 1 insertion(+) | ||
10 | |||
11 | diff --git a/policy/modules/system/udev.te b/policy/modules/system/udev.te | ||
12 | index 90e4ab3..efe6c02 100644 | ||
13 | --- a/policy/modules/system/udev.te | ||
14 | +++ b/policy/modules/system/udev.te | ||
15 | @@ -39,6 +39,7 @@ ifdef(`enable_mcs',` | ||
16 | |||
17 | allow udev_t self:capability { chown dac_override dac_read_search fowner fsetid sys_admin mknod net_raw net_admin sys_nice sys_rawio sys_resource setuid setgid sys_nice sys_ptrace }; | ||
18 | dontaudit udev_t self:capability sys_tty_config; | ||
19 | +allow udev_t self:capability2 block_suspend; | ||
20 | allow udev_t self:process ~{ setcurrent setexec setfscreate setrlimit execmem execstack execheap }; | ||
21 | allow udev_t self:process { execmem setfscreate }; | ||
22 | allow udev_t self:fd use; | ||
23 | -- | ||
24 | 1.7.9.5 | ||
25 | |||
diff --git a/recipes-security/refpolicy/refpolicy-2.20130424/filesystem-associate-tmpfs_t-shm-to-device_t-devtmpf.patch b/recipes-security/refpolicy/refpolicy-2.20130424/filesystem-associate-tmpfs_t-shm-to-device_t-devtmpf.patch deleted file mode 100644 index 094d9e5..0000000 --- a/recipes-security/refpolicy/refpolicy-2.20130424/filesystem-associate-tmpfs_t-shm-to-device_t-devtmpf.patch +++ /dev/null | |||
@@ -1,30 +0,0 @@ | |||
1 | Upstream-Status: backport | ||
2 | |||
3 | Signed-off-by: Wenzong Fan <wenzong.fan@windriver.com> | ||
4 | ========================= | ||
5 | From e3072cb7bf8f9e09598f01c9eb58d9cfb319d8a1 Mon Sep 17 00:00:00 2001 | ||
6 | From: Dominick Grift <dominick.grift@gmail.com> | ||
7 | Date: Tue, 24 Sep 2013 15:39:21 +0200 | ||
8 | Subject: [PATCH] filesystem: associate tmpfs_t (shm) to device_t (devtmpfs) | ||
9 | file systems | ||
10 | |||
11 | Signed-off-by: Dominick Grift <dominick.grift@gmail.com> | ||
12 | --- | ||
13 | policy/modules/kernel/filesystem.te | 1 + | ||
14 | 1 file changed, 1 insertion(+) | ||
15 | |||
16 | diff --git a/policy/modules/kernel/filesystem.te b/policy/modules/kernel/filesystem.te | ||
17 | index ed59e5e..f72cde1 100644 | ||
18 | --- a/policy/modules/kernel/filesystem.te | ||
19 | +++ b/policy/modules/kernel/filesystem.te | ||
20 | @@ -177,6 +177,7 @@ genfscon vxfs / gen_context(system_u:object_r:vxfs_t,s0) | ||
21 | # tmpfs_t is the type for tmpfs filesystems | ||
22 | # | ||
23 | type tmpfs_t; | ||
24 | +dev_associate(tmpfs_t) | ||
25 | fs_type(tmpfs_t) | ||
26 | files_type(tmpfs_t) | ||
27 | files_mountpoint(tmpfs_t) | ||
28 | -- | ||
29 | 1.7.10.4 | ||
30 | |||
diff --git a/recipes-security/refpolicy/refpolicy-2.20130424/hostname-do-not-audit-attempts-by-hostname-to-read-a.patch b/recipes-security/refpolicy/refpolicy-2.20130424/hostname-do-not-audit-attempts-by-hostname-to-read-a.patch deleted file mode 100644 index edba56d..0000000 --- a/recipes-security/refpolicy/refpolicy-2.20130424/hostname-do-not-audit-attempts-by-hostname-to-read-a.patch +++ /dev/null | |||
@@ -1,59 +0,0 @@ | |||
1 | From 0857061b58e5ec0bf00e78839254f21519ed55d4 Mon Sep 17 00:00:00 2001 | ||
2 | From: Dominick Grift <dominick.grift@gmail.com> | ||
3 | Date: Fri, 27 Sep 2013 10:36:14 +0200 | ||
4 | Subject: [PATCH] hostname: do not audit attempts by hostname to read and | ||
5 | write dhcpc udp sockets (looks like a leaked fd) | ||
6 | |||
7 | Upstream-Status: backport | ||
8 | |||
9 | Signed-off-by: Dominick Grift <dominick.grift@gmail.com> | ||
10 | --- | ||
11 | policy/modules/system/hostname.te | 1 + | ||
12 | policy/modules/system/sysnetwork.if | 19 +++++++++++++++++++ | ||
13 | 2 files changed, 20 insertions(+) | ||
14 | |||
15 | diff --git a/policy/modules/system/hostname.te b/policy/modules/system/hostname.te | ||
16 | index f6cbda9..380197b 100644 | ||
17 | --- a/policy/modules/system/hostname.te | ||
18 | +++ b/policy/modules/system/hostname.te | ||
19 | @@ -51,6 +51,7 @@ logging_send_syslog_msg(hostname_t) | ||
20 | |||
21 | miscfiles_read_localization(hostname_t) | ||
22 | |||
23 | +sysnet_dontaudit_rw_dhcpc_udp_sockets(hostname_t) | ||
24 | sysnet_dontaudit_rw_dhcpc_unix_stream_sockets(hostname_t) | ||
25 | sysnet_read_config(hostname_t) | ||
26 | sysnet_dns_name_resolve(hostname_t) | ||
27 | diff --git a/policy/modules/system/sysnetwork.if b/policy/modules/system/sysnetwork.if | ||
28 | index 52b548c..2cea692 100644 | ||
29 | --- a/policy/modules/system/sysnetwork.if | ||
30 | +++ b/policy/modules/system/sysnetwork.if | ||
31 | @@ -47,6 +47,25 @@ interface(`sysnet_run_dhcpc',` | ||
32 | |||
33 | ######################################## | ||
34 | ## <summary> | ||
35 | +## Do not audit attempts to read and | ||
36 | +## write dhcpc udp socket descriptors. | ||
37 | +## </summary> | ||
38 | +## <param name="domain"> | ||
39 | +## <summary> | ||
40 | +## Domain to not audit. | ||
41 | +## </summary> | ||
42 | +## </param> | ||
43 | +# | ||
44 | +interface(`sysnet_dontaudit_rw_dhcpc_udp_sockets',` | ||
45 | + gen_require(` | ||
46 | + type dhcpc_t; | ||
47 | + ') | ||
48 | + | ||
49 | + dontaudit $1 dhcpc_t:udp_socket { read write }; | ||
50 | +') | ||
51 | + | ||
52 | +######################################## | ||
53 | +## <summary> | ||
54 | ## Do not audit attempts to use | ||
55 | ## the dhcp file descriptors. | ||
56 | ## </summary> | ||
57 | -- | ||
58 | 1.7.10.4 | ||
59 | |||
diff --git a/recipes-security/refpolicy/refpolicy-2.20130424/poky-policy-fix-xconsole_device_t-as-a-dev_node.patch b/recipes-security/refpolicy/refpolicy-2.20130424/poky-policy-fix-xconsole_device_t-as-a-dev_node.patch deleted file mode 100644 index aa870f4..0000000 --- a/recipes-security/refpolicy/refpolicy-2.20130424/poky-policy-fix-xconsole_device_t-as-a-dev_node.patch +++ /dev/null | |||
@@ -1,27 +0,0 @@ | |||
1 | From 843299c135c30b036ed163a10570a1d5efe36ff8 Mon Sep 17 00:00:00 2001 | ||
2 | From: Xin Ouyang <Xin.Ouyang@windriver.com> | ||
3 | Date: Thu, 22 Aug 2013 13:37:23 +0800 | ||
4 | Subject: [PATCH 1/2] fix xconsole_device_t as a dev_node. | ||
5 | |||
6 | Upstream-Status: Inappropriate [only for Poky] | ||
7 | |||
8 | Signed-off-by: Xin Ouyang <Xin.Ouyang@windriver.com> | ||
9 | --- | ||
10 | policy/modules/services/xserver.te | 1 + | ||
11 | 1 file changed, 1 insertion(+) | ||
12 | |||
13 | diff --git a/policy/modules/services/xserver.te b/policy/modules/services/xserver.te | ||
14 | index 4f6d693..b00f004 100644 | ||
15 | --- a/policy/modules/services/xserver.te | ||
16 | +++ b/policy/modules/services/xserver.te | ||
17 | @@ -151,6 +151,7 @@ userdom_user_tmp_file(xauth_tmp_t) | ||
18 | # this is not actually a device, its a pipe | ||
19 | type xconsole_device_t; | ||
20 | files_type(xconsole_device_t) | ||
21 | +dev_node(xconsole_device_t) | ||
22 | fs_associate_tmpfs(xconsole_device_t) | ||
23 | files_associate_tmp(xconsole_device_t) | ||
24 | |||
25 | -- | ||
26 | 1.7.9.5 | ||
27 | |||
diff --git a/recipes-security/refpolicy/refpolicy-2.20130424/sysnetwork-dhcpc-binds-socket-to-random-high-udp-por.patch b/recipes-security/refpolicy/refpolicy-2.20130424/sysnetwork-dhcpc-binds-socket-to-random-high-udp-por.patch deleted file mode 100644 index e95d675..0000000 --- a/recipes-security/refpolicy/refpolicy-2.20130424/sysnetwork-dhcpc-binds-socket-to-random-high-udp-por.patch +++ /dev/null | |||
@@ -1,41 +0,0 @@ | |||
1 | From b1599e01fe3f3e7a1c2048d1c466e3e842952924 Mon Sep 17 00:00:00 2001 | ||
2 | From: Dominick Grift <dominick.grift@gmail.com> | ||
3 | Date: Fri, 27 Sep 2013 11:35:41 +0200 | ||
4 | Subject: [PATCH] sysnetwork: dhcpc binds socket to random high udp ports | ||
5 | sysnetwork: do not audit attempts by ifconfig to read, and | ||
6 | write dhcpc udp sockets (looks like a leaked fd) | ||
7 | |||
8 | Upstream-Status: backport | ||
9 | |||
10 | Signed-off-by: Dominick Grift <dominick.grift@gmail.com> | ||
11 | --- | ||
12 | policy/modules/system/sysnetwork.te | 6 +++++- | ||
13 | 1 file changed, 5 insertions(+), 1 deletion(-) | ||
14 | |||
15 | diff --git a/policy/modules/system/sysnetwork.te b/policy/modules/system/sysnetwork.te | ||
16 | index f9dce11..67709b5 100644 | ||
17 | --- a/policy/modules/system/sysnetwork.te | ||
18 | +++ b/policy/modules/system/sysnetwork.te | ||
19 | @@ -111,7 +111,9 @@ corenet_tcp_bind_dhcpc_port(dhcpc_t) | ||
20 | corenet_udp_bind_dhcpc_port(dhcpc_t) | ||
21 | corenet_tcp_connect_all_ports(dhcpc_t) | ||
22 | corenet_sendrecv_dhcpd_client_packets(dhcpc_t) | ||
23 | -corenet_sendrecv_dhcpc_server_packets(dhcpc_t) | ||
24 | + | ||
25 | +corenet_sendrecv_all_server_packets(dhcpc_t) | ||
26 | +corenet_udp_bind_all_unreserved_ports(dhcpc_t) | ||
27 | |||
28 | dev_read_sysfs(dhcpc_t) | ||
29 | # for SSP: | ||
30 | @@ -313,6 +315,8 @@ modutils_domtrans_insmod(ifconfig_t) | ||
31 | |||
32 | seutil_use_runinit_fds(ifconfig_t) | ||
33 | |||
34 | +sysnet_dontaudit_rw_dhcpc_udp_sockets(ifconfig_t) | ||
35 | + | ||
36 | userdom_use_user_terminals(ifconfig_t) | ||
37 | userdom_use_all_users_fds(ifconfig_t) | ||
38 | |||
39 | -- | ||
40 | 1.7.10.4 | ||
41 | |||
diff --git a/recipes-security/refpolicy/refpolicy-2.20130424/ftp-add-ftpd_t-to-mlsfilewrite.patch b/recipes-security/refpolicy/refpolicy-2.20140311/ftp-add-ftpd_t-to-mlsfilewrite.patch index 49da4b6..49da4b6 100644 --- a/recipes-security/refpolicy/refpolicy-2.20130424/ftp-add-ftpd_t-to-mlsfilewrite.patch +++ b/recipes-security/refpolicy/refpolicy-2.20140311/ftp-add-ftpd_t-to-mlsfilewrite.patch | |||
diff --git a/recipes-security/refpolicy/refpolicy-2.20130424/poky-fc-clock.patch b/recipes-security/refpolicy/refpolicy-2.20140311/poky-fc-clock.patch index 3ff8f55..3ff8f55 100644 --- a/recipes-security/refpolicy/refpolicy-2.20130424/poky-fc-clock.patch +++ b/recipes-security/refpolicy/refpolicy-2.20140311/poky-fc-clock.patch | |||
diff --git a/recipes-security/refpolicy/refpolicy-2.20130424/poky-fc-corecommands.patch b/recipes-security/refpolicy/refpolicy-2.20140311/poky-fc-corecommands.patch index 24b67c3..24b67c3 100644 --- a/recipes-security/refpolicy/refpolicy-2.20130424/poky-fc-corecommands.patch +++ b/recipes-security/refpolicy/refpolicy-2.20140311/poky-fc-corecommands.patch | |||
diff --git a/recipes-security/refpolicy/refpolicy-2.20130424/poky-fc-dmesg.patch b/recipes-security/refpolicy/refpolicy-2.20140311/poky-fc-dmesg.patch index db4c4d4..db4c4d4 100644 --- a/recipes-security/refpolicy/refpolicy-2.20130424/poky-fc-dmesg.patch +++ b/recipes-security/refpolicy/refpolicy-2.20140311/poky-fc-dmesg.patch | |||
diff --git a/recipes-security/refpolicy/refpolicy-2.20130424/poky-fc-fix-bind.patch b/recipes-security/refpolicy/refpolicy-2.20140311/poky-fc-fix-bind.patch index 59ba5bc..59ba5bc 100644 --- a/recipes-security/refpolicy/refpolicy-2.20130424/poky-fc-fix-bind.patch +++ b/recipes-security/refpolicy/refpolicy-2.20140311/poky-fc-fix-bind.patch | |||
diff --git a/recipes-security/refpolicy/refpolicy-2.20130424/poky-fc-fix-real-path_login.patch b/recipes-security/refpolicy/refpolicy-2.20140311/poky-fc-fix-real-path_login.patch index 427181e..427181e 100644 --- a/recipes-security/refpolicy/refpolicy-2.20130424/poky-fc-fix-real-path_login.patch +++ b/recipes-security/refpolicy/refpolicy-2.20140311/poky-fc-fix-real-path_login.patch | |||
diff --git a/recipes-security/refpolicy/refpolicy-2.20130424/poky-fc-fix-real-path_resolv.conf.patch b/recipes-security/refpolicy/refpolicy-2.20140311/poky-fc-fix-real-path_resolv.conf.patch index 80cca67..80cca67 100644 --- a/recipes-security/refpolicy/refpolicy-2.20130424/poky-fc-fix-real-path_resolv.conf.patch +++ b/recipes-security/refpolicy/refpolicy-2.20140311/poky-fc-fix-real-path_resolv.conf.patch | |||
diff --git a/recipes-security/refpolicy/refpolicy-2.20130424/poky-fc-fix-real-path_shadow.patch b/recipes-security/refpolicy/refpolicy-2.20140311/poky-fc-fix-real-path_shadow.patch index 29ac2c3..29ac2c3 100644 --- a/recipes-security/refpolicy/refpolicy-2.20130424/poky-fc-fix-real-path_shadow.patch +++ b/recipes-security/refpolicy/refpolicy-2.20140311/poky-fc-fix-real-path_shadow.patch | |||
diff --git a/recipes-security/refpolicy/refpolicy-2.20130424/poky-fc-fix-real-path_su.patch b/recipes-security/refpolicy/refpolicy-2.20140311/poky-fc-fix-real-path_su.patch index b0392ce..b0392ce 100644 --- a/recipes-security/refpolicy/refpolicy-2.20130424/poky-fc-fix-real-path_su.patch +++ b/recipes-security/refpolicy/refpolicy-2.20140311/poky-fc-fix-real-path_su.patch | |||
diff --git a/recipes-security/refpolicy/refpolicy-2.20130424/poky-fc-fstools.patch b/recipes-security/refpolicy/refpolicy-2.20140311/poky-fc-fstools.patch index 5343893..38c96c4 100644 --- a/recipes-security/refpolicy/refpolicy-2.20130424/poky-fc-fstools.patch +++ b/recipes-security/refpolicy/refpolicy-2.20140311/poky-fc-fstools.patch | |||
@@ -6,12 +6,11 @@ Subject: [PATCH] refpolicy: fix real path for fstools | |||
6 | Upstream-Status: Inappropriate [configuration] | 6 | Upstream-Status: Inappropriate [configuration] |
7 | 7 | ||
8 | Signed-off-by: Wenzong Fan <wenzong.fan@windriver.com> | 8 | Signed-off-by: Wenzong Fan <wenzong.fan@windriver.com> |
9 | Signed-off-by: Joe MacDonald <joe_macdonald@mentor.com> | ||
9 | --- | 10 | --- |
10 | policy/modules/system/fstools.fc | 12 ++++++++++++ | 11 | policy/modules/system/fstools.fc | 11 +++++++++++ |
11 | 1 file changed, 12 insertions(+) | 12 | 1 file changed, 11 insertions(+) |
12 | 13 | ||
13 | diff --git a/policy/modules/system/fstools.fc b/policy/modules/system/fstools.fc | ||
14 | index 7a46b45..a724776 100644 | ||
15 | --- a/policy/modules/system/fstools.fc | 14 | --- a/policy/modules/system/fstools.fc |
16 | +++ b/policy/modules/system/fstools.fc | 15 | +++ b/policy/modules/system/fstools.fc |
17 | @@ -1,6 +1,8 @@ | 16 | @@ -1,6 +1,8 @@ |
@@ -23,48 +22,44 @@ index 7a46b45..a724776 100644 | |||
23 | /sbin/cfdisk -- gen_context(system_u:object_r:fsadm_exec_t,s0) | 22 | /sbin/cfdisk -- gen_context(system_u:object_r:fsadm_exec_t,s0) |
24 | /sbin/dosfsck -- gen_context(system_u:object_r:fsadm_exec_t,s0) | 23 | /sbin/dosfsck -- gen_context(system_u:object_r:fsadm_exec_t,s0) |
25 | /sbin/dump -- gen_context(system_u:object_r:fsadm_exec_t,s0) | 24 | /sbin/dump -- gen_context(system_u:object_r:fsadm_exec_t,s0) |
26 | @@ -9,9 +11,12 @@ | 25 | @@ -9,9 +11,11 @@ |
27 | /sbin/e4fsck -- gen_context(system_u:object_r:fsadm_exec_t,s0) | 26 | /sbin/e4fsck -- gen_context(system_u:object_r:fsadm_exec_t,s0) |
28 | /sbin/e2label -- gen_context(system_u:object_r:fsadm_exec_t,s0) | 27 | /sbin/e2label -- gen_context(system_u:object_r:fsadm_exec_t,s0) |
29 | /sbin/fdisk -- gen_context(system_u:object_r:fsadm_exec_t,s0) | 28 | /sbin/fdisk -- gen_context(system_u:object_r:fsadm_exec_t,s0) |
30 | +/sbin/fdisk\.util-linux -- gen_context(system_u:object_r:fsadm_exec_t,s0) | 29 | +/sbin/fdisk\.util-linux -- gen_context(system_u:object_r:fsadm_exec_t,s0) |
31 | /sbin/findfs -- gen_context(system_u:object_r:fsadm_exec_t,s0) | 30 | /sbin/findfs -- gen_context(system_u:object_r:fsadm_exec_t,s0) |
32 | +/usr/sbin/findfs -- gen_context(system_u:object_r:fsadm_exec_t,s0) | ||
33 | /sbin/fsck.* -- gen_context(system_u:object_r:fsadm_exec_t,s0) | 31 | /sbin/fsck.* -- gen_context(system_u:object_r:fsadm_exec_t,s0) |
34 | /sbin/hdparm -- gen_context(system_u:object_r:fsadm_exec_t,s0) | 32 | /sbin/hdparm -- gen_context(system_u:object_r:fsadm_exec_t,s0) |
35 | +/sbin/hdparm\.hdparm -- gen_context(system_u:object_r:fsadm_exec_t,s0) | 33 | +/sbin/hdparm\.hdparm -- gen_context(system_u:object_r:fsadm_exec_t,s0) |
36 | /sbin/install-mbr -- gen_context(system_u:object_r:fsadm_exec_t,s0) | 34 | /sbin/install-mbr -- gen_context(system_u:object_r:fsadm_exec_t,s0) |
37 | /sbin/jfs_.* -- gen_context(system_u:object_r:fsadm_exec_t,s0) | 35 | /sbin/jfs_.* -- gen_context(system_u:object_r:fsadm_exec_t,s0) |
38 | /sbin/losetup.* -- gen_context(system_u:object_r:fsadm_exec_t,s0) | 36 | /sbin/losetup.* -- gen_context(system_u:object_r:fsadm_exec_t,s0) |
39 | @@ -24,21 +29,28 @@ | 37 | @@ -24,6 +28,7 @@ |
40 | /sbin/mkraid -- gen_context(system_u:object_r:fsadm_exec_t,s0) | 38 | /sbin/mkraid -- gen_context(system_u:object_r:fsadm_exec_t,s0) |
41 | /sbin/mkreiserfs -- gen_context(system_u:object_r:fsadm_exec_t,s0) | 39 | /sbin/mkreiserfs -- gen_context(system_u:object_r:fsadm_exec_t,s0) |
42 | /sbin/mkswap -- gen_context(system_u:object_r:fsadm_exec_t,s0) | 40 | /sbin/mkswap -- gen_context(system_u:object_r:fsadm_exec_t,s0) |
43 | +/sbin/mkswap\.util-linux -- gen_context(system_u:object_r:fsadm_exec_t,s0) | 41 | +/sbin/mkswap\.util-linux -- gen_context(system_u:object_r:fsadm_exec_t,s0) |
44 | /sbin/parted -- gen_context(system_u:object_r:fsadm_exec_t,s0) | 42 | /sbin/parted -- gen_context(system_u:object_r:fsadm_exec_t,s0) |
45 | +/usr/sbin/parted -- gen_context(system_u:object_r:fsadm_exec_t,s0) | ||
46 | /sbin/partprobe -- gen_context(system_u:object_r:fsadm_exec_t,s0) | 43 | /sbin/partprobe -- gen_context(system_u:object_r:fsadm_exec_t,s0) |
47 | +/usr/sbin/partprobe -- gen_context(system_u:object_r:fsadm_exec_t,s0) | ||
48 | /sbin/partx -- gen_context(system_u:object_r:fsadm_exec_t,s0) | 44 | /sbin/partx -- gen_context(system_u:object_r:fsadm_exec_t,s0) |
49 | +/usr/sbin/partx -- gen_context(system_u:object_r:fsadm_exec_t,s0) | 45 | @@ -34,6 +39,7 @@ |
50 | /sbin/raidautorun -- gen_context(system_u:object_r:fsadm_exec_t,s0) | ||
51 | /sbin/raidstart -- gen_context(system_u:object_r:fsadm_exec_t,s0) | ||
52 | /sbin/reiserfs(ck|tune) -- gen_context(system_u:object_r:fsadm_exec_t,s0) | ||
53 | /sbin/resize.*fs -- gen_context(system_u:object_r:fsadm_exec_t,s0) | ||
54 | /sbin/scsi_info -- gen_context(system_u:object_r:fsadm_exec_t,s0) | 46 | /sbin/scsi_info -- gen_context(system_u:object_r:fsadm_exec_t,s0) |
55 | /sbin/sfdisk -- gen_context(system_u:object_r:fsadm_exec_t,s0) | 47 | /sbin/sfdisk -- gen_context(system_u:object_r:fsadm_exec_t,s0) |
56 | +/usr/sbin/sfdisk -- gen_context(system_u:object_r:fsadm_exec_t,s0) | ||
57 | /sbin/swapoff -- gen_context(system_u:object_r:fsadm_exec_t,s0) | 48 | /sbin/swapoff -- gen_context(system_u:object_r:fsadm_exec_t,s0) |
58 | +/sbin/swapoff\.util-linux -- gen_context(system_u:object_r:fsadm_exec_t,s0) | 49 | +/sbin/swapoff\.util-linux -- gen_context(system_u:object_r:fsadm_exec_t,s0) |
59 | /sbin/swapon.* -- gen_context(system_u:object_r:fsadm_exec_t,s0) | 50 | /sbin/swapon.* -- gen_context(system_u:object_r:fsadm_exec_t,s0) |
60 | /sbin/tune2fs -- gen_context(system_u:object_r:fsadm_exec_t,s0) | 51 | /sbin/tune2fs -- gen_context(system_u:object_r:fsadm_exec_t,s0) |
52 | /sbin/zdb -- gen_context(system_u:object_r:fsadm_exec_t,s0) | ||
53 | @@ -50,7 +56,12 @@ | ||
61 | 54 | ||
62 | /usr/bin/partition_uuid -- gen_context(system_u:object_r:fsadm_exec_t,s0) | 55 | /usr/sbin/clubufflush -- gen_context(system_u:object_r:fsadm_exec_t,s0) |
63 | /usr/bin/raw -- gen_context(system_u:object_r:fsadm_exec_t,s0) | 56 | /usr/sbin/fatsort -- gen_context(system_u:object_r:fsadm_exec_t,s0) |
57 | +/usr/sbin/findfs -- gen_context(system_u:object_r:fsadm_exec_t,s0) | ||
58 | /usr/sbin/parted -- gen_context(system_u:object_r:fsadm_exec_t,s0) | ||
59 | +/usr/sbin/partprobe -- gen_context(system_u:object_r:fsadm_exec_t,s0) | ||
60 | +/usr/sbin/partx -- gen_context(system_u:object_r:fsadm_exec_t,s0) | ||
64 | +/usr/sbin/raw -- gen_context(system_u:object_r:fsadm_exec_t,s0) | 61 | +/usr/sbin/raw -- gen_context(system_u:object_r:fsadm_exec_t,s0) |
65 | /usr/bin/scsi_unique_id -- gen_context(system_u:object_r:fsadm_exec_t,s0) | 62 | +/usr/sbin/sfdisk -- gen_context(system_u:object_r:fsadm_exec_t,s0) |
66 | /usr/bin/syslinux -- gen_context(system_u:object_r:fsadm_exec_t,s0) | 63 | /usr/sbin/smartctl -- gen_context(system_u:object_r:fsadm_exec_t,s0) |
67 | 64 | ||
68 | -- | 65 | /var/log/fsck(/.*)? gen_context(system_u:object_r:fsadm_log_t,s0) |
69 | 1.7.9.5 | ||
70 | |||
diff --git a/recipes-security/refpolicy/refpolicy-2.20130424/poky-fc-ftpwho-dir.patch b/recipes-security/refpolicy/refpolicy-2.20140311/poky-fc-ftpwho-dir.patch index a7d434f..a7d434f 100644 --- a/recipes-security/refpolicy/refpolicy-2.20130424/poky-fc-ftpwho-dir.patch +++ b/recipes-security/refpolicy/refpolicy-2.20140311/poky-fc-ftpwho-dir.patch | |||
diff --git a/recipes-security/refpolicy/refpolicy-2.20130424/poky-fc-iptables.patch b/recipes-security/refpolicy/refpolicy-2.20140311/poky-fc-iptables.patch index 89b1547..89b1547 100644 --- a/recipes-security/refpolicy/refpolicy-2.20130424/poky-fc-iptables.patch +++ b/recipes-security/refpolicy/refpolicy-2.20140311/poky-fc-iptables.patch | |||
diff --git a/recipes-security/refpolicy/refpolicy-2.20130424/poky-fc-mta.patch b/recipes-security/refpolicy/refpolicy-2.20140311/poky-fc-mta.patch index bbd83ec..bbd83ec 100644 --- a/recipes-security/refpolicy/refpolicy-2.20130424/poky-fc-mta.patch +++ b/recipes-security/refpolicy/refpolicy-2.20140311/poky-fc-mta.patch | |||
diff --git a/recipes-security/refpolicy/refpolicy-2.20130424/poky-fc-netutils.patch b/recipes-security/refpolicy/refpolicy-2.20140311/poky-fc-netutils.patch index b45d03e..b45d03e 100644 --- a/recipes-security/refpolicy/refpolicy-2.20130424/poky-fc-netutils.patch +++ b/recipes-security/refpolicy/refpolicy-2.20140311/poky-fc-netutils.patch | |||
diff --git a/recipes-security/refpolicy/refpolicy-2.20130424/poky-fc-nscd.patch b/recipes-security/refpolicy/refpolicy-2.20140311/poky-fc-nscd.patch index 1db328c..1db328c 100644 --- a/recipes-security/refpolicy/refpolicy-2.20130424/poky-fc-nscd.patch +++ b/recipes-security/refpolicy/refpolicy-2.20140311/poky-fc-nscd.patch | |||
diff --git a/recipes-security/refpolicy/refpolicy-2.20130424/poky-fc-rpm.patch b/recipes-security/refpolicy/refpolicy-2.20140311/poky-fc-rpm.patch index 7ba3380..7ba3380 100644 --- a/recipes-security/refpolicy/refpolicy-2.20130424/poky-fc-rpm.patch +++ b/recipes-security/refpolicy/refpolicy-2.20140311/poky-fc-rpm.patch | |||
diff --git a/recipes-security/refpolicy/refpolicy-2.20130424/poky-fc-screen.patch b/recipes-security/refpolicy/refpolicy-2.20140311/poky-fc-screen.patch index 3218194..3218194 100644 --- a/recipes-security/refpolicy/refpolicy-2.20130424/poky-fc-screen.patch +++ b/recipes-security/refpolicy/refpolicy-2.20140311/poky-fc-screen.patch | |||
diff --git a/recipes-security/refpolicy/refpolicy-2.20130424/poky-fc-ssh.patch b/recipes-security/refpolicy/refpolicy-2.20140311/poky-fc-ssh.patch index 9aeb3a2..9aeb3a2 100644 --- a/recipes-security/refpolicy/refpolicy-2.20130424/poky-fc-ssh.patch +++ b/recipes-security/refpolicy/refpolicy-2.20140311/poky-fc-ssh.patch | |||
diff --git a/recipes-security/refpolicy/refpolicy-2.20130424/poky-fc-su.patch b/recipes-security/refpolicy/refpolicy-2.20140311/poky-fc-su.patch index 358e4ef..358e4ef 100644 --- a/recipes-security/refpolicy/refpolicy-2.20130424/poky-fc-su.patch +++ b/recipes-security/refpolicy/refpolicy-2.20140311/poky-fc-su.patch | |||
diff --git a/recipes-security/refpolicy/refpolicy-2.20130424/poky-fc-subs_dist.patch b/recipes-security/refpolicy/refpolicy-2.20140311/poky-fc-subs_dist.patch index 4058b18..cfec7d9 100644 --- a/recipes-security/refpolicy/refpolicy-2.20130424/poky-fc-subs_dist.patch +++ b/recipes-security/refpolicy/refpolicy-2.20140311/poky-fc-subs_dist.patch | |||
@@ -6,19 +6,17 @@ mapping to the pathes in file_contexts. | |||
6 | Upstream-Status: Inappropriate [only for Poky] | 6 | Upstream-Status: Inappropriate [only for Poky] |
7 | 7 | ||
8 | Signed-off-by: Xin Ouyang <Xin.Ouyang@windriver.com> | 8 | Signed-off-by: Xin Ouyang <Xin.Ouyang@windriver.com> |
9 | Signed-off-by: Joe MacDonald <joe_macdonald@mentor.com> | ||
9 | --- | 10 | --- |
10 | config/file_contexts.subs_dist | 8 ++++++++ | 11 | config/file_contexts.subs_dist | 10 ++++++++++ |
11 | 1 files changed, 11 insertions(+), 0 deletions(-) | 12 | 1 file changed, 10 insertions(+) |
12 | 13 | ||
13 | diff --git a/config/file_contexts.subs_dist b/config/file_contexts.subs_dist | ||
14 | index 32b87a4..ebba73d 100644 | ||
15 | --- a/config/file_contexts.subs_dist | 14 | --- a/config/file_contexts.subs_dist |
16 | +++ b/config/file_contexts.subs_dist | 15 | +++ b/config/file_contexts.subs_dist |
17 | @@ -5,3 +5,14 @@ | 16 | @@ -19,3 +19,13 @@ |
18 | /usr/lib32 /usr/lib | 17 | /usr/local/lib64 /usr/lib |
19 | /usr/lib64 /usr/lib | 18 | /usr/local/lib /usr/lib |
20 | /var/run/lock /var/lock | 19 | /var/run/lock /var/lock |
21 | +/etc/init.d /etc/rc.d/init.d | ||
22 | +/var/volatile/log /var/log | 20 | +/var/volatile/log /var/log |
23 | +/var/volatile/run /var/run | 21 | +/var/volatile/run /var/run |
24 | +/var/volatile/cache /var/cache | 22 | +/var/volatile/cache /var/cache |
@@ -29,6 +27,3 @@ index 32b87a4..ebba73d 100644 | |||
29 | +/usr/lib/busybox/bin /bin | 27 | +/usr/lib/busybox/bin /bin |
30 | +/usr/lib/busybox/sbin /sbin | 28 | +/usr/lib/busybox/sbin /sbin |
31 | +/usr/lib/busybox/usr /usr | 29 | +/usr/lib/busybox/usr /usr |
32 | -- | ||
33 | 1.7.5.4 | ||
34 | |||
diff --git a/recipes-security/refpolicy/refpolicy-2.20130424/poky-fc-sysnetwork.patch b/recipes-security/refpolicy/refpolicy-2.20140311/poky-fc-sysnetwork.patch index e0af6a1..e0af6a1 100644 --- a/recipes-security/refpolicy/refpolicy-2.20130424/poky-fc-sysnetwork.patch +++ b/recipes-security/refpolicy/refpolicy-2.20140311/poky-fc-sysnetwork.patch | |||
diff --git a/recipes-security/refpolicy/refpolicy-2.20130424/poky-fc-udevd.patch b/recipes-security/refpolicy/refpolicy-2.20140311/poky-fc-udevd.patch index c6c19be..c6c19be 100644 --- a/recipes-security/refpolicy/refpolicy-2.20130424/poky-fc-udevd.patch +++ b/recipes-security/refpolicy/refpolicy-2.20140311/poky-fc-udevd.patch | |||
diff --git a/recipes-security/refpolicy/refpolicy-2.20130424/poky-fc-update-alternatives_hostname.patch b/recipes-security/refpolicy/refpolicy-2.20140311/poky-fc-update-alternatives_hostname.patch index cedb5b5..cedb5b5 100644 --- a/recipes-security/refpolicy/refpolicy-2.20130424/poky-fc-update-alternatives_hostname.patch +++ b/recipes-security/refpolicy/refpolicy-2.20140311/poky-fc-update-alternatives_hostname.patch | |||
diff --git a/recipes-security/refpolicy/refpolicy-2.20130424/poky-fc-update-alternatives_sysklogd.patch b/recipes-security/refpolicy/refpolicy-2.20140311/poky-fc-update-alternatives_sysklogd.patch index 868ee6b..868ee6b 100644 --- a/recipes-security/refpolicy/refpolicy-2.20130424/poky-fc-update-alternatives_sysklogd.patch +++ b/recipes-security/refpolicy/refpolicy-2.20140311/poky-fc-update-alternatives_sysklogd.patch | |||
diff --git a/recipes-security/refpolicy/refpolicy-2.20130424/poky-fc-update-alternatives_sysvinit.patch b/recipes-security/refpolicy/refpolicy-2.20140311/poky-fc-update-alternatives_sysvinit.patch index 3a617d8..3a617d8 100644 --- a/recipes-security/refpolicy/refpolicy-2.20130424/poky-fc-update-alternatives_sysvinit.patch +++ b/recipes-security/refpolicy/refpolicy-2.20140311/poky-fc-update-alternatives_sysvinit.patch | |||
diff --git a/recipes-security/refpolicy/refpolicy-2.20130424/poky-policy-add-rules-for-bsdpty_device_t.patch b/recipes-security/refpolicy/refpolicy-2.20140311/poky-policy-add-rules-for-bsdpty_device_t.patch index 9a3322f..9a3322f 100644 --- a/recipes-security/refpolicy/refpolicy-2.20130424/poky-policy-add-rules-for-bsdpty_device_t.patch +++ b/recipes-security/refpolicy/refpolicy-2.20140311/poky-policy-add-rules-for-bsdpty_device_t.patch | |||
diff --git a/recipes-security/refpolicy/refpolicy-2.20130424/poky-policy-add-rules-for-syslogd_t-symlink.patch b/recipes-security/refpolicy/refpolicy-2.20140311/poky-policy-add-rules-for-syslogd_t-symlink.patch index aa9734a..aa9734a 100644 --- a/recipes-security/refpolicy/refpolicy-2.20130424/poky-policy-add-rules-for-syslogd_t-symlink.patch +++ b/recipes-security/refpolicy/refpolicy-2.20140311/poky-policy-add-rules-for-syslogd_t-symlink.patch | |||
diff --git a/recipes-security/refpolicy/refpolicy-2.20130424/poky-policy-add-rules-for-tmp-symlink.patch b/recipes-security/refpolicy/refpolicy-2.20140311/poky-policy-add-rules-for-tmp-symlink.patch index 210c297..210c297 100644 --- a/recipes-security/refpolicy/refpolicy-2.20130424/poky-policy-add-rules-for-tmp-symlink.patch +++ b/recipes-security/refpolicy/refpolicy-2.20140311/poky-policy-add-rules-for-tmp-symlink.patch | |||
diff --git a/recipes-security/refpolicy/refpolicy-2.20130424/poky-policy-add-rules-for-var-cache-symlink.patch b/recipes-security/refpolicy/refpolicy-2.20140311/poky-policy-add-rules-for-var-cache-symlink.patch index 18a92dd..18a92dd 100644 --- a/recipes-security/refpolicy/refpolicy-2.20130424/poky-policy-add-rules-for-var-cache-symlink.patch +++ b/recipes-security/refpolicy/refpolicy-2.20140311/poky-policy-add-rules-for-var-cache-symlink.patch | |||
diff --git a/recipes-security/refpolicy/refpolicy-2.20130424/poky-policy-add-rules-for-var-log-symlink-apache.patch b/recipes-security/refpolicy/refpolicy-2.20140311/poky-policy-add-rules-for-var-log-symlink-apache.patch index 8bc40c4..8bc40c4 100644 --- a/recipes-security/refpolicy/refpolicy-2.20130424/poky-policy-add-rules-for-var-log-symlink-apache.patch +++ b/recipes-security/refpolicy/refpolicy-2.20140311/poky-policy-add-rules-for-var-log-symlink-apache.patch | |||
diff --git a/recipes-security/refpolicy/refpolicy-2.20130424/poky-policy-add-rules-for-var-log-symlink-audisp_remote_t.patch b/recipes-security/refpolicy/refpolicy-2.20140311/poky-policy-add-rules-for-var-log-symlink-audisp_remote_t.patch index cbf0f7d..cbf0f7d 100644 --- a/recipes-security/refpolicy/refpolicy-2.20130424/poky-policy-add-rules-for-var-log-symlink-audisp_remote_t.patch +++ b/recipes-security/refpolicy/refpolicy-2.20140311/poky-policy-add-rules-for-var-log-symlink-audisp_remote_t.patch | |||
diff --git a/recipes-security/refpolicy/refpolicy-2.20130424/poky-policy-add-rules-for-var-log-symlink.patch b/recipes-security/refpolicy/refpolicy-2.20140311/poky-policy-add-rules-for-var-log-symlink.patch index b06f3ef..b06f3ef 100644 --- a/recipes-security/refpolicy/refpolicy-2.20130424/poky-policy-add-rules-for-var-log-symlink.patch +++ b/recipes-security/refpolicy/refpolicy-2.20140311/poky-policy-add-rules-for-var-log-symlink.patch | |||
diff --git a/recipes-security/refpolicy/refpolicy-2.20130424/poky-policy-add-syslogd_t-to-trusted-object.patch b/recipes-security/refpolicy/refpolicy-2.20140311/poky-policy-add-syslogd_t-to-trusted-object.patch index 92b1592..92b1592 100644 --- a/recipes-security/refpolicy/refpolicy-2.20130424/poky-policy-add-syslogd_t-to-trusted-object.patch +++ b/recipes-security/refpolicy/refpolicy-2.20140311/poky-policy-add-syslogd_t-to-trusted-object.patch | |||
diff --git a/recipes-security/refpolicy/refpolicy-2.20130424/poky-policy-allow-nfsd-to-exec-shell-commands.patch b/recipes-security/refpolicy/refpolicy-2.20140311/poky-policy-allow-nfsd-to-exec-shell-commands.patch index e77a730..e77a730 100644 --- a/recipes-security/refpolicy/refpolicy-2.20130424/poky-policy-allow-nfsd-to-exec-shell-commands.patch +++ b/recipes-security/refpolicy/refpolicy-2.20140311/poky-policy-allow-nfsd-to-exec-shell-commands.patch | |||
diff --git a/recipes-security/refpolicy/refpolicy-2.20130424/poky-policy-allow-setfiles_t-to-read-symlinks.patch b/recipes-security/refpolicy/refpolicy-2.20140311/poky-policy-allow-setfiles_t-to-read-symlinks.patch index 71497fb..71497fb 100644 --- a/recipes-security/refpolicy/refpolicy-2.20130424/poky-policy-allow-setfiles_t-to-read-symlinks.patch +++ b/recipes-security/refpolicy/refpolicy-2.20140311/poky-policy-allow-setfiles_t-to-read-symlinks.patch | |||
diff --git a/recipes-security/refpolicy/refpolicy-2.20130424/poky-policy-allow-sysadm-to-run-rpcinfo.patch b/recipes-security/refpolicy/refpolicy-2.20140311/poky-policy-allow-sysadm-to-run-rpcinfo.patch index ec3dbf4..ec3dbf4 100644 --- a/recipes-security/refpolicy/refpolicy-2.20130424/poky-policy-allow-sysadm-to-run-rpcinfo.patch +++ b/recipes-security/refpolicy/refpolicy-2.20140311/poky-policy-allow-sysadm-to-run-rpcinfo.patch | |||
diff --git a/recipes-security/refpolicy/refpolicy-2.20130424/poky-policy-don-t-audit-tty_device_t.patch b/recipes-security/refpolicy/refpolicy-2.20140311/poky-policy-don-t-audit-tty_device_t.patch index 82370d8..82370d8 100644 --- a/recipes-security/refpolicy/refpolicy-2.20130424/poky-policy-don-t-audit-tty_device_t.patch +++ b/recipes-security/refpolicy/refpolicy-2.20140311/poky-policy-don-t-audit-tty_device_t.patch | |||
diff --git a/recipes-security/refpolicy/refpolicy-2.20130424/poky-policy-fix-dmesg-to-use-dev-kmsg.patch b/recipes-security/refpolicy/refpolicy-2.20140311/poky-policy-fix-dmesg-to-use-dev-kmsg.patch index d6c8dbf..d6c8dbf 100644 --- a/recipes-security/refpolicy/refpolicy-2.20130424/poky-policy-fix-dmesg-to-use-dev-kmsg.patch +++ b/recipes-security/refpolicy/refpolicy-2.20140311/poky-policy-fix-dmesg-to-use-dev-kmsg.patch | |||
diff --git a/recipes-security/refpolicy/refpolicy-2.20130424/poky-policy-fix-new-SELINUXMNT-in-sys.patch b/recipes-security/refpolicy/refpolicy-2.20140311/poky-policy-fix-new-SELINUXMNT-in-sys.patch index 557af04..302a38f 100644 --- a/recipes-security/refpolicy/refpolicy-2.20130424/poky-policy-fix-new-SELINUXMNT-in-sys.patch +++ b/recipes-security/refpolicy/refpolicy-2.20140311/poky-policy-fix-new-SELINUXMNT-in-sys.patch | |||
@@ -9,12 +9,11 @@ add rules to access sysfs. | |||
9 | Upstream-Status: Inappropriate [only for Poky] | 9 | Upstream-Status: Inappropriate [only for Poky] |
10 | 10 | ||
11 | Signed-off-by: Xin Ouyang <Xin.Ouyang@windriver.com> | 11 | Signed-off-by: Xin Ouyang <Xin.Ouyang@windriver.com> |
12 | Signed-off-by: Joe MacDonald <joe_macdonald@mentor.com> | ||
12 | --- | 13 | --- |
13 | policy/modules/kernel/selinux.if | 40 ++++++++++++++++++++++++++++++++++++++ | 14 | policy/modules/kernel/selinux.if | 34 ++++++++++++++++++++++++++++++++-- |
14 | 1 file changed, 40 insertions(+) | 15 | 1 file changed, 32 insertions(+), 2 deletions(-) |
15 | 16 | ||
16 | diff --git a/policy/modules/kernel/selinux.if b/policy/modules/kernel/selinux.if | ||
17 | index 81440c5..ee4e86b 100644 | ||
18 | --- a/policy/modules/kernel/selinux.if | 17 | --- a/policy/modules/kernel/selinux.if |
19 | +++ b/policy/modules/kernel/selinux.if | 18 | +++ b/policy/modules/kernel/selinux.if |
20 | @@ -58,6 +58,10 @@ interface(`selinux_get_fs_mount',` | 19 | @@ -58,6 +58,10 @@ interface(`selinux_get_fs_mount',` |
@@ -28,7 +27,7 @@ index 81440c5..ee4e86b 100644 | |||
28 | # starting in libselinux 2.0.5, init_selinuxmnt() will | 27 | # starting in libselinux 2.0.5, init_selinuxmnt() will |
29 | # attempt to short circuit by checking if SELINUXMNT | 28 | # attempt to short circuit by checking if SELINUXMNT |
30 | # (/selinux) is already a selinuxfs | 29 | # (/selinux) is already a selinuxfs |
31 | @@ -84,6 +88,7 @@ interface(`selinux_dontaudit_get_fs_mount',` | 30 | @@ -84,6 +88,7 @@ interface(`selinux_dontaudit_get_fs_moun |
32 | type security_t; | 31 | type security_t; |
33 | ') | 32 | ') |
34 | 33 | ||
@@ -72,7 +71,7 @@ index 81440c5..ee4e86b 100644 | |||
72 | allow $1 security_t:filesystem getattr; | 71 | allow $1 security_t:filesystem getattr; |
73 | ') | 72 | ') |
74 | 73 | ||
75 | @@ -183,6 +196,7 @@ interface(`selinux_dontaudit_getattr_fs',` | 74 | @@ -183,6 +196,7 @@ interface(`selinux_dontaudit_getattr_fs' |
76 | type security_t; | 75 | type security_t; |
77 | ') | 76 | ') |
78 | 77 | ||
@@ -80,7 +79,7 @@ index 81440c5..ee4e86b 100644 | |||
80 | dontaudit $1 security_t:filesystem getattr; | 79 | dontaudit $1 security_t:filesystem getattr; |
81 | ') | 80 | ') |
82 | 81 | ||
83 | @@ -202,6 +216,7 @@ interface(`selinux_dontaudit_getattr_dir',` | 82 | @@ -202,6 +216,7 @@ interface(`selinux_dontaudit_getattr_dir |
84 | type security_t; | 83 | type security_t; |
85 | ') | 84 | ') |
86 | 85 | ||
@@ -88,16 +87,15 @@ index 81440c5..ee4e86b 100644 | |||
88 | dontaudit $1 security_t:dir getattr; | 87 | dontaudit $1 security_t:dir getattr; |
89 | ') | 88 | ') |
90 | 89 | ||
91 | @@ -220,6 +235,8 @@ interface(`selinux_search_fs',` | 90 | @@ -220,6 +235,7 @@ interface(`selinux_search_fs',` |
92 | type security_t; | 91 | type security_t; |
93 | ') | 92 | ') |
94 | 93 | ||
95 | + dev_getattr_sysfs_dirs($1) | 94 | + dev_getattr_sysfs_dirs($1) |
96 | + dev_search_sysfs($1) | 95 | dev_search_sysfs($1) |
97 | allow $1 security_t:dir search_dir_perms; | 96 | allow $1 security_t:dir search_dir_perms; |
98 | ') | 97 | ') |
99 | 98 | @@ -239,6 +255,7 @@ interface(`selinux_dontaudit_search_fs', | |
100 | @@ -238,6 +255,7 @@ interface(`selinux_dontaudit_search_fs',` | ||
101 | type security_t; | 99 | type security_t; |
102 | ') | 100 | ') |
103 | 101 | ||
@@ -105,7 +103,7 @@ index 81440c5..ee4e86b 100644 | |||
105 | dontaudit $1 security_t:dir search_dir_perms; | 103 | dontaudit $1 security_t:dir search_dir_perms; |
106 | ') | 104 | ') |
107 | 105 | ||
108 | @@ -257,6 +275,7 @@ interface(`selinux_dontaudit_read_fs',` | 106 | @@ -258,6 +275,7 @@ interface(`selinux_dontaudit_read_fs',` |
109 | type security_t; | 107 | type security_t; |
110 | ') | 108 | ') |
111 | 109 | ||
@@ -113,52 +111,75 @@ index 81440c5..ee4e86b 100644 | |||
113 | dontaudit $1 security_t:dir search_dir_perms; | 111 | dontaudit $1 security_t:dir search_dir_perms; |
114 | dontaudit $1 security_t:file read_file_perms; | 112 | dontaudit $1 security_t:file read_file_perms; |
115 | ') | 113 | ') |
116 | @@ -342,6 +361,8 @@ interface(`selinux_load_policy',` | 114 | @@ -279,6 +297,7 @@ interface(`selinux_get_enforce_mode',` |
115 | type security_t; | ||
116 | ') | ||
117 | |||
118 | + dev_getattr_sysfs_dirs($1) | ||
119 | dev_search_sysfs($1) | ||
120 | allow $1 security_t:dir list_dir_perms; | ||
121 | allow $1 security_t:file read_file_perms; | ||
122 | @@ -313,6 +332,7 @@ interface(`selinux_set_enforce_mode',` | ||
117 | bool secure_mode_policyload; | 123 | bool secure_mode_policyload; |
118 | ') | 124 | ') |
119 | 125 | ||
120 | + dev_getattr_sysfs_dirs($1) | 126 | + dev_getattr_sysfs_dirs($1) |
121 | + dev_search_sysfs($1) | 127 | dev_search_sysfs($1) |
128 | allow $1 security_t:dir list_dir_perms; | ||
129 | allow $1 security_t:file rw_file_perms; | ||
130 | @@ -345,6 +365,7 @@ interface(`selinux_load_policy',` | ||
131 | bool secure_mode_policyload; | ||
132 | ') | ||
133 | |||
134 | + dev_getattr_sysfs_dirs($1) | ||
135 | dev_search_sysfs($1) | ||
122 | allow $1 security_t:dir list_dir_perms; | 136 | allow $1 security_t:dir list_dir_perms; |
123 | allow $1 security_t:file rw_file_perms; | 137 | allow $1 security_t:file rw_file_perms; |
124 | typeattribute $1 can_load_policy; | 138 | @@ -375,6 +396,7 @@ interface(`selinux_read_policy',` |
125 | @@ -371,6 +392,8 @@ interface(`selinux_read_policy',` | ||
126 | type security_t; | 139 | type security_t; |
127 | ') | 140 | ') |
128 | 141 | ||
129 | + dev_getattr_sysfs_dirs($1) | 142 | + dev_getattr_sysfs_dirs($1) |
130 | + dev_search_sysfs($1) | 143 | dev_search_sysfs($1) |
131 | allow $1 security_t:dir list_dir_perms; | 144 | allow $1 security_t:dir list_dir_perms; |
132 | allow $1 security_t:file read_file_perms; | 145 | allow $1 security_t:file read_file_perms; |
133 | allow $1 security_t:security read_policy; | 146 | @@ -440,8 +462,8 @@ interface(`selinux_set_generic_booleans' |
134 | @@ -435,6 +458,8 @@ interface(`selinux_set_generic_booleans',` | ||
135 | type security_t; | 147 | type security_t; |
136 | ') | 148 | ') |
137 | 149 | ||
138 | + dev_getattr_sysfs_dirs($1) | 150 | + dev_getattr_sysfs_dirs($1) |
139 | + dev_search_sysfs($1) | 151 | dev_search_sysfs($1) |
152 | - | ||
140 | allow $1 security_t:dir list_dir_perms; | 153 | allow $1 security_t:dir list_dir_perms; |
141 | allow $1 security_t:file rw_file_perms; | 154 | allow $1 security_t:file rw_file_perms; |
142 | 155 | ||
143 | @@ -475,6 +500,8 @@ interface(`selinux_set_all_booleans',` | 156 | @@ -482,8 +504,8 @@ interface(`selinux_set_all_booleans',` |
144 | bool secure_mode_policyload; | 157 | bool secure_mode_policyload; |
145 | ') | 158 | ') |
146 | 159 | ||
147 | + dev_getattr_sysfs_dirs($1) | 160 | + dev_getattr_sysfs_dirs($1) |
148 | + dev_search_sysfs($1) | 161 | dev_search_sysfs($1) |
162 | - | ||
149 | allow $1 security_t:dir list_dir_perms; | 163 | allow $1 security_t:dir list_dir_perms; |
150 | allow $1 { boolean_type -secure_mode_policyload_t }:file rw_file_perms; | 164 | allow $1 { boolean_type -secure_mode_policyload_t }:file rw_file_perms; |
151 | allow $1 secure_mode_policyload_t:file read_file_perms; | 165 | allow $1 secure_mode_policyload_t:file read_file_perms; |
152 | @@ -519,6 +546,8 @@ interface(`selinux_set_parameters',` | 166 | @@ -528,6 +550,7 @@ interface(`selinux_set_parameters',` |
153 | attribute can_setsecparam; | 167 | attribute can_setsecparam; |
154 | ') | 168 | ') |
155 | 169 | ||
156 | + dev_getattr_sysfs_dirs($1) | 170 | + dev_getattr_sysfs_dirs($1) |
157 | + dev_search_sysfs($1) | 171 | dev_search_sysfs($1) |
158 | allow $1 security_t:dir list_dir_perms; | 172 | allow $1 security_t:dir list_dir_perms; |
159 | allow $1 security_t:file rw_file_perms; | 173 | allow $1 security_t:file rw_file_perms; |
160 | allow $1 security_t:security setsecparam; | 174 | @@ -552,6 +575,7 @@ interface(`selinux_validate_context',` |
161 | @@ -563,6 +592,7 @@ interface(`selinux_dontaudit_validate_context',` | 175 | type security_t; |
176 | ') | ||
177 | |||
178 | + dev_getattr_sysfs_dirs($1) | ||
179 | dev_search_sysfs($1) | ||
180 | allow $1 security_t:dir list_dir_perms; | ||
181 | allow $1 security_t:file rw_file_perms; | ||
182 | @@ -574,6 +598,7 @@ interface(`selinux_dontaudit_validate_co | ||
162 | type security_t; | 183 | type security_t; |
163 | ') | 184 | ') |
164 | 185 | ||
@@ -166,51 +187,43 @@ index 81440c5..ee4e86b 100644 | |||
166 | dontaudit $1 security_t:dir list_dir_perms; | 187 | dontaudit $1 security_t:dir list_dir_perms; |
167 | dontaudit $1 security_t:file rw_file_perms; | 188 | dontaudit $1 security_t:file rw_file_perms; |
168 | dontaudit $1 security_t:security check_context; | 189 | dontaudit $1 security_t:security check_context; |
169 | @@ -584,6 +614,8 @@ interface(`selinux_compute_access_vector',` | 190 | @@ -595,6 +620,7 @@ interface(`selinux_compute_access_vector |
170 | type security_t; | 191 | type security_t; |
171 | ') | 192 | ') |
172 | 193 | ||
173 | + dev_getattr_sysfs_dirs($1) | 194 | + dev_getattr_sysfs_dirs($1) |
174 | + dev_search_sysfs($1) | 195 | dev_search_sysfs($1) |
175 | allow $1 security_t:dir list_dir_perms; | 196 | allow $1 security_t:dir list_dir_perms; |
176 | allow $1 security_t:file rw_file_perms; | 197 | allow $1 security_t:file rw_file_perms; |
177 | allow $1 security_t:security compute_av; | 198 | @@ -617,6 +643,7 @@ interface(`selinux_compute_create_contex |
178 | @@ -605,6 +637,8 @@ interface(`selinux_compute_create_context',` | ||
179 | type security_t; | 199 | type security_t; |
180 | ') | 200 | ') |
181 | 201 | ||
182 | + dev_getattr_sysfs_dirs($1) | 202 | + dev_getattr_sysfs_dirs($1) |
183 | + dev_search_sysfs($1) | 203 | dev_search_sysfs($1) |
184 | allow $1 security_t:dir list_dir_perms; | 204 | allow $1 security_t:dir list_dir_perms; |
185 | allow $1 security_t:file rw_file_perms; | 205 | allow $1 security_t:file rw_file_perms; |
186 | allow $1 security_t:security compute_create; | 206 | @@ -639,6 +666,7 @@ interface(`selinux_compute_member',` |
187 | @@ -626,6 +660,8 @@ interface(`selinux_compute_member',` | ||
188 | type security_t; | 207 | type security_t; |
189 | ') | 208 | ') |
190 | 209 | ||
191 | + dev_getattr_sysfs_dirs($1) | 210 | + dev_getattr_sysfs_dirs($1) |
192 | + dev_search_sysfs($1) | 211 | dev_search_sysfs($1) |
193 | allow $1 security_t:dir list_dir_perms; | 212 | allow $1 security_t:dir list_dir_perms; |
194 | allow $1 security_t:file rw_file_perms; | 213 | allow $1 security_t:file rw_file_perms; |
195 | allow $1 security_t:security compute_member; | 214 | @@ -669,6 +697,7 @@ interface(`selinux_compute_relabel_conte |
196 | @@ -655,6 +691,8 @@ interface(`selinux_compute_relabel_context',` | ||
197 | type security_t; | 215 | type security_t; |
198 | ') | 216 | ') |
199 | 217 | ||
200 | + dev_getattr_sysfs_dirs($1) | 218 | + dev_getattr_sysfs_dirs($1) |
201 | + dev_search_sysfs($1) | 219 | dev_search_sysfs($1) |
202 | allow $1 security_t:dir list_dir_perms; | 220 | allow $1 security_t:dir list_dir_perms; |
203 | allow $1 security_t:file rw_file_perms; | 221 | allow $1 security_t:file rw_file_perms; |
204 | allow $1 security_t:security compute_relabel; | 222 | @@ -690,6 +719,7 @@ interface(`selinux_compute_user_contexts |
205 | @@ -675,6 +713,8 @@ interface(`selinux_compute_user_contexts',` | ||
206 | type security_t; | 223 | type security_t; |
207 | ') | 224 | ') |
208 | 225 | ||
209 | + dev_getattr_sysfs_dirs($1) | 226 | + dev_getattr_sysfs_dirs($1) |
210 | + dev_search_sysfs($1) | 227 | dev_search_sysfs($1) |
211 | allow $1 security_t:dir list_dir_perms; | 228 | allow $1 security_t:dir list_dir_perms; |
212 | allow $1 security_t:file rw_file_perms; | 229 | allow $1 security_t:file rw_file_perms; |
213 | allow $1 security_t:security compute_user; | ||
214 | -- | ||
215 | 1.7.9.5 | ||
216 | |||
diff --git a/recipes-security/refpolicy/refpolicy-2.20130424/poky-policy-fix-nfsd_t-to-mount_nfsd_fs_t.patch b/recipes-security/refpolicy/refpolicy-2.20140311/poky-policy-fix-nfsd_t-to-mount_nfsd_fs_t.patch index 19e2516..f04ebec 100644 --- a/recipes-security/refpolicy/refpolicy-2.20130424/poky-policy-fix-nfsd_t-to-mount_nfsd_fs_t.patch +++ b/recipes-security/refpolicy/refpolicy-2.20140311/poky-policy-fix-nfsd_t-to-mount_nfsd_fs_t.patch | |||
@@ -6,6 +6,7 @@ Subject: [PATCH] fix policy for nfsserver to mount nfsd_fs_t. | |||
6 | Upstream-Status: Pending | 6 | Upstream-Status: Pending |
7 | 7 | ||
8 | Signed-off-by: Xin Ouyang <Xin.Ouyang@windriver.com> | 8 | Signed-off-by: Xin Ouyang <Xin.Ouyang@windriver.com> |
9 | Signed-off-by: Joe MacDonald <joe_macdonald@mentor.com> | ||
9 | --- | 10 | --- |
10 | policy/modules/contrib/rpc.te | 5 +++++ | 11 | policy/modules/contrib/rpc.te | 5 +++++ |
11 | policy/modules/contrib/rpcbind.te | 5 +++++ | 12 | policy/modules/contrib/rpcbind.te | 5 +++++ |
@@ -13,11 +14,9 @@ Signed-off-by: Xin Ouyang <Xin.Ouyang@windriver.com> | |||
13 | policy/modules/kernel/kernel.te | 2 ++ | 14 | policy/modules/kernel/kernel.te | 2 ++ |
14 | 4 files changed, 13 insertions(+) | 15 | 4 files changed, 13 insertions(+) |
15 | 16 | ||
16 | diff --git a/policy/modules/contrib/rpc.te b/policy/modules/contrib/rpc.te | ||
17 | index 5605205..9e9f468 100644 | ||
18 | --- a/policy/modules/contrib/rpc.te | 17 | --- a/policy/modules/contrib/rpc.te |
19 | +++ b/policy/modules/contrib/rpc.te | 18 | +++ b/policy/modules/contrib/rpc.te |
20 | @@ -256,6 +256,11 @@ tunable_policy(`nfs_export_all_ro',` | 19 | @@ -263,6 +263,11 @@ tunable_policy(`nfs_export_all_ro',` |
21 | 20 | ||
22 | optional_policy(` | 21 | optional_policy(` |
23 | mount_exec(nfsd_t) | 22 | mount_exec(nfsd_t) |
@@ -29,27 +28,23 @@ index 5605205..9e9f468 100644 | |||
29 | ') | 28 | ') |
30 | 29 | ||
31 | ######################################## | 30 | ######################################## |
32 | diff --git a/policy/modules/contrib/rpcbind.te b/policy/modules/contrib/rpcbind.te | ||
33 | index 196f168..9c75677 100644 | ||
34 | --- a/policy/modules/contrib/rpcbind.te | 31 | --- a/policy/modules/contrib/rpcbind.te |
35 | +++ b/policy/modules/contrib/rpcbind.te | 32 | +++ b/policy/modules/contrib/rpcbind.te |
36 | @@ -71,6 +71,11 @@ miscfiles_read_localization(rpcbind_t) | 33 | @@ -70,6 +70,11 @@ logging_send_syslog_msg(rpcbind_t) |
37 | 34 | ||
38 | sysnet_dns_name_resolve(rpcbind_t) | 35 | miscfiles_read_localization(rpcbind_t) |
39 | 36 | ||
40 | +# nfsd_t would not be allowed to send unix_stream_socket to rpcbind_t, | 37 | +# nfsd_t would not be allowed to send unix_stream_socket to rpcbind_t, |
41 | +# because the are running in different level. So add rules to allow this. | 38 | +# because the are running in different level. So add rules to allow this. |
42 | +mls_socket_read_all_levels(rpcbind_t) | 39 | +mls_socket_read_all_levels(rpcbind_t) |
43 | +mls_socket_write_all_levels(rpcbind_t) | 40 | +mls_socket_write_all_levels(rpcbind_t) |
44 | + | 41 | + |
45 | optional_policy(` | 42 | ifdef(`distro_debian',` |
46 | nis_use_ypbind(rpcbind_t) | 43 | term_dontaudit_use_unallocated_ttys(rpcbind_t) |
47 | ') | 44 | ') |
48 | diff --git a/policy/modules/kernel/filesystem.te b/policy/modules/kernel/filesystem.te | ||
49 | index 1c66416..2b9e7ce 100644 | ||
50 | --- a/policy/modules/kernel/filesystem.te | 45 | --- a/policy/modules/kernel/filesystem.te |
51 | +++ b/policy/modules/kernel/filesystem.te | 46 | +++ b/policy/modules/kernel/filesystem.te |
52 | @@ -119,6 +119,7 @@ genfscon mvfs / gen_context(system_u:object_r:mvfs_t,s0) | 47 | @@ -119,6 +119,7 @@ genfscon mvfs / gen_context(system_u:obj |
53 | 48 | ||
54 | type nfsd_fs_t; | 49 | type nfsd_fs_t; |
55 | fs_type(nfsd_fs_t) | 50 | fs_type(nfsd_fs_t) |
@@ -57,11 +52,9 @@ index 1c66416..2b9e7ce 100644 | |||
57 | genfscon nfsd / gen_context(system_u:object_r:nfsd_fs_t,s0) | 52 | genfscon nfsd / gen_context(system_u:object_r:nfsd_fs_t,s0) |
58 | 53 | ||
59 | type oprofilefs_t; | 54 | type oprofilefs_t; |
60 | diff --git a/policy/modules/kernel/kernel.te b/policy/modules/kernel/kernel.te | ||
61 | index 49fde6e..a731078 100644 | ||
62 | --- a/policy/modules/kernel/kernel.te | 55 | --- a/policy/modules/kernel/kernel.te |
63 | +++ b/policy/modules/kernel/kernel.te | 56 | +++ b/policy/modules/kernel/kernel.te |
64 | @@ -284,6 +284,8 @@ mls_process_read_up(kernel_t) | 57 | @@ -293,6 +293,8 @@ mls_process_read_up(kernel_t) |
65 | mls_process_write_down(kernel_t) | 58 | mls_process_write_down(kernel_t) |
66 | mls_file_write_all_levels(kernel_t) | 59 | mls_file_write_all_levels(kernel_t) |
67 | mls_file_read_all_levels(kernel_t) | 60 | mls_file_read_all_levels(kernel_t) |
@@ -70,6 +63,3 @@ index 49fde6e..a731078 100644 | |||
70 | 63 | ||
71 | ifdef(`distro_redhat',` | 64 | ifdef(`distro_redhat',` |
72 | # Bugzilla 222337 | 65 | # Bugzilla 222337 |
73 | -- | ||
74 | 1.7.9.5 | ||
75 | |||
diff --git a/recipes-security/refpolicy/refpolicy-2.20130424/poky-policy-fix-setfiles-statvfs-get-file-count.patch b/recipes-security/refpolicy/refpolicy-2.20140311/poky-policy-fix-setfiles-statvfs-get-file-count.patch index 90efbd8..90efbd8 100644 --- a/recipes-security/refpolicy/refpolicy-2.20130424/poky-policy-fix-setfiles-statvfs-get-file-count.patch +++ b/recipes-security/refpolicy/refpolicy-2.20140311/poky-policy-fix-setfiles-statvfs-get-file-count.patch | |||
diff --git a/recipes-security/refpolicy/refpolicy-2.20130424/poky-policy-fix-seutils-manage-config-files.patch b/recipes-security/refpolicy/refpolicy-2.20140311/poky-policy-fix-seutils-manage-config-files.patch index be33bf1..be33bf1 100644 --- a/recipes-security/refpolicy/refpolicy-2.20130424/poky-policy-fix-seutils-manage-config-files.patch +++ b/recipes-security/refpolicy/refpolicy-2.20140311/poky-policy-fix-seutils-manage-config-files.patch | |||
diff --git a/recipes-security/refpolicy/refpolicy-mcs_2.20130424.bb b/recipes-security/refpolicy/refpolicy-mcs_2.20140311.bb index 9288e2a..062727b 100644 --- a/recipes-security/refpolicy/refpolicy-mcs_2.20130424.bb +++ b/recipes-security/refpolicy/refpolicy-mcs_2.20140311.bb | |||
@@ -6,8 +6,6 @@ level. This is useful on systems where a hierarchical policy (MLS) isn't \ | |||
6 | needed (pretty much all systems) but the non-hierarchical categories are. \ | 6 | needed (pretty much all systems) but the non-hierarchical categories are. \ |
7 | " | 7 | " |
8 | 8 | ||
9 | PR = "r99" | ||
10 | |||
11 | POLICY_TYPE = "mcs" | 9 | POLICY_TYPE = "mcs" |
12 | 10 | ||
13 | include refpolicy_${PV}.inc | 11 | include refpolicy_${PV}.inc |
diff --git a/recipes-security/refpolicy/refpolicy-minimum_2.20130424.bb b/recipes-security/refpolicy/refpolicy-minimum_2.20140311.bb index fc83fd5..b275821 100644 --- a/recipes-security/refpolicy/refpolicy-minimum_2.20130424.bb +++ b/recipes-security/refpolicy/refpolicy-minimum_2.20140311.bb | |||
@@ -1,5 +1,3 @@ | |||
1 | PR = "r99" | ||
2 | |||
3 | include refpolicy-targeted_${PV}.bb | 1 | include refpolicy-targeted_${PV}.bb |
4 | 2 | ||
5 | SUMMARY = "SELinux minimum policy" | 3 | SUMMARY = "SELinux minimum policy" |
@@ -40,19 +38,11 @@ prepare_policy_store () { | |||
40 | mkdir -p ${D}${sysconfdir}/selinux/${POLICY_NAME}/modules/active/modules | 38 | mkdir -p ${D}${sysconfdir}/selinux/${POLICY_NAME}/modules/active/modules |
41 | mkdir -p ${D}${sysconfdir}/selinux/${POLICY_NAME}/contexts/files | 39 | mkdir -p ${D}${sysconfdir}/selinux/${POLICY_NAME}/contexts/files |
42 | touch ${D}${sysconfdir}/selinux/${POLICY_NAME}/contexts/files/file_contexts.local | 40 | touch ${D}${sysconfdir}/selinux/${POLICY_NAME}/contexts/files/file_contexts.local |
43 | if ${@bb.utils.contains('DISTRO_FEATURES','compressed_policy','true','false',d)}; then | 41 | for i in ${D}${datadir}/selinux/${POLICY_NAME}/*.pp; do |
44 | bzip2 base.pp | 42 | bzip2 -f $i && mv -f $i.bz2 $i |
45 | cp base.pp.bz2 ${D}${sysconfdir}/selinux/${POLICY_NAME}/modules/active/base.pp | 43 | done |
46 | for i in ${POLICY_MODULES_MIN}; do | 44 | cp base.pp ${D}${sysconfdir}/selinux/${POLICY_NAME}/modules/active/base.pp |
47 | bzip2 $i | 45 | for i in ${POLICY_MODULES_MIN}; do |
48 | cp ${i}.bz2 ${D}${sysconfdir}/selinux/${POLICY_NAME}/modules/active/modules/`basename $i` | 46 | cp ${i}.pp ${D}${sysconfdir}/selinux/${POLICY_NAME}/modules/active/modules/`basename $i.pp` |
49 | done | 47 | done |
50 | else | ||
51 | bzip2 -c ${D}${datadir}/selinux/${POLICY_NAME}/base.pp > \ | ||
52 | ${D}${sysconfdir}/selinux/${POLICY_NAME}/modules/active/base.pp | ||
53 | for i in ${POLICY_MODULES_MIN}; do | ||
54 | bzip2 -c ${D}${datadir}/selinux/${POLICY_NAME}/$i.pp > \ | ||
55 | ${D}${sysconfdir}/selinux/${POLICY_NAME}/modules/active/modules/$i.pp | ||
56 | done | ||
57 | fi | ||
58 | } | 48 | } |
diff --git a/recipes-security/refpolicy/refpolicy-mls_2.20130424.bb b/recipes-security/refpolicy/refpolicy-mls_2.20140311.bb index e586ac2..7388232 100644 --- a/recipes-security/refpolicy/refpolicy-mls_2.20130424.bb +++ b/recipes-security/refpolicy/refpolicy-mls_2.20140311.bb | |||
@@ -5,8 +5,6 @@ It allows giving data labels such as \"Top Secret\" and preventing \ | |||
5 | such data from leaking to processes or files with lower classification. \ | 5 | such data from leaking to processes or files with lower classification. \ |
6 | " | 6 | " |
7 | 7 | ||
8 | PR = "r99" | ||
9 | |||
10 | POLICY_TYPE = "mls" | 8 | POLICY_TYPE = "mls" |
11 | 9 | ||
12 | include refpolicy_${PV}.inc | 10 | include refpolicy_${PV}.inc |
diff --git a/recipes-security/refpolicy/refpolicy-standard_2.20130424.bb b/recipes-security/refpolicy/refpolicy-standard_2.20140311.bb index 98bc26b..3674fdd 100644 --- a/recipes-security/refpolicy/refpolicy-standard_2.20130424.bb +++ b/recipes-security/refpolicy/refpolicy-standard_2.20140311.bb | |||
@@ -3,8 +3,6 @@ DESCRIPTION = "\ | |||
3 | This is the reference policy for SELinux built with type enforcement \ | 3 | This is the reference policy for SELinux built with type enforcement \ |
4 | only." | 4 | only." |
5 | 5 | ||
6 | PR = "r99" | ||
7 | |||
8 | POLICY_TYPE = "standard" | 6 | POLICY_TYPE = "standard" |
9 | 7 | ||
10 | include refpolicy_${PV}.inc | 8 | include refpolicy_${PV}.inc |
diff --git a/recipes-security/refpolicy/refpolicy-targeted/refpolicy-unconfined_u-default-user.patch b/recipes-security/refpolicy/refpolicy-targeted/refpolicy-unconfined_u-default-user.patch index e39afca..51edcd2 100644 --- a/recipes-security/refpolicy/refpolicy-targeted/refpolicy-unconfined_u-default-user.patch +++ b/recipes-security/refpolicy/refpolicy-targeted/refpolicy-unconfined_u-default-user.patch | |||
@@ -1,4 +1,4 @@ | |||
1 | Subject: [PATCH] refpolicy: make unconfined_u the default selinux user | 1 | refpolicy: make unconfined_u the default selinux user |
2 | 2 | ||
3 | For targeted policy type, we define unconfined_u as the default selinux | 3 | For targeted policy type, we define unconfined_u as the default selinux |
4 | user for root and normal users, so users could login in and run most | 4 | user for root and normal users, so users could login in and run most |
@@ -10,16 +10,15 @@ run_init. | |||
10 | Upstream-Status: Inappropriate [configuration] | 10 | Upstream-Status: Inappropriate [configuration] |
11 | 11 | ||
12 | Signed-off-by: Xin Ouyang <Xin.Ouyang@windriver.com> | 12 | Signed-off-by: Xin Ouyang <Xin.Ouyang@windriver.com> |
13 | Signed-off-by: Joe MacDonald <joe_macdonald@mentor.com> | ||
13 | --- | 14 | --- |
14 | config/appconfig-mcs/seusers | 4 +- | 15 | config/appconfig-mcs/seusers | 4 +-- |
15 | policy/modules/roles/sysadm.te | 1 + | 16 | policy/modules/roles/sysadm.te | 1 |
16 | policy/modules/system/init.if | 47 +++++++++++++++++++++++++++++------ | 17 | policy/modules/system/init.if | 47 +++++++++++++++++++++++++++++------- |
17 | policy/modules/system/unconfined.te | 7 +++++ | 18 | policy/modules/system/unconfined.te | 7 +++++ |
18 | policy/users | 14 +++------ | 19 | policy/users | 16 ++++-------- |
19 | 5 files changed, 54 insertions(+), 19 deletions(-) | 20 | 5 files changed, 55 insertions(+), 20 deletions(-) |
20 | 21 | ||
21 | diff --git a/config/appconfig-mcs/seusers b/config/appconfig-mcs/seusers | ||
22 | index dc5f1e4..4428da8 100644 | ||
23 | --- a/config/appconfig-mcs/seusers | 22 | --- a/config/appconfig-mcs/seusers |
24 | +++ b/config/appconfig-mcs/seusers | 23 | +++ b/config/appconfig-mcs/seusers |
25 | @@ -1,3 +1,3 @@ | 24 | @@ -1,3 +1,3 @@ |
@@ -28,11 +27,9 @@ index dc5f1e4..4428da8 100644 | |||
28 | -__default__:user_u:s0 | 27 | -__default__:user_u:s0 |
29 | +root:unconfined_u:s0-mcs_systemhigh | 28 | +root:unconfined_u:s0-mcs_systemhigh |
30 | +__default__:unconfined_u:s0 | 29 | +__default__:unconfined_u:s0 |
31 | diff --git a/policy/modules/roles/sysadm.te b/policy/modules/roles/sysadm.te | ||
32 | index 85ff145..77d7bdc 100644 | ||
33 | --- a/policy/modules/roles/sysadm.te | 30 | --- a/policy/modules/roles/sysadm.te |
34 | +++ b/policy/modules/roles/sysadm.te | 31 | +++ b/policy/modules/roles/sysadm.te |
35 | @@ -37,6 +37,7 @@ ubac_file_exempt(sysadm_t) | 32 | @@ -34,6 +34,7 @@ ubac_file_exempt(sysadm_t) |
36 | ubac_fd_exempt(sysadm_t) | 33 | ubac_fd_exempt(sysadm_t) |
37 | 34 | ||
38 | init_exec(sysadm_t) | 35 | init_exec(sysadm_t) |
@@ -40,11 +37,9 @@ index 85ff145..77d7bdc 100644 | |||
40 | 37 | ||
41 | # Add/remove user home directories | 38 | # Add/remove user home directories |
42 | userdom_manage_user_home_dirs(sysadm_t) | 39 | userdom_manage_user_home_dirs(sysadm_t) |
43 | diff --git a/policy/modules/system/init.if b/policy/modules/system/init.if | ||
44 | index d26fe81..fa46786 100644 | ||
45 | --- a/policy/modules/system/init.if | 40 | --- a/policy/modules/system/init.if |
46 | +++ b/policy/modules/system/init.if | 41 | +++ b/policy/modules/system/init.if |
47 | @@ -803,11 +803,12 @@ interface(`init_script_file_entry_type',` | 42 | @@ -825,11 +825,12 @@ interface(`init_script_file_entry_type', |
48 | # | 43 | # |
49 | interface(`init_spec_domtrans_script',` | 44 | interface(`init_spec_domtrans_script',` |
50 | gen_require(` | 45 | gen_require(` |
@@ -59,7 +54,7 @@ index d26fe81..fa46786 100644 | |||
59 | 54 | ||
60 | ifdef(`distro_gentoo',` | 55 | ifdef(`distro_gentoo',` |
61 | gen_require(` | 56 | gen_require(` |
62 | @@ -818,11 +819,11 @@ interface(`init_spec_domtrans_script',` | 57 | @@ -840,11 +841,11 @@ interface(`init_spec_domtrans_script',` |
63 | ') | 58 | ') |
64 | 59 | ||
65 | ifdef(`enable_mcs',` | 60 | ifdef(`enable_mcs',` |
@@ -73,7 +68,7 @@ index d26fe81..fa46786 100644 | |||
73 | ') | 68 | ') |
74 | ') | 69 | ') |
75 | 70 | ||
76 | @@ -838,18 +839,19 @@ interface(`init_spec_domtrans_script',` | 71 | @@ -860,18 +861,19 @@ interface(`init_spec_domtrans_script',` |
77 | # | 72 | # |
78 | interface(`init_domtrans_script',` | 73 | interface(`init_domtrans_script',` |
79 | gen_require(` | 74 | gen_require(` |
@@ -97,7 +92,7 @@ index d26fe81..fa46786 100644 | |||
97 | ') | 92 | ') |
98 | ') | 93 | ') |
99 | 94 | ||
100 | @@ -1792,3 +1794,32 @@ interface(`init_udp_recvfrom_all_daemons',` | 95 | @@ -1837,3 +1839,32 @@ interface(`init_udp_recvfrom_all_daemons |
101 | ') | 96 | ') |
102 | corenet_udp_recvfrom_labeled($1, daemon) | 97 | corenet_udp_recvfrom_labeled($1, daemon) |
103 | ') | 98 | ') |
@@ -130,8 +125,6 @@ index d26fe81..fa46786 100644 | |||
130 | + role_transition $1 init_script_file_type system_r; | 125 | + role_transition $1 init_script_file_type system_r; |
131 | +') | 126 | +') |
132 | + | 127 | + |
133 | diff --git a/policy/modules/system/unconfined.te b/policy/modules/system/unconfined.te | ||
134 | index 0280b32..00b4dcf 100644 | ||
135 | --- a/policy/modules/system/unconfined.te | 128 | --- a/policy/modules/system/unconfined.te |
136 | +++ b/policy/modules/system/unconfined.te | 129 | +++ b/policy/modules/system/unconfined.te |
137 | @@ -20,6 +20,11 @@ type unconfined_execmem_t; | 130 | @@ -20,6 +20,11 @@ type unconfined_execmem_t; |
@@ -146,17 +139,15 @@ index 0280b32..00b4dcf 100644 | |||
146 | 139 | ||
147 | ######################################## | 140 | ######################################## |
148 | # | 141 | # |
149 | @@ -34,6 +39,8 @@ mcs_killall(unconfined_t) | 142 | @@ -50,6 +55,8 @@ userdom_user_home_dir_filetrans_user_hom |
150 | mcs_ptrace_all(unconfined_t) | 143 | ifdef(`direct_sysadm_daemon',` |
151 | 144 | optional_policy(` | |
152 | init_run_daemon(unconfined_t, unconfined_r) | 145 | init_run_daemon(unconfined_t, unconfined_r) |
153 | +init_domtrans_script(unconfined_t) | 146 | + init_domtrans_script(unconfined_t) |
154 | +init_script_role_transition(unconfined_r) | 147 | + init_script_role_transition(unconfined_r) |
155 | 148 | ') | |
156 | libs_run_ldconfig(unconfined_t, unconfined_r) | 149 | ',` |
157 | 150 | ifdef(`distro_gentoo',` | |
158 | diff --git a/policy/users b/policy/users | ||
159 | index c4ebc7e..f300f22 100644 | ||
160 | --- a/policy/users | 151 | --- a/policy/users |
161 | +++ b/policy/users | 152 | +++ b/policy/users |
162 | @@ -15,7 +15,7 @@ | 153 | @@ -15,7 +15,7 @@ |
@@ -168,7 +159,7 @@ index c4ebc7e..f300f22 100644 | |||
168 | 159 | ||
169 | # | 160 | # |
170 | # user_u is a generic user identity for Linux users who have no | 161 | # user_u is a generic user identity for Linux users who have no |
171 | @@ -25,11 +25,11 @@ gen_user(system_u,, system_r, s0, s0 - mls_systemhigh, mcs_allcats) | 162 | @@ -25,14 +25,14 @@ gen_user(system_u,, system_r, s0, s0 - m |
172 | # permit any access to such users, then remove this entry. | 163 | # permit any access to such users, then remove this entry. |
173 | # | 164 | # |
174 | gen_user(user_u, user, user_r, s0, s0) | 165 | gen_user(user_u, user, user_r, s0, s0) |
@@ -178,12 +169,16 @@ index c4ebc7e..f300f22 100644 | |||
178 | +gen_user(sysadm_u, user, sysadm_r, s0, s0 - mls_systemhigh, mcs_allcats) | 169 | +gen_user(sysadm_u, user, sysadm_r, s0, s0 - mls_systemhigh, mcs_allcats) |
179 | 170 | ||
180 | # Until order dependence is fixed for users: | 171 | # Until order dependence is fixed for users: |
181 | -gen_user(unconfined_u, unconfined, unconfined_r, s0, s0 - mls_systemhigh, mcs_allcats) | 172 | ifdef(`direct_sysadm_daemon',` |
182 | +gen_user(unconfined_u, user, unconfined_r system_r, s0, s0 - mls_systemhigh, mcs_allcats) | 173 | - gen_user(unconfined_u, unconfined, unconfined_r system_r, s0, s0 - mls_systemhigh, mcs_allcats) |
174 | + gen_user(unconfined_u, user, unconfined_r system_r, s0, s0 - mls_systemhigh, mcs_allcats) | ||
175 | ',` | ||
176 | - gen_user(unconfined_u, unconfined, unconfined_r, s0, s0 - mls_systemhigh, mcs_allcats) | ||
177 | + gen_user(unconfined_u, user, unconfined_r, s0, s0 - mls_systemhigh, mcs_allcats) | ||
178 | ') | ||
183 | 179 | ||
184 | # | 180 | # |
185 | # The following users correspond to Unix identities. | 181 | @@ -42,8 +42,4 @@ ifdef(`direct_sysadm_daemon',` |
186 | @@ -38,8 +38,4 @@ gen_user(unconfined_u, unconfined, unconfined_r, s0, s0 - mls_systemhigh, mcs_al | ||
187 | # role should use the staff_r role instead of the user_r role when | 182 | # role should use the staff_r role instead of the user_r role when |
188 | # not in the sysadm_r. | 183 | # not in the sysadm_r. |
189 | # | 184 | # |
@@ -193,6 +188,3 @@ index c4ebc7e..f300f22 100644 | |||
193 | - gen_user(root, sysadm, sysadm_r staff_r ifdef(`enable_mls',`secadm_r auditadm_r'), s0, s0 - mls_systemhigh, mcs_allcats) | 188 | - gen_user(root, sysadm, sysadm_r staff_r ifdef(`enable_mls',`secadm_r auditadm_r'), s0, s0 - mls_systemhigh, mcs_allcats) |
194 | -') | 189 | -') |
195 | +gen_user(root, user, sysadm_r staff_r ifdef(`enable_mls',`secadm_r auditadm_r') unconfined_r system_r, s0, s0 - mls_systemhigh, mcs_allcats) | 190 | +gen_user(root, user, sysadm_r staff_r ifdef(`enable_mls',`secadm_r auditadm_r') unconfined_r system_r, s0, s0 - mls_systemhigh, mcs_allcats) |
196 | -- | ||
197 | 1.7.1 | ||
198 | |||
diff --git a/recipes-security/refpolicy/refpolicy-targeted_2.20130424.bb b/recipes-security/refpolicy/refpolicy-targeted_2.20140311.bb index 1f20caa..b169604 100644 --- a/recipes-security/refpolicy/refpolicy-targeted_2.20130424.bb +++ b/recipes-security/refpolicy/refpolicy-targeted_2.20140311.bb | |||
@@ -12,8 +12,9 @@ POLICY_NAME = "targeted" | |||
12 | POLICY_TYPE = "mcs" | 12 | POLICY_TYPE = "mcs" |
13 | POLICY_MLS_SENS = "0" | 13 | POLICY_MLS_SENS = "0" |
14 | 14 | ||
15 | PR = "r99" | ||
16 | include refpolicy_${PV}.inc | 15 | include refpolicy_${PV}.inc |
17 | 16 | ||
18 | SRC_URI += "file://refpolicy-fix-optional-issue-on-sysadm-module.patch \ | 17 | SRC_URI += " \ |
19 | file://refpolicy-unconfined_u-default-user.patch" | 18 | file://refpolicy-fix-optional-issue-on-sysadm-module.patch \ |
19 | file://refpolicy-unconfined_u-default-user.patch \ | ||
20 | " | ||
diff --git a/recipes-security/refpolicy/refpolicy_2.20130424.inc b/recipes-security/refpolicy/refpolicy_2.20140311.inc index 0e7419d..8894583 100644 --- a/recipes-security/refpolicy/refpolicy_2.20130424.inc +++ b/recipes-security/refpolicy/refpolicy_2.20140311.inc | |||
@@ -1,8 +1,8 @@ | |||
1 | SRC_URI = "http://oss.tresys.com/files/refpolicy/refpolicy-${PV}.tar.bz2;" | 1 | SRC_URI = "https://raw.githubusercontent.com/wiki/TresysTechnology/refpolicy/files/refpolicy-${PV}.tar.bz2;" |
2 | SRC_URI[md5sum] = "6a5c975258cc8eb92c122f11b11a5085" | 2 | SRC_URI[md5sum] = "418f8d2a6ada3a299816153e70970449" |
3 | SRC_URI[sha256sum] = "6039ba854f244a39dc727cc7db25632f7b933bb271c803772d754d4354f5aef4" | 3 | SRC_URI[sha256sum] = "f69437db95548c78a5dec44c236397146b144153149009ea554d2e536e5436f7" |
4 | 4 | ||
5 | FILESEXTRAPATHS_prepend := "${THISDIR}/refpolicy-2.20130424:" | 5 | FILESEXTRAPATHS_prepend := "${THISDIR}/refpolicy-2.20140311:" |
6 | 6 | ||
7 | # Fix file contexts for Poky | 7 | # Fix file contexts for Poky |
8 | SRC_URI += "file://poky-fc-subs_dist.patch \ | 8 | SRC_URI += "file://poky-fc-subs_dist.patch \ |
@@ -49,19 +49,11 @@ SRC_URI += "file://poky-policy-add-syslogd_t-to-trusted-object.patch \ | |||
49 | " | 49 | " |
50 | 50 | ||
51 | # Other policy fixes | 51 | # Other policy fixes |
52 | SRC_URI += "file://poky-policy-fix-xconsole_device_t-as-a-dev_node.patch \ | 52 | SRC_URI += " \ |
53 | file://poky-policy-fix-seutils-manage-config-files.patch \ | 53 | file://poky-policy-fix-seutils-manage-config-files.patch \ |
54 | file://poky-policy-fix-setfiles-statvfs-get-file-count.patch \ | 54 | file://poky-policy-fix-setfiles-statvfs-get-file-count.patch \ |
55 | file://poky-policy-fix-dmesg-to-use-dev-kmsg.patch \ | 55 | file://poky-policy-fix-dmesg-to-use-dev-kmsg.patch \ |
56 | file://hostname-do-not-audit-attempts-by-hostname-to-read-a.patch \ | ||
57 | file://sysnetwork-dhcpc-binds-socket-to-random-high-udp-por.patch \ | ||
58 | file://ftp-add-ftpd_t-to-mlsfilewrite.patch \ | 56 | file://ftp-add-ftpd_t-to-mlsfilewrite.patch \ |
59 | " | 57 | " |
60 | 58 | ||
61 | # Backport from upstream | ||
62 | SRC_URI += "file://Allow-ping-to-get-set-capabilities.patch \ | ||
63 | file://filesystem-associate-tmpfs_t-shm-to-device_t-devtmpf.patch \ | ||
64 | file://Allow-udev-the-block_suspend-capability.patch \ | ||
65 | " | ||
66 | |||
67 | include refpolicy_common.inc | 59 | include refpolicy_common.inc |
diff --git a/recipes-security/refpolicy/refpolicy_common.inc b/recipes-security/refpolicy/refpolicy_common.inc index abadb2a..0dc055e 100644 --- a/recipes-security/refpolicy/refpolicy_common.inc +++ b/recipes-security/refpolicy/refpolicy_common.inc | |||
@@ -13,7 +13,7 @@ S = "${WORKDIR}/refpolicy" | |||
13 | 13 | ||
14 | FILES_${PN} = " \ | 14 | FILES_${PN} = " \ |
15 | ${sysconfdir}/selinux/${POLICY_NAME}/ \ | 15 | ${sysconfdir}/selinux/${POLICY_NAME}/ \ |
16 | ${@bb.utils.contains('DISTRO_FEATURES', 'compressed_policy', '${datadir}/selinux/${POLICY_NAME}/*.pp.bz2', '${datadir}/selinux/${POLICY_NAME}/*.pp', d)} \ | 16 | ${datadir}/selinux/${POLICY_NAME}/*.pp \ |
17 | " | 17 | " |
18 | FILES_${PN}-dev =+ "${datadir}/selinux/${POLICY_NAME}/include/" | 18 | FILES_${PN}-dev =+ "${datadir}/selinux/${POLICY_NAME}/include/" |
19 | 19 | ||
@@ -69,24 +69,14 @@ prepare_policy_store () { | |||
69 | mkdir -p ${D}${sysconfdir}/selinux/${POLICY_NAME}/modules/active/modules | 69 | mkdir -p ${D}${sysconfdir}/selinux/${POLICY_NAME}/modules/active/modules |
70 | mkdir -p ${D}${sysconfdir}/selinux/${POLICY_NAME}/contexts/files | 70 | mkdir -p ${D}${sysconfdir}/selinux/${POLICY_NAME}/contexts/files |
71 | touch ${D}${sysconfdir}/selinux/${POLICY_NAME}/contexts/files/file_contexts.local | 71 | touch ${D}${sysconfdir}/selinux/${POLICY_NAME}/contexts/files/file_contexts.local |
72 | if ${@bb.utils.contains('DISTRO_FEATURES','compressed_policy','true','false',d)}; then | 72 | for i in ${D}${datadir}/selinux/${POLICY_NAME}/*.pp; do |
73 | for i in ${D}${datadir}/selinux/${POLICY_NAME}/*.pp; do | 73 | bzip2 -f $i && mv -f $i.bz2 $i |
74 | bzip2 $i | 74 | if [ "`basename $i`" != "base.pp" ]; then |
75 | if [ "`basename $i`" != "base.pp" ]; then | 75 | cp $i ${D}${sysconfdir}/selinux/${POLICY_NAME}/modules/active/modules/`basename $i` |
76 | cp ${i}.bz2 ${D}${sysconfdir}/selinux/${POLICY_NAME}/modules/active/modules/`basename $i` | 76 | else |
77 | else | 77 | cp $i ${D}${sysconfdir}/selinux/${POLICY_NAME}/modules/active/`basename $i` |
78 | cp ${i}.bz2 ${D}${sysconfdir}/selinux/${POLICY_NAME}/modules/active/`basename $i` | 78 | fi |
79 | fi | 79 | done |
80 | done | ||
81 | else | ||
82 | bzip2 -c ${D}${datadir}/selinux/${POLICY_NAME}/base.pp >\ | ||
83 | ${D}${sysconfdir}/selinux/${POLICY_NAME}/modules/active/base.pp | ||
84 | for i in ${D}${datadir}/selinux/${POLICY_NAME}/*.pp; do | ||
85 | if [ "`basename $i`" != "base.pp" ]; then | ||
86 | bzip2 -c $i > ${D}${sysconfdir}/selinux/${POLICY_NAME}/modules/active/modules/`basename $i`; | ||
87 | fi | ||
88 | done | ||
89 | fi | ||
90 | } | 80 | } |
91 | 81 | ||
92 | rebuild_policy () { | 82 | rebuild_policy () { |
diff --git a/recipes-security/selinux/checkpolicy.inc b/recipes-security/selinux/checkpolicy.inc index e0c7377..1a21680 100644 --- a/recipes-security/selinux/checkpolicy.inc +++ b/recipes-security/selinux/checkpolicy.inc | |||
@@ -11,7 +11,7 @@ LICENSE = "GPLv2+" | |||
11 | 11 | ||
12 | DEPENDS += "libsepol libselinux bison-native flex-native" | 12 | DEPENDS += "libsepol libselinux bison-native flex-native" |
13 | 13 | ||
14 | SRC_URI += "file://checkpolicy-Do-not-link-against-libfl.patch" | 14 | #SRC_URI += "file://checkpolicy-Do-not-link-against-libfl.patch" |
15 | 15 | ||
16 | EXTRA_OEMAKE += "PREFIX=${D}" | 16 | EXTRA_OEMAKE += "PREFIX=${D}" |
17 | EXTRA_OEMAKE += "LEX='flex'" | 17 | EXTRA_OEMAKE += "LEX='flex'" |
diff --git a/recipes-security/selinux/checkpolicy_2.2.bb b/recipes-security/selinux/checkpolicy_2.2.bb deleted file mode 100644 index 23d57c1..0000000 --- a/recipes-security/selinux/checkpolicy_2.2.bb +++ /dev/null | |||
@@ -1,9 +0,0 @@ | |||
1 | PR = "r99" | ||
2 | |||
3 | include selinux_20131030.inc | ||
4 | include ${BPN}.inc | ||
5 | |||
6 | LIC_FILES_CHKSUM = "file://COPYING;md5=393a5ca445f6965873eca0259a17f833" | ||
7 | |||
8 | SRC_URI[md5sum] = "d76d5c70cd594fdb15f8d319c6536324" | ||
9 | SRC_URI[sha256sum] = "5d74075379cbaf17135c2a113a3053bd2e7b2a2c54ac04458de652457306c020" | ||
diff --git a/recipes-security/selinux/checkpolicy_2.3.bb b/recipes-security/selinux/checkpolicy_2.3.bb new file mode 100644 index 0000000..9f68487 --- /dev/null +++ b/recipes-security/selinux/checkpolicy_2.3.bb | |||
@@ -0,0 +1,7 @@ | |||
1 | include selinux_20140506.inc | ||
2 | include ${BPN}.inc | ||
3 | |||
4 | LIC_FILES_CHKSUM = "file://COPYING;md5=393a5ca445f6965873eca0259a17f833" | ||
5 | |||
6 | SRC_URI[md5sum] = "920f1a048b6023a22e1bae7b40fd413c" | ||
7 | SRC_URI[sha256sum] = "8072c12121613ba943417bbb6d33224d12373ea19d75c5acd1846a35e0e05b74" | ||
diff --git a/recipes-security/selinux/libselinux_2.2.2.bb b/recipes-security/selinux/libselinux_2.3.bb index d6502ad..81e599d 100644 --- a/recipes-security/selinux/libselinux_2.2.2.bb +++ b/recipes-security/selinux/libselinux_2.3.bb | |||
@@ -1,12 +1,10 @@ | |||
1 | PR = "r99" | 1 | include selinux_20140506.inc |
2 | |||
3 | include selinux_20131030.inc | ||
4 | include ${BPN}.inc | 2 | include ${BPN}.inc |
5 | 3 | ||
6 | LIC_FILES_CHKSUM = "file://LICENSE;md5=84b4d2c6ef954a2d4081e775a270d0d0" | 4 | LIC_FILES_CHKSUM = "file://LICENSE;md5=84b4d2c6ef954a2d4081e775a270d0d0" |
7 | 5 | ||
8 | SRC_URI[md5sum] = "c13ea5de171f21fee399abfd4aef9481" | 6 | SRC_URI[md5sum] = "d27e249ad8450e7182203134cf4d85e2" |
9 | SRC_URI[sha256sum] = "cc8354d67d7bef11fb2a03d23e788c6f4e8510b6760c3778dc7baf6dcfa97539" | 7 | SRC_URI[sha256sum] = "03fe2baa7ceeea531a64fd321b44ecf09a55f3af5ef66a58a4135944f34e9851" |
10 | 8 | ||
11 | SRC_URI += "\ | 9 | SRC_URI += "\ |
12 | file://libselinux-drop-Wno-unused-but-set-variable.patch \ | 10 | file://libselinux-drop-Wno-unused-but-set-variable.patch \ |
diff --git a/recipes-security/selinux/libsemanage_2.2.bb b/recipes-security/selinux/libsemanage_2.3.bb index 1f00d07..5eada94 100644 --- a/recipes-security/selinux/libsemanage_2.2.bb +++ b/recipes-security/selinux/libsemanage_2.3.bb | |||
@@ -1,12 +1,10 @@ | |||
1 | PR = "r99" | 1 | include selinux_20140506.inc |
2 | |||
3 | include selinux_20131030.inc | ||
4 | include ${BPN}.inc | 2 | include ${BPN}.inc |
5 | 3 | ||
6 | LIC_FILES_CHKSUM = "file://COPYING;md5=a6f89e2100d9b6cdffcea4f398e37343" | 4 | LIC_FILES_CHKSUM = "file://COPYING;md5=a6f89e2100d9b6cdffcea4f398e37343" |
7 | 5 | ||
8 | SRC_URI[md5sum] = "2bb8f4b728a5667519764297b7725c19" | 6 | SRC_URI[md5sum] = "cc313b400637d94e3a549bf77555d8c3" |
9 | SRC_URI[sha256sum] = "9b421ce1df10594cb467eef37faeb403d5c6b341a4b7e4b407ac4cb77df95cba" | 7 | SRC_URI[sha256sum] = "4c984379a98ee9f05b80ff6e57dd2de886273d7136146456cabdce21ac32ed7f" |
10 | 8 | ||
11 | SRC_URI += "\ | 9 | SRC_URI += "\ |
12 | file://libsemanage-Fix-execve-segfaults-on-Ubuntu.patch \ | 10 | file://libsemanage-Fix-execve-segfaults-on-Ubuntu.patch \ |
diff --git a/recipes-security/selinux/libsepol_2.2.bb b/recipes-security/selinux/libsepol_2.2.bb deleted file mode 100644 index a0b7df7..0000000 --- a/recipes-security/selinux/libsepol_2.2.bb +++ /dev/null | |||
@@ -1,9 +0,0 @@ | |||
1 | PR = "r99" | ||
2 | |||
3 | include selinux_20131030.inc | ||
4 | include ${BPN}.inc | ||
5 | |||
6 | LIC_FILES_CHKSUM = "file://COPYING;md5=a6f89e2100d9b6cdffcea4f398e37343" | ||
7 | |||
8 | SRC_URI[md5sum] = "2d43599ed29fea9ef41218ec9635ef64" | ||
9 | SRC_URI[sha256sum] = "fbd77459fd03979a9020289b10c89a0af56a52bcd0f7ae0a78455713bb04878b" | ||
diff --git a/recipes-security/selinux/libsepol_2.3.bb b/recipes-security/selinux/libsepol_2.3.bb new file mode 100644 index 0000000..0c07d41 --- /dev/null +++ b/recipes-security/selinux/libsepol_2.3.bb | |||
@@ -0,0 +1,7 @@ | |||
1 | include selinux_20140506.inc | ||
2 | include ${BPN}.inc | ||
3 | |||
4 | LIC_FILES_CHKSUM = "file://COPYING;md5=a6f89e2100d9b6cdffcea4f398e37343" | ||
5 | |||
6 | SRC_URI[md5sum] = "c6b3dc07bf19ab4f364f21bbecb44beb" | ||
7 | SRC_URI[sha256sum] = "5a4481bfd0fad6fdad1511c786d69de1fc3eddc28154eae1691e1bf4e9e505c3" | ||
diff --git a/recipes-security/selinux/policycoreutils.inc b/recipes-security/selinux/policycoreutils.inc index 153b688..44a5861 100644 --- a/recipes-security/selinux/policycoreutils.inc +++ b/recipes-security/selinux/policycoreutils.inc | |||
@@ -211,7 +211,7 @@ FILES_${PN}-setsebool += "\ | |||
211 | FILES_system-config-selinux = " \ | 211 | FILES_system-config-selinux = " \ |
212 | ${bindir}/sepolgen \ | 212 | ${bindir}/sepolgen \ |
213 | ${datadir}/system-config-selinux/* \ | 213 | ${datadir}/system-config-selinux/* \ |
214 | ${datadir}/icons/hicolor/24x24/apps/system-config-selinux.png \ | 214 | ${datadir}/icons/hicolor/ \ |
215 | ${datadir}/polkit-1/actions/org.selinux.config.policy \ | 215 | ${datadir}/polkit-1/actions/org.selinux.config.policy \ |
216 | " | 216 | " |
217 | 217 | ||
diff --git a/recipes-security/selinux/policycoreutils_2.2.5.bb b/recipes-security/selinux/policycoreutils_2.3.bb index 96cf354..447e6c9 100644 --- a/recipes-security/selinux/policycoreutils_2.2.5.bb +++ b/recipes-security/selinux/policycoreutils_2.3.bb | |||
@@ -1,12 +1,10 @@ | |||
1 | PR = "r99" | 1 | include selinux_20140506.inc |
2 | |||
3 | include selinux_20131030.inc | ||
4 | include ${BPN}.inc | 2 | include ${BPN}.inc |
5 | 3 | ||
6 | LIC_FILES_CHKSUM = "file://COPYING;md5=393a5ca445f6965873eca0259a17f833" | 4 | LIC_FILES_CHKSUM = "file://COPYING;md5=393a5ca445f6965873eca0259a17f833" |
7 | 5 | ||
8 | SRC_URI[md5sum] = "f330a90c566c8b564858d45399ce3dd1" | 6 | SRC_URI[md5sum] = "4f5c508e3c3867c8beb343e993d353dd" |
9 | SRC_URI[sha256sum] = "3d2c8806742004693c2d4726abbc4f412340ee07bed407976dd8abeda09a4333" | 7 | SRC_URI[sha256sum] = "11e8815ac13debb87897d2781381b89ec5c6c746a3d44223a493bc7ace6cc71f" |
10 | 8 | ||
11 | SRC_URI += "\ | 9 | SRC_URI += "\ |
12 | file://policycoreutils-fix-sepolicy-install-path.patch \ | 10 | file://policycoreutils-fix-sepolicy-install-path.patch \ |
diff --git a/recipes-security/selinux/selinux_20131030.inc b/recipes-security/selinux/selinux_20140506.inc index 01cc52f..01cc52f 100644 --- a/recipes-security/selinux/selinux_20131030.inc +++ b/recipes-security/selinux/selinux_20140506.inc | |||
diff --git a/recipes-security/selinux/selinux_git.inc b/recipes-security/selinux/selinux_git.inc index d56f25b..6112d7d 100644 --- a/recipes-security/selinux/selinux_git.inc +++ b/recipes-security/selinux/selinux_git.inc | |||
@@ -1,6 +1,6 @@ | |||
1 | SRCREV = "edc2e99687b050d5be21a78a66d038aa1fc068d9" | 1 | SRCREV = "edc2e99687b050d5be21a78a66d038aa1fc068d9" |
2 | 2 | ||
3 | SRC_URI = "git://oss.tresys.com/git/selinux.git;protocol=http" | 3 | SRC_URI = "git://github.com/SELinuxProject/selinux.git;protocol=http" |
4 | 4 | ||
5 | include selinux_common.inc | 5 | include selinux_common.inc |
6 | 6 | ||
diff --git a/recipes-security/selinux/sepolgen_1.2.1.bb b/recipes-security/selinux/sepolgen_1.2.1.bb index 21dff41..b47ff26 100644 --- a/recipes-security/selinux/sepolgen_1.2.1.bb +++ b/recipes-security/selinux/sepolgen_1.2.1.bb | |||
@@ -1,6 +1,4 @@ | |||
1 | PR = "r99" | 1 | include selinux_20140506.inc |
2 | |||
3 | include selinux_20131030.inc | ||
4 | include ${BPN}.inc | 2 | include ${BPN}.inc |
5 | 3 | ||
6 | LIC_FILES_CHKSUM = "file://COPYING;md5=393a5ca445f6965873eca0259a17f833" | 4 | LIC_FILES_CHKSUM = "file://COPYING;md5=393a5ca445f6965873eca0259a17f833" |
diff --git a/recipes-security/setools/setools/setools-Changes-to-support-named-file_trans-rules.patch b/recipes-security/setools/setools/setools-Changes-to-support-named-file_trans-rules.patch deleted file mode 100644 index d44ae21..0000000 --- a/recipes-security/setools/setools/setools-Changes-to-support-named-file_trans-rules.patch +++ /dev/null | |||
@@ -1,1511 +0,0 @@ | |||
1 | From e0f74aa934140ccc6f5a51aa2df6fd19f0c0ee08 Mon Sep 17 00:00:00 2001 | ||
2 | From: Xin Ouyang <Xin.Ouyang@windriver.com> | ||
3 | Date: Wed, 7 Mar 2012 11:00:19 +0800 | ||
4 | Subject: [PATCH 5/7] setools: Changes to support named file_trans rules | ||
5 | |||
6 | Integrated from Fedora: | ||
7 | https://community.dev.fedoraproject.org/packages/setools/sources/patches/ | ||
8 | --- | ||
9 | libapol/include/apol/Makefile.am | 1 + | ||
10 | libapol/include/apol/ftrule-query.h | 198 +++++++++++++++++++ | ||
11 | libapol/include/apol/policy-query.h | 1 + | ||
12 | libapol/src/Makefile.am | 1 + | ||
13 | libapol/src/ftrule-query.c | 363 +++++++++++++++++++++++++++++++++++ | ||
14 | libapol/src/libapol.map | 1 + | ||
15 | libqpol/include/qpol/Makefile.am | 1 + | ||
16 | libqpol/include/qpol/ftrule_query.h | 116 +++++++++++ | ||
17 | libqpol/include/qpol/policy.h | 1 + | ||
18 | libqpol/src/Makefile.am | 1 + | ||
19 | libqpol/src/ftrule_query.c | 277 ++++++++++++++++++++++++++ | ||
20 | libqpol/src/libqpol.map | 1 + | ||
21 | libqpol/src/module_compiler.c | 12 ++ | ||
22 | libqpol/src/policy_define.c | 186 ++++++++++++++++++- | ||
23 | libqpol/src/policy_parse.y | 13 +- | ||
24 | libqpol/src/policy_scan.l | 1 + | ||
25 | secmds/sesearch.c | 101 ++++++++++ | ||
26 | 17 files changed, 1272 insertions(+), 3 deletions(-) | ||
27 | create mode 100644 libapol/include/apol/ftrule-query.h | ||
28 | create mode 100644 libapol/src/ftrule-query.c | ||
29 | create mode 100644 libqpol/include/qpol/ftrule_query.h | ||
30 | create mode 100644 libqpol/src/ftrule_query.c | ||
31 | |||
32 | diff --git a/libapol/include/apol/Makefile.am b/libapol/include/apol/Makefile.am | ||
33 | index 0883c10..e398ff2 100644 | ||
34 | --- a/libapol/include/apol/Makefile.am | ||
35 | +++ b/libapol/include/apol/Makefile.am | ||
36 | @@ -27,6 +27,7 @@ apol_HEADERS = \ | ||
37 | relabel-analysis.h \ | ||
38 | render.h \ | ||
39 | role-query.h \ | ||
40 | + ftrule-query.h \ | ||
41 | terule-query.h \ | ||
42 | type-query.h \ | ||
43 | types-relation-analysis.h \ | ||
44 | diff --git a/libapol/include/apol/ftrule-query.h b/libapol/include/apol/ftrule-query.h | ||
45 | new file mode 100644 | ||
46 | index 0000000..119c52f | ||
47 | --- /dev/null | ||
48 | +++ b/libapol/include/apol/ftrule-query.h | ||
49 | @@ -0,0 +1,198 @@ | ||
50 | +/** | ||
51 | + * @file | ||
52 | + * | ||
53 | + * Routines to query filename_transition rules of a | ||
54 | + * policy. | ||
55 | + * | ||
56 | + * @author Jeremy A. Mowery jmowery@tresys.com | ||
57 | + * @author Jason Tang jtang@tresys.com | ||
58 | + * | ||
59 | + * Copyright (C) 2006-2007 Tresys Technology, LLC | ||
60 | + * | ||
61 | + * This library is free software; you can redistribute it and/or | ||
62 | + * modify it under the terms of the GNU Lesser General Public | ||
63 | + * License as published by the Free Software Foundation; either | ||
64 | + * version 2.1 of the License, or (at your option) any later version. | ||
65 | + * | ||
66 | + * This library is distributed in the hope that it will be useful, | ||
67 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
68 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
69 | + * Lesser General Public License for more details. | ||
70 | + * | ||
71 | + * You should have received a copy of the GNU Lesser General Public | ||
72 | + * License along with this library; if not, write to the Free Software | ||
73 | + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
74 | + */ | ||
75 | + | ||
76 | +#ifndef APOL_FILENAMERULE_QUERY_H | ||
77 | +#define APOL_FILENAMERULE_QUERY_H | ||
78 | + | ||
79 | +#ifdef __cplusplus | ||
80 | +extern "C" | ||
81 | +{ | ||
82 | +#endif | ||
83 | + | ||
84 | +#include "policy.h" | ||
85 | +#include "vector.h" | ||
86 | +#include <qpol/policy.h> | ||
87 | + | ||
88 | + typedef struct apol_filename_trans_query apol_filename_trans_query_t; | ||
89 | + | ||
90 | + | ||
91 | +/******************** filename_transition queries ********************/ | ||
92 | + | ||
93 | +/** | ||
94 | + * Execute a query against all filename_transition rules within the | ||
95 | + * policy. | ||
96 | + * | ||
97 | + * @param p Policy within which to look up filename_transition rules. | ||
98 | + * @param r Structure containing parameters for query. If this is | ||
99 | + * NULL then return all filename_transition rules. | ||
100 | + * @param v Reference to a vector of qpol_filename_trans_t. The vector | ||
101 | + * will be allocated by this function. The caller must call | ||
102 | + * apol_vector_destroy() afterwards. This will be set to NULL upon no | ||
103 | + * results or upon error. | ||
104 | + * | ||
105 | + * @return 0 on success (including none found), negative on error. | ||
106 | + */ | ||
107 | + extern int apol_filename_trans_get_by_query(const apol_policy_t * p, const apol_filename_trans_query_t * r, apol_vector_t ** v); | ||
108 | + | ||
109 | +/** | ||
110 | + * Allocate and return a new filename trans query structure. All fields | ||
111 | + * are initialized, such that running this blank query results in | ||
112 | + * returning all filename_transitions within the policy. The caller must | ||
113 | + * call apol_filename_trans_query_destroy() upon the return value | ||
114 | + * afterwards. | ||
115 | + * | ||
116 | + * @return An initialized filename trans query structure, or NULL upon | ||
117 | + * error. | ||
118 | + */ | ||
119 | + extern apol_filename_trans_query_t *apol_filename_trans_query_create(void); | ||
120 | + | ||
121 | +/** | ||
122 | + * Deallocate all memory associated with the referenced filename trans | ||
123 | + * query, and then set it to NULL. This function does nothing if the | ||
124 | + * query is already NULL. | ||
125 | + * | ||
126 | + * @param r Reference to a filename trans query structure to destroy. | ||
127 | + */ | ||
128 | + extern void apol_filename_trans_query_destroy(apol_filename_trans_query_t ** r); | ||
129 | + | ||
130 | +/** | ||
131 | + * Set a filename_trans query to return rules whose source symbol matches | ||
132 | + * symbol. Symbol may be a type or attribute; if it is an alias then | ||
133 | + * the query will convert it to its primary prior to searching. If | ||
134 | + * is_indirect is non-zero then the search will be done indirectly. | ||
135 | + * If the symbol is a type, then the query matches rules with one of | ||
136 | + * the type's attributes. If the symbol is an attribute, then it | ||
137 | + * matches rule with any of the attribute's types. | ||
138 | + * | ||
139 | + * @param p Policy handler, to report errors. | ||
140 | + * @param t TE rule query to set. | ||
141 | + * @param symbol Limit query to rules with this symbol as their | ||
142 | + * source, or NULL to unset this field. | ||
143 | + * @param is_indirect If non-zero, perform indirect matching. | ||
144 | + * | ||
145 | + * @return 0 on success, negative on error. | ||
146 | + */ | ||
147 | + extern int apol_filename_trans_query_set_source(const apol_policy_t * p, apol_filename_trans_query_t * t, const char *symbol, | ||
148 | + int is_indirect); | ||
149 | + | ||
150 | +/** | ||
151 | + * Set a filename trans query to return rules with a particular target | ||
152 | + * symbol. Symbol may be a type or attribute; if it is an alias then | ||
153 | + * the query will convert it to its primary prior to searching. If | ||
154 | + * is_indirect is non-zero then the search will be done indirectly. | ||
155 | + * If the symbol is a type, then the query matches rules with one of | ||
156 | + * the type's attributes. If the symbol is an attribute, then it | ||
157 | + * matches rule with any of the attribute's types. | ||
158 | + * | ||
159 | + * @param p Policy handler, to report errors. | ||
160 | + * @param r Role trans query to set. | ||
161 | + * @param symbol Limit query to rules with this type or attribute as | ||
162 | + * their target, or NULL to unset this field. | ||
163 | + * @param is_indirect If non-zero, perform indirect matching. | ||
164 | + * | ||
165 | + * @return 0 on success, negative on error. | ||
166 | + */ | ||
167 | + extern int apol_filename_trans_query_set_target(const apol_policy_t * p, apol_filename_trans_query_t * r, const char *symbol, | ||
168 | + int is_indirect); | ||
169 | + | ||
170 | +/** | ||
171 | + * Set a filename trans query to return rules with a particular default | ||
172 | + * filename. This field is ignored if | ||
173 | + * apol_filename_trans_query_set_source_any() is set to non-zero. | ||
174 | + * | ||
175 | + * @param p Policy handler, to report errors. | ||
176 | + * @param r Role trans query to set. | ||
177 | + * @param filename Limit query to rules with this filename as their default, or | ||
178 | + * NULL to unset this field. | ||
179 | + * | ||
180 | + * @return 0 on success, negative on error. | ||
181 | + */ | ||
182 | + extern int apol_filename_trans_query_set_default(const apol_policy_t * p, apol_filename_trans_query_t * r, const char *filename); | ||
183 | + | ||
184 | +/** | ||
185 | + * Set at filename_trans query to return rules with this object (non-common) | ||
186 | + * class. If more than one class are appended to the query, the | ||
187 | + * rule's class must be one of those appended. (I.e., the rule's | ||
188 | + * class must be a member of the query's classes.) Pass a NULL to | ||
189 | + * clear all classes. Note that this performs straight string | ||
190 | + * comparison, ignoring the regex flag. | ||
191 | + | ||
192 | + * | ||
193 | + * @param p Policy handler, to report errors. | ||
194 | + * @param t TE rule query to set. | ||
195 | + * @param obj_class Name of object class to add to search set. | ||
196 | + * | ||
197 | + * @return 0 on success, negative on error. | ||
198 | + */ | ||
199 | + extern int apol_filename_trans_query_append_class(const apol_policy_t * p, apol_filename_trans_query_t * t, const char *obj_class); | ||
200 | + | ||
201 | +/** | ||
202 | + * Set a filename trans query to treat the source filename as any. That is, | ||
203 | + * use the same symbol for either source or default of a | ||
204 | + * filename_transition rule. This flag does nothing if the source filename is | ||
205 | + * not set. Note that a filename_transition's target is a type, so thus | ||
206 | + * this flag does not affect its searching. | ||
207 | + * | ||
208 | + * @param p Policy handler, to report errors. | ||
209 | + * @param r Role trans query to set. | ||
210 | + * @param is_any Non-zero to use source symbol for source or default | ||
211 | + * field, 0 to keep source as only source. | ||
212 | + * | ||
213 | + * @return Always 0. | ||
214 | + */ | ||
215 | + extern int apol_filename_trans_query_set_source_any(const apol_policy_t * p, apol_filename_trans_query_t * r, int is_any); | ||
216 | + | ||
217 | +/** | ||
218 | + * Set a filename trans query to use regular expression searching for | ||
219 | + * source, target, and default fields. Strings will be treated as | ||
220 | + * regexes instead of literals. For the target type, matching will | ||
221 | + * occur against the type name or any of its aliases. | ||
222 | + * | ||
223 | + * @param p Policy handler, to report errors. | ||
224 | + * @param r Role trans query to set. | ||
225 | + * @param is_regex Non-zero to enable regex searching, 0 to disable. | ||
226 | + * | ||
227 | + * @return Always 0. | ||
228 | + */ | ||
229 | + extern int apol_filename_trans_query_set_regex(const apol_policy_t * p, apol_filename_trans_query_t * r, int is_regex); | ||
230 | + | ||
231 | +/** | ||
232 | + * Render a filename_transition rule to a string. | ||
233 | + * | ||
234 | + * @param policy Policy handler, to report errors. | ||
235 | + * @param rule The rule to render. | ||
236 | + * | ||
237 | + * @return A newly malloc()'d string representation of the rule, or NULL on | ||
238 | + * failure; if the call fails, errno will be set. The caller is responsible | ||
239 | + * for calling free() on the returned string. | ||
240 | + */ | ||
241 | + extern char *apol_filename_trans_render(const apol_policy_t * policy, const qpol_filename_trans_t * rule); | ||
242 | + | ||
243 | +#ifdef __cplusplus | ||
244 | +} | ||
245 | +#endif | ||
246 | + | ||
247 | +#endif | ||
248 | diff --git a/libapol/include/apol/policy-query.h b/libapol/include/apol/policy-query.h | ||
249 | index 315f70e..665e4cb 100644 | ||
250 | --- a/libapol/include/apol/policy-query.h | ||
251 | +++ b/libapol/include/apol/policy-query.h | ||
252 | @@ -71,6 +71,7 @@ extern "C" | ||
253 | #include "terule-query.h" | ||
254 | #include "condrule-query.h" | ||
255 | #include "rbacrule-query.h" | ||
256 | +#include "ftrule-query.h" | ||
257 | #include "range_trans-query.h" | ||
258 | #include "constraint-query.h" | ||
259 | |||
260 | diff --git a/libapol/src/Makefile.am b/libapol/src/Makefile.am | ||
261 | index 3fa4f06..baaa4f6 100644 | ||
262 | --- a/libapol/src/Makefile.am | ||
263 | +++ b/libapol/src/Makefile.am | ||
264 | @@ -40,6 +40,7 @@ libapol_a_SOURCES = \ | ||
265 | render.c \ | ||
266 | role-query.c \ | ||
267 | terule-query.c \ | ||
268 | + ftrule-query.c \ | ||
269 | type-query.c \ | ||
270 | types-relation-analysis.c \ | ||
271 | user-query.c \ | ||
272 | diff --git a/libapol/src/ftrule-query.c b/libapol/src/ftrule-query.c | ||
273 | new file mode 100644 | ||
274 | index 0000000..dc248de | ||
275 | --- /dev/null | ||
276 | +++ b/libapol/src/ftrule-query.c | ||
277 | @@ -0,0 +1,363 @@ | ||
278 | +/** | ||
279 | + * @file | ||
280 | + * | ||
281 | + * Provides a way for setools to make queries about type enforcement | ||
282 | + * filename_transs within a policy. The caller obtains a query object, fills in | ||
283 | + * its parameters, and then runs the query; it obtains a vector of | ||
284 | + * results. Searches are conjunctive -- all fields of the search | ||
285 | + * query must match for a datum to be added to the results query. | ||
286 | + * | ||
287 | + * @author Jeremy A. Mowery jmowery@tresys.com | ||
288 | + * @author Jason Tang jtang@tresys.com | ||
289 | + * | ||
290 | + * Copyright (C) 2006-2007 Tresys Technology, LLC | ||
291 | + * | ||
292 | + * This library is free software; you can redistribute it and/or | ||
293 | + * modify it under the terms of the GNU Lesser General Public | ||
294 | + * License as published by the Free Software Foundation; either | ||
295 | + * version 2.1 of the License, or (at your option) any later version. | ||
296 | + * | ||
297 | + * This library is distributed in the hope that it will be useful, | ||
298 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
299 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
300 | + * Lesser General Public License for more details. | ||
301 | + * | ||
302 | + * You should have received a copy of the GNU Lesser General Public | ||
303 | + * License along with this library; if not, write to the Free Software | ||
304 | + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
305 | + */ | ||
306 | + | ||
307 | +#include "policy-query-internal.h" | ||
308 | + | ||
309 | +#include <errno.h> | ||
310 | +#include <string.h> | ||
311 | + | ||
312 | +struct apol_filename_trans_query | ||
313 | +{ | ||
314 | + char *source, *target, *default_type, *name; | ||
315 | + apol_vector_t *classes; | ||
316 | + unsigned int flags; | ||
317 | +}; | ||
318 | + | ||
319 | + | ||
320 | +/******************** filename_transition queries ********************/ | ||
321 | + | ||
322 | +int apol_filename_trans_get_by_query(const apol_policy_t * p, const apol_filename_trans_query_t * t, apol_vector_t ** v) | ||
323 | +{ | ||
324 | + apol_vector_t *source_list = NULL, *target_list = NULL, *class_list = NULL, *default_list = NULL; | ||
325 | + int retval = -1, source_as_any = 0, is_regex = 0, append_filename_trans; | ||
326 | + char *bool_name = NULL; | ||
327 | + *v = NULL; | ||
328 | + unsigned int flags = 0; | ||
329 | + qpol_iterator_t *iter = NULL, *type_iter = NULL; | ||
330 | + | ||
331 | + if (t != NULL) { | ||
332 | + flags = t->flags; | ||
333 | + is_regex = t->flags & APOL_QUERY_REGEX; | ||
334 | + if (t->source != NULL && | ||
335 | + (source_list = | ||
336 | + apol_query_create_candidate_type_list(p, t->source, is_regex, | ||
337 | + t->flags & APOL_QUERY_SOURCE_INDIRECT, | ||
338 | + ((t->flags & (APOL_QUERY_SOURCE_TYPE | APOL_QUERY_SOURCE_ATTRIBUTE)) / | ||
339 | + APOL_QUERY_SOURCE_TYPE))) == NULL) { | ||
340 | + goto cleanup; | ||
341 | + } | ||
342 | + | ||
343 | + if ((t->flags & APOL_QUERY_SOURCE_AS_ANY) && t->source != NULL) { | ||
344 | + default_list = target_list = source_list; | ||
345 | + source_as_any = 1; | ||
346 | + } else { | ||
347 | + if (t->target != NULL && | ||
348 | + (target_list = | ||
349 | + apol_query_create_candidate_type_list(p, t->target, is_regex, | ||
350 | + t->flags & APOL_QUERY_TARGET_INDIRECT, | ||
351 | + ((t-> | ||
352 | + flags & (APOL_QUERY_TARGET_TYPE | APOL_QUERY_TARGET_ATTRIBUTE)) | ||
353 | + / APOL_QUERY_TARGET_TYPE))) == NULL) { | ||
354 | + goto cleanup; | ||
355 | + } | ||
356 | + if (t->default_type != NULL && | ||
357 | + (default_list = | ||
358 | + apol_query_create_candidate_type_list(p, t->default_type, is_regex, 0, | ||
359 | + APOL_QUERY_SYMBOL_IS_TYPE)) == NULL) { | ||
360 | + goto cleanup; | ||
361 | + } | ||
362 | + } | ||
363 | + if (t->classes != NULL && | ||
364 | + apol_vector_get_size(t->classes) > 0 && | ||
365 | + (class_list = apol_query_create_candidate_class_list(p, t->classes)) == NULL) { | ||
366 | + goto cleanup; | ||
367 | + } | ||
368 | + } | ||
369 | + | ||
370 | + if (qpol_policy_get_filename_trans_iter(p->p, &iter) < 0) { | ||
371 | + return -1; | ||
372 | + } | ||
373 | + | ||
374 | + if ((*v = apol_vector_create(NULL)) == NULL) { | ||
375 | + ERR(p, "%s", strerror(errno)); | ||
376 | + goto cleanup; | ||
377 | + } | ||
378 | + | ||
379 | + for (; !qpol_iterator_end(iter); qpol_iterator_next(iter)) { | ||
380 | + qpol_filename_trans_t *filename_trans; | ||
381 | + if (qpol_iterator_get_item(iter, (void **)&filename_trans) < 0) { | ||
382 | + goto cleanup; | ||
383 | + } | ||
384 | + int match_source = 0, match_target = 0, match_default = 0, match_bool = 0; | ||
385 | + size_t i; | ||
386 | + | ||
387 | + if (source_list == NULL) { | ||
388 | + match_source = 1; | ||
389 | + } else { | ||
390 | + const qpol_type_t *source_type; | ||
391 | + if (qpol_filename_trans_get_source_type(p->p, filename_trans, &source_type) < 0) { | ||
392 | + goto cleanup; | ||
393 | + } | ||
394 | + if (apol_vector_get_index(source_list, source_type, NULL, NULL, &i) == 0) { | ||
395 | + match_source = 1; | ||
396 | + } | ||
397 | + } | ||
398 | + | ||
399 | + /* if source did not match, but treating source symbol | ||
400 | + * as any field, then delay rejecting this filename_trans until | ||
401 | + * the target and default have been checked */ | ||
402 | + if (!source_as_any && !match_source) { | ||
403 | + continue; | ||
404 | + } | ||
405 | + | ||
406 | + if (target_list == NULL || (source_as_any && match_source)) { | ||
407 | + match_target = 1; | ||
408 | + } else { | ||
409 | + const qpol_type_t *target_type; | ||
410 | + if (qpol_filename_trans_get_target_type(p->p, filename_trans, &target_type) < 0) { | ||
411 | + goto cleanup; | ||
412 | + } | ||
413 | + if (apol_vector_get_index(target_list, target_type, NULL, NULL, &i) == 0) { | ||
414 | + match_target = 1; | ||
415 | + } | ||
416 | + } | ||
417 | + | ||
418 | + if (!source_as_any && !match_target) { | ||
419 | + continue; | ||
420 | + } | ||
421 | + | ||
422 | + if (default_list == NULL || (source_as_any && match_source) || (source_as_any && match_target)) { | ||
423 | + match_default = 1; | ||
424 | + } else { | ||
425 | + const qpol_type_t *default_type; | ||
426 | + if (qpol_filename_trans_get_default_type(p->p, filename_trans, &default_type) < 0) { | ||
427 | + goto cleanup; | ||
428 | + } | ||
429 | + if (apol_vector_get_index(default_list, default_type, NULL, NULL, &i) == 0) { | ||
430 | + match_default = 1; | ||
431 | + } | ||
432 | + } | ||
433 | + | ||
434 | + if (!source_as_any && !match_default) { | ||
435 | + continue; | ||
436 | + } | ||
437 | + /* at least one thing must match if source_as_any was given */ | ||
438 | + if (source_as_any && (!match_source && !match_target && !match_default)) { | ||
439 | + continue; | ||
440 | + } | ||
441 | + | ||
442 | + if (class_list != NULL) { | ||
443 | + const qpol_class_t *obj_class; | ||
444 | + if (qpol_filename_trans_get_object_class(p->p, filename_trans, &obj_class) < 0) { | ||
445 | + goto cleanup; | ||
446 | + } | ||
447 | + if (apol_vector_get_index(class_list, obj_class, NULL, NULL, &i) < 0) { | ||
448 | + continue; | ||
449 | + } | ||
450 | + } | ||
451 | + | ||
452 | + if (apol_vector_append(*v, filename_trans)) { | ||
453 | + ERR(p, "%s", strerror(ENOMEM)); | ||
454 | + goto cleanup; | ||
455 | + } | ||
456 | + } | ||
457 | + | ||
458 | + retval = 0; | ||
459 | + cleanup: | ||
460 | + if (retval != 0) { | ||
461 | + apol_vector_destroy(v); | ||
462 | + } | ||
463 | + apol_vector_destroy(&source_list); | ||
464 | + if (!source_as_any) { | ||
465 | + apol_vector_destroy(&target_list); | ||
466 | + apol_vector_destroy(&default_list); | ||
467 | + } | ||
468 | + apol_vector_destroy(&class_list); | ||
469 | + return retval; | ||
470 | +} | ||
471 | + | ||
472 | +apol_filename_trans_query_t *apol_filename_trans_query_create(void) | ||
473 | +{ | ||
474 | + apol_filename_trans_query_t *t = calloc(1, sizeof(apol_filename_trans_query_t)); | ||
475 | + if (t != NULL) { | ||
476 | + t->flags = | ||
477 | + (APOL_QUERY_SOURCE_TYPE | APOL_QUERY_SOURCE_ATTRIBUTE | APOL_QUERY_TARGET_TYPE | | ||
478 | + APOL_QUERY_TARGET_ATTRIBUTE); | ||
479 | + } | ||
480 | + return t; | ||
481 | +} | ||
482 | + | ||
483 | +void apol_filename_trans_query_destroy(apol_filename_trans_query_t ** r) | ||
484 | +{ | ||
485 | + if (r != NULL && *r != NULL) { | ||
486 | + free((*r)->source); | ||
487 | + free((*r)->target); | ||
488 | + free((*r)->default_type); | ||
489 | + free((*r)->name); | ||
490 | + free(*r); | ||
491 | + *r = NULL; | ||
492 | + } | ||
493 | +} | ||
494 | + | ||
495 | +int apol_filename_trans_query_set_source(const apol_policy_t * p, apol_filename_trans_query_t * t, const char *filename, int is_indirect) | ||
496 | +{ | ||
497 | + apol_query_set_flag(p, &t->flags, is_indirect, APOL_QUERY_TARGET_INDIRECT); | ||
498 | + return apol_query_set(p, &t->source, NULL, filename); | ||
499 | +} | ||
500 | + | ||
501 | +int apol_filename_trans_query_set_target(const apol_policy_t * p, apol_filename_trans_query_t * t, const char *type, int is_indirect) | ||
502 | +{ | ||
503 | + apol_query_set_flag(p, &t->flags, is_indirect, APOL_QUERY_TARGET_INDIRECT); | ||
504 | + return apol_query_set(p, &t->target, NULL, type); | ||
505 | +} | ||
506 | + | ||
507 | +int apol_filename_trans_query_set_default(const apol_policy_t * p, apol_filename_trans_query_t * t, const char *symbol) | ||
508 | +{ | ||
509 | + return apol_query_set(p, &t->default_type, NULL, symbol); | ||
510 | +} | ||
511 | + | ||
512 | +int apol_filename_trans_query_append_class(const apol_policy_t * p, apol_filename_trans_query_t * t, const char *obj_class) | ||
513 | +{ | ||
514 | + char *s = NULL; | ||
515 | + if (obj_class == NULL) { | ||
516 | + apol_vector_destroy(&t->classes); | ||
517 | + } else if ((s = strdup(obj_class)) == NULL || (t->classes == NULL && (t->classes = apol_vector_create(free)) == NULL) | ||
518 | + || apol_vector_append(t->classes, s) < 0) { | ||
519 | + ERR(p, "%s", strerror(errno)); | ||
520 | + free(s); | ||
521 | + return -1; | ||
522 | + } | ||
523 | + return 0; | ||
524 | +} | ||
525 | + | ||
526 | +int apol_filename_trans_query_set_name(const apol_policy_t * p, apol_filename_trans_query_t * t, const char *filename) | ||
527 | +{ | ||
528 | + return apol_query_set(p, &t->name, NULL, filename); | ||
529 | +} | ||
530 | + | ||
531 | +int apol_filename_trans_query_set_source_any(const apol_policy_t * p, apol_filename_trans_query_t * t, int is_any) | ||
532 | +{ | ||
533 | + return apol_query_set_flag(p, &t->flags, is_any, APOL_QUERY_SOURCE_AS_ANY); | ||
534 | +} | ||
535 | + | ||
536 | +int apol_filename_trans_query_set_regex(const apol_policy_t * p, apol_filename_trans_query_t * t, int is_regex) | ||
537 | +{ | ||
538 | + return apol_query_set_regex(p, &t->flags, is_regex); | ||
539 | +} | ||
540 | + | ||
541 | +char *apol_filename_trans_render(const apol_policy_t * policy, const qpol_filename_trans_t * filename_trans) | ||
542 | +{ | ||
543 | + char *tmp = NULL; | ||
544 | + const char *tmp_name = NULL; | ||
545 | + const char *filename_trans_type_str; | ||
546 | + int error = 0; | ||
547 | + size_t tmp_sz = 0; | ||
548 | + uint32_t filename_trans_type = 0; | ||
549 | + const qpol_type_t *type = NULL; | ||
550 | + const qpol_class_t *obj_class = NULL; | ||
551 | + | ||
552 | + if (!policy || !filename_trans) { | ||
553 | + ERR(policy, "%s", strerror(EINVAL)); | ||
554 | + errno = EINVAL; | ||
555 | + return NULL; | ||
556 | + } | ||
557 | + | ||
558 | + /* source type */ | ||
559 | + if (qpol_filename_trans_get_source_type(policy->p, filename_trans, &type)) { | ||
560 | + error = errno; | ||
561 | + goto err; | ||
562 | + } | ||
563 | + if (qpol_type_get_name(policy->p, type, &tmp_name)) { | ||
564 | + error = errno; | ||
565 | + goto err; | ||
566 | + } | ||
567 | + if (apol_str_appendf(&tmp, &tmp_sz, "transition_type %s ", tmp_name)) { | ||
568 | + error = errno; | ||
569 | + ERR(policy, "%s", strerror(error)); | ||
570 | + goto err; | ||
571 | + } | ||
572 | + | ||
573 | + /* target type */ | ||
574 | + if (qpol_filename_trans_get_target_type(policy->p, filename_trans, &type)) { | ||
575 | + error = errno; | ||
576 | + goto err; | ||
577 | + } | ||
578 | + if (qpol_type_get_name(policy->p, type, &tmp_name)) { | ||
579 | + error = errno; | ||
580 | + goto err; | ||
581 | + } | ||
582 | + if (apol_str_appendf(&tmp, &tmp_sz, "%s : ", tmp_name)) { | ||
583 | + error = errno; | ||
584 | + ERR(policy, "%s", strerror(error)); | ||
585 | + goto err; | ||
586 | + } | ||
587 | + | ||
588 | + /* object class */ | ||
589 | + if (qpol_filename_trans_get_object_class(policy->p, filename_trans, &obj_class)) { | ||
590 | + error = errno; | ||
591 | + goto err; | ||
592 | + } | ||
593 | + if (qpol_class_get_name(policy->p, obj_class, &tmp_name)) { | ||
594 | + error = errno; | ||
595 | + goto err; | ||
596 | + } | ||
597 | + if (apol_str_appendf(&tmp, &tmp_sz, "%s ", tmp_name)) { | ||
598 | + error = errno; | ||
599 | + ERR(policy, "%s", strerror(error)); | ||
600 | + goto err; | ||
601 | + } | ||
602 | + | ||
603 | + /* default type */ | ||
604 | + if (qpol_filename_trans_get_default_type(policy->p, filename_trans, &type)) { | ||
605 | + error = errno; | ||
606 | + goto err; | ||
607 | + } | ||
608 | + if (qpol_type_get_name(policy->p, type, &tmp_name)) { | ||
609 | + error = errno; | ||
610 | + goto err; | ||
611 | + } | ||
612 | + if (apol_str_appendf(&tmp, &tmp_sz, "%s", tmp_name)) { | ||
613 | + error = errno; | ||
614 | + ERR(policy, "%s", strerror(error)); | ||
615 | + goto err; | ||
616 | + } | ||
617 | + | ||
618 | + if (qpol_filename_trans_get_filename(policy->p, filename_trans, &tmp_name)) { | ||
619 | + error = errno; | ||
620 | + goto err; | ||
621 | + } | ||
622 | + | ||
623 | + if (apol_str_appendf(&tmp, &tmp_sz, " %s", tmp_name)) { | ||
624 | + error = errno; | ||
625 | + ERR(policy, "%s", strerror(error)); | ||
626 | + goto err; | ||
627 | + } | ||
628 | + | ||
629 | + if (apol_str_appendf(&tmp, &tmp_sz, ";")) { | ||
630 | + error = errno; | ||
631 | + ERR(policy, "%s", strerror(error)); | ||
632 | + goto err; | ||
633 | + } | ||
634 | + return tmp; | ||
635 | + | ||
636 | + err: | ||
637 | + free(tmp); | ||
638 | + errno = error; | ||
639 | + return NULL; | ||
640 | +} | ||
641 | diff --git a/libapol/src/libapol.map b/libapol/src/libapol.map | ||
642 | index 4894374..7657a2d 100644 | ||
643 | --- a/libapol/src/libapol.map | ||
644 | +++ b/libapol/src/libapol.map | ||
645 | @@ -34,6 +34,7 @@ VERS_4.0{ | ||
646 | apol_protocol_to_str; | ||
647 | apol_qpol_context_render; | ||
648 | apol_range_trans_*; | ||
649 | + apol_filename_trans_*; | ||
650 | apol_relabel_*; | ||
651 | apol_role_*; | ||
652 | apol_role_allow_*; | ||
653 | diff --git a/libqpol/include/qpol/Makefile.am b/libqpol/include/qpol/Makefile.am | ||
654 | index b55acb7..9b570e1 100644 | ||
655 | --- a/libqpol/include/qpol/Makefile.am | ||
656 | +++ b/libqpol/include/qpol/Makefile.am | ||
657 | @@ -25,6 +25,7 @@ qpol_HEADERS = \ | ||
658 | role_query.h \ | ||
659 | syn_rule_query.h \ | ||
660 | terule_query.h \ | ||
661 | + ftrule_query.h \ | ||
662 | type_query.h \ | ||
663 | user_query.h \ | ||
664 | util.h | ||
665 | diff --git a/libqpol/include/qpol/ftrule_query.h b/libqpol/include/qpol/ftrule_query.h | ||
666 | new file mode 100644 | ||
667 | index 0000000..1f533a4 | ||
668 | --- /dev/null | ||
669 | +++ b/libqpol/include/qpol/ftrule_query.h | ||
670 | @@ -0,0 +1,116 @@ | ||
671 | +/** | ||
672 | + * @file | ||
673 | + * Defines public interface for iterating over FTRULE rules. | ||
674 | + * | ||
675 | + * @author Kevin Carr kcarr@tresys.com | ||
676 | + * @author Jeremy A. Mowery jmowery@tresys.com | ||
677 | + * @author Jason Tang jtang@tresys.com | ||
678 | + * | ||
679 | + * Copyright (C) 2006-2007 Tresys Technology, LLC | ||
680 | + * | ||
681 | + * This library is free software; you can redistribute it and/or | ||
682 | + * modify it under the terms of the GNU Lesser General Public | ||
683 | + * License as published by the Free Software Foundation; either | ||
684 | + * version 2.1 of the License, or (at your option) any later version. | ||
685 | + * | ||
686 | + * This library is distributed in the hope that it will be useful, | ||
687 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
688 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
689 | + * Lesser General Public License for more details. | ||
690 | + * | ||
691 | + * You should have received a copy of the GNU Lesser General Public | ||
692 | + * License along with this library; if not, write to the Free Software | ||
693 | + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
694 | + */ | ||
695 | + | ||
696 | +#ifndef QPOL_FTRULERULE_QUERY | ||
697 | +#define QPOL_FTRULERULE_QUERY | ||
698 | + | ||
699 | +#ifdef __cplusplus | ||
700 | +extern "C" | ||
701 | +{ | ||
702 | +#endif | ||
703 | + | ||
704 | +#include <qpol/policy.h> | ||
705 | +#include <qpol/iterator.h> | ||
706 | + | ||
707 | + typedef struct qpol_filename_trans qpol_filename_trans_t; | ||
708 | + | ||
709 | +/** | ||
710 | + * Get an iterator over all filename transition rules in the policy. | ||
711 | + * @param policy Policy from which to create the iterator. | ||
712 | + * @param iter Iterator over items of type qpol_filename_trans_t returned. | ||
713 | + * The caller is responsible for calling qpol_iterator_destroy() | ||
714 | + * to free memory used by this iterator. | ||
715 | + * It is important to note that this iterator is only valid as long as | ||
716 | + * the policy is unmodifed. | ||
717 | + * @returm 0 on success and < 0 on failure; if the call fails, | ||
718 | + * errno will be set and *iter will be NULL. | ||
719 | + */ | ||
720 | + extern int qpol_policy_get_filename_trans_iter(const qpol_policy_t * policy, qpol_iterator_t ** iter); | ||
721 | + | ||
722 | +/** | ||
723 | + * Get the source type from a filename transition rule. | ||
724 | + * @param policy The policy from which the rule comes. | ||
725 | + * @param rule The rule from which to get the source type. | ||
726 | + * @param source Pointer in which to store the source type. | ||
727 | + * The caller should not free this pointer. | ||
728 | + * @return 0 on success and < 0 on failure; if the call fails, | ||
729 | + * errno will be set and *source will be NULL. | ||
730 | + */ | ||
731 | + extern int qpol_filename_trans_get_source_type(const qpol_policy_t * policy, const qpol_filename_trans_t * rule, | ||
732 | + const qpol_type_t ** source); | ||
733 | + | ||
734 | +/** | ||
735 | + * Get the target type from a filename transition rule. | ||
736 | + * @param policy The policy from which the rule comes. | ||
737 | + * @param rule The rule from which to get the target type. | ||
738 | + * @param target Pointer in which to store the target type. | ||
739 | + * The caller should not free this pointer. | ||
740 | + * @return 0 on success and < 0 on failure; if the call fails, | ||
741 | + * errno will be set and *target will be NULL. | ||
742 | + */ | ||
743 | + extern int qpol_filename_trans_get_target_type(const qpol_policy_t * policy, const qpol_filename_trans_t * rule, | ||
744 | + const qpol_type_t ** target); | ||
745 | + | ||
746 | +/** | ||
747 | + * Get the default type from a type rule. | ||
748 | + * @param policy Policy from which the rule comes. | ||
749 | + * @param rule The rule from which to get the default type. | ||
750 | + * @param dflt Pointer in which to store the default type. | ||
751 | + * The caller should not free this pointer. | ||
752 | + * @returm 0 on success and < 0 on failure; if the call fails, | ||
753 | + * errno will be set and *dflt will be NULL. | ||
754 | + */ | ||
755 | + extern int qpol_filename_trans_get_default_type(const qpol_policy_t * policy, const qpol_filename_trans_t * rule, | ||
756 | + const qpol_type_t ** dflt); | ||
757 | + | ||
758 | +/** | ||
759 | + * Get the object class from a type rule. | ||
760 | + * @param policy Policy from which the rule comes. | ||
761 | + * @param rule The rule from which to get the object class. | ||
762 | + * @param obj_class Pointer in which to store the object class. | ||
763 | + * The caller should not free this pointer. | ||
764 | + * @returm 0 on success and < 0 on failure; if the call fails, | ||
765 | + * errno will be set and *obj_class will be NULL. | ||
766 | + */ | ||
767 | + extern int qpol_filename_trans_get_object_class(const qpol_policy_t * policy, const qpol_filename_trans_t * rule, | ||
768 | + const qpol_class_t ** obj_class); | ||
769 | + | ||
770 | +/** | ||
771 | + * Get the transition filename type from a type rule. | ||
772 | + * @param policy Policy from which the rule comes. | ||
773 | + * @param rule The rule from which to get the transition filename. | ||
774 | + * @param target Pointer in which to store the transition filename. | ||
775 | + * The caller should not free this pointer. | ||
776 | + * @returm 0 on success and < 0 on failure; if the call fails, | ||
777 | + * errno will be set and *target will be NULL. | ||
778 | + */ | ||
779 | + extern int qpol_filename_trans_get_filename(const qpol_policy_t * policy, const qpol_filename_trans_t * rule, | ||
780 | + const char ** name); | ||
781 | + | ||
782 | +#ifdef __cplusplus | ||
783 | +} | ||
784 | +#endif | ||
785 | + | ||
786 | +#endif /* QPOL_FTRULERULE_QUERY */ | ||
787 | diff --git a/libqpol/include/qpol/policy.h b/libqpol/include/qpol/policy.h | ||
788 | index ae4ea08..bf85718 100644 | ||
789 | --- a/libqpol/include/qpol/policy.h | ||
790 | +++ b/libqpol/include/qpol/policy.h | ||
791 | @@ -55,6 +55,7 @@ extern "C" | ||
792 | #include <qpol/polcap_query.h> | ||
793 | #include <qpol/portcon_query.h> | ||
794 | #include <qpol/rbacrule_query.h> | ||
795 | +#include <qpol/ftrule_query.h> | ||
796 | #include <qpol/role_query.h> | ||
797 | #include <qpol/syn_rule_query.h> | ||
798 | #include <qpol/terule_query.h> | ||
799 | diff --git a/libqpol/src/Makefile.am b/libqpol/src/Makefile.am | ||
800 | index 34d87a6..0889a61 100644 | ||
801 | --- a/libqpol/src/Makefile.am | ||
802 | +++ b/libqpol/src/Makefile.am | ||
803 | @@ -48,6 +48,7 @@ libqpol_a_SOURCES = \ | ||
804 | syn_rule_internal.h \ | ||
805 | syn_rule_query.c \ | ||
806 | terule_query.c \ | ||
807 | + ftrule_query.c \ | ||
808 | type_query.c \ | ||
809 | user_query.c \ | ||
810 | util.c \ | ||
811 | diff --git a/libqpol/src/ftrule_query.c b/libqpol/src/ftrule_query.c | ||
812 | new file mode 100644 | ||
813 | index 0000000..d6db848 | ||
814 | --- /dev/null | ||
815 | +++ b/libqpol/src/ftrule_query.c | ||
816 | @@ -0,0 +1,277 @@ | ||
817 | +/** | ||
818 | + * @file | ||
819 | + * Defines public interface for iterating over RBAC rules. | ||
820 | + * | ||
821 | + * @author Jeremy A. Mowery jmowery@tresys.com | ||
822 | + * @author Jason Tang jtang@tresys.com | ||
823 | + * | ||
824 | + * Copyright (C) 2006-2007 Tresys Technology, LLC | ||
825 | + * | ||
826 | + * This library is free software; you can redistribute it and/or | ||
827 | + * modify it under the terms of the GNU Lesser General Public | ||
828 | + * License as published by the Free Software Foundation; either | ||
829 | + * version 2.1 of the License, or (at your option) any later version. | ||
830 | + * | ||
831 | + * This library is distributed in the hope that it will be useful, | ||
832 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
833 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
834 | + * Lesser General Public License for more details. | ||
835 | + * | ||
836 | + * You should have received a copy of the GNU Lesser General Public | ||
837 | + * License along with this library; if not, write to the Free Software | ||
838 | + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
839 | + */ | ||
840 | + | ||
841 | +#include <qpol/iterator.h> | ||
842 | +#include <qpol/policy.h> | ||
843 | +#include <qpol/ftrule_query.h> | ||
844 | +#include <stdlib.h> | ||
845 | +#include "iterator_internal.h" | ||
846 | +#include "qpol_internal.h" | ||
847 | +#include <sepol/policydb/policydb.h> | ||
848 | + | ||
849 | +typedef struct filename_trans_state | ||
850 | +{ | ||
851 | + filename_trans_t *head; | ||
852 | + filename_trans_t *cur; | ||
853 | +} filename_trans_state_t; | ||
854 | + | ||
855 | +static int filename_trans_state_end(const qpol_iterator_t * iter) | ||
856 | +{ | ||
857 | + filename_trans_state_t *fts = NULL; | ||
858 | + | ||
859 | + if (!iter || !(fts = qpol_iterator_state(iter))) { | ||
860 | + errno = EINVAL; | ||
861 | + return STATUS_ERR; | ||
862 | + } | ||
863 | + | ||
864 | + return fts->cur ? 0 : 1; | ||
865 | +} | ||
866 | + | ||
867 | +static void *filename_trans_state_get_cur(const qpol_iterator_t * iter) | ||
868 | +{ | ||
869 | + filename_trans_state_t *fts = NULL; | ||
870 | + const policydb_t *db = NULL; | ||
871 | + | ||
872 | + if (!iter || !(fts = qpol_iterator_state(iter)) || !(db = qpol_iterator_policy(iter)) || filename_trans_state_end(iter)) { | ||
873 | + errno = EINVAL; | ||
874 | + return NULL; | ||
875 | + } | ||
876 | + | ||
877 | + return fts->cur; | ||
878 | +} | ||
879 | + | ||
880 | +static int filename_trans_state_next(qpol_iterator_t * iter) | ||
881 | +{ | ||
882 | + filename_trans_state_t *fts = NULL; | ||
883 | + const policydb_t *db = NULL; | ||
884 | + | ||
885 | + if (!iter || !(fts = qpol_iterator_state(iter)) || !(db = qpol_iterator_policy(iter))) { | ||
886 | + errno = EINVAL; | ||
887 | + return STATUS_ERR; | ||
888 | + } | ||
889 | + | ||
890 | + if (filename_trans_state_end(iter)) { | ||
891 | + errno = ERANGE; | ||
892 | + return STATUS_ERR; | ||
893 | + } | ||
894 | + | ||
895 | + fts->cur = fts->cur->next; | ||
896 | + | ||
897 | + return STATUS_SUCCESS; | ||
898 | +} | ||
899 | + | ||
900 | +static size_t filename_trans_state_size(const qpol_iterator_t * iter) | ||
901 | +{ | ||
902 | + filename_trans_state_t *fts = NULL; | ||
903 | + const policydb_t *db = NULL; | ||
904 | + filename_trans_t *tmp = NULL; | ||
905 | + size_t count = 0; | ||
906 | + | ||
907 | + if (!iter || !(fts = qpol_iterator_state(iter)) || !(db = qpol_iterator_policy(iter))) { | ||
908 | + errno = EINVAL; | ||
909 | + return STATUS_ERR; | ||
910 | + } | ||
911 | + | ||
912 | + for (tmp = fts->head; tmp; tmp = tmp->next) | ||
913 | + count++; | ||
914 | + | ||
915 | + return count; | ||
916 | +} | ||
917 | + | ||
918 | +int qpol_policy_get_filename_trans_iter(const qpol_policy_t * policy, qpol_iterator_t ** iter) | ||
919 | +{ | ||
920 | + policydb_t *db = NULL; | ||
921 | + filename_trans_state_t *fts = NULL; | ||
922 | + int error = 0; | ||
923 | + | ||
924 | + if (iter) | ||
925 | + *iter = NULL; | ||
926 | + | ||
927 | + if (!policy || !iter) { | ||
928 | + ERR(policy, "%s", strerror(EINVAL)); | ||
929 | + errno = EINVAL; | ||
930 | + return STATUS_ERR; | ||
931 | + } | ||
932 | + | ||
933 | + db = &policy->p->p; | ||
934 | + | ||
935 | + fts = calloc(1, sizeof(filename_trans_state_t)); | ||
936 | + if (!fts) { | ||
937 | + /* errno set by calloc */ | ||
938 | + ERR(policy, "%s", strerror(errno)); | ||
939 | + return STATUS_ERR; | ||
940 | + } | ||
941 | + fts->head = fts->cur = db->filename_trans; | ||
942 | + | ||
943 | + if (qpol_iterator_create | ||
944 | + (policy, (void *)fts, filename_trans_state_get_cur, filename_trans_state_next, filename_trans_state_end, filename_trans_state_size, | ||
945 | + free, iter)) { | ||
946 | + error = errno; | ||
947 | + free(fts); | ||
948 | + errno = error; | ||
949 | + return STATUS_ERR; | ||
950 | + } | ||
951 | + | ||
952 | + return STATUS_SUCCESS; | ||
953 | +} | ||
954 | + | ||
955 | +int qpol_filename_trans_get_source_type(const qpol_policy_t * policy, const qpol_filename_trans_t * rule, const qpol_type_t ** source) | ||
956 | +{ | ||
957 | + policydb_t *db = NULL; | ||
958 | + filename_trans_t *ft = NULL; | ||
959 | + | ||
960 | + if (source) { | ||
961 | + *source = NULL; | ||
962 | + } | ||
963 | + | ||
964 | + if (!policy || !rule || !source) { | ||
965 | + ERR(policy, "%s", strerror(EINVAL)); | ||
966 | + errno = EINVAL; | ||
967 | + return STATUS_ERR; | ||
968 | + } | ||
969 | + | ||
970 | + db = &policy->p->p; | ||
971 | + ft = (filename_trans_t *) rule; | ||
972 | + | ||
973 | + *source = (qpol_type_t *) db->type_val_to_struct[ft->stype - 1]; | ||
974 | + | ||
975 | + return STATUS_SUCCESS; | ||
976 | +} | ||
977 | + | ||
978 | +int qpol_filename_trans_get_target_type(const qpol_policy_t * policy, const qpol_filename_trans_t * rule, const qpol_type_t ** target) | ||
979 | +{ | ||
980 | + policydb_t *db = NULL; | ||
981 | + filename_trans_t *ft = NULL; | ||
982 | + | ||
983 | + if (target) { | ||
984 | + *target = NULL; | ||
985 | + } | ||
986 | + | ||
987 | + if (!policy || !rule || !target) { | ||
988 | + ERR(policy, "%s", strerror(EINVAL)); | ||
989 | + errno = EINVAL; | ||
990 | + return STATUS_ERR; | ||
991 | + } | ||
992 | + | ||
993 | + db = &policy->p->p; | ||
994 | + ft = (filename_trans_t *) rule; | ||
995 | + | ||
996 | + *target = (qpol_type_t *) db->type_val_to_struct[ft->ttype - 1]; | ||
997 | + | ||
998 | + return STATUS_SUCCESS; | ||
999 | +} | ||
1000 | + | ||
1001 | +int qpol_filename_trans_get_object_class(const qpol_policy_t * policy, const qpol_filename_trans_t * rule, | ||
1002 | + const qpol_class_t ** obj_class) | ||
1003 | +{ | ||
1004 | + policydb_t *db = NULL; | ||
1005 | + filename_trans_t *ft = NULL; | ||
1006 | + | ||
1007 | + if (obj_class) { | ||
1008 | + *obj_class = NULL; | ||
1009 | + } | ||
1010 | + | ||
1011 | + if (!policy || !rule || !obj_class) { | ||
1012 | + ERR(policy, "%s", strerror(EINVAL)); | ||
1013 | + errno = EINVAL; | ||
1014 | + return STATUS_ERR; | ||
1015 | + } | ||
1016 | + | ||
1017 | + db = &policy->p->p; | ||
1018 | + ft = (filename_trans_t *) rule; | ||
1019 | + | ||
1020 | + *obj_class = (qpol_class_t *) db->class_val_to_struct[ft->tclass - 1]; | ||
1021 | + | ||
1022 | + return STATUS_SUCCESS; | ||
1023 | +} | ||
1024 | + | ||
1025 | +int qpol_filename_trans_get_trans_type(const qpol_policy_t * policy, const qpol_filename_trans_t * rule, const qpol_type_t ** output_type) | ||
1026 | +{ | ||
1027 | + policydb_t *db = NULL; | ||
1028 | + filename_trans_t *ft = NULL; | ||
1029 | + | ||
1030 | + if (output_type) { | ||
1031 | + *output_type = NULL; | ||
1032 | + } | ||
1033 | + | ||
1034 | + if (!policy || !rule || !output_type) { | ||
1035 | + ERR(policy, "%s", strerror(EINVAL)); | ||
1036 | + errno = EINVAL; | ||
1037 | + return STATUS_ERR; | ||
1038 | + } | ||
1039 | + | ||
1040 | + db = &policy->p->p; | ||
1041 | + ft = (filename_trans_t *) rule; | ||
1042 | + | ||
1043 | + *output_type = (qpol_type_t *) db->type_val_to_struct[ft->otype - 1]; | ||
1044 | + | ||
1045 | + return STATUS_SUCCESS; | ||
1046 | +} | ||
1047 | + | ||
1048 | +int qpol_filename_trans_get_default_type(const qpol_policy_t * policy, const qpol_filename_trans_t * rule, const qpol_type_t ** dflt) | ||
1049 | +{ | ||
1050 | + policydb_t *db = NULL; | ||
1051 | + filename_trans_t *ft = NULL; | ||
1052 | + | ||
1053 | + if (dflt) { | ||
1054 | + *dflt = NULL; | ||
1055 | + } | ||
1056 | + | ||
1057 | + if (!policy || !rule || !dflt) { | ||
1058 | + ERR(policy, "%s", strerror(EINVAL)); | ||
1059 | + errno = EINVAL; | ||
1060 | + return STATUS_ERR; | ||
1061 | + } | ||
1062 | + | ||
1063 | + db = &policy->p->p; | ||
1064 | + ft = (filename_trans_t *) rule; | ||
1065 | + | ||
1066 | + *dflt = (qpol_type_t *) db->type_val_to_struct[ft->otype - 1]; | ||
1067 | + | ||
1068 | + return STATUS_SUCCESS; | ||
1069 | +} | ||
1070 | + | ||
1071 | +int qpol_filename_trans_get_filename(const qpol_policy_t * policy, const qpol_filename_trans_t * rule, const char ** name) | ||
1072 | +{ | ||
1073 | + policydb_t *db = NULL; | ||
1074 | + filename_trans_t *ft = NULL; | ||
1075 | + | ||
1076 | + if (name) { | ||
1077 | + *name = NULL; | ||
1078 | + } | ||
1079 | + | ||
1080 | + if (!policy || !rule || !name) { | ||
1081 | + ERR(policy, "%s", strerror(EINVAL)); | ||
1082 | + errno = EINVAL; | ||
1083 | + return STATUS_ERR; | ||
1084 | + } | ||
1085 | + | ||
1086 | + db = &policy->p->p; | ||
1087 | + ft = (filename_trans_t *) rule; | ||
1088 | + | ||
1089 | + *name = ft->name; | ||
1090 | + | ||
1091 | + return STATUS_SUCCESS; | ||
1092 | +} | ||
1093 | + | ||
1094 | diff --git a/libqpol/src/libqpol.map b/libqpol/src/libqpol.map | ||
1095 | index dd293bc..6973cca 100644 | ||
1096 | --- a/libqpol/src/libqpol.map | ||
1097 | +++ b/libqpol/src/libqpol.map | ||
1098 | @@ -34,6 +34,7 @@ VERS_1.2 { | ||
1099 | qpol_policy_reevaluate_conds; | ||
1100 | qpol_portcon_*; | ||
1101 | qpol_range_trans_*; | ||
1102 | + qpol_filename_trans_*; | ||
1103 | qpol_role_*; | ||
1104 | qpol_syn_avrule_*; | ||
1105 | qpol_syn_terule_*; | ||
1106 | diff --git a/libqpol/src/module_compiler.c b/libqpol/src/module_compiler.c | ||
1107 | index dc19798..b06e285 100644 | ||
1108 | --- a/libqpol/src/module_compiler.c | ||
1109 | +++ b/libqpol/src/module_compiler.c | ||
1110 | @@ -1247,6 +1247,18 @@ void append_role_allow(role_allow_rule_t * role_allow_rules) | ||
1111 | } | ||
1112 | |||
1113 | /* this doesn't actually append, but really prepends it */ | ||
1114 | +void append_filename_trans(filename_trans_rule_t * filename_trans_rules) | ||
1115 | +{ | ||
1116 | + avrule_decl_t *decl = stack_top->decl; | ||
1117 | + | ||
1118 | + /* filename transitions are not allowed within conditionals */ | ||
1119 | + assert(stack_top->type == 1); | ||
1120 | + | ||
1121 | + filename_trans_rules->next = decl->filename_trans_rules; | ||
1122 | + decl->filename_trans_rules = filename_trans_rules; | ||
1123 | +} | ||
1124 | + | ||
1125 | +/* this doesn't actually append, but really prepends it */ | ||
1126 | void append_range_trans(range_trans_rule_t * range_tr_rules) | ||
1127 | { | ||
1128 | avrule_decl_t *decl = stack_top->decl; | ||
1129 | diff --git a/libqpol/src/policy_define.c b/libqpol/src/policy_define.c | ||
1130 | index c94f7aa..0f3a45a 100644 | ||
1131 | --- a/libqpol/src/policy_define.c | ||
1132 | +++ b/libqpol/src/policy_define.c | ||
1133 | @@ -2133,7 +2133,7 @@ int define_role_trans(void) | ||
1134 | |||
1135 | /* This ebitmap business is just to ensure that there are not conflicting role_trans rules */ | ||
1136 | #ifdef HAVE_SEPOL_USER_ROLE_MAPPING | ||
1137 | - if (role_set_expand(&roles, &e_roles, policydbp, NULL)) | ||
1138 | + if (role_set_expand(&roles, &e_roles, policydbp, NULL, NULL)) | ||
1139 | #else | ||
1140 | if (role_set_expand(&roles, &e_roles, policydbp)) | ||
1141 | #endif | ||
1142 | @@ -2226,6 +2226,190 @@ int define_role_allow(void) | ||
1143 | return 0; | ||
1144 | } | ||
1145 | |||
1146 | +avrule_t *define_cond_filename_trans(void) | ||
1147 | +{ | ||
1148 | + yyerror("type transitions with a filename not allowed inside " | ||
1149 | + "conditionals\n"); | ||
1150 | + return COND_ERR; | ||
1151 | +} | ||
1152 | + | ||
1153 | +int define_filename_trans(void) | ||
1154 | +{ | ||
1155 | + char *id, *name = NULL; | ||
1156 | + type_set_t stypes, ttypes; | ||
1157 | + ebitmap_t e_stypes, e_ttypes; | ||
1158 | + ebitmap_t e_tclasses; | ||
1159 | + ebitmap_node_t *snode, *tnode, *cnode; | ||
1160 | + filename_trans_t *ft; | ||
1161 | + filename_trans_rule_t *ftr; | ||
1162 | + class_datum_t *cladatum; | ||
1163 | + type_datum_t *typdatum; | ||
1164 | + uint32_t otype; | ||
1165 | + unsigned int c, s, t; | ||
1166 | + int add; | ||
1167 | + | ||
1168 | + if (pass == 1) { | ||
1169 | + /* stype */ | ||
1170 | + while ((id = queue_remove(id_queue))) | ||
1171 | + free(id); | ||
1172 | + /* ttype */ | ||
1173 | + while ((id = queue_remove(id_queue))) | ||
1174 | + free(id); | ||
1175 | + /* tclass */ | ||
1176 | + while ((id = queue_remove(id_queue))) | ||
1177 | + free(id); | ||
1178 | + /* otype */ | ||
1179 | + id = queue_remove(id_queue); | ||
1180 | + free(id); | ||
1181 | + /* name */ | ||
1182 | + id = queue_remove(id_queue); | ||
1183 | + free(id); | ||
1184 | + return 0; | ||
1185 | + } | ||
1186 | + | ||
1187 | + | ||
1188 | + add = 1; | ||
1189 | + type_set_init(&stypes); | ||
1190 | + while ((id = queue_remove(id_queue))) { | ||
1191 | + if (set_types(&stypes, id, &add, 0)) | ||
1192 | + goto bad; | ||
1193 | + } | ||
1194 | + | ||
1195 | + add =1; | ||
1196 | + type_set_init(&ttypes); | ||
1197 | + while ((id = queue_remove(id_queue))) { | ||
1198 | + if (set_types(&ttypes, id, &add, 0)) | ||
1199 | + goto bad; | ||
1200 | + } | ||
1201 | + | ||
1202 | + ebitmap_init(&e_tclasses); | ||
1203 | + while ((id = queue_remove(id_queue))) { | ||
1204 | + if (!is_id_in_scope(SYM_CLASSES, id)) { | ||
1205 | + yyerror2("class %s is not within scope", id); | ||
1206 | + free(id); | ||
1207 | + goto bad; | ||
1208 | + } | ||
1209 | + cladatum = hashtab_search(policydbp->p_classes.table, id); | ||
1210 | + if (!cladatum) { | ||
1211 | + yyerror2("unknown class %s", id); | ||
1212 | + goto bad; | ||
1213 | + } | ||
1214 | + if (ebitmap_set_bit(&e_tclasses, cladatum->s.value - 1, TRUE)) { | ||
1215 | + yyerror("Out of memory"); | ||
1216 | + goto bad; | ||
1217 | + } | ||
1218 | + free(id); | ||
1219 | + } | ||
1220 | + | ||
1221 | + id = (char *)queue_remove(id_queue); | ||
1222 | + if (!id) { | ||
1223 | + yyerror("no otype in transition definition?"); | ||
1224 | + goto bad; | ||
1225 | + } | ||
1226 | + if (!is_id_in_scope(SYM_TYPES, id)) { | ||
1227 | + yyerror2("type %s is not within scope", id); | ||
1228 | + free(id); | ||
1229 | + goto bad; | ||
1230 | + } | ||
1231 | + typdatum = hashtab_search(policydbp->p_types.table, id); | ||
1232 | + if (!typdatum) { | ||
1233 | + yyerror2("unknown type %s used in transition definition", id); | ||
1234 | + goto bad; | ||
1235 | + } | ||
1236 | + free(id); | ||
1237 | + otype = typdatum->s.value; | ||
1238 | + | ||
1239 | + name = queue_remove(id_queue); | ||
1240 | + if (!name) { | ||
1241 | + yyerror("no pathname specified in filename_trans definition?"); | ||
1242 | + goto bad; | ||
1243 | + } | ||
1244 | + | ||
1245 | + /* We expand the class set into seperate rules. We expand the types | ||
1246 | + * just to make sure there are not duplicates. They will get turned | ||
1247 | + * into seperate rules later */ | ||
1248 | + ebitmap_init(&e_stypes); | ||
1249 | + if (type_set_expand(&stypes, &e_stypes, policydbp, 1)) | ||
1250 | + goto bad; | ||
1251 | + | ||
1252 | + ebitmap_init(&e_ttypes); | ||
1253 | + if (type_set_expand(&ttypes, &e_ttypes, policydbp, 1)) | ||
1254 | + goto bad; | ||
1255 | + | ||
1256 | + ebitmap_for_each_bit(&e_tclasses, cnode, c) { | ||
1257 | + if (!ebitmap_node_get_bit(cnode, c)) | ||
1258 | + continue; | ||
1259 | + ebitmap_for_each_bit(&e_stypes, snode, s) { | ||
1260 | + if (!ebitmap_node_get_bit(snode, s)) | ||
1261 | + continue; | ||
1262 | + ebitmap_for_each_bit(&e_ttypes, tnode, t) { | ||
1263 | + if (!ebitmap_node_get_bit(tnode, t)) | ||
1264 | + continue; | ||
1265 | + | ||
1266 | + for (ft = policydbp->filename_trans; ft; ft = ft->next) { | ||
1267 | + if (ft->stype == (s + 1) && | ||
1268 | + ft->ttype == (t + 1) && | ||
1269 | + ft->tclass == (c + 1) && | ||
1270 | + !strcmp(ft->name, name)) { | ||
1271 | + yyerror2("duplicate filename transition for: filename_trans %s %s %s:%s", | ||
1272 | + name, | ||
1273 | + policydbp->p_type_val_to_name[s], | ||
1274 | + policydbp->p_type_val_to_name[t], | ||
1275 | + policydbp->p_class_val_to_name[c]); | ||
1276 | + goto bad; | ||
1277 | + } | ||
1278 | + } | ||
1279 | + | ||
1280 | + ft = malloc(sizeof(*ft)); | ||
1281 | + if (!ft) { | ||
1282 | + yyerror("out of memory"); | ||
1283 | + goto bad; | ||
1284 | + } | ||
1285 | + memset(ft, 0, sizeof(*ft)); | ||
1286 | + | ||
1287 | + ft->next = policydbp->filename_trans; | ||
1288 | + policydbp->filename_trans = ft; | ||
1289 | + | ||
1290 | + ft->name = strdup(name); | ||
1291 | + if (!ft->name) { | ||
1292 | + yyerror("out of memory"); | ||
1293 | + goto bad; | ||
1294 | + } | ||
1295 | + ft->stype = s + 1; | ||
1296 | + ft->ttype = t + 1; | ||
1297 | + ft->tclass = c + 1; | ||
1298 | + ft->otype = otype; | ||
1299 | + } | ||
1300 | + } | ||
1301 | + | ||
1302 | + /* Now add the real rule since we didn't find any duplicates */ | ||
1303 | + ftr = malloc(sizeof(*ftr)); | ||
1304 | + if (!ftr) { | ||
1305 | + yyerror("out of memory"); | ||
1306 | + goto bad; | ||
1307 | + } | ||
1308 | + filename_trans_rule_init(ftr); | ||
1309 | + append_filename_trans(ftr); | ||
1310 | + | ||
1311 | + ftr->name = strdup(name); | ||
1312 | + ftr->stypes = stypes; | ||
1313 | + ftr->ttypes = ttypes; | ||
1314 | + ftr->tclass = c + 1; | ||
1315 | + ftr->otype = otype; | ||
1316 | + } | ||
1317 | + | ||
1318 | + free(name); | ||
1319 | + ebitmap_destroy(&e_stypes); | ||
1320 | + ebitmap_destroy(&e_ttypes); | ||
1321 | + ebitmap_destroy(&e_tclasses); | ||
1322 | + | ||
1323 | + return 0; | ||
1324 | + | ||
1325 | +bad: | ||
1326 | + free(name); | ||
1327 | + return -1; | ||
1328 | +} | ||
1329 | + | ||
1330 | static constraint_expr_t *constraint_expr_clone(constraint_expr_t * expr) | ||
1331 | { | ||
1332 | constraint_expr_t *h = NULL, *l = NULL, *e, *newe; | ||
1333 | diff --git a/libqpol/src/policy_parse.y b/libqpol/src/policy_parse.y | ||
1334 | index 84f4114..dc16c6f 100644 | ||
1335 | --- a/libqpol/src/policy_parse.y | ||
1336 | +++ b/libqpol/src/policy_parse.y | ||
1337 | @@ -98,6 +98,7 @@ extern char *qpol_src_inputlim;/* end of data */ | ||
1338 | %type <require_func> require_decl_def | ||
1339 | |||
1340 | %token PATH | ||
1341 | +%token FILENAME | ||
1342 | %token CLONE | ||
1343 | %token COMMON | ||
1344 | %token CLASS | ||
1345 | @@ -360,7 +361,10 @@ cond_rule_def : cond_transition_def | ||
1346 | | require_block | ||
1347 | { $$ = NULL; } | ||
1348 | ; | ||
1349 | -cond_transition_def : TYPE_TRANSITION names names ':' names identifier ';' | ||
1350 | +cond_transition_def : TYPE_TRANSITION names names ':' names identifier filename ';' | ||
1351 | + { $$ = define_cond_filename_trans() ; | ||
1352 | + if ($$ == COND_ERR) return -1;} | ||
1353 | + | TYPE_TRANSITION names names ':' names identifier ';' | ||
1354 | { $$ = define_cond_compute_type(AVRULE_TRANSITION) ; | ||
1355 | if ($$ == COND_ERR) return -1;} | ||
1356 | | TYPE_MEMBER names names ':' names identifier ';' | ||
1357 | @@ -395,7 +399,9 @@ cond_dontaudit_def : DONTAUDIT names names ':' names names ';' | ||
1358 | { $$ = define_cond_te_avtab(AVRULE_DONTAUDIT); | ||
1359 | if ($$ == COND_ERR) return -1; } | ||
1360 | ; | ||
1361 | -transition_def : TYPE_TRANSITION names names ':' names identifier ';' | ||
1362 | +transition_def : TYPE_TRANSITION names names ':' names identifier filename ';' | ||
1363 | + {if (define_filename_trans()) return -1; } | ||
1364 | + | TYPE_TRANSITION names names ':' names identifier ';' | ||
1365 | {if (define_compute_type(AVRULE_TRANSITION)) return -1;} | ||
1366 | | TYPE_MEMBER names names ':' names identifier ';' | ||
1367 | {if (define_compute_type(AVRULE_MEMBER)) return -1;} | ||
1368 | @@ -752,6 +758,9 @@ identifier : IDENTIFIER | ||
1369 | path : PATH | ||
1370 | { if (insert_id(yytext,0)) return -1; } | ||
1371 | ; | ||
1372 | +filename : FILENAME | ||
1373 | + { yytext[strlen(yytext) - 1] = '\0'; if (insert_id(yytext + 1,0)) return -1; } | ||
1374 | + ; | ||
1375 | number : NUMBER | ||
1376 | { $$ = strtoul(yytext,NULL,0); } | ||
1377 | ; | ||
1378 | diff --git a/libqpol/src/policy_scan.l b/libqpol/src/policy_scan.l | ||
1379 | index 75485f3..30203cd 100644 | ||
1380 | --- a/libqpol/src/policy_scan.l | ||
1381 | +++ b/libqpol/src/policy_scan.l | ||
1382 | @@ -235,6 +235,7 @@ POLICYCAP { return(POLICYCAP); } | ||
1383 | permissive | | ||
1384 | PERMISSIVE { return(PERMISSIVE); } | ||
1385 | "/"({alnum}|[_\.\-/])* { return(PATH); } | ||
1386 | +\"({alnum}|[_\.\-])+\" { return(FILENAME); } | ||
1387 | {letter}({alnum}|[_\-])*([\.]?({alnum}|[_\-]))* { return(IDENTIFIER); } | ||
1388 | {digit}+|0x{hexval}+ { return(NUMBER); } | ||
1389 | {digit}{1,3}(\.{digit}{1,3}){3} { return(IPV4_ADDR); } | ||
1390 | diff --git a/secmds/sesearch.c b/secmds/sesearch.c | ||
1391 | index ec0315f..e44b3bc 100644 | ||
1392 | --- a/secmds/sesearch.c | ||
1393 | +++ b/secmds/sesearch.c | ||
1394 | @@ -575,6 +575,95 @@ static void print_te_results(const apol_policy_t * policy, const options_t * opt | ||
1395 | free(expr); | ||
1396 | } | ||
1397 | |||
1398 | +static int perform_ft_query(const apol_policy_t * policy, const options_t * opt, apol_vector_t ** v) | ||
1399 | +{ | ||
1400 | + apol_filename_trans_query_t *ftq = NULL; | ||
1401 | + int error = 0; | ||
1402 | + | ||
1403 | + if (!policy || !opt || !v) { | ||
1404 | + ERR(policy, "%s", strerror(EINVAL)); | ||
1405 | + errno = EINVAL; | ||
1406 | + return -1; | ||
1407 | + } | ||
1408 | + | ||
1409 | + if (!opt->type == QPOL_RULE_TYPE_TRANS && !opt->all) { | ||
1410 | + *v = NULL; | ||
1411 | + return 0; /* no search to do */ | ||
1412 | + } | ||
1413 | + | ||
1414 | + ftq = apol_filename_trans_query_create(); | ||
1415 | + if (!ftq) { | ||
1416 | + ERR(policy, "%s", strerror(ENOMEM)); | ||
1417 | + errno = ENOMEM; | ||
1418 | + return -1; | ||
1419 | + } | ||
1420 | + | ||
1421 | + apol_filename_trans_query_set_regex(policy, ftq, opt->useregex); | ||
1422 | + if (opt->src_name) { | ||
1423 | + if (apol_filename_trans_query_set_source(policy, ftq, opt->src_name)) { | ||
1424 | + error = errno; | ||
1425 | + goto err; | ||
1426 | + } | ||
1427 | + } | ||
1428 | + if (opt->tgt_name) { | ||
1429 | + if (apol_filename_trans_query_set_target(policy, ftq, opt->tgt_name, opt->indirect)) { | ||
1430 | + error = errno; | ||
1431 | + goto err; | ||
1432 | + } | ||
1433 | + } | ||
1434 | + | ||
1435 | + if (apol_filename_trans_get_by_query(policy, ftq, v)) { | ||
1436 | + error = errno; | ||
1437 | + goto err; | ||
1438 | + } | ||
1439 | + | ||
1440 | + apol_filename_trans_query_destroy(&ftq); | ||
1441 | + return 0; | ||
1442 | + | ||
1443 | + err: | ||
1444 | + apol_vector_destroy(v); | ||
1445 | + apol_filename_trans_query_destroy(&ftq); | ||
1446 | + ERR(policy, "%s", strerror(error)); | ||
1447 | + errno = error; | ||
1448 | + return -1; | ||
1449 | +} | ||
1450 | + | ||
1451 | +static void print_ft_results(const apol_policy_t * policy, const options_t * opt, const apol_vector_t * v) | ||
1452 | +{ | ||
1453 | + qpol_policy_t *q = apol_policy_get_qpol(policy); | ||
1454 | + size_t i, num_rules = 0; | ||
1455 | + const qpol_filename_trans_t *rule = NULL; | ||
1456 | + char *tmp = NULL, *rule_str = NULL, *expr = NULL; | ||
1457 | + char enable_char = ' ', branch_char = ' '; | ||
1458 | + qpol_iterator_t *iter = NULL; | ||
1459 | + const qpol_cond_t *cond = NULL; | ||
1460 | + uint32_t enabled = 0, list = 0; | ||
1461 | + | ||
1462 | + if (!(num_rules = apol_vector_get_size(v))) | ||
1463 | + goto cleanup; | ||
1464 | + | ||
1465 | + fprintf(stdout, "Found %zd named file transition rules:\n", num_rules); | ||
1466 | + | ||
1467 | + for (i = 0; i < num_rules; i++) { | ||
1468 | + enable_char = branch_char = ' '; | ||
1469 | + if (!(rule = apol_vector_get_element(v, i))) | ||
1470 | + goto cleanup; | ||
1471 | + | ||
1472 | + if (!(rule_str = apol_filename_trans_render(policy, rule))) | ||
1473 | + goto cleanup; | ||
1474 | + fprintf(stdout, "%s %s\n", rule_str, expr ? expr : ""); | ||
1475 | + free(rule_str); | ||
1476 | + rule_str = NULL; | ||
1477 | + free(expr); | ||
1478 | + expr = NULL; | ||
1479 | + } | ||
1480 | + | ||
1481 | + cleanup: | ||
1482 | + free(tmp); | ||
1483 | + free(rule_str); | ||
1484 | + free(expr); | ||
1485 | +} | ||
1486 | + | ||
1487 | static int perform_ra_query(const apol_policy_t * policy, const options_t * opt, apol_vector_t ** v) | ||
1488 | { | ||
1489 | apol_role_allow_query_t *raq = NULL; | ||
1490 | @@ -1128,6 +1217,18 @@ int main(int argc, char **argv) | ||
1491 | print_te_results(policy, &cmd_opts, v); | ||
1492 | fprintf(stdout, "\n"); | ||
1493 | } | ||
1494 | + | ||
1495 | + if (cmd_opts.all || cmd_opts.type == QPOL_RULE_TYPE_TRANS) { | ||
1496 | + apol_vector_destroy(&v); | ||
1497 | + if (perform_ft_query(policy, &cmd_opts, &v)) { | ||
1498 | + rt = 1; | ||
1499 | + goto cleanup; | ||
1500 | + } | ||
1501 | + | ||
1502 | + print_ft_results(policy, &cmd_opts, v); | ||
1503 | + fprintf(stdout, "\n"); | ||
1504 | + } | ||
1505 | + | ||
1506 | apol_vector_destroy(&v); | ||
1507 | if (perform_ra_query(policy, &cmd_opts, &v)) { | ||
1508 | rt = 1; | ||
1509 | -- | ||
1510 | 1.7.5.4 | ||
1511 | |||
diff --git a/recipes-security/setools/setools/setools-replcon-correct-invalid-prototype-for-lsetfilecon_ra.patch b/recipes-security/setools/setools/setools-replcon-correct-invalid-prototype-for-lsetfilecon_ra.patch new file mode 100644 index 0000000..c9bacbd --- /dev/null +++ b/recipes-security/setools/setools/setools-replcon-correct-invalid-prototype-for-lsetfilecon_ra.patch | |||
@@ -0,0 +1,34 @@ | |||
1 | From 74680dfb3df4c0c5b0e4bcf41717a9ea16fd8680 Mon Sep 17 00:00:00 2001 | ||
2 | From: Joe MacDonald <joe_macdonald@mentor.com> | ||
3 | Date: Mon, 29 Sep 2014 14:19:48 -0400 | ||
4 | Subject: [PATCH] replcon: correct invalid prototype for lsetfilecon_raw | ||
5 | |||
6 | Port debian patch from: | ||
7 | |||
8 | git://anonscm.debian.org/selinux/setools.git | ||
9 | commit a3ab84b35efd9c42641d53ec2236ad01f7411df7 | ||
10 | |||
11 | Upstream-Status: Denied [ the setools3 tree is in stasis and the focus is | ||
12 | only on setools4 now ] | ||
13 | |||
14 | Signed-off-by: Joe MacDonald <joe_macdonald@mentor.com> | ||
15 | --- | ||
16 | secmds/replcon.cc | 2 +- | ||
17 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
18 | |||
19 | diff --git a/secmds/replcon.cc b/secmds/replcon.cc | ||
20 | index 34f7c1a..307c39f 100644 | ||
21 | --- a/secmds/replcon.cc | ||
22 | +++ b/secmds/replcon.cc | ||
23 | @@ -60,7 +60,7 @@ static struct option const longopts[] = { | ||
24 | {NULL, 0, NULL, 0} | ||
25 | }; | ||
26 | |||
27 | -extern int lsetfilecon_raw(const char *, security_context_t) __attribute__ ((weak)); | ||
28 | +extern int lsetfilecon_raw(const char *, const char *) __attribute__ ((weak)); | ||
29 | |||
30 | /** | ||
31 | * As that setools must work with older libselinux versions that may | ||
32 | -- | ||
33 | 1.9.1 | ||
34 | |||
diff --git a/recipes-security/setools/setools_3.3.8.bb b/recipes-security/setools/setools_3.3.8.bb index 6f3b1dd..050f4ff 100644 --- a/recipes-security/setools/setools_3.3.8.bb +++ b/recipes-security/setools/setools_3.3.8.bb | |||
@@ -14,7 +14,6 @@ SRC_URI[sha256sum] = "44387ecc9a231ec536a937783440cd8960a72c51f14bffc1604b7525e3 | |||
14 | 14 | ||
15 | SRC_URI += "file://setools-neverallow-rules-all-always-fail.patch" | 15 | SRC_URI += "file://setools-neverallow-rules-all-always-fail.patch" |
16 | SRC_URI += "file://setools-Fix-sepol-calls-to-work-with-latest-libsepol.patch" | 16 | SRC_URI += "file://setools-Fix-sepol-calls-to-work-with-latest-libsepol.patch" |
17 | #SRC_URI += "file://setools-Changes-to-support-named-file_trans-rules.patch" | ||
18 | 17 | ||
19 | SRC_URI += "file://setools-Don-t-check-selinux-policies-if-disabled.patch" | 18 | SRC_URI += "file://setools-Don-t-check-selinux-policies-if-disabled.patch" |
20 | SRC_URI += "file://setools-configure-ac.patch" | 19 | SRC_URI += "file://setools-configure-ac.patch" |
@@ -23,6 +22,8 @@ SRC_URI += "file://setools-cross-ar.patch" | |||
23 | SRC_URI += "file://setools-Fix-test-bug-for-unary-operator.patch" | 22 | SRC_URI += "file://setools-Fix-test-bug-for-unary-operator.patch" |
24 | SRC_URI += "file://setools-Fix-python-setools-Makefile.am-for-cross.patch" | 23 | SRC_URI += "file://setools-Fix-python-setools-Makefile.am-for-cross.patch" |
25 | 24 | ||
25 | SRC_URI += "file://setools-replcon-correct-invalid-prototype-for-lsetfilecon_ra.patch" | ||
26 | |||
26 | LIC_FILES_CHKSUM = "file://${S}/COPYING;md5=26035c503c68ae1098177934ac0cc795 \ | 27 | LIC_FILES_CHKSUM = "file://${S}/COPYING;md5=26035c503c68ae1098177934ac0cc795 \ |
27 | file://${S}/COPYING.GPL;md5=751419260aa954499f7abaabaa882bbe \ | 28 | file://${S}/COPYING.GPL;md5=751419260aa954499f7abaabaa882bbe \ |
28 | file://${S}/COPYING.LGPL;md5=fbc093901857fcd118f065f900982c24" | 29 | file://${S}/COPYING.LGPL;md5=fbc093901857fcd118f065f900982c24" |