1(type bin_t) 2(type kernel_t) 3(type security_t) 4(type unlabeled_t) 5(handleunknown allow) 6(mls true) 7 8(policycap open_perms) 9 10(category c0) 11(category c1) 12(category c2) 13(category c3) 14(category c4) 15(category c5) 16(categoryalias cat0) 17(categoryaliasactual cat0 c0) 18(categoryset cats01 (c0 c1)) 19(categoryset cats02 (c2 c3)) 20(categoryset cats03 (range c0 c5)) 21(categoryset cats04 (not (range c0 c2))) 22(categoryorder (cat0 c1 c2 c3)) 23(categoryorder (c3 c4 c5)) 24 25(sensitivity s0) 26(sensitivity s1) 27(sensitivity s2) 28(sensitivity s3) 29(sensitivityalias sens0) 30(sensitivityaliasactual sens0 s0) 31(sensitivityorder (s0 s1 s2 s3)) 32 33(sensitivitycategory s0 (cats03)) 34(sensitivitycategory s1 cats01) 35(sensitivitycategory s1 (c2)) 36(sensitivitycategory s2 (cats01 cats02)) 37(sensitivitycategory s2 (range c4 c5)) 38(sensitivitycategory s3 (range c0 c5)) 39 40(level low (s0)) 41(level high (s3 (range c0 c3))) 42(levelrange low_high (low high)) 43(levelrange lh1 ((s0 (c0)) (s2 (c0 c3)))) 44(levelrange lh2 (low (s2 (c0 c3)))) 45(levelrange lh3 ((s0 cats04) (s2 (range c0 c5)))) 46(levelrange lh4 ((s0) (s1))) 47 48(block policy 49 (classorder (file char dir)) 50 (class file (execute_no_trans entrypoint execmod open audit_access)) 51 (common file (ioctl read write create getattr setattr lock relabelfrom 52 relabelto append unlink link rename execute swapon 53 quotaon mounton)) 54 (classcommon file file) 55 56 (classpermission file_rw) 57 (classpermissionset file_rw (file (read write getattr setattr lock append))) 58 59 ;;(classpermission loop1) 60 ;;(classpermissionset loop1 ((loop2))) 61 ;;(classpermission loop2) 62 ;;(classpermissionset loop2 ((loop3))) 63 ;;(classpermission loop3) 64 ;;(classpermissionset loop3 ((loop1))) 65 66 (class char (foo)) 67 (classcommon char file) 68 69 (class dir ()) 70 (classcommon dir file) 71 72 (classpermission char_w) 73 (classpermissionset char_w (char (write setattr))) 74 (classpermissionset char_w (file (open read getattr))) 75 76 (classmap files (read)) 77 (classmapping files read 78 (file (open read getattr))) 79 (classmapping files read 80 char_w) 81 82 (type auditadm_t) 83 (type console_t) 84 (type console_device_t) 85 (type user_tty_device_t) 86 (type device_t) 87 (type getty_t) 88 (type exec_t) 89 (type bad_t) 90 91 ;;(allow console_t console_device_t file_rw) 92 (allow console_t console_device_t (files (read))) 93 94 (boolean secure_mode false) 95 (boolean console_login true) 96 97 (sid kernel) 98 (sid security) 99 (sid unlabeled) 100 (sidorder (kernel security)) 101 (sidorder (security unlabeled)) 102 103 (typeattribute exec_type) 104 (typeattribute foo_type) 105 (typeattribute bar_type) 106 (typeattribute baz_type) 107 (typeattribute not_bad_type) 108 (typeattributeset exec_type (or bin_t kernel_t)) 109 (typeattributeset foo_type (and exec_type kernel_t)) 110 (typeattributeset bar_type (xor exec_type foo_type)) 111 (typeattributeset baz_type (not bin_t)) 112 (typeattributeset baz_type (and exec_type (and bar_type bin_t))) 113 (typeattributeset not_bad_type (not bad_t)) 114 (typealias sbin_t) 115 (typealiasactual sbin_t bin_t) 116 (typepermissive device_t) 117 (typebounds device_t bin_t) 118 ;;(typebounds bin_t kernel_t) ;; This statement and the next can be used 119 ;;(typebounds kernel_t device_t) ;; to verify that circular bounds can be found 120 (typemember device_t bin_t file exec_t) 121 (typetransition device_t console_t files console_device_t) 122 123 (roleattribute exec_role) 124 (roleattribute foo_role) 125 (roleattribute bar_role) 126 (roleattribute baz_role) 127 (roleattributeset exec_role (or user_r system_r)) 128 (roleattributeset foo_role (and exec_role system_r)) 129 (roleattributeset bar_role (xor exec_role foo_role)) 130 (roleattributeset baz_role (not user_r)) 131 132 (rangetransition device_t console_t file low_high) 133 (rangetransition device_t kernel_t file ((s0) (s3 (not c3)))) 134 135 (typetransition device_t console_t file "some_file" getty_t) 136 137 (allow foo_type self (file (execute))) 138 (allow bin_t device_t (file (execute))) 139 140 ;; Next two rules violate the neverallow rule that follows 141 ;;(allow bad_t not_bad_type (file (execute))) 142 ;;(allow bad_t exec_t (file (execute))) 143 (neverallow bad_t not_bad_type (file (execute))) 144 145 (booleanif secure_mode 146 (true 147 (auditallow device_t exec_t (file (read write))) 148 ) 149 ) 150 151 (booleanif console_login 152 (true 153 (typechange auditadm_t console_device_t file user_tty_device_t) 154 (allow getty_t console_device_t (file (getattr open read write append))) 155 ) 156 (false 157 (dontaudit getty_t console_device_t (file (getattr open read write append))) 158 ) 159 ) 160 161 (booleanif (not (xor (eq secure_mode console_login) 162 (and (or secure_mode console_login) secure_mode ) ) ) 163 (true 164 (allow bin_t exec_t (file (execute))) 165 ) 166 ) 167 168 (tunable allow_execfile true) 169 (tunable allow_userexec false) 170 171 (tunableif (not (xor (eq allow_execfile allow_userexec) 172 (and (or allow_execfile allow_userexec) 173 (and allow_execfile allow_userexec) ) ) ) 174 (true 175 (allow bin_t exec_t (file (execute))) 176 ) 177 ) 178 179 (optional allow_rules 180 (allow user_t exec_t (bins (execute))) 181 ) 182 183 (dontaudit device_t auditadm_t (file (read))) 184 (auditallow device_t auditadm_t (file (open))) 185 186 (user system_u) 187 (user user_u) 188 (user foo_u) 189 (userprefix user_u user) 190 (userprefix system_u user) 191 192 (selinuxuser name user_u low_high) 193 (selinuxuserdefault user_u ((s0 (c0)) (s3 (range c0 c3)))) 194 195 (role system_r) 196 (role user_r) 197 198 (roletype system_r bin_t) 199 (roletype system_r kernel_t) 200 (roletype system_r security_t) 201 (roletype system_r unlabeled_t) 202 (roletype system_r exec_type) 203 (roletype exec_role bin_t) 204 (roletype exec_role exec_type) 205 (roleallow system_r user_r) 206 (rolebounds system_r user_r) 207 (roletransition system_r bin_t file user_r) 208 209 (userrole foo_u foo_role) 210 (userlevel foo_u low) 211 (userrange foo_u low_high) 212 213 (userrole system_u system_r) 214 (userlevel system_u low) 215 (userrange system_u low_high) 216 (userbounds system_u user_u) 217 218 (userrole user_u user_r) 219 (userlevel user_u (s0 (range c0 c2))) 220 (userrange user_u (low high)) 221 222 (sidcontext kernel (system_u system_r kernel_t ((s0) high))) 223 (sidcontext security (system_u system_r security_t (low (s3 (range c0 c3))))) 224 (sidcontext unlabeled (system_u system_r unlabeled_t (low high))) 225 226 (context system_u_bin_t_l2h (system_u system_r bin_t (low high))) 227 228 (ipaddr ip_v4 192.25.35.200) 229 (ipaddr netmask 192.168.1.1) 230 (ipaddr ip_v6 2001:0DB8:AC10:FE01::) 231 (ipaddr netmask_v6 2001:0DE0:DA88:2222::) 232 233 (filecon "/usr/bin/foo" file system_u_bin_t_l2h) 234 (filecon "/usr/bin/bar" file (system_u system_r kernel_t (low low))) 235 (filecon "/usr/bin/baz" any ()) 236 (filecon "/usr/bin/aaa" any (system_u system_r kernel_t ((s0) (s3 (range c0 c2))))) 237 (filecon "/usr/bin/bbb" any (system_u system_r kernel_t ((s0 (c0)) high))) 238 (filecon "/usr/bin/ccc" any (system_u system_r kernel_t (low (s3 (cats01))))) 239 (filecon "/usr/bin/ddd" any (system_u system_r kernel_t (low (s3 (cats01 cats02))))) 240 (nodecon ip_v4 netmask system_u_bin_t_l2h) 241 (nodecon ip_v6 netmask_v6 system_u_bin_t_l2h) 242 (portcon udp 25 system_u_bin_t_l2h) 243 (portcon tcp 22 system_u_bin_t_l2h) 244 (genfscon - "/usr/bin" system_u_bin_t_l2h) 245 (netifcon eth0 system_u_bin_t_l2h system_u_bin_t_l2h) ;different contexts? 246 (fsuse xattr ext3 system_u_bin_t_l2h) 247 248 ; XEN 249 (pirqcon 256 system_u_bin_t_l2h) 250 (iomemcon (0 255) system_u_bin_t_l2h) 251 (ioportcon (22 22) system_u_bin_t_l2h) 252 (pcidevicecon 345 system_u_bin_t_l2h) 253 (devicetreecon "/this is/a/path" system_u_bin_t_l2h) 254 255 (constrain (files (read)) (not (or (and (eq t1 exec_t) (eq t2 bin_t)) (eq r1 r2)))) 256 (constrain char_w (not (or (and (eq t1 exec_t) (eq t2 bin_t)) (eq r1 r2)))) 257 258 (constrain (file (read)) (or (and (eq t1 exec_t) (neq t2 bin_t) ) (eq u1 u2) ) ) 259 (constrain (file (open)) (dom r1 r2)) 260 (constrain (file (open)) (domby r1 r2)) 261 (constrain (file (open)) (incomp r1 r2)) 262 263 (validatetrans file (eq t1 exec_t)) 264 265 (mlsconstrain (file (open)) (not (or (and (eq l1 l2) (eq u1 u2)) (eq r1 r2)))) 266 (mlsconstrain (file (open)) (or (and (eq l1 l2) (eq u1 u2)) (neq r1 r2))) 267 (mlsconstrain (file (open)) (dom h1 l2)) 268 (mlsconstrain (file (open)) (domby l1 h2)) 269 (mlsconstrain (file (open)) (incomp l1 l2)) 270 271 (mlsvalidatetrans file (domby l1 h2)) 272 273 (macro test_mapping ((classpermission cps)) 274 (allow bin_t auditadm_t cps)) 275 276 (call test_mapping ((file (read)))) 277 (call test_mapping ((files (read)))) 278 (call test_mapping (char_w)) 279 280 (defaultuser (file char) source) 281 (defaultrole char target) 282 (defaulttype (files) source) 283 (defaultrange (file) target low) 284 (defaultrange (char) source low-high) 285) 286 287(macro all ((type x)) 288 (allow x bin_t (policy.file (execute))) 289) 290(call all (bin_t)) 291 292(block z 293 (block ba 294 (roletype r t) 295 (blockabstract z.ba))) 296 297(block test_ba 298 (blockinherit z.ba) 299 (role r) 300 (type t)) 301 302(block bb 303 (type t1) 304 (type t2) 305 (boolean b1 false) 306 (tunable tun1 true) 307 (macro m ((boolean b)) 308 (tunableif tun1 309 (true 310 (allow t1 t2 (policy.file (write)))) 311 (false 312 (allow t1 t2 (policy.file (execute))))) 313 (booleanif b 314 (true 315 (allow t1 t2 (policy.file (read)))))) 316 317 (call m (b1)) 318) 319 320(in bb 321 (tunableif bb.tun1 322 (true 323 (allow bb.t2 bb.t1 (policy.file (read write execute)))))) 324