Gentoo Archives: gentoo-hardened

From: Bill Sharer <bsharer@××××××××××.com>
To: gentoo-hardened@l.g.o
Subject: Re: [gentoo-hardened] SELinux module compile error: unknown type
Date: Fri, 28 Sep 2007 22:12:49
Message-Id: 46FD7983.60602@sharerland.com
In Reply to: [gentoo-hardened] SELinux module compile error: unknown type by "Dominik J. Fischer"
1 Actually what you have there is a mislabeled file. Here's the relevant
2 poop:
3
4 # cd /etc/selinux/strict/contexts/files
5
6 # grep ld.so.cache file_contexts
7 /etc/ld\.so\.cache -- system_u:object_r:ld_so_cache_t
8 /etc/ld\.so\.preload -- system_u:object_r:ld_so_cache_t
9
10 # ls -Z /etc/ld.so.cache
11 -rw-r--r-- root root root:object_r:ld_so_cache_t /etc/ld.so.cache
12
13 See if this does the trick:
14
15 # restorecon -v /etc/ld.so.cache
16
17 If that doesn't change it, your system is not firing the rule properly
18 or else it is missing from the file_contexts file for some reason. I've
19 had some rules fail to fire on an x86_64 box because there were issues
20 matching the /lib symlink to the /lib64 target and so forth.Also, have
21 you done an rlpkg to relabel your filesystem lately?
22
23 Dominik J. Fischer wrote:
24 > Dear list,
25 >
26 > I am running a freshly intalled SELinux system with
27 > sec-policy/selinux-base-policy 20070329 in strict/permissive mode.
28 >
29 > When I try to write a TE module for my avc denials the compiler doesn't
30 > resolve the necesary types. For example, considerung the following avc
31 > entry for type consoletype:
32 >
33 > vmdefault # dmesg | grep avc
34 > audit(1190988750.096:3): avc: denied { read } for pid=26115
35 > comm="consoletype" name="ld.so.cache" dev=sda1 ino=336323476
36 > scontext=system_u:system_r:consoletype_t tcontext=root:object_r:etc_t
37 > tclass=file
38 > audit(1190988750.096:4): avc: denied { getattr } for pid=26115
39 > comm="consoletype" name="ld.so.cache" dev=sda1 ino=336323476
40 > scontext=system_u:system_r:consoletype_t tcontext=root:object_r:etc_t
41 > tclass=file
42 >
43 > My policy module looks like this:
44 >
45 > policy_module(local,1.0.0)
46 > type local_t;
47 > files_read_etc_files(consoletype_t)
48 >
49 > When I try to compile, the compiler gives me an unknown type error:
50 >
51 > vmdefault include # make -f /usr/share/selinux/strict/include/Makefile
52 > Compiling strict local module
53 > /usr/bin/checkmodule: loading policy configuration from tmp/local.tmp
54 > local.te:11:ERROR 'unknown type consoletype_t' at token ';' on line
55 > 78133:
56 > allow consoletype_t etc_t:dir { getattr search read lock
57 > ioctl };
58 > #line 11
59 > /usr/bin/checkmodule: error(s) encountered while parsing configuration
60 > make: *** [tmp/local.mod] Error 1
61 >
62 > Seems to me that the compiler does not resolve the types against the
63 > base policy.
64 >
65 > Any ideas? Comments are highly appreciated.
66 >
67 > Dominik
68 >
69 >
70
71 --
72 gentoo-hardened@g.o mailing list

Replies

Subject Author
Re: [gentoo-hardened] SELinux module compile error: unknown type "Dominik J. Fischer" <sysadmin@×××××××××.de>