blob: 714c3917ce352b1f2ad5bff194ae58aef45a0d01 [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001SUMMARY = "Secure rlogin/rsh/rcp/telnet replacement"
2DESCRIPTION = "Secure rlogin/rsh/rcp/telnet replacement (OpenSSH) \
3Ssh (Secure Shell) is a program for logging into a remote machine \
4and for executing commands on a remote machine."
5HOMEPAGE = "http://openssh.org"
6SECTION = "console/network"
7LICENSE = "BSD"
8LIC_FILES_CHKSUM = "file://LICENCE;md5=e326045657e842541d3f35aada442507"
9
10DEPENDS = "zlib openssl"
11DEPENDS += "${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'libpam', '', d)}"
12
13SRC_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 Williamsf1e5d692016-03-30 15:21:19 -050023 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 Williamsc124f4f2015-09-15 14:41:29 -050027
28PAM_SRC_URI = "file://sshd"
29
Patrick Williamsf1e5d692016-03-30 15:21:19 -050030SRC_URI[md5sum] = "4d8547670e2a220d5ef805ad9e47acf2"
31SRC_URI[sha256sum] = "dd75f024dcf21e06a0d6421d582690bf987a1f6323e32ad6619392f3bfde6bbd"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050032
33inherit useradd update-rc.d update-alternatives systemd
34
35USERADD_PACKAGES = "${PN}-sshd"
36USERADD_PARAM_${PN}-sshd = "--system --no-create-home --home-dir /var/run/sshd --shell /bin/false --user-group sshd"
37INITSCRIPT_PACKAGES = "${PN}-sshd"
38INITSCRIPT_NAME_${PN}-sshd = "sshd"
39INITSCRIPT_PARAMS_${PN}-sshd = "defaults 9"
40
41SYSTEMD_PACKAGES = "${PN}-sshd"
42SYSTEMD_SERVICE_${PN}-sshd = "sshd.socket"
43
44inherit autotools-brokensep ptest
45
46# LFS support:
47CFLAGS += "-D__FILE_OFFSET_BITS=64"
48
49# login path is hardcoded in sshd
50EXTRA_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...
62CACHED_CONFIGUREVARS += "ac_cv_header_bsd_libutil_h=no ac_cv_header_libutil_h=no"
63
64# passwd path is hardcoded in sshd
65CACHED_CONFIGUREVARS += "ac_cv_path_PATH_PASSWD_PROG=${bindir}/passwd"
66
67# We don't want to depend on libblockfile
68CACHED_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.
74EXTRA_OECONF_append_libc-uclibc=" --without-pam"
75
76do_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
85do_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
91do_install_append () {
92 if [ "${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'pam', '', d)}" = "pam" ]; then
Patrick Williamsf1e5d692016-03-30 15:21:19 -050093 install -D -m 0644 ${WORKDIR}/sshd ${D}${sysconfdir}/pam.d/sshd
Patrick Williamsc124f4f2015-09-15 14:41:29 -050094 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
123do_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
128ALLOW_EMPTY_${PN} = "1"
129
130PACKAGES =+ "${PN}-keygen ${PN}-scp ${PN}-ssh ${PN}-sshd ${PN}-sftp ${PN}-misc ${PN}-sftp-server"
131FILES_${PN}-scp = "${bindir}/scp.${BPN}"
132FILES_${PN}-ssh = "${bindir}/ssh.${BPN} ${sysconfdir}/ssh/ssh_config"
133FILES_${PN}-sshd = "${sbindir}/sshd ${sysconfdir}/init.d/sshd ${systemd_unitdir}/system"
134FILES_${PN}-sshd += "${sysconfdir}/ssh/moduli ${sysconfdir}/ssh/sshd_config ${sysconfdir}/ssh/sshd_config_readonly ${sysconfdir}/default/volatiles/99_sshd ${sysconfdir}/pam.d/sshd"
135FILES_${PN}-sftp = "${bindir}/sftp"
136FILES_${PN}-sftp-server = "${libexecdir}/sftp-server"
137FILES_${PN}-misc = "${bindir}/ssh* ${libexecdir}/ssh*"
138FILES_${PN}-keygen = "${bindir}/ssh-keygen"
139
140RDEPENDS_${PN} += "${PN}-scp ${PN}-ssh ${PN}-sshd ${PN}-keygen"
141RDEPENDS_${PN}-sshd += "${PN}-keygen ${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'pam-plugin-keyinit pam-plugin-loginuid', '', d)}"
142RDEPENDS_${PN}-ptest += "${PN}-sftp ${PN}-misc ${PN}-sftp-server make"
143
144RPROVIDES_${PN}-ssh = "ssh"
145RPROVIDES_${PN}-sshd = "sshd"
146
147RCONFLICTS_${PN} = "dropbear"
148RCONFLICTS_${PN}-sshd = "dropbear"
149RCONFLICTS_${PN}-keygen = "ssh-keygen"
150
151CONFFILES_${PN}-sshd = "${sysconfdir}/ssh/sshd_config"
152CONFFILES_${PN}-ssh = "${sysconfdir}/ssh/ssh_config"
153
154ALTERNATIVE_PRIORITY = "90"
155ALTERNATIVE_${PN}-scp = "scp"
156ALTERNATIVE_${PN}-ssh = "ssh"
157