openssh_9.8p1.bb 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  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. DEPENDS = "zlib openssl virtual/crypt"
  11. DEPENDS += "${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'libpam', '', d)}"
  12. SRC_URI = "http://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-${PV}.tar.gz \
  13. file://sshd_config \
  14. file://ssh_config \
  15. file://init \
  16. ${@bb.utils.contains('DISTRO_FEATURES', 'pam', '${PAM_SRC_URI}', '', d)} \
  17. file://sshd.service \
  18. file://sshd.socket \
  19. file://sshd@.service \
  20. file://sshdgenkeys.service \
  21. file://volatiles.99_sshd \
  22. file://run-ptest \
  23. file://sshd_check_keys \
  24. file://0001-Cast-to-sockaddr-in-systemd-interface.patch \
  25. file://0001-regress-banner.sh-log-input-and-output-files-on-erro.patch \
  26. file://0001-regress-test-exec-use-the-absolute-path-in-the-SSH-e.patch \
  27. file://CVE-2025-26466.patch \
  28. file://CVE-2025-26465.patch \
  29. "
  30. SRC_URI[sha256sum] = "dd8bd002a379b5d499dfb050dd1fa9af8029e80461f4bb6c523c49973f5a39f3"
  31. 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."
  32. # This CVE is specific to OpenSSH server, as used in Fedora and Red Hat Enterprise Linux 7
  33. # and when running in a Kerberos environment. As such it is not relevant to OpenEmbedded
  34. CVE_STATUS[CVE-2014-9278] = "not-applicable-platform: This CVE is specific to OpenSSH server, as used in Fedora and \
  35. Red Hat Enterprise Linux 7 and when running in a Kerberos environment"
  36. CVE_STATUS[CVE-2008-3844] = "not-applicable-platform: Only applies to some distributed RHEL binaries."
  37. CVE_STATUS[CVE-2023-51767] = "upstream-wontfix: It was demonstrated on modified sshd and does not exist in upstream openssh https://bugzilla.mindrot.org/show_bug.cgi?id=3656#c1."
  38. PAM_SRC_URI = "file://sshd"
  39. inherit manpages useradd update-rc.d update-alternatives systemd
  40. USERADD_PACKAGES = "${PN}-sshd"
  41. USERADD_PARAM:${PN}-sshd = "--system --no-create-home --home-dir /var/run/sshd --shell /bin/false --user-group sshd"
  42. INITSCRIPT_PACKAGES = "${PN}-sshd"
  43. INITSCRIPT_NAME:${PN}-sshd = "sshd"
  44. INITSCRIPT_PARAMS:${PN}-sshd = "defaults 9"
  45. SYSTEMD_PACKAGES = "${PN}-sshd"
  46. 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)}"
  47. inherit autotools-brokensep ptest pkgconfig
  48. # systemd-sshd-socket-mode means installing sshd.socket
  49. # and systemd-sshd-service-mode corresponding to sshd.service
  50. PACKAGECONFIG ??= "systemd-sshd-socket-mode hostkey-ecdsa"
  51. PACKAGECONFIG[fido2] = "--with-security-key-builtin,--disable-security-key,libfido2"
  52. PACKAGECONFIG[kerberos] = "--with-kerberos5,--without-kerberos5,krb5"
  53. PACKAGECONFIG[ldns] = "--with-ldns,--without-ldns,ldns"
  54. PACKAGECONFIG[libedit] = "--with-libedit,--without-libedit,libedit"
  55. PACKAGECONFIG[manpages] = "--with-mantype=man,--with-mantype=cat"
  56. PACKAGECONFIG[systemd-sshd-socket-mode] = ""
  57. PACKAGECONFIG[systemd-sshd-service-mode] = ""
  58. PACKAGECONFIG[hostkey-rsa] = ""
  59. PACKAGECONFIG[hostkey-ecdsa] = ""
  60. PACKAGECONFIG[hostkey-ed25519] = ""
  61. EXTRA_AUTORECONF += "--exclude=aclocal"
  62. # login path is hardcoded in sshd
  63. EXTRA_OECONF = "'LOGIN_PROGRAM=${base_bindir}/login' \
  64. ${@bb.utils.contains('DISTRO_FEATURES', 'pam', '--with-pam', '--without-pam', d)} \
  65. --without-zlib-version-check \
  66. --with-privsep-path=${localstatedir}/run/sshd \
  67. --sysconfdir=${sysconfdir}/ssh \
  68. --with-xauth=${bindir}/xauth \
  69. --disable-strip \
  70. "
  71. # musl doesn't implement wtmp/utmp and logwtmp
  72. EXTRA_OECONF:append:libc-musl = " --disable-wtmp --disable-lastlog"
  73. # Work around ICE on mips/mips64 starting in 9.6p1
  74. EXTRA_OECONF:append:mips = " --without-hardening"
  75. EXTRA_OECONF:append:mips64 = " --without-hardening"
  76. # Work around ICE on powerpc64le starting in 9.6p1
  77. EXTRA_OECONF:append:powerpc64le = " --without-hardening"
  78. # Since we do not depend on libbsd, we do not want configure to use it
  79. # just because it finds libutil.h. But, specifying --disable-libutil
  80. # causes compile errors, so...
  81. CACHED_CONFIGUREVARS += "ac_cv_header_bsd_libutil_h=no ac_cv_header_libutil_h=no"
  82. # passwd path is hardcoded in sshd
  83. CACHED_CONFIGUREVARS += "ac_cv_path_PATH_PASSWD_PROG=${bindir}/passwd"
  84. # We don't want to depend on libblockfile
  85. CACHED_CONFIGUREVARS += "ac_cv_header_maillock_h=no"
  86. do_configure:prepend () {
  87. export LD="${CC}"
  88. install -m 0644 ${UNPACKDIR}/sshd_config ${B}/
  89. install -m 0644 ${UNPACKDIR}/ssh_config ${B}/
  90. }
  91. do_compile_ptest() {
  92. oe_runmake regress-binaries regress-unit-binaries
  93. }
  94. sshd_hostkey_setup() {
  95. # Enable specific ssh host keys
  96. sed -i '/HostKey/d' ${D}${sysconfdir}/ssh/sshd_config
  97. if ${@bb.utils.contains('PACKAGECONFIG','hostkey-rsa','true','false',d)}; then
  98. echo "HostKey /etc/ssh/ssh_host_rsa_key" >> ${D}${sysconfdir}/ssh/sshd_config
  99. fi
  100. if ${@bb.utils.contains('PACKAGECONFIG','hostkey-ecdsa','true','false',d)}; then
  101. echo "HostKey /etc/ssh/ssh_host_ecdsa_key" >> ${D}${sysconfdir}/ssh/sshd_config
  102. fi
  103. if ${@bb.utils.contains('PACKAGECONFIG','hostkey-ed25519','true','false',d)}; then
  104. echo "HostKey /etc/ssh/ssh_host_ed25519_key" >> ${D}${sysconfdir}/ssh/sshd_config
  105. fi
  106. sed -i '/HostKey/d' ${D}${sysconfdir}/ssh/sshd_config_readonly
  107. if ${@bb.utils.contains('PACKAGECONFIG','hostkey-rsa','true','false',d)}; then
  108. echo "HostKey /var/run/ssh/ssh_host_rsa_key" >> ${D}${sysconfdir}/ssh/sshd_config_readonly
  109. fi
  110. if ${@bb.utils.contains('PACKAGECONFIG','hostkey-ecdsa','true','false',d)}; then
  111. echo "HostKey /var/run/ssh/ssh_host_ecdsa_key" >> ${D}${sysconfdir}/ssh/sshd_config_readonly
  112. fi
  113. if ${@bb.utils.contains('PACKAGECONFIG','hostkey-ed25519','true','false',d)}; then
  114. echo "HostKey /var/run/ssh/ssh_host_ed25519_key" >> ${D}${sysconfdir}/ssh/sshd_config_readonly
  115. fi
  116. }
  117. do_install:append () {
  118. if [ "${@bb.utils.filter('DISTRO_FEATURES', 'pam', d)}" ]; then
  119. install -D -m 0644 ${UNPACKDIR}/sshd ${D}${sysconfdir}/pam.d/sshd
  120. sed -i -e 's:#UsePAM no:UsePAM yes:' ${D}${sysconfdir}/ssh/sshd_config
  121. fi
  122. if [ "${@bb.utils.filter('DISTRO_FEATURES', 'x11', d)}" ]; then
  123. sed -i -e 's:#X11Forwarding no:X11Forwarding yes:' ${D}${sysconfdir}/ssh/sshd_config
  124. fi
  125. install -d ${D}${sysconfdir}/init.d
  126. install -m 0755 ${UNPACKDIR}/init ${D}${sysconfdir}/init.d/sshd
  127. rm -f ${D}${bindir}/slogin ${D}${datadir}/Ssh.bin
  128. rmdir ${D}${localstatedir}/run/sshd ${D}${localstatedir}/run ${D}${localstatedir}
  129. install -d ${D}/${sysconfdir}/default/volatiles
  130. install -m 644 ${UNPACKDIR}/volatiles.99_sshd ${D}/${sysconfdir}/default/volatiles/99_sshd
  131. install -m 0755 ${S}/contrib/ssh-copy-id ${D}${bindir}
  132. # Create config files for read-only rootfs
  133. install -d ${D}${sysconfdir}/ssh
  134. install -m 644 ${D}${sysconfdir}/ssh/sshd_config ${D}${sysconfdir}/ssh/sshd_config_readonly
  135. install -d ${D}${systemd_system_unitdir}
  136. if ${@bb.utils.contains('PACKAGECONFIG','systemd-sshd-socket-mode','true','false',d)}; then
  137. install -c -m 0644 ${UNPACKDIR}/sshd.socket ${D}${systemd_system_unitdir}
  138. install -c -m 0644 ${UNPACKDIR}/sshd@.service ${D}${systemd_system_unitdir}
  139. sed -i -e 's,@BASE_BINDIR@,${base_bindir},g' \
  140. -e 's,@SBINDIR@,${sbindir},g' \
  141. -e 's,@BINDIR@,${bindir},g' \
  142. -e 's,@LIBEXECDIR@,${libexecdir}/${BPN},g' \
  143. ${D}${systemd_system_unitdir}/sshd.socket
  144. fi
  145. if ${@bb.utils.contains('PACKAGECONFIG','systemd-sshd-service-mode','true','false',d)}; then
  146. install -c -m 0644 ${UNPACKDIR}/sshd.service ${D}${systemd_system_unitdir}
  147. fi
  148. install -c -m 0644 ${UNPACKDIR}/sshdgenkeys.service ${D}${systemd_system_unitdir}
  149. sed -i -e 's,@BASE_BINDIR@,${base_bindir},g' \
  150. -e 's,@SBINDIR@,${sbindir},g' \
  151. -e 's,@BINDIR@,${bindir},g' \
  152. -e 's,@LIBEXECDIR@,${libexecdir}/${BPN},g' \
  153. ${D}${systemd_system_unitdir}/*.service
  154. sed -i -e 's,@LIBEXECDIR@,${libexecdir}/${BPN},g' \
  155. ${D}${sysconfdir}/init.d/sshd
  156. install -D -m 0755 ${UNPACKDIR}/sshd_check_keys ${D}${libexecdir}/${BPN}/sshd_check_keys
  157. sshd_hostkey_setup
  158. }
  159. do_install_ptest () {
  160. sed -i -e "s|^SFTPSERVER=.*|SFTPSERVER=${libexecdir}/sftp-server|" regress/test-exec.sh
  161. cp -r regress ${D}${PTEST_PATH}
  162. cp config.h ${D}${PTEST_PATH}
  163. }
  164. ALLOW_EMPTY:${PN} = "1"
  165. PACKAGES =+ "${PN}-keygen ${PN}-scp ${PN}-ssh ${PN}-sshd ${PN}-sftp ${PN}-misc ${PN}-sftp-server"
  166. FILES:${PN}-scp = "${bindir}/scp.${BPN}"
  167. FILES:${PN}-ssh = "${bindir}/ssh.${BPN} ${sysconfdir}/ssh/ssh_config"
  168. FILES:${PN}-sshd = "${sbindir}/sshd ${libexecdir}/sshd-session ${sysconfdir}/init.d/sshd ${systemd_system_unitdir}"
  169. FILES:${PN}-sshd += "${sysconfdir}/ssh/moduli ${sysconfdir}/ssh/sshd_config ${sysconfdir}/ssh/sshd_config_readonly ${sysconfdir}/default/volatiles/99_sshd ${sysconfdir}/pam.d/sshd"
  170. FILES:${PN}-sshd += "${libexecdir}/${BPN}/sshd_check_keys"
  171. FILES:${PN}-sftp = "${bindir}/sftp"
  172. FILES:${PN}-sftp-server = "${libexecdir}/sftp-server"
  173. FILES:${PN}-misc = "${bindir}/ssh* ${libexecdir}/ssh*"
  174. FILES:${PN}-keygen = "${bindir}/ssh-keygen"
  175. RDEPENDS:${PN} += "${PN}-scp ${PN}-ssh ${PN}-sshd ${PN}-keygen ${PN}-sftp-server"
  176. RDEPENDS:${PN}-sshd += "${PN}-keygen ${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'pam-plugin-keyinit pam-plugin-loginuid', '', d)}"
  177. # gdb would make attach-ptrace test pass rather than skip but not worth the build dependencies
  178. RDEPENDS:${PN}-ptest += "${PN}-sftp ${PN}-misc ${PN}-sftp-server make sed coreutils openssl-bin"
  179. RPROVIDES:${PN}-ssh = "ssh"
  180. RPROVIDES:${PN}-sshd = "sshd"
  181. RCONFLICTS:${PN} = "dropbear"
  182. RCONFLICTS:${PN}-sshd = "dropbear"
  183. CONFFILES:${PN}-sshd = "${sysconfdir}/ssh/sshd_config"
  184. CONFFILES:${PN}-ssh = "${sysconfdir}/ssh/ssh_config"
  185. ALTERNATIVE_PRIORITY = "90"
  186. ALTERNATIVE:${PN}-scp = "scp"
  187. ALTERNATIVE:${PN}-ssh = "ssh"
  188. BBCLASSEXTEND += "nativesdk"