Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [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" |
Brad Bishop | c68388fc | 2019-08-26 01:33:31 -0400 | [diff] [blame] | 8 | LICENSE = "BSD & ISC & MIT" |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 9 | LIC_FILES_CHKSUM = "file://LICENCE;md5=429658c6612f3a9b1293782366ab29d8" |
| 10 | |
Brad Bishop | f3fd288 | 2019-06-21 08:06:37 -0400 | [diff] [blame] | 11 | DEPENDS = "zlib openssl virtual/crypt" |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 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.socket \ |
| 20 | file://sshd@.service \ |
| 21 | file://sshdgenkeys.service \ |
| 22 | file://volatiles.99_sshd \ |
| 23 | file://run-ptest \ |
| 24 | file://fix-potential-signed-overflow-in-pointer-arithmatic.patch \ |
| 25 | file://sshd_check_keys \ |
| 26 | file://add-test-support-for-busybox.patch \ |
Brad Bishop | 64c979e | 2019-11-04 13:55:29 -0500 | [diff] [blame] | 27 | file://0001-upstream-fix-integer-overflow-in-XMSS-private-key-pa.patch \ |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 28 | " |
Brad Bishop | 15ae250 | 2019-06-18 21:44:24 -0400 | [diff] [blame] | 29 | SRC_URI[md5sum] = "bf050f002fe510e1daecd39044e1122d" |
| 30 | SRC_URI[sha256sum] = "bd943879e69498e8031eb6b7f44d08cdc37d59a7ab689aa0b437320c3481fd68" |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 31 | |
| 32 | PAM_SRC_URI = "file://sshd" |
| 33 | |
| 34 | inherit useradd update-rc.d update-alternatives systemd |
| 35 | |
| 36 | USERADD_PACKAGES = "${PN}-sshd" |
| 37 | USERADD_PARAM_${PN}-sshd = "--system --no-create-home --home-dir /var/run/sshd --shell /bin/false --user-group sshd" |
| 38 | INITSCRIPT_PACKAGES = "${PN}-sshd" |
| 39 | INITSCRIPT_NAME_${PN}-sshd = "sshd" |
| 40 | INITSCRIPT_PARAMS_${PN}-sshd = "defaults 9" |
| 41 | |
| 42 | SYSTEMD_PACKAGES = "${PN}-sshd" |
| 43 | SYSTEMD_SERVICE_${PN}-sshd = "sshd.socket" |
| 44 | |
| 45 | inherit autotools-brokensep ptest |
| 46 | |
| 47 | EXTRA_AUTORECONF += "--exclude=aclocal" |
| 48 | |
| 49 | # login path is hardcoded in sshd |
| 50 | EXTRA_OECONF = "'LOGIN_PROGRAM=${base_bindir}/login' \ |
| 51 | ${@bb.utils.contains('DISTRO_FEATURES', 'pam', '--with-pam', '--without-pam', d)} \ |
| 52 | --without-zlib-version-check \ |
| 53 | --with-privsep-path=${localstatedir}/run/sshd \ |
| 54 | --sysconfdir=${sysconfdir}/ssh \ |
| 55 | --with-xauth=${bindir}/xauth \ |
| 56 | --disable-strip \ |
| 57 | " |
| 58 | |
| 59 | # musl doesn't implement wtmp/utmp |
| 60 | EXTRA_OECONF_append_libc-musl = " --disable-wtmp" |
| 61 | |
| 62 | # Since we do not depend on libbsd, we do not want configure to use it |
| 63 | # just because it finds libutil.h. But, specifying --disable-libutil |
| 64 | # causes compile errors, so... |
| 65 | CACHED_CONFIGUREVARS += "ac_cv_header_bsd_libutil_h=no ac_cv_header_libutil_h=no" |
| 66 | |
| 67 | # passwd path is hardcoded in sshd |
| 68 | CACHED_CONFIGUREVARS += "ac_cv_path_PATH_PASSWD_PROG=${bindir}/passwd" |
| 69 | |
| 70 | # We don't want to depend on libblockfile |
| 71 | CACHED_CONFIGUREVARS += "ac_cv_header_maillock_h=no" |
| 72 | |
| 73 | do_configure_prepend () { |
| 74 | export LD="${CC}" |
| 75 | install -m 0644 ${WORKDIR}/sshd_config ${B}/ |
| 76 | install -m 0644 ${WORKDIR}/ssh_config ${B}/ |
| 77 | } |
| 78 | |
| 79 | do_compile_ptest() { |
| 80 | # skip regress/unittests/ binaries: this will silently skip |
| 81 | # unittests in run-ptests which is good because they are so slow. |
| 82 | oe_runmake regress/modpipe regress/setuid-allowed regress/netcat \ |
| 83 | regress/check-perm regress/mkdtemp |
| 84 | } |
| 85 | |
| 86 | do_install_append () { |
| 87 | if [ "${@bb.utils.filter('DISTRO_FEATURES', 'pam', d)}" ]; then |
| 88 | install -D -m 0644 ${WORKDIR}/sshd ${D}${sysconfdir}/pam.d/sshd |
| 89 | sed -i -e 's:#UsePAM no:UsePAM yes:' ${D}${sysconfdir}/ssh/sshd_config |
| 90 | fi |
| 91 | |
| 92 | if [ "${@bb.utils.filter('DISTRO_FEATURES', 'x11', d)}" ]; then |
| 93 | sed -i -e 's:#X11Forwarding no:X11Forwarding yes:' ${D}${sysconfdir}/ssh/sshd_config |
| 94 | fi |
| 95 | |
| 96 | install -d ${D}${sysconfdir}/init.d |
| 97 | install -m 0755 ${WORKDIR}/init ${D}${sysconfdir}/init.d/sshd |
| 98 | rm -f ${D}${bindir}/slogin ${D}${datadir}/Ssh.bin |
| 99 | rmdir ${D}${localstatedir}/run/sshd ${D}${localstatedir}/run ${D}${localstatedir} |
| 100 | install -d ${D}/${sysconfdir}/default/volatiles |
| 101 | install -m 644 ${WORKDIR}/volatiles.99_sshd ${D}/${sysconfdir}/default/volatiles/99_sshd |
| 102 | install -m 0755 ${S}/contrib/ssh-copy-id ${D}${bindir} |
| 103 | |
| 104 | # Create config files for read-only rootfs |
| 105 | install -d ${D}${sysconfdir}/ssh |
| 106 | install -m 644 ${D}${sysconfdir}/ssh/sshd_config ${D}${sysconfdir}/ssh/sshd_config_readonly |
| 107 | sed -i '/HostKey/d' ${D}${sysconfdir}/ssh/sshd_config_readonly |
| 108 | echo "HostKey /var/run/ssh/ssh_host_rsa_key" >> ${D}${sysconfdir}/ssh/sshd_config_readonly |
| 109 | echo "HostKey /var/run/ssh/ssh_host_ecdsa_key" >> ${D}${sysconfdir}/ssh/sshd_config_readonly |
| 110 | echo "HostKey /var/run/ssh/ssh_host_ed25519_key" >> ${D}${sysconfdir}/ssh/sshd_config_readonly |
| 111 | |
| 112 | install -d ${D}${systemd_unitdir}/system |
| 113 | install -c -m 0644 ${WORKDIR}/sshd.socket ${D}${systemd_unitdir}/system |
| 114 | install -c -m 0644 ${WORKDIR}/sshd@.service ${D}${systemd_unitdir}/system |
| 115 | install -c -m 0644 ${WORKDIR}/sshdgenkeys.service ${D}${systemd_unitdir}/system |
| 116 | sed -i -e 's,@BASE_BINDIR@,${base_bindir},g' \ |
| 117 | -e 's,@SBINDIR@,${sbindir},g' \ |
| 118 | -e 's,@BINDIR@,${bindir},g' \ |
| 119 | -e 's,@LIBEXECDIR@,${libexecdir}/${BPN},g' \ |
| 120 | ${D}${systemd_unitdir}/system/sshd.socket ${D}${systemd_unitdir}/system/*.service |
| 121 | |
| 122 | sed -i -e 's,@LIBEXECDIR@,${libexecdir}/${BPN},g' \ |
| 123 | ${D}${sysconfdir}/init.d/sshd |
| 124 | |
| 125 | install -D -m 0755 ${WORKDIR}/sshd_check_keys ${D}${libexecdir}/${BPN}/sshd_check_keys |
| 126 | } |
| 127 | |
| 128 | do_install_ptest () { |
| 129 | sed -i -e "s|^SFTPSERVER=.*|SFTPSERVER=${libexecdir}/sftp-server|" regress/test-exec.sh |
| 130 | cp -r regress ${D}${PTEST_PATH} |
| 131 | } |
| 132 | |
| 133 | ALLOW_EMPTY_${PN} = "1" |
| 134 | |
| 135 | PACKAGES =+ "${PN}-keygen ${PN}-scp ${PN}-ssh ${PN}-sshd ${PN}-sftp ${PN}-misc ${PN}-sftp-server" |
| 136 | FILES_${PN}-scp = "${bindir}/scp.${BPN}" |
| 137 | FILES_${PN}-ssh = "${bindir}/ssh.${BPN} ${sysconfdir}/ssh/ssh_config" |
| 138 | FILES_${PN}-sshd = "${sbindir}/sshd ${sysconfdir}/init.d/sshd ${systemd_unitdir}/system" |
| 139 | FILES_${PN}-sshd += "${sysconfdir}/ssh/moduli ${sysconfdir}/ssh/sshd_config ${sysconfdir}/ssh/sshd_config_readonly ${sysconfdir}/default/volatiles/99_sshd ${sysconfdir}/pam.d/sshd" |
| 140 | FILES_${PN}-sshd += "${libexecdir}/${BPN}/sshd_check_keys" |
| 141 | FILES_${PN}-sftp = "${bindir}/sftp" |
| 142 | FILES_${PN}-sftp-server = "${libexecdir}/sftp-server" |
| 143 | FILES_${PN}-misc = "${bindir}/ssh* ${libexecdir}/ssh*" |
| 144 | FILES_${PN}-keygen = "${bindir}/ssh-keygen" |
| 145 | |
| 146 | RDEPENDS_${PN} += "${PN}-scp ${PN}-ssh ${PN}-sshd ${PN}-keygen" |
| 147 | RDEPENDS_${PN}-sshd += "${PN}-keygen ${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'pam-plugin-keyinit pam-plugin-loginuid', '', d)}" |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 148 | RRECOMMENDS_${PN}-sshd_append_class-target = " rng-tools" |
Brad Bishop | 15ae250 | 2019-06-18 21:44:24 -0400 | [diff] [blame] | 149 | # gdb would make attach-ptrace test pass rather than skip but not worth the build dependencies |
| 150 | RDEPENDS_${PN}-ptest += "${PN}-sftp ${PN}-misc ${PN}-sftp-server make sed sudo coreutils" |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 151 | |
| 152 | RPROVIDES_${PN}-ssh = "ssh" |
| 153 | RPROVIDES_${PN}-sshd = "sshd" |
| 154 | |
| 155 | RCONFLICTS_${PN} = "dropbear" |
| 156 | RCONFLICTS_${PN}-sshd = "dropbear" |
| 157 | |
| 158 | CONFFILES_${PN}-sshd = "${sysconfdir}/ssh/sshd_config" |
| 159 | CONFFILES_${PN}-ssh = "${sysconfdir}/ssh/ssh_config" |
| 160 | |
| 161 | ALTERNATIVE_PRIORITY = "90" |
| 162 | ALTERNATIVE_${PN}-scp = "scp" |
| 163 | ALTERNATIVE_${PN}-ssh = "ssh" |
| 164 | |
| 165 | BBCLASSEXTEND += "nativesdk" |