<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>14724</bug_id>
          
          <creation_ts>2022-02-17 10:15:26 +0000</creation_ts>
          <short_desc>[meta-tpm] tpm2-tss recipe: extrausers bbclass is used instead of useradd</short_desc>
          <delta_ts>2022-06-16 04:11:49 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>7</classification_id>
          <classification>Build System, Metadata &amp; Runtime</classification>
          <product>Other YP Layers</product>
          <component>meta-security</component>
          <version>unspecified</version>
          <rep_platform>All</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Undecided</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>4.0 M3</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Mykyta Dorokhin">kit-d</reporter>
          <assigned_to name="akuster">akuster808</assigned_to>
          
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>Don&apos;t know</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>92569</commentid>
    <comment_count>0</comment_count>
    <who name="Mykyta Dorokhin">kit-d</who>
    <bug_when>2022-02-17 10:15:26 +0000</bug_when>
    <thetext>If you look at tpm2-tss recipe of any version (in my current setup I use tpm2-tss_2.3.2.bb) you can see that extrausers class is used to add tss user and group. This is odd since Yocto reference manual explicitly states:


[quote]
The user and group operations added using the extrausers class are not tied to a specific recipe outside of the recipe for the image. Thus, the operations can be performed across the image as a whole. Use the useradd class to add user and group configuration to a specific recipe. 
[/quote]

Other recipies in meta-tmp also add users (for instance tpm2-abrmd, swtpm, trousers) and they do it with the help of useradd bbclass. I suspect this is a correct way to add users/groups from within a recipe. 


For example (tpm2-abrmd recipe):
inherit autotools pkgconfig systemd update-rc.d useradd
USERADD_PACKAGES = &quot;${PN}&quot;
GROUPADD_PARAM_${PN} = &quot;tss&quot;
USERADD_PARAM_${PN} = &quot;--system -M -d /var/lib/tpm -s /bin/false -g tss tss&quot;

Moreover, you won&apos;t find extrausers usages in meta-openembedded and other mainline layers. 

So I suppose extrausers is designed to be used only on image recipes and not in spicific recipies. Let alone, in the example above the tss user/group is created using useradd class

As a side effect, I see that in the built image/filesystem the tss user gets created with uid 1000:

bash-5.0# cat /etc/passwd | grep tss
tss:x:999:1000::/var/lib/tpm:/bin/false

which is not a common practice for system users.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>92591</commentid>
    <comment_count>1</comment_count>
    <who name="akuster">akuster808</who>
    <bug_when>2022-02-17 23:06:11 +0000</bug_when>
    <thetext>Thanks for letting me know. I will take a look shortly.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>93509</commentid>
    <comment_count>2</comment_count>
    <who name="akuster">akuster808</who>
    <bug_when>2022-06-16 04:11:00 +0000</bug_when>
    <thetext>in kirkstone.

https://git.yoctoproject.org/meta-security/commit/?h=kirkstone&amp;id=da23c2a094b2e1a87da2932552ec96c0f842a639</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>