Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | SUMMARY = "Secure rlogin/rsh/rcp/telnet replacement" |
| 2 | DESCRIPTION = "Secure rlogin/rsh/rcp/telnet replacement (OpenSSH) \ |
| 3 | Ssh (Secure Shell) is a program for logging into a remote machine \ |
| 4 | and for executing commands on a remote machine." |
| 5 | HOMEPAGE = "http://openssh.org" |
| 6 | SECTION = "console/network" |
| 7 | LICENSE = "BSD" |
| 8 | LIC_FILES_CHKSUM = "file://LICENCE;md5=e326045657e842541d3f35aada442507" |
| 9 | |
| 10 | DEPENDS = "zlib openssl" |
| 11 | DEPENDS += "${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'libpam', '', d)}" |
| 12 | |
| 13 | SRC_URI = "ftp://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-${PV}.tar.gz \ |
| 14 | file://sshd_config \ |
| 15 | file://ssh_config \ |
| 16 | file://init \ |
| 17 | ${@bb.utils.contains('DISTRO_FEATURES', 'pam', '${PAM_SRC_URI}', '', d)} \ |
| 18 | file://sshd.socket \ |
| 19 | file://sshd@.service \ |
| 20 | file://sshdgenkeys.service \ |
| 21 | file://volatiles.99_sshd \ |
| 22 | file://add-test-support-for-busybox.patch \ |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 23 | file://run-ptest \ |
| 24 | file://CVE-2016-1907_upstream_commit.patch \ |
| 25 | file://CVE-2016-1907_2.patch \ |
| 26 | file://CVE-2016-1907_3.patch " |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 27 | |
| 28 | PAM_SRC_URI = "file://sshd" |
| 29 | |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 30 | SRC_URI[md5sum] = "4d8547670e2a220d5ef805ad9e47acf2" |
| 31 | SRC_URI[sha256sum] = "dd75f024dcf21e06a0d6421d582690bf987a1f6323e32ad6619392f3bfde6bbd" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 32 | |
| 33 | inherit useradd update-rc.d update-alternatives systemd |
| 34 | |
| 35 | USERADD_PACKAGES = "${PN}-sshd" |
| 36 | USERADD_PARAM_${PN}-sshd = "--system --no-create-home --home-dir /var/run/sshd --shell /bin/false --user-group sshd" |
| 37 | INITSCRIPT_PACKAGES = "${PN}-sshd" |
| 38 | INITSCRIPT_NAME_${PN}-sshd = "sshd" |
| 39 | INITSCRIPT_PARAMS_${PN}-sshd = "defaults 9" |
| 40 | |
| 41 | SYSTEMD_PACKAGES = "${PN}-sshd" |
| 42 | SYSTEMD_SERVICE_${PN}-sshd = "sshd.socket" |
| 43 | |
| 44 | inherit autotools-brokensep ptest |
| 45 | |
| 46 | # LFS support: |
| 47 | CFLAGS += "-D__FILE_OFFSET_BITS=64" |
| 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=/var/run/sshd \ |
| 54 | --sysconfdir=${sysconfdir}/ssh \ |
| 55 | --with-xauth=/usr/bin/xauth \ |
| 56 | --disable-strip \ |
| 57 | " |
| 58 | |
| 59 | # Since we do not depend on libbsd, we do not want configure to use it |
| 60 | # just because it finds libutil.h. But, specifying --disable-libutil |
| 61 | # causes compile errors, so... |
| 62 | CACHED_CONFIGUREVARS += "ac_cv_header_bsd_libutil_h=no ac_cv_header_libutil_h=no" |
| 63 | |
| 64 | # passwd path is hardcoded in sshd |
| 65 | CACHED_CONFIGUREVARS += "ac_cv_path_PATH_PASSWD_PROG=${bindir}/passwd" |
| 66 | |
| 67 | # We don't want to depend on libblockfile |
| 68 | CACHED_CONFIGUREVARS += "ac_cv_header_maillock_h=no" |
| 69 | |
| 70 | # This is a workaround for uclibc because including stdio.h |
| 71 | # pulls in pthreads.h and causes conflicts in function prototypes. |
| 72 | # This results in compilation failure, so unless this is fixed, |
| 73 | # disable pam for uclibc. |
| 74 | EXTRA_OECONF_append_libc-uclibc=" --without-pam" |
| 75 | |
| 76 | do_configure_prepend () { |
| 77 | export LD="${CC}" |
| 78 | install -m 0644 ${WORKDIR}/sshd_config ${B}/ |
| 79 | install -m 0644 ${WORKDIR}/ssh_config ${B}/ |
| 80 | if [ ! -e acinclude.m4 -a -e aclocal.m4 ]; then |
| 81 | cp aclocal.m4 acinclude.m4 |
| 82 | fi |
| 83 | } |
| 84 | |
| 85 | do_compile_ptest() { |
| 86 | # skip regress/unittests/ binaries: this will silently skip |
| 87 | # unittests in run-ptests which is good because they are so slow. |
| 88 | oe_runmake regress/modpipe regress/setuid-allowed regress/netcat |
| 89 | } |
| 90 | |
| 91 | do_install_append () { |
| 92 | if [ "${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'pam', '', d)}" = "pam" ]; then |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 93 | install -D -m 0644 ${WORKDIR}/sshd ${D}${sysconfdir}/pam.d/sshd |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 94 | sed -i -e 's:#UsePAM no:UsePAM yes:' ${WORKDIR}/sshd_config ${D}${sysconfdir}/ssh/sshd_config |
| 95 | fi |
| 96 | |
| 97 | install -d ${D}${sysconfdir}/init.d |
| 98 | install -m 0755 ${WORKDIR}/init ${D}${sysconfdir}/init.d/sshd |
| 99 | rm -f ${D}${bindir}/slogin ${D}${datadir}/Ssh.bin |
| 100 | rmdir ${D}${localstatedir}/run/sshd ${D}${localstatedir}/run ${D}${localstatedir} |
| 101 | install -d ${D}/${sysconfdir}/default/volatiles |
| 102 | install -m 644 ${WORKDIR}/volatiles.99_sshd ${D}/${sysconfdir}/default/volatiles/99_sshd |
| 103 | install -m 0755 ${S}/contrib/ssh-copy-id ${D}${bindir} |
| 104 | |
| 105 | # Create config files for read-only rootfs |
| 106 | install -d ${D}${sysconfdir}/ssh |
| 107 | install -m 644 ${D}${sysconfdir}/ssh/sshd_config ${D}${sysconfdir}/ssh/sshd_config_readonly |
| 108 | sed -i '/HostKey/d' ${D}${sysconfdir}/ssh/sshd_config_readonly |
| 109 | echo "HostKey /var/run/ssh/ssh_host_rsa_key" >> ${D}${sysconfdir}/ssh/sshd_config_readonly |
| 110 | echo "HostKey /var/run/ssh/ssh_host_dsa_key" >> ${D}${sysconfdir}/ssh/sshd_config_readonly |
| 111 | echo "HostKey /var/run/ssh/ssh_host_ecdsa_key" >> ${D}${sysconfdir}/ssh/sshd_config_readonly |
| 112 | |
| 113 | install -d ${D}${systemd_unitdir}/system |
| 114 | install -c -m 0644 ${WORKDIR}/sshd.socket ${D}${systemd_unitdir}/system |
| 115 | install -c -m 0644 ${WORKDIR}/sshd@.service ${D}${systemd_unitdir}/system |
| 116 | install -c -m 0644 ${WORKDIR}/sshdgenkeys.service ${D}${systemd_unitdir}/system |
| 117 | sed -i -e 's,@BASE_BINDIR@,${base_bindir},g' \ |
| 118 | -e 's,@SBINDIR@,${sbindir},g' \ |
| 119 | -e 's,@BINDIR@,${bindir},g' \ |
| 120 | ${D}${systemd_unitdir}/system/sshd.socket ${D}${systemd_unitdir}/system/*.service |
| 121 | } |
| 122 | |
| 123 | do_install_ptest () { |
| 124 | sed -i -e "s|^SFTPSERVER=.*|SFTPSERVER=${libdir}/${PN}/sftp-server|" regress/test-exec.sh |
| 125 | cp -r regress ${D}${PTEST_PATH} |
| 126 | } |
| 127 | |
| 128 | ALLOW_EMPTY_${PN} = "1" |
| 129 | |
| 130 | PACKAGES =+ "${PN}-keygen ${PN}-scp ${PN}-ssh ${PN}-sshd ${PN}-sftp ${PN}-misc ${PN}-sftp-server" |
| 131 | FILES_${PN}-scp = "${bindir}/scp.${BPN}" |
| 132 | FILES_${PN}-ssh = "${bindir}/ssh.${BPN} ${sysconfdir}/ssh/ssh_config" |
| 133 | FILES_${PN}-sshd = "${sbindir}/sshd ${sysconfdir}/init.d/sshd ${systemd_unitdir}/system" |
| 134 | FILES_${PN}-sshd += "${sysconfdir}/ssh/moduli ${sysconfdir}/ssh/sshd_config ${sysconfdir}/ssh/sshd_config_readonly ${sysconfdir}/default/volatiles/99_sshd ${sysconfdir}/pam.d/sshd" |
| 135 | FILES_${PN}-sftp = "${bindir}/sftp" |
| 136 | FILES_${PN}-sftp-server = "${libexecdir}/sftp-server" |
| 137 | FILES_${PN}-misc = "${bindir}/ssh* ${libexecdir}/ssh*" |
| 138 | FILES_${PN}-keygen = "${bindir}/ssh-keygen" |
| 139 | |
| 140 | RDEPENDS_${PN} += "${PN}-scp ${PN}-ssh ${PN}-sshd ${PN}-keygen" |
| 141 | RDEPENDS_${PN}-sshd += "${PN}-keygen ${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'pam-plugin-keyinit pam-plugin-loginuid', '', d)}" |
| 142 | RDEPENDS_${PN}-ptest += "${PN}-sftp ${PN}-misc ${PN}-sftp-server make" |
| 143 | |
| 144 | RPROVIDES_${PN}-ssh = "ssh" |
| 145 | RPROVIDES_${PN}-sshd = "sshd" |
| 146 | |
| 147 | RCONFLICTS_${PN} = "dropbear" |
| 148 | RCONFLICTS_${PN}-sshd = "dropbear" |
| 149 | RCONFLICTS_${PN}-keygen = "ssh-keygen" |
| 150 | |
| 151 | CONFFILES_${PN}-sshd = "${sysconfdir}/ssh/sshd_config" |
| 152 | CONFFILES_${PN}-ssh = "${sysconfdir}/ssh/ssh_config" |
| 153 | |
| 154 | ALTERNATIVE_PRIORITY = "90" |
| 155 | ALTERNATIVE_${PN}-scp = "scp" |
| 156 | ALTERNATIVE_${PN}-ssh = "ssh" |
| 157 | |