Skip to contentSkip to conversation

shadow: update default settings for useradd

PATCH In review Yi Zhao 2 participants 3 messages Aug 17, 2021

lore
Share & tools
lore

Yi Zhao

author
#0 lore raw

PATCH 1/1 shadow: update default settings for useradd

The shadow 4.9 stops shiping /etc/default/useradd[1] and uses built-in settings by default. Some settings are not consistent with previous shadow 4.8.1 in oe-core. Per shadow 4.8.1 settings, change the default shell to /bin/sh and stop creating mail spool.

[1] https://github.com/shadow-maint/shadow/commit/bbf4b79bc49fd1826eb41f6629669ef0b647267b

---
 ...0001-useradd-update-default-settings.patch | 38 +++++++++++++++++++
 meta/recipes-extended/shadow/shadow.inc       |  1 +
 2 files changed, 39 insertions(+)
 create mode 100644 meta/recipes-extended/shadow/files/0001-useradd-update-default-settings.patch
meta/recipes-extended/shadow/files/0001-useradd-update-default-settings.patch new file +38 -0
new file mode 100644
index 0000000000..1e6702019b
@@ -0,0 +1,38 @@
+From 46106ec16409ea99f73a8a8823e50ac54db8e122 Mon Sep 17 00:00:00 2001
+From: Yi Zhao <[email protected]>
+Date: Tue, 17 Aug 2021 10:11:27 +0800
+Subject: [PATCH] useradd: update default settings
+
+The shadow 4.9 stops shiping /etc/default/useradd[1] and uses built-in
+settings by default. Some settings are not consistent with previous
+shadow 4.8.1 in oe-core. Per shadow 4.8.1 settings, change the default
+shell to /bin/sh and stop creating mail spool.
+
+[1] https://github.com/shadow-maint/shadow/commit/bbf4b79bc49fd1826eb41f6629669ef0b647267b
+
+Upstream-Status: Inappropriate [embedded specific]
+
+Signed-off-by: Yi Zhao <[email protected]>
+---
+ src/useradd.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/useradd.c b/src/useradd.c
+index 0d3f390d..715351b4 100644
+--- a/src/useradd.c
++++ b/src/useradd.c
+@@ -104,9 +104,9 @@ FILE *shadow_logfd = NULL;
+ static gid_t def_group = 1000;
+ static const char *def_gname = "other";
+ static const char *def_home = "/home";
+-static const char *def_shell = "/bin/bash";
++static const char *def_shell = "/bin/sh";
+ static const char *def_template = SKEL_DIR;
+-static const char *def_create_mail_spool = "yes";
++static const char *def_create_mail_spool = "no";
+ 
+ static long def_inactive = -1;
+ static const char *def_expire = "";
+-- 
+2.25.1
+
meta/recipes-extended/shadow/shadow.inc +1 -0
index 97ffae978a..e2a7a5bac6 100644
@@ -16,6 +16,7 @@ SRC_URI = "https://github.com/shadow-maint/shadow/releases/download/v${PV}/${BP}
            file://shadow-relaxed-usernames.patch \
            file://0001-Fix-out-of-tree-builds-with-respect-to-libsubid-incl.patch \
            file://0001-libsubid-link-to-PAM-libraries.patch \
+           file://0001-useradd-update-default-settings.patch \
            "
 
 SRC_URI:append:class-target = " \
Signature · 1 line
2.25.1
#1 lore raw

If the issue is that /etc/default/useradd was deleted, shouldn't we address this by reinstating that file? Patching the source code does not seem like a better solution, and introduces surprising behaviour for those expecting upstream defaults rather than Yocto's.

Alex

Quoted 83 lines · Yi Zhao

The shadow 4.9 stops shiping /etc/default/useradd[1] and uses built-in settings by default. Some settings are not consistent with previous shadow 4.8.1 in oe-core. Per shadow 4.8.1 settings, change the default shell to /bin/sh and stop creating mail spool.

[1]
https://github.com/shadow-maint/shadow/commit/bbf4b79bc49fd1826eb41f6629669ef0b647267b

---
 ...0001-useradd-update-default-settings.patch | 38 +++++++++++++++++++
 meta/recipes-extended/shadow/shadow.inc       |  1 +
 2 files changed, 39 insertions(+)
 create mode 100644

meta/recipes-extended/shadow/files/0001-useradd-update-default-settings.patch

diff --git a/meta/recipes-extended/shadow/files/0001-useradd-update-default-settings.patch b/meta/recipes-extended/shadow/files/0001-useradd-update-default-settings.patch new file mode 100644
index 0000000000..1e6702019b
--- /dev/null
+++
b/meta/recipes-extended/shadow/files/0001-useradd-update-default-settings.patch

meta/recipes-extended/shadow/files/0001-useradd-update-default-settings.patch new file +11 -0
@@ -0,0 +1,38 @@
+From 46106ec16409ea99f73a8a8823e50ac54db8e122 Mon Sep 17 00:00:00 2001
+From: Yi Zhao <[email protected]>
+Date: Tue, 17 Aug 2021 10:11:27 +0800
+Subject: [PATCH] useradd: update default settings
+
+The shadow 4.9 stops shiping /etc/default/useradd[1] and uses built-in
+settings by default. Some settings are not consistent with previous
+shadow 4.8.1 in oe-core. Per shadow 4.8.1 settings, change the default
+shell to /bin/sh and stop creating mail spool.
+
+[1]

https://github.com/shadow-maint/shadow/commit/bbf4b79bc49fd1826eb41f6629669ef0b647267b

meta/recipes-extended/shadow/files/0001-useradd-update-default-settings.patch new file +27 -0
+
+Upstream-Status: Inappropriate [embedded specific]
+
+Signed-off-by: Yi Zhao <[email protected]>
+---
+ src/useradd.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/useradd.c b/src/useradd.c
+index 0d3f390d..715351b4 100644
+--- a/src/useradd.c
++++ b/src/useradd.c
+@@ -104,9 +104,9 @@ FILE *shadow_logfd = NULL;
+ static gid_t def_group = 1000;
+ static const char *def_gname = "other";
+ static const char *def_home = "/home";
+-static const char *def_shell = "/bin/bash";
++static const char *def_shell = "/bin/sh";
+ static const char *def_template = SKEL_DIR;
+-static const char *def_create_mail_spool = "yes";
++static const char *def_create_mail_spool = "no";
+
+ static long def_inactive = -1;
+ static const char *def_expire = "";
+--
+2.25.1
+
meta/recipes-extended/shadow/shadow.inc +1 -0
index 97ffae978a..e2a7a5bac6 100644
@@ -16,6 +16,7 @@ SRC_URI = "
 https://github.com/shadow-maint/shadow/releases/download/v${PV}/${BP}
            file://shadow-relaxed-usernames.patch \
 
 file://0001-Fix-out-of-tree-builds-with-respect-to-libsubid-incl.patch \
            file://0001-libsubid-link-to-PAM-libraries.patch \
+           file://0001-useradd-update-default-settings.patch \
            "

SRC_URI:append:class-target = " \
--
2.25.1

author
#2 lore raw
Quoted 1 line · Alexander Kanavin

If the issue is that /etc/default/useradd was deleted, shouldn't we address this by reinstating that file? Patching the source code does not seem like a better solution, and introduces surprising behaviour for those expecting upstream defaults rather than Yocto's.

Thanks. That's reasonable. I will send V2.

//Yi

Quoted 99 lines

Alex

On Tue, 17 Aug 2021 at 05:11, Yi Zhao <[email protected] <mailto:[email protected]>> wrote:

    The shadow 4.9 stops shiping /etc/default/useradd[1] and uses built-in
    settings by default. Some settings are not consistent with previous
    shadow 4.8.1 in oe-core. Per shadow 4.8.1 settings, change the default
    shell to /bin/sh and stop creating mail spool.

    [1]
    https://github.com/shadow-maint/shadow/commit/bbf4b79bc49fd1826eb41f6629669ef0b647267b
    <https://urldefense.com/v3/__https://github.com/shadow-maint/shadow/commit/bbf4b79bc49fd1826eb41f6629669ef0b647267b__;!!AjveYdw8EvQ!Kk3VAv9WZwGA3kQvHueZFUH7P9syGlPpKSUrJFOeT58lU68Bf5fcNuv3yIPf9hGQng$>

    Signed-off-by: Yi Zhao <[email protected]
    <mailto:[email protected]>>
    ---
     ...0001-useradd-update-default-settings.patch | 38
    +++++++++++++++++++
     meta/recipes-extended/shadow/shadow.inc       |  1 +
     2 files changed, 39 insertions(+)
     create mode 100644
    meta/recipes-extended/shadow/files/0001-useradd-update-default-settings.patch

    diff --git
    a/meta/recipes-extended/shadow/files/0001-useradd-update-default-settings.patch
    b/meta/recipes-extended/shadow/files/0001-useradd-update-default-settings.patch
    new file mode 100644
    index 0000000000..1e6702019b
    --- /dev/null
    +++
    b/meta/recipes-extended/shadow/files/0001-useradd-update-default-settings.patch
    @@ -0,0 +1,38 @@
    +From 46106ec16409ea99f73a8a8823e50ac54db8e122 Mon Sep 17 00:00:00
    2001
    +From: Yi Zhao <[email protected] <mailto:[email protected]>>
    +Date: Tue, 17 Aug 2021 10:11:27 +0800
    +Subject: [PATCH] useradd: update default settings
    +
    +The shadow 4.9 stops shiping /etc/default/useradd[1] and uses
    built-in
    +settings by default. Some settings are not consistent with previous
    +shadow 4.8.1 in oe-core. Per shadow 4.8.1 settings, change the
    default
    +shell to /bin/sh and stop creating mail spool.
    +
    +[1]
    https://github.com/shadow-maint/shadow/commit/bbf4b79bc49fd1826eb41f6629669ef0b647267b
    <https://urldefense.com/v3/__https://github.com/shadow-maint/shadow/commit/bbf4b79bc49fd1826eb41f6629669ef0b647267b__;!!AjveYdw8EvQ!Kk3VAv9WZwGA3kQvHueZFUH7P9syGlPpKSUrJFOeT58lU68Bf5fcNuv3yIPf9hGQng$>
    +
    +Upstream-Status: Inappropriate [embedded specific]
    +
    +Signed-off-by: Yi Zhao <[email protected]
    <mailto:[email protected]>>
    +---
    + src/useradd.c | 4 ++--
    + 1 file changed, 2 insertions(+), 2 deletions(-)
    +
    +diff --git a/src/useradd.c b/src/useradd.c
    +index 0d3f390d..715351b4 100644
    +--- a/src/useradd.c
    ++++ b/src/useradd.c
    +@@ -104,9 +104,9 @@ FILE *shadow_logfd = NULL;
    + static gid_t def_group = 1000;
    + static const char *def_gname = "other";
    + static const char *def_home = "/home";
    +-static const char *def_shell = "/bin/bash";
    ++static const char *def_shell = "/bin/sh";
    + static const char *def_template = SKEL_DIR;
    +-static const char *def_create_mail_spool = "yes";
    ++static const char *def_create_mail_spool = "no";
    +
    + static long def_inactive = -1;
    + static const char *def_expire = "";
    +--
    +2.25.1
    +
    diff --git a/meta/recipes-extended/shadow/shadow.inc
    b/meta/recipes-extended/shadow/shadow.inc
    index 97ffae978a..e2a7a5bac6 100644
    --- a/meta/recipes-extended/shadow/shadow.inc
    +++ b/meta/recipes-extended/shadow/shadow.inc
    @@ -16,6 +16,7 @@ SRC_URI =
    "https://github.com/shadow-maint/shadow/releases/download/v${PV}/${BP}
    <https://urldefense.com/v3/__https://github.com/shadow-maint/shadow/releases/download/v$*7BPV*7D/$*7BBP*7D__;JSUlJQ!!AjveYdw8EvQ!Kk3VAv9WZwGA3kQvHueZFUH7P9syGlPpKSUrJFOeT58lU68Bf5fcNuv3yIMldpXy0w$>
                file://shadow-relaxed-usernames.patch \
    file://0001-Fix-out-of-tree-builds-with-respect-to-libsubid-incl.patch
    \
                file://0001-libsubid-link-to-PAM-libraries.patch \
    +           file://0001-useradd-update-default-settings.patch \
                "

     SRC_URI:append:class-target = " \
    -- 
    2.25.1