Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | SUMMARY = "Tools to change and administer password and group data" |
Brad Bishop | f3f93bb | 2019-10-16 14:33:32 -0400 | [diff] [blame] | 2 | HOMEPAGE = "http://github.com/shadow-maint/shadow" |
Andrew Geissler | 95ac1b8 | 2021-03-31 14:34:31 -0500 | [diff] [blame] | 3 | DESCRIPTION = "${SUMMARY}" |
Brad Bishop | f3f93bb | 2019-10-16 14:33:32 -0400 | [diff] [blame] | 4 | BUGTRACKER = "http://github.com/shadow-maint/shadow/issues" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 5 | SECTION = "base/utils" |
Andrew Geissler | d159c7f | 2021-09-02 21:05:58 -0500 | [diff] [blame] | 6 | LICENSE = "BSD-3-Clause | Artistic-1.0" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 7 | LIC_FILES_CHKSUM = "file://COPYING;md5=ed80ff1c2b40843cf5768e5229cf16e5 \ |
Brad Bishop | c68388fc | 2019-08-26 01:33:31 -0400 | [diff] [blame] | 8 | file://src/passwd.c;beginline=2;endline=30;md5=5720ff729a6ff39ecc9f64555d75f4af" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 9 | |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 10 | DEPENDS = "virtual/crypt" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 11 | |
Brad Bishop | d5ae7d9 | 2018-06-14 09:52:03 -0700 | [diff] [blame] | 12 | UPSTREAM_CHECK_URI = "https://github.com/shadow-maint/shadow/releases" |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 13 | SRC_URI = "https://github.com/shadow-maint/shadow/releases/download/v${PV}/${BP}.tar.gz \ |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 14 | file://shadow-4.1.3-dots-in-usernames.patch \ |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 15 | ${@bb.utils.contains('PACKAGECONFIG', 'pam', '${PAM_SRC_URI}', '', d)} \ |
Brad Bishop | 00e122a | 2019-10-05 11:10:57 -0400 | [diff] [blame] | 16 | file://shadow-relaxed-usernames.patch \ |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 17 | file://0001-Fix-out-of-tree-builds-with-respect-to-libsubid-incl.patch \ |
| 18 | file://0001-libsubid-link-to-PAM-libraries.patch \ |
Andrew Geissler | d159c7f | 2021-09-02 21:05:58 -0500 | [diff] [blame] | 19 | file://0001-libmisc-fix-default-value-in-SHA_get_salt_rounds.patch \ |
| 20 | file://useradd \ |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 21 | " |
| 22 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 23 | SRC_URI:append:class-target = " \ |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 24 | file://login_defs_pam.sed \ |
| 25 | file://shadow-update-pam-conf.patch \ |
| 26 | " |
| 27 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 28 | SRC_URI:append:class-native = " \ |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 29 | file://0001-Disable-use-of-syslog-for-sysroot.patch \ |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 30 | file://commonio.c-fix-unexpected-open-failure-in-chroot-env.patch \ |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 31 | " |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 32 | SRC_URI:append:class-nativesdk = " \ |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 33 | file://0001-Disable-use-of-syslog-for-sysroot.patch \ |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 34 | " |
| 35 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 36 | SRC_URI[sha256sum] = "6c4627ff9c9422b96664517ae753c944f2902e92809d0698b65f5fef11985212" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 37 | |
| 38 | # Additional Policy files for PAM |
| 39 | PAM_SRC_URI = "file://pam.d/chfn \ |
| 40 | file://pam.d/chpasswd \ |
| 41 | file://pam.d/chsh \ |
| 42 | file://pam.d/login \ |
| 43 | file://pam.d/newusers \ |
| 44 | file://pam.d/passwd \ |
| 45 | file://pam.d/su" |
| 46 | |
| 47 | inherit autotools gettext |
| 48 | |
Brad Bishop | e2d5b61 | 2018-11-23 10:55:50 +1300 | [diff] [blame] | 49 | export CONFIG_SHELL="/bin/sh" |
| 50 | |
Patrick Williams | 0ca19cc | 2021-08-16 14:03:13 -0500 | [diff] [blame] | 51 | EXTRA_OECONF += "--without-libcrack \ |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 52 | --with-group-name-max-length=24 \ |
| 53 | --enable-subordinate-ids=yes \ |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 54 | --without-sssd \ |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 55 | ${NSCDOPT}" |
| 56 | |
| 57 | NSCDOPT = "" |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 58 | NSCDOPT:class-native = "--without-nscd" |
| 59 | NSCDOPT:class-nativesdk = "--without-nscd" |
| 60 | NSCDOPT:libc-glibc = "--with-nscd" |
Brad Bishop | f3f93bb | 2019-10-16 14:33:32 -0400 | [diff] [blame] | 61 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 62 | PAM_PLUGINS = "libpam-runtime \ |
| 63 | pam-plugin-faildelay \ |
| 64 | pam-plugin-securetty \ |
| 65 | pam-plugin-nologin \ |
| 66 | pam-plugin-env \ |
| 67 | pam-plugin-group \ |
| 68 | pam-plugin-limits \ |
| 69 | pam-plugin-lastlog \ |
| 70 | pam-plugin-motd \ |
| 71 | pam-plugin-mail \ |
| 72 | pam-plugin-shells \ |
| 73 | pam-plugin-rootok" |
| 74 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 75 | PAM_PLUGINS:remove:libc-musl = "pam-plugin-lastlog" |
Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame] | 76 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 77 | PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'pam', d)} \ |
| 78 | ${@bb.utils.contains('DISTRO_FEATURES', 'xattr', 'attr', '', d)}" |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 79 | PACKAGECONFIG:class-native ??= "${@bb.utils.contains('DISTRO_FEATURES', 'xattr', 'attr', '', d)}" |
| 80 | PACKAGECONFIG:class-nativesdk = "" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 81 | PACKAGECONFIG[pam] = "--with-libpam,--without-libpam,libpam,${PAM_PLUGINS}" |
| 82 | PACKAGECONFIG[attr] = "--with-attr,--without-attr,attr" |
| 83 | PACKAGECONFIG[acl] = "--with-acl,--without-acl,acl" |
Patrick Williams | 0ca19cc | 2021-08-16 14:03:13 -0500 | [diff] [blame] | 84 | PACKAGECONFIG[audit] = "--with-audit,--without-audit,audit" |
| 85 | PACKAGECONFIG[selinux] = "--with-selinux,--without-selinux,libselinux libsemanage" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 86 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 87 | RDEPENDS:${PN} = "shadow-securetty \ |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 88 | base-passwd \ |
| 89 | util-linux-sulogin" |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 90 | RDEPENDS:${PN}:class-native = "" |
| 91 | RDEPENDS:${PN}:class-nativesdk = "" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 92 | |
| 93 | do_install() { |
| 94 | oe_runmake DESTDIR="${D}" sbindir="${base_sbindir}" usbindir="${sbindir}" install |
| 95 | |
| 96 | # Info dir listing isn't interesting at this point so remove it if it exists. |
| 97 | if [ -e "${D}${infodir}/dir" ]; then |
| 98 | rm -f ${D}${infodir}/dir |
| 99 | fi |
| 100 | |
| 101 | # Enable CREATE_HOME by default. |
| 102 | sed -i 's/#CREATE_HOME/CREATE_HOME/g' ${D}${sysconfdir}/login.defs |
| 103 | |
| 104 | # As we are on an embedded system, ensure the users mailbox is in |
| 105 | # ~/ not /var/spool/mail by default, as who knows where or how big |
| 106 | # /var is. The system MDA will set this later anyway. |
| 107 | sed -i 's/MAIL_DIR/#MAIL_DIR/g' ${D}${sysconfdir}/login.defs |
| 108 | sed -i 's/#MAIL_FILE/MAIL_FILE/g' ${D}${sysconfdir}/login.defs |
| 109 | |
| 110 | # Disable checking emails. |
| 111 | sed -i 's/MAIL_CHECK_ENAB/#MAIL_CHECK_ENAB/g' ${D}${sysconfdir}/login.defs |
| 112 | |
| 113 | # Comment out SU_NAME to work correctly with busybox |
| 114 | # See Bug#5359 and Bug#7173 |
| 115 | sed -i 's:^SU_NAME:#SU_NAME:g' ${D}${sysconfdir}/login.defs |
| 116 | |
| 117 | # Use proper encryption for passwords |
| 118 | sed -i 's/^#ENCRYPT_METHOD.*$/ENCRYPT_METHOD SHA512/' ${D}${sysconfdir}/login.defs |
| 119 | |
Andrew Geissler | d159c7f | 2021-09-02 21:05:58 -0500 | [diff] [blame] | 120 | install -d ${D}${sysconfdir}/default |
| 121 | install -m 0644 ${WORKDIR}/useradd ${D}${sysconfdir}/default |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 122 | } |
| 123 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 124 | do_install:append() { |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 125 | # Ensure that the image has as a /var/spool/mail dir so shadow can |
| 126 | # put mailboxes there if the user reconfigures shadow to its |
| 127 | # defaults (see sed below). |
Brad Bishop | d5ae7d9 | 2018-06-14 09:52:03 -0700 | [diff] [blame] | 128 | install -m 0775 -d ${D}${localstatedir}/spool/mail |
| 129 | chown root:mail ${D}${localstatedir}/spool/mail |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 130 | |
| 131 | if [ -e ${WORKDIR}/pam.d ]; then |
| 132 | install -d ${D}${sysconfdir}/pam.d/ |
| 133 | install -m 0644 ${WORKDIR}/pam.d/* ${D}${sysconfdir}/pam.d/ |
| 134 | # Remove defaults that are not used when supporting PAM. |
| 135 | sed -i -f ${WORKDIR}/login_defs_pam.sed ${D}${sysconfdir}/login.defs |
| 136 | fi |
| 137 | |
Brad Bishop | f3f93bb | 2019-10-16 14:33:32 -0400 | [diff] [blame] | 138 | install -d ${D}${sbindir} ${D}${base_sbindir} ${D}${base_bindir} |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 139 | |
| 140 | # Move binaries to the locations we want |
| 141 | rm ${D}${sbindir}/vigr |
| 142 | ln -sf vipw.${BPN} ${D}${base_sbindir}/vigr |
| 143 | if [ "${sbindir}" != "${base_sbindir}" ]; then |
| 144 | mv ${D}${sbindir}/vipw ${D}${base_sbindir}/vipw |
| 145 | fi |
| 146 | if [ "${bindir}" != "${base_bindir}" ]; then |
| 147 | mv ${D}${bindir}/login ${D}${base_bindir}/login |
| 148 | mv ${D}${bindir}/su ${D}${base_bindir}/su |
| 149 | fi |
| 150 | |
| 151 | # Handle link properly after rename, otherwise missing files would |
| 152 | # lead rpm failed dependencies. |
| 153 | ln -sf newgrp.${BPN} ${D}${bindir}/sg |
| 154 | } |
| 155 | |
| 156 | PACKAGES =+ "${PN}-base" |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 157 | FILES:${PN}-base = "\ |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 158 | ${base_bindir}/login.shadow \ |
| 159 | ${base_bindir}/su.shadow \ |
| 160 | ${bindir}/sg \ |
| 161 | ${bindir}/newgrp.shadow \ |
| 162 | ${bindir}/groups.shadow \ |
| 163 | ${sysconfdir}/pam.d/login \ |
| 164 | ${sysconfdir}/pam.d/su \ |
| 165 | ${sysconfdir}/login.defs \ |
| 166 | " |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 167 | RDEPENDS:${PN} += "${PN}-base" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 168 | |
| 169 | inherit update-alternatives |
| 170 | |
| 171 | ALTERNATIVE_PRIORITY = "200" |
| 172 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 173 | ALTERNATIVE:${PN} = "passwd chfn chsh chpasswd vipw vigr nologin" |
Andrew Geissler | 5f35090 | 2021-07-23 13:09:54 -0400 | [diff] [blame] | 174 | ALTERNATIVE_LINK_NAME[chfn] = "${bindir}/chfn" |
| 175 | ALTERNATIVE_LINK_NAME[chsh] = "${bindir}/chsh" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 176 | ALTERNATIVE_LINK_NAME[chpasswd] = "${sbindir}/chpasswd" |
| 177 | ALTERNATIVE_LINK_NAME[vipw] = "${base_sbindir}/vipw" |
| 178 | ALTERNATIVE_LINK_NAME[vigr] = "${base_sbindir}/vigr" |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 179 | ALTERNATIVE_LINK_NAME[nologin] = "${base_sbindir}/nologin" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 180 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 181 | ALTERNATIVE:${PN}-base = "newgrp groups login su" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 182 | ALTERNATIVE_LINK_NAME[login] = "${base_bindir}/login" |
| 183 | ALTERNATIVE_LINK_NAME[su] = "${base_bindir}/su" |
| 184 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 185 | PACKAGE_WRITE_DEPS += "shadow-native" |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 186 | pkg_postinst:${PN}:class-target () { |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 187 | if [ "x$D" != "x" ]; then |
| 188 | rootarg="--root $D" |
| 189 | else |
| 190 | rootarg="" |
| 191 | fi |
| 192 | |
| 193 | pwconv $rootarg || exit 1 |
| 194 | grpconv $rootarg || exit 1 |
| 195 | } |