-
Notifications
You must be signed in to change notification settings - Fork 361
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
libsepol/tests: add test for segregate attributes
Signed-off-by: Christian Göttsche <[email protected]>
- Loading branch information
Showing
8 changed files
with
394 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
class process | ||
class blk_file | ||
class chr_file | ||
class dir | ||
class fifo_file | ||
class file | ||
class lnk_file | ||
class sock_file | ||
|
||
sid kernel | ||
sid security | ||
sid unlabeled | ||
sid file | ||
sid port | ||
sid netif | ||
sid netmsg | ||
sid node | ||
sid devnull | ||
|
||
class process { dyntransition transition } | ||
class file { write } | ||
|
||
ifdef(`enable_mls',` | ||
sensitivity s0; | ||
dominance { s0 } | ||
category c0; category c1; category c2; category c3; | ||
category c4; category c5; category c6; category c7; | ||
category c8; category c9; category c10; category c11; | ||
category c12; category c13; category c14; category c15; | ||
category c16; category c17; category c18; category c19; | ||
category c20; category c21; category c22; category c23; | ||
|
||
level s0:c0.c23; | ||
|
||
mlsconstrain file { write } ( h1 dom h2 ); | ||
') | ||
|
||
# | ||
# Test start | ||
# | ||
|
||
attribute test1_attr1; | ||
attribute test1_attr2; | ||
type test1_type; | ||
typeattribute test1_type test1_attr1; | ||
typeattribute test1_type test1_attr2; | ||
segregate_attributes test1_attr1, test1_attr2; | ||
|
||
|
||
attribute test2_attr1; | ||
attribute test2_attr2; | ||
attribute test2_attr3; | ||
type test2_type1; | ||
type test2_type2; | ||
type test2_type3; | ||
type test2_type4; | ||
typeattribute test2_type1 test2_attr1; | ||
typeattribute test2_type1 test2_attr2; | ||
typeattribute test2_type2 test2_attr1; | ||
typeattribute test2_type2 test2_attr3; | ||
typeattribute test2_type3 test2_attr2; | ||
typeattribute test2_type3 test2_attr3; | ||
typeattribute test2_type4 test2_attr1; | ||
typeattribute test2_type4 test2_attr2; | ||
typeattribute test2_type4 test2_attr3; | ||
segregate_attributes test2_attr1, test2_attr2, test2_attr3; | ||
|
||
# | ||
# Test End | ||
# | ||
|
||
type sys_isid; | ||
allow sys_isid self : process { dyntransition transition }; | ||
role sys_role; | ||
role sys_role types sys_isid; | ||
gen_user(sys_user,, sys_role, s0, s0 - s0:c0.c23) | ||
sid kernel gen_context(sys_user:sys_role:sys_isid, s0) | ||
sid security gen_context(sys_user:sys_role:sys_isid, s0) | ||
sid unlabeled gen_context(sys_user:sys_role:sys_isid, s0) | ||
sid file gen_context(sys_user:sys_role:sys_isid, s0) | ||
sid port gen_context(sys_user:sys_role:sys_isid, s0) | ||
sid netif gen_context(sys_user:sys_role:sys_isid, s0) | ||
sid netmsg gen_context(sys_user:sys_role:sys_isid, s0) | ||
sid node gen_context(sys_user:sys_role:sys_isid, s0) | ||
sid devnull gen_context(sys_user:sys_role:sys_isid, s0) | ||
fs_use_trans devpts gen_context(sys_user:sys_role:sys_isid, s0); | ||
fs_use_trans devtmpfs gen_context(sys_user:sys_role:sys_isid, s0); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
class process | ||
class blk_file | ||
class chr_file | ||
class dir | ||
class fifo_file | ||
class file | ||
class lnk_file | ||
class sock_file | ||
|
||
sid kernel | ||
sid security | ||
sid unlabeled | ||
sid file | ||
sid port | ||
sid netif | ||
sid netmsg | ||
sid node | ||
sid devnull | ||
|
||
class process { dyntransition transition } | ||
class file { write } | ||
|
||
ifdef(`enable_mls',` | ||
sensitivity s0; | ||
dominance { s0 } | ||
category c0; category c1; category c2; category c3; | ||
category c4; category c5; category c6; category c7; | ||
category c8; category c9; category c10; category c11; | ||
category c12; category c13; category c14; category c15; | ||
category c16; category c17; category c18; category c19; | ||
category c20; category c21; category c22; category c23; | ||
|
||
level s0:c0.c23; | ||
|
||
mlsconstrain file { write } ( h1 dom h2 ); | ||
') | ||
|
||
type sys_isid; | ||
allow sys_isid self : process { dyntransition transition }; | ||
role sys_role; | ||
role sys_role types sys_isid; | ||
gen_user(sys_user,, sys_role, s0, s0 - s0:c0.c23) | ||
sid kernel gen_context(sys_user:sys_role:sys_isid, s0) | ||
sid security gen_context(sys_user:sys_role:sys_isid, s0) | ||
sid unlabeled gen_context(sys_user:sys_role:sys_isid, s0) | ||
sid file gen_context(sys_user:sys_role:sys_isid, s0) | ||
sid port gen_context(sys_user:sys_role:sys_isid, s0) | ||
sid netif gen_context(sys_user:sys_role:sys_isid, s0) | ||
sid netmsg gen_context(sys_user:sys_role:sys_isid, s0) | ||
sid node gen_context(sys_user:sys_role:sys_isid, s0) | ||
sid devnull gen_context(sys_user:sys_role:sys_isid, s0) | ||
fs_use_trans devpts gen_context(sys_user:sys_role:sys_isid, s0); | ||
fs_use_trans devtmpfs gen_context(sys_user:sys_role:sys_isid, s0); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
module sattrs_test_1 1.0; | ||
|
||
require { | ||
type test_type_t; | ||
} | ||
|
||
attribute attr1; | ||
|
||
typeattribute test_type_t attr1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
module sattrs_test_2 1.0; | ||
|
||
require { | ||
type test_type_t; | ||
} | ||
|
||
attribute attr2; | ||
|
||
typeattribute test_type_t attr2; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
module sattrs_test_3 1.0; | ||
|
||
require { | ||
attribute attr1, attr2; | ||
} | ||
|
||
type test_type_t; | ||
|
||
segregate_attributes attr1, attr2; |
Oops, something went wrong.