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

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

    <bug>
          <bug_id>36064</bug_id>
          
          <creation_ts>2019-02-08 15:27:05 +0300</creation_ts>
          <short_desc>su doesn&apos;t work in hasher</short_desc>
          <delta_ts>2019-02-12 04:40:01 +0300</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>4</classification_id>
          <classification>Development</classification>
          <product>Sisyphus</product>
          <component>branding-xalt-kworkstation-release</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="Ivan Zakharyaschev">imz</reporter>
          <assigned_to name="Sergey V Turchin">zerg</assigned_to>
          <cc>iv</cc>
    
    <cc>ldv</cc>
    
    <cc>zerg</cc>
          
          <qa_contact>qa-sisyphus</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>178378</commentid>
    <comment_count>0</comment_count>
    <who name="Ivan Zakharyaschev">imz</who>
    <bug_when>2019-02-08 15:27:05 +0300</bug_when>
    <thetext>hasher-priv-1.5.2-alt1.x86_64
hasher-1.3.35-alt1.noarch
su-0.60-alt35.x86_64

su doesn&apos;t work in hasher anymore.

[root@localhost .in]# su -l nobody -s /bin/sh -c pwd
&lt;86&gt;Feb  8 12:23:11 su[32381]: pam_tcb(su:session): Session opened for nobody by caller(uid=0)
&lt;83&gt;Feb  8 12:23:11 su[32381]: pam_limits(su:session): Could not set limit for &apos;nproc&apos;: Operation not permitted
su: Permission denied
[root@localhost .in]# su
&lt;86&gt;Feb  8 12:23:13 su[32383]: pam_tcb(su:session): Session opened for root by caller(uid=0)
&lt;83&gt;Feb  8 12:23:13 su[32383]: pam_limits(su:session): Could not set limit for &apos;nproc&apos;: Operation not permitted
su: Permission denied

Sometimes, there are similar messages about &quot;memlock&quot; and not &quot;nproc&quot;.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>178405</commentid>
    <comment_count>1</comment_count>
    <who name="Ivan A. Melnikov">iv</who>
    <bug_when>2019-02-09 09:16:55 +0300</bug_when>
    <thetext>(In reply to comment #0)
&gt; hasher-priv-1.5.2-alt1.x86_64
&gt; hasher-1.3.35-alt1.noarch
&gt; su-0.60-alt35.x86_64
&gt; 
&gt; su doesn&apos;t work in hasher anymore.
&gt; 
&gt; [root@localhost .in]# su -l nobody -s /bin/sh -c pwd
[...]

It works on my machine; versions of hasher, hasher-priv and su are the same.

[root@localhost .in]# su -l nobody -s /bin/sh -c pwd
&lt;86&gt;Feb  9 06:03:05 su[13764]: pam_tcb(su:session): Session opened for nobody by (uid=0)
su: wtmp open: No such file or directory
/var/nobody
&lt;86&gt;Feb  9 06:03:05 su[13764]: pam_tcb(su:session): Session closed for nobody


[...]
&gt; &lt;83&gt;Feb  8 12:23:11 su[32381]: pam_limits(su:session): Could not set limit for
&gt; &apos;nproc&apos;: Operation not permitted

Probably nproc an memlock limits on your machine are stricter than the defaults.  I can easily break su in hasher by setting, for example, nproc limit to some smaller value:

[10:06:45 ~]$ ulimit -u 512
[10:06:49 ~]$ hsh-shell -q --rooter
[root@localhost .in]# su -l nobody -s /bin/sh -c pwd
&lt;86&gt;Feb  9 06:06:59 su[13922]: pam_tcb(su:session): Session opened for nobody by (uid=0)
&lt;83&gt;Feb  9 06:06:59 su[13922]: pam_limits(su:session): Could not set limit for &apos;nproc&apos;: Operation not permitted
su: Permission denied
[root@localhost .in]#

So, why such liberal limits are configured for the hasher chroot? For one, they are set in /etc/security/limits.d/90-desktop.conf:

[root@localhost .in]# cat /etc/security/limits.d/90-desktop.conf
# better defaults for desktop systems
*               soft    nproc   4096
*               hard    nproc   5120
*               soft    nofile  8192
*               hard    nofile  10240
*               soft    memlock 1024
*               hard    memlock 2048
[root@localhost .in]# rpm -qf /etc/security/limits.d/90-desktop.conf
pam-limits-desktop-0.1-alt2.noarch

And it gets into the chroot because of branding:

[root@localhost .in]# rpm -e pam-limits-desktop
error: Failed dependencies:
        pam-limits-desktop is needed by (installed) branding-xalt-kworkstation-release-8.3.0-alt2.noarch

I&apos;m not sure what should we do about this.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>178474</commentid>
    <comment_count>2</comment_count>
    <who name="Repository Robot">repository-robot</who>
    <bug_when>2019-02-12 04:40:01 +0300</bug_when>
    <thetext>branding-xalt-kworkstation-8.3.0-alt3 -&gt; sisyphus:

Mon Feb 11 2019 Sergey V Turchin &lt;zerg at altlinux dot org&gt; 8.3.0-alt3
- remove requires to pam-limits-desktop (ALT#36064)</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>