Skip to contentSkip to conversation

Identification of Attribute values within the Security Server

DISCUSSION JanuGerman 2 participants 2 messages Apr 3, 2007 SELinux security module

lore
Share & tools
lore

JanuGerman

author
#0 lore raw

Hi Every one,

1) Can constraint(s) be specified in the "RefPolicy" e.g. is this Refpolicy is correct:

policy_module(local, 1.0)

require {
         type unconfined_t;
         type fs_t priv_type;
}

type x_t;
bool test true;

allow x_t fs_t:filesystem associate;

if (test) {
         # allow unconfined_t all access to x_t
         allow unconfined_t x_t:dir *;
         allow unconfined_t x_t:file *;
} else {
         # allow unconfined_t only ls access
         allow unconfined_t x_t:dir { getattr read search };
         allow unconfined_t x_t:file {getattr }; 
}
constrain filesystem associate (t1=priv_type)

The intended semantics of this policy is to associate an attribute with the fs_t typeand then further constrain the permissions. But the above semantics can be achieved by (t1=t2) may be?.

2) SELinux policy may contain attributes, which can be associated with types and can be checked within the constrain(t) expressions in a further step. Within the security server i.e. ss/services.c however, the function "constraint_expr_eval" checks the types only and there is no check for delcared attribute seperately i think so. It seems that attributes are internally mapped to types and within the "constraint_expr_eval" function, only types are checked? Secondly, integers are associated with these types. Whether these types are mapped to integers seperately some where else?. Actually, my intension is to identify a particular type within the "constraint_expr_eval" but i found that, types are first mapped to integers first, and not directly machted based on their names. Is this a correct approach for the identification of particular types or a better approach can be taken before entering into the security server?

Thanks,
Best
JG

___________________________________________________________
Yahoo! Messenger - with free PC-PC calling and photo sharing. http://uk.messenger.yahoo.com

___________________________________________________________
Inbox full of unwanted email? Get leading protection and 1GB storage with All New Yahoo! Mail. http://uk.docs.yahoo.com/nowyoucan.html

--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.

#1 lore raw
Quoted 5 lines · JanuGerman

Hi Every one,

1) Can constraint(s) be specified in the "RefPolicy" e.g. is this Refpolicy is correct:

I think you mean "loadable policy module" rather than "RefPolicy". The answer is no, constraints are not supported by the current module language. Only RBAC, TE, and user statements are supported in the current module language.

Quoted 22 lines

policy_module(local, 1.0)

require {
         type unconfined_t;
         type fs_t priv_type;
}

type x_t;
bool test true;

allow x_t fs_t:filesystem associate;

if (test) {
         # allow unconfined_t all access to x_t
         allow unconfined_t x_t:dir *;
         allow unconfined_t x_t:file *;
} else {
         # allow unconfined_t only ls access
         allow unconfined_t x_t:dir { getattr read search };
         allow unconfined_t x_t:file {getattr }; 
}
constrain filesystem associate (t1=priv_type)
Quoted 1 line

The intended semantics of this policy is to associate an attribute with the fs_t typeand then further constrain the permissions. But the above semantics can be achieved by (t1=t2) may be?.

filesystem associate is a check between a file's security context and the security context of the containing filesystem (superblock/partition). It is rarely used at present but could be used to e.g. bind specific file types to specific filesystems. It is not a process-based check.

Quoted 7 lines

2) SELinux policy may contain attributes, which can be associated with types and can be checked within the constrain(t) expressions in a further step. Within the security server i.e. ss/services.c however, the function "constraint_expr_eval" checks the types only and there is no check for delcared attribute seperately i think so. It seems that attributes are internally mapped to types and within the "constraint_expr_eval" function, only types are checked?

Correct; attributes are expanded to their type sets when the policy is generated (at expand time for modular policy). Originally this was always done and attributes were completely discarded from the policy at that time; later support was added for preserving allow rules based on attributes as a more compact representation, which is why there is now a type_attr_map in the policydb, but this is only used for avtab lookups by compute_av, not by the constraint evaluator.

Quoted 7 lines

Secondly, integers are associated with these types. Whether these
types are mapped to integers seperately some where else?. Actually, my intension is to identify a particular type within the "constraint_expr_eval" but i found that, types are first mapped to integers first, and not directly machted based on their names. Is this a correct approach for the identification of particular types or a better approach can be taken before entering into the security server?

Types (and all other symbols) are mapped to integer index values during policy generation, and those indices are used within the security server to identify them and efficiently represent sets of them (via ebitmaps). The values can change upon policy reload and should never be exposed outside of the security server.

Signature · 8 lines
Stephen Smalley
National Security Agency


--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.