Ñò Ã#xPc @ s4 d d k l Z l Z d d k l Z l Z l Z d d k Td d k l Z l Z d d k l Z e d ƒ Z e d ƒ Z d „ Z d „ Z d e f d „ ƒ YZ e i e ƒ d e f d „ ƒ YZ e i e ƒ d e f d „ ƒ YZ e i e ƒ d e f d „ ƒ YZ e i e ƒ d e f d „ ƒ YZ e i e ƒ d e f d „ ƒ YZ e i e ƒ d e f d „ ƒ YZ e i e ƒ d e f d „ ƒ YZ e i e ƒ d e f d „ ƒ YZ e i e ƒ d e! f d „ ƒ YZ" e i e" ƒ d e f d „ ƒ YZ# e i e# ƒ d e! f d! „ ƒ YZ$ e i e$ ƒ d" S(# iÿÿÿÿ( t apit errors( t Strt StrEnumt Bool( t *( t _t ngettext( t is_allsü SELinux User Mapping Map IPA users to SELinux users by host. Hosts, hostgroups, users and groups can be either defined within the rule or it may point to an existing HBAC rule. When using --hbacrule option to selinuxusermap-find an exact match is made on the HBAC rule name, so only one or zero entries will be returned. EXAMPLES: Create a rule, "test1", that sets all users to xguest_u:s0 on the host "server": ipa selinuxusermap-add --usercat=all --selinuxuser=xguest_u:s0 test1 ipa selinuxusermap-add-host --hosts=server.example.com test1 Create a rule, "test2", that sets all users to guest_u:s0 and uses an existing HBAC rule for users and hosts: ipa selinuxusermap-add --usercat=all --hbacrule=webserver --selinuxuser=guest_u:s0 test2 Display the properties of a rule: ipa selinuxusermap-show test2 Create a rule for a specific user. This sets the SELinux context for user john to unconfined_u:s0-s0:c0.c1023 on any machine: ipa selinuxusermap-add --hostcat=all --selinuxuser=unconfined_u:s0-s0:c0.c1023 john_unconfined ipa selinuxusermap-add-user --users=john john_unconfined Disable a rule: ipa selinuxusermap-disable test1 Enable a rule: ipa selinuxusermap-enable test1 Find a rule referencing a specific HBAC rule: ipa selinuxusermap-find --hbacrule=allow_some Remove a rule: ipa selinuxusermap-del john_unconfined SEEALSO: The list controlling the order in which the SELinux user map is applied and the default SELinux user are available in the config-show command. s. HBAC rule and local members cannot both be setc C sç t i d ƒ } t i d ƒ } t i d ƒ } | d i d d ƒ \ } } } } | i | ƒ p t d ƒ S| p | i | ƒ o t d ƒ S| i | ƒ } | o? | p, | i d ƒ o' t | i d ƒ ƒ d j o t d ƒ Sd S( sÈ An SELinux user has 3 components: user:MLS:MCS. user and MLS are required. user traditionally ends with _u but this is not mandatory. The regex is ^[a-zA-Z][a-zA-Z_]* The MLS part can only be: Level: s[0-15](-s[0-15]) Then MCS could be c[0-1023].c[0-1023] and/or c[0-1023]-c[0-c0123] Meaning s0 s0-s1 s0-s15:c0.c1023 s0-s1:c0,c2,c15.c26 s0-s0:c0.c1023 Returns a message on invalid, returns nothing on valid. s ^[a-zA-Z][a-zA-Z_]*$s* ^s[0-9][1-5]{0,1}(-s[0-9][1-5]{0,1}){0,1}$s ^c(\d+)([.,-]c(\d+))*?$s :::t :i s5 Invalid SELinux user name, only a-Z and _ are alloweds/ Invalid MLS value, must match s[0-15](-s[0-15])iÿ sM Invalid MCS value, must match c[0-1023].c[0-1023] and/or c[0-1023]-c[0-c0123]N( t ret compilet splitt matchR t groupt intt None( t ugettextt usert regex_namet regex_mlst regex_mcst namet mlst mcst ignoret m( ( sA /usr/lib/python2.6/site-packages/ipalib/plugins/selinuxusermap.pyt validate_selinuxuserJ s ";c C sž | i ƒ d } | i d g ƒ } t | ƒ d j o t i d t d ƒ ƒ ‚ n | d i d ƒ } | | j o) t i d t d ƒ t d | ƒ ƒ ‚ n d S( sŒ Ensure the user is in the list of allowed SELinux users. Returns nothing if the user is found, raises an exception otherwise. i t ipaselinuxusermapordert reasons0 SELinux user map list not found in configurationi t $s<