Patrick Williams | ac13d5f | 2023-11-24 18:59:46 -0600 | [diff] [blame] | 1 | SUMMARY = "A suite of security-related network utilities based on \ |
| 2 | the SSH protocol including the ssh client and sshd server" |
| 3 | DESCRIPTION = "Secure rlogin/rsh/rcp/telnet replacement (OpenSSH) \ |
| 4 | Ssh (Secure Shell) is a program for logging into a remote machine \ |
| 5 | and for executing commands on a remote machine." |
| 6 | HOMEPAGE = "http://www.openssh.com/" |
| 7 | SECTION = "console/network" |
| 8 | LICENSE = "BSD-2-Clause & BSD-3-Clause & ISC & MIT" |
| 9 | LIC_FILES_CHKSUM = "file://LICENCE;md5=072979064e691d342002f43cd89c0394" |
| 10 | |
| 11 | DEPENDS = "zlib openssl virtual/crypt" |
| 12 | DEPENDS += "${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'libpam', '', d)}" |
| 13 | |
| 14 | SRC_URI = "http://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-${PV}.tar.gz \ |
| 15 | file://sshd_config \ |
| 16 | file://ssh_config \ |
| 17 | file://init \ |
| 18 | ${@bb.utils.contains('DISTRO_FEATURES', 'pam', '${PAM_SRC_URI}', '', d)} \ |
| 19 | file://sshd.service \ |
| 20 | file://sshd.socket \ |
| 21 | file://sshd@.service \ |
| 22 | file://sshdgenkeys.service \ |
| 23 | file://volatiles.99_sshd \ |
| 24 | file://run-ptest \ |
| 25 | file://fix-potential-signed-overflow-in-pointer-arithmatic.patch \ |
| 26 | file://sshd_check_keys \ |
| 27 | file://add-test-support-for-busybox.patch \ |
| 28 | file://0001-regress-banner.sh-log-input-and-output-files-on-erro.patch \ |
| 29 | file://0001-systemd-Add-optional-support-for-systemd-sd_notify.patch \ |
| 30 | " |
Patrick Williams | 44b3caf | 2024-04-12 16:51:14 -0500 | [diff] [blame] | 31 | SRC_URI[sha256sum] = "490426f766d82a2763fcacd8d83ea3d70798750c7bd2aff2e57dc5660f773ffd" |
Patrick Williams | ac13d5f | 2023-11-24 18:59:46 -0600 | [diff] [blame] | 32 | |
| 33 | CVE_STATUS[CVE-2007-2768] = "not-applicable-config: This CVE is specific to OpenSSH with the pam opie which we don't build/use here." |
| 34 | |
| 35 | # This CVE is specific to OpenSSH server, as used in Fedora and Red Hat Enterprise Linux 7 |
| 36 | # and when running in a Kerberos environment. As such it is not relevant to OpenEmbedded |
| 37 | CVE_STATUS[CVE-2014-9278] = "not-applicable-platform: This CVE is specific to OpenSSH server, as used in Fedora and \ |
| 38 | Red Hat Enterprise Linux 7 and when running in a Kerberos environment" |
| 39 | |
| 40 | CVE_STATUS[CVE-2008-3844] = "not-applicable-platform: Only applies to some distributed RHEL binaries." |
| 41 | |
| 42 | PAM_SRC_URI = "file://sshd" |
| 43 | |
| 44 | inherit manpages useradd update-rc.d update-alternatives systemd |
| 45 | |
| 46 | USERADD_PACKAGES = "${PN}-sshd" |
| 47 | USERADD_PARAM:${PN}-sshd = "--system --no-create-home --home-dir /var/run/sshd --shell /bin/false --user-group sshd" |
| 48 | INITSCRIPT_PACKAGES = "${PN}-sshd" |
| 49 | INITSCRIPT_NAME:${PN}-sshd = "sshd" |
| 50 | INITSCRIPT_PARAMS:${PN}-sshd = "defaults 9" |
| 51 | |
| 52 | SYSTEMD_PACKAGES = "${PN}-sshd" |
Patrick Williams | 705982a | 2024-01-12 09:51:57 -0600 | [diff] [blame] | 53 | SYSTEMD_SERVICE:${PN}-sshd = "${@bb.utils.contains('PACKAGECONFIG','systemd-sshd-socket-mode','sshd.socket', '', d)} ${@bb.utils.contains('PACKAGECONFIG','systemd-sshd-service-mode','sshd.service', '', d)}" |
Patrick Williams | ac13d5f | 2023-11-24 18:59:46 -0600 | [diff] [blame] | 54 | |
| 55 | inherit autotools-brokensep ptest pkgconfig |
| 56 | DEPENDS += "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd', '', d)}" |
| 57 | |
Patrick Williams | 705982a | 2024-01-12 09:51:57 -0600 | [diff] [blame] | 58 | # systemd-sshd-socket-mode means installing sshd.socket |
| 59 | # and systemd-sshd-service-mode corresponding to sshd.service |
| 60 | PACKAGECONFIG ??= "systemd-sshd-socket-mode" |
Patrick Williams | 2f814a6 | 2024-04-16 16:28:03 -0500 | [diff] [blame] | 61 | PACKAGECONFIG[fido2] = "--with-security-key-builtin,--disable-security-key,libfido2" |
Patrick Williams | ac13d5f | 2023-11-24 18:59:46 -0600 | [diff] [blame] | 62 | PACKAGECONFIG[kerberos] = "--with-kerberos5,--without-kerberos5,krb5" |
| 63 | PACKAGECONFIG[ldns] = "--with-ldns,--without-ldns,ldns" |
| 64 | PACKAGECONFIG[libedit] = "--with-libedit,--without-libedit,libedit" |
| 65 | PACKAGECONFIG[manpages] = "--with-mantype=man,--with-mantype=cat" |
Patrick Williams | 705982a | 2024-01-12 09:51:57 -0600 | [diff] [blame] | 66 | PACKAGECONFIG[systemd-sshd-socket-mode] = "" |
| 67 | PACKAGECONFIG[systemd-sshd-service-mode] = "" |
Patrick Williams | ac13d5f | 2023-11-24 18:59:46 -0600 | [diff] [blame] | 68 | |
| 69 | EXTRA_AUTORECONF += "--exclude=aclocal" |
| 70 | |
| 71 | # login path is hardcoded in sshd |
| 72 | EXTRA_OECONF = "'LOGIN_PROGRAM=${base_bindir}/login' \ |
| 73 | ${@bb.utils.contains('DISTRO_FEATURES', 'pam', '--with-pam', '--without-pam', d)} \ |
| 74 | --without-zlib-version-check \ |
| 75 | --with-privsep-path=${localstatedir}/run/sshd \ |
| 76 | --sysconfdir=${sysconfdir}/ssh \ |
| 77 | --with-xauth=${bindir}/xauth \ |
| 78 | --disable-strip \ |
| 79 | ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '--with-systemd', '--without-systemd', d)} \ |
| 80 | " |
| 81 | |
| 82 | # musl doesn't implement wtmp/utmp and logwtmp |
| 83 | EXTRA_OECONF:append:libc-musl = " --disable-wtmp --disable-lastlog" |
| 84 | |
Patrick Williams | 73bd93f | 2024-02-20 08:07:48 -0600 | [diff] [blame] | 85 | # Work around ICE on mips/mips64 starting in 9.6p1 |
| 86 | EXTRA_OECONF:append:mips = " --without-hardening" |
| 87 | EXTRA_OECONF:append:mips64 = " --without-hardening" |
| 88 | |
Patrick Williams | 03514f1 | 2024-04-05 07:04:11 -0500 | [diff] [blame] | 89 | # Work around ICE on powerpc64le starting in 9.6p1 |
| 90 | EXTRA_OECONF:append:powerpc64le = " --without-hardening" |
| 91 | |
Patrick Williams | ac13d5f | 2023-11-24 18:59:46 -0600 | [diff] [blame] | 92 | # Since we do not depend on libbsd, we do not want configure to use it |
| 93 | # just because it finds libutil.h. But, specifying --disable-libutil |
| 94 | # causes compile errors, so... |
| 95 | CACHED_CONFIGUREVARS += "ac_cv_header_bsd_libutil_h=no ac_cv_header_libutil_h=no" |
| 96 | |
| 97 | # passwd path is hardcoded in sshd |
| 98 | CACHED_CONFIGUREVARS += "ac_cv_path_PATH_PASSWD_PROG=${bindir}/passwd" |
| 99 | |
| 100 | # We don't want to depend on libblockfile |
| 101 | CACHED_CONFIGUREVARS += "ac_cv_header_maillock_h=no" |
| 102 | |
| 103 | do_configure:prepend () { |
| 104 | export LD="${CC}" |
| 105 | install -m 0644 ${WORKDIR}/sshd_config ${B}/ |
| 106 | install -m 0644 ${WORKDIR}/ssh_config ${B}/ |
| 107 | } |
| 108 | |
| 109 | do_compile_ptest() { |
| 110 | oe_runmake regress-binaries regress-unit-binaries |
| 111 | } |
| 112 | |
| 113 | do_install:append () { |
| 114 | if [ "${@bb.utils.filter('DISTRO_FEATURES', 'pam', d)}" ]; then |
| 115 | install -D -m 0644 ${WORKDIR}/sshd ${D}${sysconfdir}/pam.d/sshd |
| 116 | sed -i -e 's:#UsePAM no:UsePAM yes:' ${D}${sysconfdir}/ssh/sshd_config |
| 117 | fi |
| 118 | |
| 119 | if [ "${@bb.utils.filter('DISTRO_FEATURES', 'x11', d)}" ]; then |
| 120 | sed -i -e 's:#X11Forwarding no:X11Forwarding yes:' ${D}${sysconfdir}/ssh/sshd_config |
| 121 | fi |
| 122 | |
| 123 | install -d ${D}${sysconfdir}/init.d |
| 124 | install -m 0755 ${WORKDIR}/init ${D}${sysconfdir}/init.d/sshd |
| 125 | rm -f ${D}${bindir}/slogin ${D}${datadir}/Ssh.bin |
| 126 | rmdir ${D}${localstatedir}/run/sshd ${D}${localstatedir}/run ${D}${localstatedir} |
| 127 | install -d ${D}/${sysconfdir}/default/volatiles |
| 128 | install -m 644 ${WORKDIR}/volatiles.99_sshd ${D}/${sysconfdir}/default/volatiles/99_sshd |
| 129 | install -m 0755 ${S}/contrib/ssh-copy-id ${D}${bindir} |
| 130 | |
| 131 | # Create config files for read-only rootfs |
| 132 | install -d ${D}${sysconfdir}/ssh |
| 133 | install -m 644 ${D}${sysconfdir}/ssh/sshd_config ${D}${sysconfdir}/ssh/sshd_config_readonly |
| 134 | sed -i '/HostKey/d' ${D}${sysconfdir}/ssh/sshd_config_readonly |
| 135 | echo "HostKey /var/run/ssh/ssh_host_rsa_key" >> ${D}${sysconfdir}/ssh/sshd_config_readonly |
| 136 | echo "HostKey /var/run/ssh/ssh_host_ecdsa_key" >> ${D}${sysconfdir}/ssh/sshd_config_readonly |
| 137 | echo "HostKey /var/run/ssh/ssh_host_ed25519_key" >> ${D}${sysconfdir}/ssh/sshd_config_readonly |
| 138 | |
| 139 | install -d ${D}${systemd_system_unitdir} |
Patrick Williams | 705982a | 2024-01-12 09:51:57 -0600 | [diff] [blame] | 140 | if ${@bb.utils.contains('PACKAGECONFIG','systemd-sshd-socket-mode','true','false',d)}; then |
| 141 | install -c -m 0644 ${WORKDIR}/sshd.socket ${D}${systemd_system_unitdir} |
| 142 | install -c -m 0644 ${WORKDIR}/sshd@.service ${D}${systemd_system_unitdir} |
| 143 | sed -i -e 's,@BASE_BINDIR@,${base_bindir},g' \ |
| 144 | -e 's,@SBINDIR@,${sbindir},g' \ |
| 145 | -e 's,@BINDIR@,${bindir},g' \ |
| 146 | -e 's,@LIBEXECDIR@,${libexecdir}/${BPN},g' \ |
| 147 | ${D}${systemd_system_unitdir}/sshd.socket |
| 148 | fi |
| 149 | if ${@bb.utils.contains('PACKAGECONFIG','systemd-sshd-service-mode','true','false',d)}; then |
| 150 | install -c -m 0644 ${WORKDIR}/sshd.service ${D}${systemd_system_unitdir} |
| 151 | fi |
Patrick Williams | ac13d5f | 2023-11-24 18:59:46 -0600 | [diff] [blame] | 152 | install -c -m 0644 ${WORKDIR}/sshdgenkeys.service ${D}${systemd_system_unitdir} |
| 153 | sed -i -e 's,@BASE_BINDIR@,${base_bindir},g' \ |
| 154 | -e 's,@SBINDIR@,${sbindir},g' \ |
| 155 | -e 's,@BINDIR@,${bindir},g' \ |
| 156 | -e 's,@LIBEXECDIR@,${libexecdir}/${BPN},g' \ |
Patrick Williams | 705982a | 2024-01-12 09:51:57 -0600 | [diff] [blame] | 157 | ${D}${systemd_system_unitdir}/*.service |
Patrick Williams | ac13d5f | 2023-11-24 18:59:46 -0600 | [diff] [blame] | 158 | |
| 159 | sed -i -e 's,@LIBEXECDIR@,${libexecdir}/${BPN},g' \ |
| 160 | ${D}${sysconfdir}/init.d/sshd |
| 161 | |
| 162 | install -D -m 0755 ${WORKDIR}/sshd_check_keys ${D}${libexecdir}/${BPN}/sshd_check_keys |
| 163 | } |
| 164 | |
| 165 | do_install_ptest () { |
| 166 | sed -i -e "s|^SFTPSERVER=.*|SFTPSERVER=${libexecdir}/sftp-server|" regress/test-exec.sh |
| 167 | cp -r regress ${D}${PTEST_PATH} |
| 168 | cp config.h ${D}${PTEST_PATH} |
| 169 | } |
| 170 | |
| 171 | ALLOW_EMPTY:${PN} = "1" |
| 172 | |
| 173 | PACKAGES =+ "${PN}-keygen ${PN}-scp ${PN}-ssh ${PN}-sshd ${PN}-sftp ${PN}-misc ${PN}-sftp-server" |
| 174 | FILES:${PN}-scp = "${bindir}/scp.${BPN}" |
| 175 | FILES:${PN}-ssh = "${bindir}/ssh.${BPN} ${sysconfdir}/ssh/ssh_config" |
| 176 | FILES:${PN}-sshd = "${sbindir}/sshd ${sysconfdir}/init.d/sshd ${systemd_system_unitdir}" |
| 177 | FILES:${PN}-sshd += "${sysconfdir}/ssh/moduli ${sysconfdir}/ssh/sshd_config ${sysconfdir}/ssh/sshd_config_readonly ${sysconfdir}/default/volatiles/99_sshd ${sysconfdir}/pam.d/sshd" |
| 178 | FILES:${PN}-sshd += "${libexecdir}/${BPN}/sshd_check_keys" |
| 179 | FILES:${PN}-sftp = "${bindir}/sftp" |
| 180 | FILES:${PN}-sftp-server = "${libexecdir}/sftp-server" |
| 181 | FILES:${PN}-misc = "${bindir}/ssh* ${libexecdir}/ssh*" |
| 182 | FILES:${PN}-keygen = "${bindir}/ssh-keygen" |
| 183 | |
| 184 | RDEPENDS:${PN} += "${PN}-scp ${PN}-ssh ${PN}-sshd ${PN}-keygen ${PN}-sftp-server" |
| 185 | RDEPENDS:${PN}-sshd += "${PN}-keygen ${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'pam-plugin-keyinit pam-plugin-loginuid', '', d)}" |
| 186 | # gdb would make attach-ptrace test pass rather than skip but not worth the build dependencies |
| 187 | RDEPENDS:${PN}-ptest += "${PN}-sftp ${PN}-misc ${PN}-sftp-server make sed coreutils openssl-bin" |
| 188 | |
| 189 | RPROVIDES:${PN}-ssh = "ssh" |
| 190 | RPROVIDES:${PN}-sshd = "sshd" |
| 191 | |
| 192 | RCONFLICTS:${PN} = "dropbear" |
| 193 | RCONFLICTS:${PN}-sshd = "dropbear" |
| 194 | |
| 195 | CONFFILES:${PN}-sshd = "${sysconfdir}/ssh/sshd_config" |
| 196 | CONFFILES:${PN}-ssh = "${sysconfdir}/ssh/ssh_config" |
| 197 | |
| 198 | ALTERNATIVE_PRIORITY = "90" |
| 199 | ALTERNATIVE:${PN}-scp = "scp" |
| 200 | ALTERNATIVE:${PN}-ssh = "ssh" |
| 201 | |
| 202 | BBCLASSEXTEND += "nativesdk" |