blob: e11e8d77497d3041f186632c088e309906ff695b [file] [log] [blame]
Brad Bishop316dfdd2018-06-25 12:45:53 -04001SUMMARY = "A suite of security-related network utilities based on \
2the SSH protocol including the ssh client and sshd server"
3DESCRIPTION = "Secure rlogin/rsh/rcp/telnet replacement (OpenSSH) \
4Ssh (Secure Shell) is a program for logging into a remote machine \
5and for executing commands on a remote machine."
6HOMEPAGE = "http://www.openssh.com/"
7SECTION = "console/network"
8LICENSE = "BSD"
9LIC_FILES_CHKSUM = "file://LICENCE;md5=429658c6612f3a9b1293782366ab29d8"
10
11# openssl 1.1 patches are proposed at https://github.com/openssh/openssh-portable/pull/48
12DEPENDS = "zlib openssl10"
13DEPENDS += "${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'libpam', '', d)}"
14
15SRC_URI = "http://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-${PV}.tar.gz \
16 file://sshd_config \
17 file://ssh_config \
18 file://init \
19 ${@bb.utils.contains('DISTRO_FEATURES', 'pam', '${PAM_SRC_URI}', '', d)} \
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://disable-ciphers-not-supported-by-OpenSSL-DES.patch \
29 "
30
31PAM_SRC_URI = "file://sshd"
32
33SRC_URI[md5sum] = "06a88699018e5fef13d4655abfed1f63"
34SRC_URI[sha256sum] = "a323caeeddfe145baaa0db16e98d784b1fbc7dd436a6bf1f479dfd5cd1d21723"
35
36inherit useradd update-rc.d update-alternatives systemd
37
38USERADD_PACKAGES = "${PN}-sshd"
39USERADD_PARAM_${PN}-sshd = "--system --no-create-home --home-dir /var/run/sshd --shell /bin/false --user-group sshd"
40INITSCRIPT_PACKAGES = "${PN}-sshd"
41INITSCRIPT_NAME_${PN}-sshd = "sshd"
42INITSCRIPT_PARAMS_${PN}-sshd = "defaults 9"
43
44SYSTEMD_PACKAGES = "${PN}-sshd"
45SYSTEMD_SERVICE_${PN}-sshd = "sshd.socket"
46
47inherit autotools-brokensep ptest
48
49# LFS support:
50CFLAGS += "-D__FILE_OFFSET_BITS=64"
51
52EXTRA_AUTORECONF += "--exclude=aclocal"
53
54# login path is hardcoded in sshd
55EXTRA_OECONF = "'LOGIN_PROGRAM=${base_bindir}/login' \
56 ${@bb.utils.contains('DISTRO_FEATURES', 'pam', '--with-pam', '--without-pam', d)} \
57 --without-zlib-version-check \
58 --with-privsep-path=/var/run/sshd \
59 --sysconfdir=${sysconfdir}/ssh \
60 --with-xauth=/usr/bin/xauth \
61 --disable-strip \
62 "
63
64# musl doesn't implement wtmp/utmp
65EXTRA_OECONF_append_libc-musl = " --disable-wtmp"
66
67# Since we do not depend on libbsd, we do not want configure to use it
68# just because it finds libutil.h. But, specifying --disable-libutil
69# causes compile errors, so...
70CACHED_CONFIGUREVARS += "ac_cv_header_bsd_libutil_h=no ac_cv_header_libutil_h=no"
71
72# passwd path is hardcoded in sshd
73CACHED_CONFIGUREVARS += "ac_cv_path_PATH_PASSWD_PROG=${bindir}/passwd"
74
75# We don't want to depend on libblockfile
76CACHED_CONFIGUREVARS += "ac_cv_header_maillock_h=no"
77
78do_configure_prepend () {
79 export LD="${CC}"
80 install -m 0644 ${WORKDIR}/sshd_config ${B}/
81 install -m 0644 ${WORKDIR}/ssh_config ${B}/
82}
83
84do_compile_ptest() {
85 # skip regress/unittests/ binaries: this will silently skip
86 # unittests in run-ptests which is good because they are so slow.
87 oe_runmake regress/modpipe regress/setuid-allowed regress/netcat
88}
89
90do_install_append () {
91 if [ "${@bb.utils.filter('DISTRO_FEATURES', 'pam', d)}" ]; then
92 install -D -m 0644 ${WORKDIR}/sshd ${D}${sysconfdir}/pam.d/sshd
93 sed -i -e 's:#UsePAM no:UsePAM yes:' ${D}${sysconfdir}/ssh/sshd_config
94 fi
95
96 if [ "${@bb.utils.filter('DISTRO_FEATURES', 'x11', d)}" ]; then
97 sed -i -e 's:#X11Forwarding no:X11Forwarding yes:' ${D}${sysconfdir}/ssh/sshd_config
98 fi
99
100 install -d ${D}${sysconfdir}/init.d
101 install -m 0755 ${WORKDIR}/init ${D}${sysconfdir}/init.d/sshd
102 rm -f ${D}${bindir}/slogin ${D}${datadir}/Ssh.bin
103 rmdir ${D}${localstatedir}/run/sshd ${D}${localstatedir}/run ${D}${localstatedir}
104 install -d ${D}/${sysconfdir}/default/volatiles
105 install -m 644 ${WORKDIR}/volatiles.99_sshd ${D}/${sysconfdir}/default/volatiles/99_sshd
106 install -m 0755 ${S}/contrib/ssh-copy-id ${D}${bindir}
107
108 # Create config files for read-only rootfs
109 install -d ${D}${sysconfdir}/ssh
110 install -m 644 ${D}${sysconfdir}/ssh/sshd_config ${D}${sysconfdir}/ssh/sshd_config_readonly
111 sed -i '/HostKey/d' ${D}${sysconfdir}/ssh/sshd_config_readonly
112 echo "HostKey /var/run/ssh/ssh_host_rsa_key" >> ${D}${sysconfdir}/ssh/sshd_config_readonly
113 echo "HostKey /var/run/ssh/ssh_host_dsa_key" >> ${D}${sysconfdir}/ssh/sshd_config_readonly
114 echo "HostKey /var/run/ssh/ssh_host_ecdsa_key" >> ${D}${sysconfdir}/ssh/sshd_config_readonly
115 echo "HostKey /var/run/ssh/ssh_host_ed25519_key" >> ${D}${sysconfdir}/ssh/sshd_config_readonly
116
117 install -d ${D}${systemd_unitdir}/system
118 install -c -m 0644 ${WORKDIR}/sshd.socket ${D}${systemd_unitdir}/system
119 install -c -m 0644 ${WORKDIR}/sshd@.service ${D}${systemd_unitdir}/system
120 install -c -m 0644 ${WORKDIR}/sshdgenkeys.service ${D}${systemd_unitdir}/system
121 sed -i -e 's,@BASE_BINDIR@,${base_bindir},g' \
122 -e 's,@SBINDIR@,${sbindir},g' \
123 -e 's,@BINDIR@,${bindir},g' \
124 -e 's,@LIBEXECDIR@,${libexecdir}/${BPN},g' \
125 ${D}${systemd_unitdir}/system/sshd.socket ${D}${systemd_unitdir}/system/*.service
126
127 sed -i -e 's,@LIBEXECDIR@,${libexecdir}/${BPN},g' \
128 ${D}${sysconfdir}/init.d/sshd
129
130 install -D -m 0755 ${WORKDIR}/sshd_check_keys ${D}${libexecdir}/${BPN}/sshd_check_keys
131}
132
133do_install_ptest () {
134 sed -i -e "s|^SFTPSERVER=.*|SFTPSERVER=${libexecdir}/sftp-server|" regress/test-exec.sh
135 cp -r regress ${D}${PTEST_PATH}
136}
137
138ALLOW_EMPTY_${PN} = "1"
139
140PACKAGES =+ "${PN}-keygen ${PN}-scp ${PN}-ssh ${PN}-sshd ${PN}-sftp ${PN}-misc ${PN}-sftp-server"
141FILES_${PN}-scp = "${bindir}/scp.${BPN}"
142FILES_${PN}-ssh = "${bindir}/ssh.${BPN} ${sysconfdir}/ssh/ssh_config"
143FILES_${PN}-sshd = "${sbindir}/sshd ${sysconfdir}/init.d/sshd ${systemd_unitdir}/system"
144FILES_${PN}-sshd += "${sysconfdir}/ssh/moduli ${sysconfdir}/ssh/sshd_config ${sysconfdir}/ssh/sshd_config_readonly ${sysconfdir}/default/volatiles/99_sshd ${sysconfdir}/pam.d/sshd"
145FILES_${PN}-sshd += "${libexecdir}/${BPN}/sshd_check_keys"
146FILES_${PN}-sftp = "${bindir}/sftp"
147FILES_${PN}-sftp-server = "${libexecdir}/sftp-server"
148FILES_${PN}-misc = "${bindir}/ssh* ${libexecdir}/ssh*"
149FILES_${PN}-keygen = "${bindir}/ssh-keygen"
150
151RDEPENDS_${PN} += "${PN}-scp ${PN}-ssh ${PN}-sshd ${PN}-keygen"
152RDEPENDS_${PN}-sshd += "${PN}-keygen ${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'pam-plugin-keyinit pam-plugin-loginuid', '', d)}"
153RDEPENDS_${PN}-ptest += "${PN}-sftp ${PN}-misc ${PN}-sftp-server make"
154
155RPROVIDES_${PN}-ssh = "ssh"
156RPROVIDES_${PN}-sshd = "sshd"
157
158RCONFLICTS_${PN} = "dropbear"
159RCONFLICTS_${PN}-sshd = "dropbear"
160RCONFLICTS_${PN}-keygen = "ssh-keygen"
161
162CONFFILES_${PN}-sshd = "${sysconfdir}/ssh/sshd_config"
163CONFFILES_${PN}-ssh = "${sysconfdir}/ssh/ssh_config"
164
165ALTERNATIVE_PRIORITY = "90"
166ALTERNATIVE_${PN}-scp = "scp"
167ALTERNATIVE_${PN}-ssh = "ssh"