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