policycoreutils user_u seuser vs. genhomedircon
PATCH 1/1 policycoreutils user_u seuser vs. genhomedircon
In the stable branch, genhomedircon will ignore making home dir contexts for linux users mapped to user_u. For a long time, this was fine since user_u was the default for strict and targeted. With a merged strict-targeted policy, a more targeted-like system will have unconfined_u as the default. If you then try to make a confined user_u user, a set of home directory contexts will not be created. This patch fixes the behavior. I made a cursory look through the trunk C genhomedircon, and did not see this behavior, but someone should probably doublecheck.
scripts/genhomedircon +1 -1
@@ -193,7 +193,7 @@ return prefix def adduser(self, udict, user, seuser, prefix): - if seuser == "user_u" or user == "__default__" or user == "system_u": + if user == "__default__" or user == "system_u": return # !!! chooses first prefix in the list to use in the file context !!! try:
Signature · 7 lines
Chris PeBenito <[email protected]> Developer, Hardened Gentoo Linux Public Key: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0xE6AF9243 Key fingerprint = B0E6 877A 883F A57A 8E6A CB00 BC8E E42D E6AF 9243
Quoted 16 lines · Chris PeBenito
In the stable branch, genhomedircon will ignore making home dir contexts for linux users mapped to
user_u. For a long time, this was fine sinceuser_uwas the default for strict and targeted. With a merged strict-targeted policy, a more targeted-like system will haveunconfined_uas the default. If you then try to make a confineduser_uuser, a set of home directory contexts will not be created. This patch fixes the behavior. I made a cursory look through the trunk C genhomedircon, and did not see this behavior, but someone should probably doublecheck.Index: policycoreutils/scripts/genhomedircon
===================================================================
scripts/genhomedircon line 199
Quoted 8 lines
scripts/genhomedircon +1
-1@@ -193,7 +193,7 @@ return prefix def adduser(self, udict, user, seuser, prefix): - if seuser == "user_u" or user == "__default__" or user == "system_u": + if user == "__default__" or user == "system_u": return # !!! chooses first prefix in the list to use in the file context !!! try:
This appears to be the fallback_user in libsemanage genhomedircon.c, which is initialized to "user_u" and then set to whatever seuser is set in the __default__ entry of the seusers file (setup_fallback_user). get_users() then skips users that map to this fallback user with the exception of "root". Plus the usual skipping of __default__ and system_u. BTW, putting system_u into seusers was never a good idea; crond should have just been changed in the first place to not perform getseuserbyname() call for system crontabs.
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.
Recent problems recompiling libsemanage with new libustr (1.0.4)
Hi folks,
I tried recompiling libsemanage on a recent Debian unstable
box, and the build failed (error below). The same build, with the same code, had worked on 18 Mar 2008 .
The difference seems to be libustr version 1.0.3 works, and
1.0.4 fails. I do not see anything in the upstream ChangeLog to explain this, offhand, though there have been a whole slew of new files in /usr/include for version 1.0.4 -- though there was no so name bump.
This is just a heads up, I'll follow up with the ustr folks.
manoj
--8<---------------cut here---------------start------------->8---
__> rgrep -n ustr_dup_buf /usr/include/
/usr/include/ustr-main.h:502:#define USTR_DUP_OBJ(y) ustr_dup_buf(y, sizeof(y))
/usr/include/ustr-main.h:503:#define USTR_DUP_OSTR(y) ustr_dup_buf(y, sizeof(y) - 1)
/usr/include/ustr-main.h:730:USTR_CONF_E_PROTO struct Ustr *ustr_dup_buf(const void *, size_t) /usr/include/ustr-main.h:959:{ return (ustr_dup_buf(cstr, strlen(cstr))); } --8<---------------cut here---------------end--------------->8---
cc -O2 -g -I../include -I/usr/include -D_GNU_SOURCE -fPIC -DSHARED -c -o utilities.lo utilities.c
cc -O2 -g -I../include -I/usr/include -D_GNU_SOURCE -fPIC -DSHARED -c -o conf-scan.lo conf-scan.c
cc -O2 -g -I../include -I/usr/include -D_GNU_SOURCE -fPIC -DSHARED -c -o conf-parse.lo conf-parse.c
cc -O2 -g -I../include -I/usr/include -D_GNU_SOURCE -s -s -shared -o libsemanage.so.1 boolean_record.lo booleans_active.lo booleans_activedb.lo booleans_file.lo booleans_local.lo booleans_policy.lo booleans_policydb.lo context_record.lo database.lo database_activedb.lo database_file.lo database_join.lo database_llist.lo database_policydb.lo debug.lo direct_api.lo fcontext_record.lo fcontexts_file.lo fcontexts_local.lo fcontexts_policy.lo genhomedircon.lo handle.lo iface_record.lo interfaces_file.lo interfaces_local.lo interfaces_policy.lo interfaces_policydb.lo modules.lo node_record.lo nodes_file.lo nodes_local.lo nodes_policy.lo nodes_policydb.lo parse_utils.lo policy_components.lo port_record.lo ports_file.lo ports_local.lo ports_policy.lo ports_policydb.lo semanage_store.lo seuser_record.lo seusers_file.lo seusers_local.lo seusers_policy.lo user_base_record.lo user_extra_record.lo user_record.lo users_base_file.lo users_base_policydb.lo users_extra_file.lo users_join.lo!
users_local.lo users_policy.lo utilities.lo conf-scan.lo conf-parse.lo -lsepol -lselinux -L/usr/lib -Wl,-soname,libsemanage.so.1,--version-script=libsemanage.map,-z,defs
genhomedircon.lo: In function `ustr_dup_cstr':/usr/include/ustr-main.h:959: undefined reference to `ustr_dup_buf'
genhomedircon.lo: In function `ustr_replace_cstr':/usr/include/ustr-replace.h:58: undefined reference to `ustr_replace_buf'
genhomedircon.lo: In function `replace_all':/home/srivasta/libsemanage-2.0.24/src/genhomedircon.c:434: undefined reference to `ustr_sc_free'
genhomedircon.lo: In function `extract_context':/home/srivasta/libsemanage-2.0.24/src/genhomedircon.c:446: undefined reference to `ustr_spn_chrs_rev'/home/srivasta/libsemanage-2.0.24/src/genhomedircon.c:449: undefined reference to `ustr_cspn_chrs_rev'
genhomedircon.lo: In function `ustr_io_putfileline':/usr/include/ustr-io.h:78: undefined reference to `ustr_io_putline'
genhomedircon.lo: In function `write_user_context':/home/srivasta/libsemanage-2.0.24/src/genhomedircon.c:558: undefined reference to `ustr_sc_free'/home/srivasta/libsemanage-2.0.24/src/genhomedircon.c:563: undefined reference to `ustr_sc_free'
genhomedircon.lo: In function `ustr_io_putfileline':/usr/include/ustr-io.h:78: undefined reference to `ustr_io_putline'
genhomedircon.lo: In function `write_home_dir_context':/home/srivasta/libsemanage-2.0.24/src/genhomedircon.c:503: undefined reference to `ustr_sc_free'/home/srivasta/libsemanage-2.0.24/src/genhomedircon.c:508: undefined reference to `ustr_sc_free'
genhomedircon.lo: In function `ustr_dup_cstr':/usr/include/ustr-main.h:959: undefined reference to `ustr_dup_buf'
genhomedircon.lo: In function `ustr_add_cstr':/usr/include/ustr-main.h:945: undefined reference to `ustr_add_buf'
genhomedircon.lo: In function `ustr_io_putfileline':/usr/include/ustr-io.h:78: undefined reference to `ustr_io_putline'
genhomedircon.lo: In function `write_home_root_context':/home/srivasta/libsemanage-2.0.24/src/genhomedircon.c:529: undefined reference to `ustr_sc_free'
genhomedircon.lo: In function `write_context_file':/home/srivasta/libsemanage-2.0.24/src/genhomedircon.c:910: undefined reference to `ustr_sc_free'
genhomedircon.lo: In function `write_home_root_context':/home/srivasta/libsemanage-2.0.24/src/genhomedircon.c:534: undefined reference to `ustr_sc_free'
genhomedircon.lo: In function `write_context_file':/home/srivasta/libsemanage-2.0.24/src/genhomedircon.c:905: undefined reference to `ustr_sc_free'/home/srivasta/libsemanage-2.0.24/src/genhomedircon.c:887: undefined reference to `ustr_sc_free'
genhomedircon.lo: In function `ustr_dup_cstr':/usr/include/ustr-main.h:959: undefined reference to `ustr_dup_buf'
genhomedircon.lo: In function `ustr_add_cstr':/usr/include/ustr-main.h:945: undefined reference to `ustr_add_buf'
genhomedircon.lo: In function `fcontext_matches':/home/srivasta/libsemanage-2.0.24/src/genhomedircon.c:209: undefined reference to `ustr_free'/home/srivasta/libsemanage-2.0.24/src/genhomedircon.c:185: undefined reference to `ustr_del'/home/srivasta/libsemanage-2.0.24/src/genhomedircon.c:191: undefined reference to `ustr_del'
genhomedircon.lo: In function `ustr_add_cstr':/usr/include/ustr-main.h:945: undefined reference to `ustr_add_buf'
utilities.lo: In function `semanage_split_on_space':/home/srivasta/libsemanage-2.0.24/src/utilities.c:102: undefined reference to `ustr_sc_free'
utilities.lo: In function `ustr_dup_cstr':/usr/include/ustr-main.h:959: undefined reference to `ustr_dup_buf'
utilities.lo: In function `semanage_split_on_space':/home/srivasta/libsemanage-2.0.24/src/utilities.c:86: undefined reference to `ustr_split_spn_chrs'/home/srivasta/libsemanage-2.0.24/src/utilities.c:92: undefined reference to `ustr_sc_free'/home/srivasta/libsemanage-2.0.24/src/utilities.c:95: undefined reference to `ustr_dup_subustr'/home/srivasta/libsemanage-2.0.24/src/utilities.c:99: undefined reference to `ustr_sc_free'
utilities.lo: In function `ustr_dup_cstr':/usr/include/ustr-main.h:959: undefined reference to `ustr_dup_buf'
utilities.lo: In function `ustr_split_cstr':/usr/include/ustr-split.h:83: undefined reference to `ustr_split_buf'
utilities.lo: In function `semanage_split':/home/srivasta/libsemanage-2.0.24/src/utilities.c:122: undefined reference to `ustr_sc_free'/home/srivasta/libsemanage-2.0.24/src/utilities.c:126: undefined reference to `ustr_dup_subustr'/home/srivasta/libsemanage-2.0.24/src/utilities.c:130: undefined reference to `ustr_sc_free'/home/srivasta/libsemanage-2.0.24/src/utilities.c:133: undefined reference to `ustr_sc_free'
collect2: ld returned 1 exit status
make[3]: *** [libsemanage.so.1] Error 1
make[3]: Leaving directory `/home/srivasta/libsemanage-2.0.24/src'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/home/srivasta/libsemanage-2.0.24'
make[1]: *** [debian/stamp/build/libsemanage1] Error 2
make[1]: Leaving directory `/home/srivasta/libsemanage-2.0.24'
make: *** [debian/stamp/do-build-arch] Error 2
dpkg-buildpackage: failure: debian/rules build gave error exit status 2
Signature · 10 lines
[...] or some clown changed the chips on a board and not its name. (Don't laugh! Look at the SMC etherpower for that.) -- from /usr/src/linux/MAINTAINERS Manoj Srivastava <[email protected]> <[email protected]> 1024D/BF24424C print 4966 F272 D093 B493 410B 924B 21BA DABB BF24 424C -- 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.
Re: Recent problems recompiling libsemanage with new libustr (1.0.4)
Hi,
I should know better to send out such mails at 4am. Mea culpa. I
had forgotten to remove th -z defs from the loader command line; since failing to do so on Debian result sin th failure you saw before.
Sorry for all the noise.
manoj
Signature · 9 lines
You know you are getting old when you think you should drive the speed limit. E.A. Gilliam Manoj Srivastava <[email protected]> <[email protected]> 1024D/BF24424C print 4966 F272 D093 B493 410B 924B 21BA DABB BF24 424C -- 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.