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