Gentoo Archives: gentoo-hardened

From: "Dominik J. Fischer" <sysadmin@×××××××××.de>
To: gentoo-hardened@l.g.o
Subject: Re: [gentoo-hardened] SELinux module compile error: unknown type
Date: Sun, 30 Sep 2007 14:44:16
Message-Id: 1191162795.11290.19.camel@ws.dom
In Reply to: Re: [gentoo-hardened] SELinux module compile error: unknown type by Bill Sharer
1 Thanks Bill, that worked - at least for consoletype_t and some other
2 types - I am using an amd64 system and have the same problem with
3 symlinks (the labellers seem to have problems with them... replace /lib
4 with /lib(64)? in file_contexts).
5
6 Unfortunately, I am still facing some error messages in which case the
7 file type is correct:
8
9 vmdefault # dmesg | grep avc
10
11 audit(1191161059.993:4): avc: denied { read } for pid=16909
12 comm="mount" name="urandom" dev=tmpfs ino=2443
13 scontext=system_u:system_r:mount_t
14 tcontext=system_u:object_r:urandom_device_t tclass=chr_file
15
16 When trying to write a policy_module
17
18 vmdefault # files_manage_urandom_seed(mount_t)
19
20 the compile error stops me again:
21
22 Compiling strict local module
23 /usr/bin/checkmodule: loading policy configuration from tmp/local.tmp
24 local.te:11:ERROR 'unknown type mount_t' at token ';' on line 78190:
25 allow mount_t var_t:dir { getattr search };
26 #line 11
27 /usr/bin/checkmodule: error(s) encountered while parsing configuration
28 make: *** [tmp/local.mod] Error 1
29
30 Also I don't manage to install the base policy from the Tresys guys (I
31 think they have more types compiled in??)
32
33 vmdefault # make
34 vmdefault # semodule -v -b policy.21
35
36 Attempting to install base module 'policy.21':
37 libsepol.module_package_read_offsets: wrong magic number for module
38 package: expected 4185718671, got 4185718668
39 libsemanage.parse_base_headers: Could not parse base module data.
40 semodule: Failed on policy.21!
41
42 How to change the magic number?
43 Do you have some input for me?
44
45 Dominik
46
47 On Fri, 2007-09-28 at 18:00 -0400, Bill Sharer wrote:
48 > Actually what you have there is a mislabeled file. Here's the relevant
49 > poop:
50 >
51 > # cd /etc/selinux/strict/contexts/files
52 >
53 > # grep ld.so.cache file_contexts
54 > /etc/ld\.so\.cache -- system_u:object_r:ld_so_cache_t
55 > /etc/ld\.so\.preload -- system_u:object_r:ld_so_cache_t
56 >
57 > # ls -Z /etc/ld.so.cache
58 > -rw-r--r-- root root root:object_r:ld_so_cache_t /etc/ld.so.cache
59 >
60 > See if this does the trick:
61 >
62 > # restorecon -v /etc/ld.so.cache
63 >
64 > If that doesn't change it, your system is not firing the rule properly
65 > or else it is missing from the file_contexts file for some reason. I've
66 > had some rules fail to fire on an x86_64 box because there were issues
67 > matching the /lib symlink to the /lib64 target and so forth.Also, have
68 > you done an rlpkg to relabel your filesystem lately?
69 >
70 > Dominik J. Fischer wrote:
71 > > Dear list,
72 > >
73 > > I am running a freshly intalled SELinux system with
74 > > sec-policy/selinux-base-policy 20070329 in strict/permissive mode.
75 > >
76 > > When I try to write a TE module for my avc denials the compiler doesn't
77 > > resolve the necesary types. For example, considerung the following avc
78 > > entry for type consoletype:
79 > >
80 > > vmdefault # dmesg | grep avc
81 > > audit(1190988750.096:3): avc: denied { read } for pid=26115
82 > > comm="consoletype" name="ld.so.cache" dev=sda1 ino=336323476
83 > > scontext=system_u:system_r:consoletype_t tcontext=root:object_r:etc_t
84 > > tclass=file
85 > > audit(1190988750.096:4): avc: denied { getattr } for pid=26115
86 > > comm="consoletype" name="ld.so.cache" dev=sda1 ino=336323476
87 > > scontext=system_u:system_r:consoletype_t tcontext=root:object_r:etc_t
88 > > tclass=file
89 > >
90 > > My policy module looks like this:
91 > >
92 > > policy_module(local,1.0.0)
93 > > type local_t;
94 > > files_read_etc_files(consoletype_t)
95 > >
96 > > When I try to compile, the compiler gives me an unknown type error:
97 > >
98 > > vmdefault include # make -f /usr/share/selinux/strict/include/Makefile
99 > > Compiling strict local module
100 > > /usr/bin/checkmodule: loading policy configuration from tmp/local.tmp
101 > > local.te:11:ERROR 'unknown type consoletype_t' at token ';' on line
102 > > 78133:
103 > > allow consoletype_t etc_t:dir { getattr search read lock
104 > > ioctl };
105 > > #line 11
106 > > /usr/bin/checkmodule: error(s) encountered while parsing configuration
107 > > make: *** [tmp/local.mod] Error 1
108 > >
109 > > Seems to me that the compiler does not resolve the types against the
110 > > base policy.
111 > >
112 > > Any ideas? Comments are highly appreciated.
113 > >
114 > > Dominik
115 > >
116 > >
117 >
118
119 --
120 gentoo-hardened@g.o mailing list

Replies

Subject Author
Re: [gentoo-hardened] SELinux module compile error: unknown type "Marek Wróbel" <smbmarek@×××××××××××.pl>