/tmp
Subsystems (2)
What should be done about /tmp.
The types of things like:/tmp/scrollkeeper-$USER/tmp/hsperfdata_$USER/tmp/orbit-$USER/tmp/gconfd-$USER
- are not stored in the policy, and cannot be "restored" - I am trying to introduce a new gconfd domain, and change the /tmp/gconfd folder to ROLE_gconfd_tmp_t, but I have to chcon it manually - this seems like a bad thing.
- are set according to the first user - for example, I click on HELP in some random gnome app, and all of the sudden a scrollkeeper folder is created, and its type is set to the parent's tmp_domain(). Then the next app can't access this folder if it doesn't have a matching context.
==================
It seems like all those folders should be created ahead of time (login script? tmp could be on tmpfs), and their context set to the right thing
- but the right thing should be in the policy - should be able to use restorecon on those files. Couldn't such tmp files be made to work similarly to the home directories? Any suggestions?
Signature · 8 lines
Ivan Gyurdiev <[email protected]> Cornell University -- 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.
Quoted 6 lines
It seems like all those folders should be created ahead of time (login script? tmp could be on tmpfs), and their context set to the right thing
- but the right thing should be in the policy - should be able to use restorecon on those files. Couldn't such tmp files be made to work similarly to the home directories? Any suggestions?
So couldn't a new expansion be added called USER that expands to the corresponding user name?
/tmp <<none>> /tmp/orbit-USER system_u:object_r:ROLE_orbit_tmp_t /tmp/gconfd-USER system_u:object_r:ROLE_gconfd_tmp_t
/tmp/scrollkeeper-USER system_u:object_r:ROLE_scrollkeeper_tmp_t/tmp/hsperfdata_USER system_u:object_r:ROLE_java_tmp_t/tmp/.esd system_u:object_r:esd_tmp_t
And then, in /etc/profile.d/selinux.sh, create a whole bunch of those folders, or restorecon existing ones?
Signature · 8 lines
Ivan Gyurdiev <[email protected]> Cornell University -- 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.
Quoted 3 lines
So couldn't a new expansion be added called USER that expands to the corresponding user name?
Patch attached for USER expansion. Not sure if it belongs in this script, but it does what I want :)
Next...selinux profile script to create the /tmp folders every time.
Signature · 2 lines
Ivan Gyurdiev <[email protected]> Cornell University
genhomedircon.new renamed from genhomedircon +7 -1
@@ -357,16 +357,22 @@ return udict def getHomeDirContext(self, user, home, role): - ret="\n\n#\n# Context for user %s\n#\n\n" % user + ret="\n\n#\n# Home Context for user %s\n#\n\n" % user rc=commands.getstatusoutput("grep '^HOME_DIR' %s | sed -e 's|HOME_DIR|%s|' -e 's/ROLE/%s/' -e 's/system_u/%s/'" % (self.getHomeDirTemplate(), home, role, user)) return ret + rc[1] + "\n" + def getUserContext(self, user, role): + ret="\n\n#\n# Other Context for user %s\n#\n\n" % user + rc=commands.getstatusoutput("grep 'USER' %s | sed -e 's/USER/%s/' -e 's/ROLE/%s/' -e 's/system_u/%s/'" % (self.getHomeDirTemplate(), user, role, user)) + return ret + rc[1] + "\n" + def genHomeDirContext(self): users = self.getUsers() ret="" # Fill in HOME and ROLE for users that are defined for u in users.keys(): ret += self.getHomeDirContext (u, users[u]["home"], users[u]["role"]) + ret += self.getUserContext (u, users[u]["role"]) return ret+"\n" def checkExists(self, home):
Makefile.new renamed from Makefile +1 -1
@@ -221,7 +221,7 @@ @echo "Building file contexts files..." @m4 $(M4PARAM) $(ALL_TUNABLES) tmp/program_used_flags.te $(FCFILES) > [email protected] @grep -v -e HOME -e ROLE [email protected] > $@ - @grep -e HOME -e ROLE [email protected] > $(HOMEDIR_TEMPLATE) + @grep -e HOME -e ROLE -e USER [email protected] > $(HOMEDIR_TEMPLATE) @-rm [email protected] # Create a tags-file for the policy: