Message ID | 20231114203608.1490318-3-joakim.tjernlund@infinera.com |
---|---|
State | New |
Headers | show |
Series | Add sub dir for passwd files | expand |
On Tue, 14 Nov 2023 at 21:36, Joakim Tjernlund via lists.openembedded.org <Joakim.Tjernlund=infinera.com@lists.openembedded.org> wrote: > Add support for creating passwd files in a /etc subdir > +Subject: [PATCH] Define SUBUID_FILE/SUBGID_FILE > + > +Upstream-Status: Pending Pending... what exactly? In other words, upstream first, please. This is clearly not something that oe-core should not be carrying and maintaining and rebasing. Alex
On Wed, 2023-11-15 at 13:35 +0100, Alexander Kanavin wrote: > On Tue, 14 Nov 2023 at 21:36, Joakim Tjernlund via > lists.openembedded.org > <Joakim.Tjernlund=infinera.com@lists.openembedded.org> wrote: > > Add support for creating passwd files in a /etc subdir > > +Subject: [PATCH] Define SUBUID_FILE/SUBGID_FILE > > + > > +Upstream-Status: Pending > > Pending... what exactly? Pending merge > > In other words, upstream first, please. This is clearly not something > that oe-core should not be carrying and maintaining and rebasing. Upstream merged it, see https://github.com/shadow-maint/shadow/commit/ee3a79c6952f8ca649c286c7f76639d9d1dedaad Jocke
On Wed, 15 Nov 2023 at 14:42, Joakim Tjernlund <Joakim.Tjernlund@infinera.com> wrote: > > Pending... what exactly? > > Pending merge If a patch is pending merge, the correct status is 'Submitted' (with a link). If it's already been merged, the correct status is 'Backport' (also with a link). 'Pending' is a frowned-upon status used only when there's a genuine obstacle to upstream submission. > > In other words, upstream first, please. This is clearly not something > > that oe-core should not be carrying and maintaining and rebasing. > > Upstream merged it, see https://github.com/shadow-maint/shadow/commit/ee3a79c6952f8ca649c286c7f76639d9d1dedaad You need to resubmit here with the correct upstream-status then. Alex
On Wed, 2023-11-15 at 14:45 +0100, Alexander Kanavin wrote: > On Wed, 15 Nov 2023 at 14:42, Joakim Tjernlund > <Joakim.Tjernlund@infinera.com> wrote: > > > Pending... what exactly? > > > > Pending merge > > If a patch is pending merge, the correct status is 'Submitted' (with a > link). If it's already been merged, the correct status is 'Backport' > (also with a link). 'Pending' is a frowned-upon status used only when > there's a genuine obstacle to upstream submission. I had no idea, will stay away from Pending then. Thanks. > > > > In other words, upstream first, please. This is clearly not something > > > that oe-core should not be carrying and maintaining and rebasing. > > > > Upstream merged it, see https://github.com/shadow-maint/shadow/commit/ee3a79c6952f8ca649c286c7f76639d9d1dedaad > > You need to resubmit here with the correct upstream-status then. > Will do, I am just not sure on the overall patch submission procedure and what OW in general thinks. Ideally I would like to have this in Kirkstone (and upwards) Jocke
On Wed, 15 Nov 2023 at 15:06, Joakim Tjernlund <Joakim.Tjernlund@infinera.com> wrote: > Will do, I am just not sure on the overall patch submission procedure and what OW in general thinks. > Ideally I would like to have this in Kirkstone (and upwards) Thanks. Whether any additional component patches need to be carried by oe-core has a big influence on what people think, so it's in your interest to emphasize from the start that the patches do come from upstream, and will disappear in a future version update. Alex
On Nov 15, 2023 at 7:09 AM -0700, Joakim Tjernlund via lists.openembedded.org <Joakim.Tjernlund=infinera.com@lists.openembedded.org>, wrote: > On Wed, 2023-11-15 at 14:45 +0100, Alexander Kanavin wrote: > > On Wed, 15 Nov 2023 at 14:42, Joakim Tjernlund > > <Joakim.Tjernlund@infinera.com> wrote: > > > > Pending... what exactly? > > > > > > Pending merge > > > > If a patch is pending merge, the correct status is 'Submitted' (with a > > link). If it's already been merged, the correct status is 'Backport' > > (also with a link). 'Pending' is a frowned-upon status used only when > > there's a genuine obstacle to upstream submission. > > I had no idea, will stay away from Pending then. Thanks. > > > > > > > In other words, upstream first, please. This is clearly not something > > > > that oe-core should not be carrying and maintaining and rebasing. > > > > > > Upstream merged it, see https://github.com/shadow-maint/shadow/commit/ee3a79c6952f8ca649c286c7f76639d9d1dedaad > > > > You need to resubmit here with the correct upstream-status then. > > > > Will do, I am just not sure on the overall patch submission procedure and what OW in general thinks. https://docs.yoctoproject.org/contributor-guide/recipe-style-guide.html#patch-upstream-status in the new contributor guide covers it pretty well now. -- Christopher Larson chris_larson@mentor.com, chris.larson@siemens.com, kergoth@gmail.com Principal Software Engineer, Embedded Linux Solutions, Siemens Digital Industries Software
diff --git a/meta/recipes-extended/shadow/files/0001-Define-SUBUID_FILE-SUBGID_FILE.patch b/meta/recipes-extended/shadow/files/0001-Define-SUBUID_FILE-SUBGID_FILE.patch new file mode 100644 index 0000000000..b02a61e3c2 --- /dev/null +++ b/meta/recipes-extended/shadow/files/0001-Define-SUBUID_FILE-SUBGID_FILE.patch @@ -0,0 +1,92 @@ +From f605fb315faef7ddcad70d638f3b3aa16ea98fc0 Mon Sep 17 00:00:00 2001 +From: Joakim Tjernlund <joakim.tjernlund@infinera.com> +Date: Thu, 2 Nov 2023 00:27:10 +0100 +Subject: [PATCH] Define SUBUID_FILE/SUBGID_FILE + +Upstream-Status: Pending + +These where hard coded, make them definable like SHADOW_FILE + +Signed-off-by: Joakim Tjernlund <joakim.tjernlund@infinera.com> +--- + lib/defines.h | 8 ++++++++ + lib/subordinateio.c | 6 +++--- + libmisc/prefix_flag.c | 8 ++++---- + 3 files changed, 15 insertions(+), 7 deletions(-) + +diff --git a/lib/defines.h b/lib/defines.h +index fc1521c..27b220f 100644 +--- a/lib/defines.h ++++ b/lib/defines.h +@@ -312,6 +312,14 @@ char *strchr (), *strrchr (), *strtok (); + #define SHADOW_FILE "/etc/shadow" + #endif + ++#ifndef SUBUID_FILE ++#define SUBUID_FILE "/etc/subuid" ++#endif ++ ++#ifndef SUBGID_FILE ++#define SUBGID_FILE "/etc/subgid" ++#endif ++ + #ifdef SHADOWGRP + #ifndef SGROUP_FILE + #define SGROUP_FILE "/etc/gshadow" +diff --git a/lib/subordinateio.c b/lib/subordinateio.c +index 9ca70b8..9ddc5e1 100644 +--- a/lib/subordinateio.c ++++ b/lib/subordinateio.c +@@ -206,7 +206,7 @@ static const struct subordinate_range *find_range(struct commonio_db *db, + /* + * We only do special handling for these two files + */ +- if ((0 != strcmp(db->filename, "/etc/subuid")) && (0 != strcmp(db->filename, "/etc/subgid"))) ++ if ((0 != strcmp(db->filename, SUBUID_FILE)) && (0 != strcmp(db->filename, SUBGID_FILE))) + return NULL; + + /* +@@ -554,7 +554,7 @@ static int remove_range (struct commonio_db *db, + } + + static struct commonio_db subordinate_uid_db = { +- "/etc/subuid", /* filename */ ++ SUBUID_FILE, /* filename */ + &subordinate_ops, /* ops */ + NULL, /* fp */ + #ifdef WITH_SELINUX +@@ -650,7 +650,7 @@ uid_t sub_uid_find_free_range(uid_t min, uid_t max, unsigned long count) + } + + static struct commonio_db subordinate_gid_db = { +- "/etc/subgid", /* filename */ ++ SUBGID_FILE, /* filename */ + &subordinate_ops, /* ops */ + NULL, /* fp */ + #ifdef WITH_SELINUX +diff --git a/libmisc/prefix_flag.c b/libmisc/prefix_flag.c +index d4dfbc2..0e7dfa7 100644 +--- a/libmisc/prefix_flag.c ++++ b/libmisc/prefix_flag.c +@@ -120,14 +120,14 @@ extern const char* process_prefix_flag (const char* short_opt, int argc, char ** + spw_setdbname(spw_db_file); + + #ifdef ENABLE_SUBIDS +- len = strlen(prefix) + strlen("/etc/subuid") + 2; ++ len = strlen(prefix) + strlen(SUBUID_FILE) + 2; + suid_db_file = xmalloc(len); +- snprintf(suid_db_file, len, "%s/%s", prefix, "/etc/subuid"); ++ snprintf(suid_db_file, len, "%s/%s", prefix, SUBUID_FILE); + sub_uid_setdbname(suid_db_file); + +- len = strlen(prefix) + strlen("/etc/subgid") + 2; ++ len = strlen(prefix) + strlen(SUBGID_FILE) + 2; + sgid_db_file = xmalloc(len); +- snprintf(sgid_db_file, len, "%s/%s", prefix, "/etc/subgid"); ++ snprintf(sgid_db_file, len, "%s/%s", prefix, SUBGID_FILE); + sub_gid_setdbname(sgid_db_file); + #endif + +-- +2.41.0 + diff --git a/meta/recipes-extended/shadow/shadow.inc b/meta/recipes-extended/shadow/shadow.inc index 3c1dd2f98e..bcb9b09a49 100644 --- a/meta/recipes-extended/shadow/shadow.inc +++ b/meta/recipes-extended/shadow/shadow.inc @@ -18,6 +18,7 @@ SRC_URI = "https://github.com/shadow-maint/shadow/releases/download/v${PV}/${BP} file://useradd \ file://CVE-2023-29383.patch \ file://0001-Overhaul-valid_field.patch \ + file://0001-Define-SUBUID_FILE-SUBGID_FILE.patch \ " SRC_URI:append:class-target = " \ @@ -46,6 +47,21 @@ PAM_SRC_URI = "file://pam.d/chfn \ file://pam.d/passwd \ file://pam.d/su" +#Set PW_SUBDIR to pwdb to get passwd files in /etc/pwdb +PW_SUBDIR ?= "" +PWPRE = "/etc/${PW_SUBDIR}" +CFLAGS:append = ' -DPASSWD_FILE=\\"${PWPRE}/passwd\\"' +CFLAGS:append = ' -DSHADOW_FILE=\\"${PWPRE}/shadow\\"' +CFLAGS:append = ' -DGROUP_FILE=\\"${PWPRE}/group\\"' +CFLAGS:append = ' -DSGROUP_FILE=\\"${PWPRE}/gshadow\\"' +CFLAGS:append = ' -DSUBUID_FILE=\\"${PWPRE}/subuid\\"' +CFLAGS:append = ' -DSUBGID_FILE=\\"${PWPRE}/subgid\\"' + +#shadow has it own impl. that uses whatever dir passwd files are in +do_configure:prepend () { + sed -i -e 's/lckpwdf//' ${S}/configure.ac +} + inherit autotools gettext export CONFIG_SHELL="/bin/sh" @@ -157,9 +173,9 @@ do_install:append() { # usermod requires the subuid/subgid files to be in place before being # able to use the -v/-V flags otherwise it fails: # usermod: /etc/subuid does not exist, you cannot use the flags -v or -V - install -d ${D}${sysconfdir} - touch ${D}${sysconfdir}/subuid - touch ${D}${sysconfdir}/subgid + install -d ${D}${sysconfdir}/${PW_SUBDIR} + touch ${D}${sysconfdir}/${PW_SUBDIR}/subuid + touch ${D}${sysconfdir}/${PW_SUBDIR}/subgid } PACKAGES =+ "${PN}-base" @@ -193,12 +209,18 @@ ALTERNATIVE_LINK_NAME[su] = "${base_bindir}/su" PACKAGE_WRITE_DEPS += "shadow-native" pkg_postinst:${PN}:class-target () { + install -d $D${sysconfdir}/${PW_SUBDIR} if [ "x$D" != "x" ]; then rootarg="--root $D" else rootarg="" fi - + if [ -n "${PW_SUBDIR}" ]; then + ln -fs ${PW_SUBDIR}/subuid $D${sysconfdir}/subuid + ln -fs ${PW_SUBDIR}/subgid $D${sysconfdir}/subgid + ln -fs ${PW_SUBDIR}/shadow $D${sysconfdir}/shadow + ln -fs ${PW_SUBDIR}/gshadow $D${sysconfdir}/gshadow + fi pwconv $rootarg || exit 1 grpconv $rootarg || exit 1 }
Add support for creating passwd files in a /etc subdir Set PW_SUBIR to pwdb to get passwd files in /etc/pwdb Signed-off-by: Joakim Tjernlund <joakim.tjernlund@infinera.com> --- .../0001-Define-SUBUID_FILE-SUBGID_FILE.patch | 92 +++++++++++++++++++ meta/recipes-extended/shadow/shadow.inc | 30 +++++- 2 files changed, 118 insertions(+), 4 deletions(-) create mode 100644 meta/recipes-extended/shadow/files/0001-Define-SUBUID_FILE-SUBGID_FILE.patch