<?xml version="1.0" encoding="UTF-8" ?>

<bugzilla version="5.2"
          urlbase="https://bugzilla.altlinux.org/"
          
          maintainer="jenya@basealt.ru"
>

    <bug>
          <bug_id>28784</bug_id>
          
          <creation_ts>2013-04-03 12:02:54 +0400</creation_ts>
          <short_desc>Добавить CAP_SETGID....</short_desc>
          <delta_ts>2013-04-03 18:58:21 +0400</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>4</classification_id>
          <classification>Development</classification>
          <product>Sisyphus</product>
          <component>policycoreutils-newrole</component>
          <version>unstable</version>
          <rep_platform>all</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>CLOSED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P3</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Andriy Stepanov (stanv)">stanv</reporter>
          <assigned_to name="Anton Farygin">rider</assigned_to>
          <cc>ancieg</cc>
    
    <cc>rider</cc>
    
    <cc>zerg</cc>
          
          <qa_contact>qa-sisyphus</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>139288</commentid>
    <comment_count>0</comment_count>
    <who name="Andriy Stepanov (stanv)">stanv</who>
    <bug_when>2013-04-03 12:02:54 +0400</bug_when>
    <thetext>Чтобы работал pam_tcb.so вызывающий процесс должен иметь установленную CAP_SETGID.


Поскольку newrole (как и весь SeLinux) писали маньяки безопасности они сделали вот это:

/**
 * This function will drop the capabilities so that we are left
 * only with access to the audit system and the ability to raise
 * CAP_SYS_ADMIN, CAP_DAC_OVERRIDE, CAP_FOWNER and CAP_CHOWN,
 * before invoking pam_namespace.  These capabilities are needed
 * for performing bind mounts/unmounts and to create potential new
 * instance directories with appropriate DAC attributes. If the
 * user is root, we leave the capabilities alone since they already
 * should have access to the audit netlink socket and should have
 * the ability to create/mount/unmount instance directories.
 *
 * Returns zero on success, non-zero otherwise
 */
static int drop_capabilities(int full)
{
    capng_setpid(getpid());
    capng_clear(CAPNG_SELECT_BOTH);



Получаем:

stat64(&quot;/etc/tcb&quot;, {st_mode=S_IFDIR|0710, st_size=4096, ...}) = 0
stat64(&quot;/etc/tcb/root&quot;, {st_mode=S_IFDIR|S_ISGID|0710, st_size=4096, ...}) = 0
getgroups32(1024, [0, 1, 2, 3, 4, 6, 10, 19]) = 8
setgroups32(0, [])                = -1 EPERM (Operation not permitted)

Где setgroups() sets the supplementary group IDs for the calling process. Appropriate privileges (Linux: the CAP_SETGID capability) are required. 


Патч сводится к policycoreutils/newrole/newrole.c:

-               capng_updatev(CAPNG_ADD, CAPNG_EFFECTIVE | CAPNG_PERMITTED, CAP_SYS_ADMIN , CAP_FOWNER , CAP_CHOWN, CAP_DAC_OVERRIDE, CAP_SETPCAP, -1);
+               capng_updatev(CAPNG_ADD, CAPNG_EFFECTIVE | CAPNG_PERMITTED, CAP_SYS_ADMIN , CAP_FOWNER , CAP_CHOWN, CAP_DAC_OVERRIDE, CAP_SETPCAP, CAP_SETGID, -1);


Приложите пожалуйста этот патч. Спасибо.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>139294</commentid>
    <comment_count>1</comment_count>
    <who name="Mikhail Efremov">sem</who>
    <bug_when>2013-04-03 14:48:03 +0400</bug_when>
    <thetext>Аналогичный патч там был:
http://git.altlinux.org/people/sem/packages/selinux.git?p=selinux.git;a=commit;h=c304dd2ec920a88cfec2e83935942181e3896936
(правда в том виде он сейчас не подойдет).
Видимо потерялось при обновлении.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>139304</commentid>
    <comment_count>2</comment_count>
    <who name="Repository Robot">repository-robot</who>
    <bug_when>2013-04-03 18:58:21 +0400</bug_when>
    <thetext>policycoreutils-2.1.13-alt4 -&gt; sisyphus:

* Wed Apr 03 2013 Led &lt;led@altlinux&gt; 2.1.13-alt4
- newrole: add CAP_SETGID to list fo drop_capabilities() (ALT#28784)</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>