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