blob: eeeb4b4c732bc3b67bbae0dbd008d61d00d43a06 [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 \
23 file://run-ptest"
24
25PAM_SRC_URI = "file://sshd"
26
27SRC_URI[md5sum] = "8709736bc8a8c253bc4eeb4829888ca5"
28SRC_URI[sha256sum] = "fc0a6d2d1d063d5c66dffd952493d0cda256cad204f681de0f84ef85b2ad8428"
29
30inherit useradd update-rc.d update-alternatives systemd
31
32USERADD_PACKAGES = "${PN}-sshd"
33USERADD_PARAM_${PN}-sshd = "--system --no-create-home --home-dir /var/run/sshd --shell /bin/false --user-group sshd"
34INITSCRIPT_PACKAGES = "${PN}-sshd"
35INITSCRIPT_NAME_${PN}-sshd = "sshd"
36INITSCRIPT_PARAMS_${PN}-sshd = "defaults 9"
37
38SYSTEMD_PACKAGES = "${PN}-sshd"
39SYSTEMD_SERVICE_${PN}-sshd = "sshd.socket"
40
41inherit autotools-brokensep ptest
42
43# LFS support:
44CFLAGS += "-D__FILE_OFFSET_BITS=64"
45
46# login path is hardcoded in sshd
47EXTRA_OECONF = "'LOGIN_PROGRAM=${base_bindir}/login' \
48 ${@bb.utils.contains('DISTRO_FEATURES', 'pam', '--with-pam', '--without-pam', d)} \
49 --without-zlib-version-check \
50 --with-privsep-path=/var/run/sshd \
51 --sysconfdir=${sysconfdir}/ssh \
52 --with-xauth=/usr/bin/xauth \
53 --disable-strip \
54 "
55
56# Since we do not depend on libbsd, we do not want configure to use it
57# just because it finds libutil.h. But, specifying --disable-libutil
58# causes compile errors, so...
59CACHED_CONFIGUREVARS += "ac_cv_header_bsd_libutil_h=no ac_cv_header_libutil_h=no"
60
61# passwd path is hardcoded in sshd
62CACHED_CONFIGUREVARS += "ac_cv_path_PATH_PASSWD_PROG=${bindir}/passwd"
63
64# We don't want to depend on libblockfile
65CACHED_CONFIGUREVARS += "ac_cv_header_maillock_h=no"
66
67# This is a workaround for uclibc because including stdio.h
68# pulls in pthreads.h and causes conflicts in function prototypes.
69# This results in compilation failure, so unless this is fixed,
70# disable pam for uclibc.
71EXTRA_OECONF_append_libc-uclibc=" --without-pam"
72
73do_configure_prepend () {
74 export LD="${CC}"
75 install -m 0644 ${WORKDIR}/sshd_config ${B}/
76 install -m 0644 ${WORKDIR}/ssh_config ${B}/
77 if [ ! -e acinclude.m4 -a -e aclocal.m4 ]; then
78 cp aclocal.m4 acinclude.m4
79 fi
80}
81
82do_compile_ptest() {
83 # skip regress/unittests/ binaries: this will silently skip
84 # unittests in run-ptests which is good because they are so slow.
85 oe_runmake regress/modpipe regress/setuid-allowed regress/netcat
86}
87
88do_install_append () {
89 if [ "${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'pam', '', d)}" = "pam" ]; then
90 install -D -m 0755 ${WORKDIR}/sshd ${D}${sysconfdir}/pam.d/sshd
91 sed -i -e 's:#UsePAM no:UsePAM yes:' ${WORKDIR}/sshd_config ${D}${sysconfdir}/ssh/sshd_config
92 fi
93
94 install -d ${D}${sysconfdir}/init.d
95 install -m 0755 ${WORKDIR}/init ${D}${sysconfdir}/init.d/sshd
96 rm -f ${D}${bindir}/slogin ${D}${datadir}/Ssh.bin
97 rmdir ${D}${localstatedir}/run/sshd ${D}${localstatedir}/run ${D}${localstatedir}
98 install -d ${D}/${sysconfdir}/default/volatiles
99 install -m 644 ${WORKDIR}/volatiles.99_sshd ${D}/${sysconfdir}/default/volatiles/99_sshd
100 install -m 0755 ${S}/contrib/ssh-copy-id ${D}${bindir}
101
102 # Create config files for read-only rootfs
103 install -d ${D}${sysconfdir}/ssh
104 install -m 644 ${D}${sysconfdir}/ssh/sshd_config ${D}${sysconfdir}/ssh/sshd_config_readonly
105 sed -i '/HostKey/d' ${D}${sysconfdir}/ssh/sshd_config_readonly
106 echo "HostKey /var/run/ssh/ssh_host_rsa_key" >> ${D}${sysconfdir}/ssh/sshd_config_readonly
107 echo "HostKey /var/run/ssh/ssh_host_dsa_key" >> ${D}${sysconfdir}/ssh/sshd_config_readonly
108 echo "HostKey /var/run/ssh/ssh_host_ecdsa_key" >> ${D}${sysconfdir}/ssh/sshd_config_readonly
109
110 install -d ${D}${systemd_unitdir}/system
111 install -c -m 0644 ${WORKDIR}/sshd.socket ${D}${systemd_unitdir}/system
112 install -c -m 0644 ${WORKDIR}/sshd@.service ${D}${systemd_unitdir}/system
113 install -c -m 0644 ${WORKDIR}/sshdgenkeys.service ${D}${systemd_unitdir}/system
114 sed -i -e 's,@BASE_BINDIR@,${base_bindir},g' \
115 -e 's,@SBINDIR@,${sbindir},g' \
116 -e 's,@BINDIR@,${bindir},g' \
117 ${D}${systemd_unitdir}/system/sshd.socket ${D}${systemd_unitdir}/system/*.service
118}
119
120do_install_ptest () {
121 sed -i -e "s|^SFTPSERVER=.*|SFTPSERVER=${libdir}/${PN}/sftp-server|" regress/test-exec.sh
122 cp -r regress ${D}${PTEST_PATH}
123}
124
125ALLOW_EMPTY_${PN} = "1"
126
127PACKAGES =+ "${PN}-keygen ${PN}-scp ${PN}-ssh ${PN}-sshd ${PN}-sftp ${PN}-misc ${PN}-sftp-server"
128FILES_${PN}-scp = "${bindir}/scp.${BPN}"
129FILES_${PN}-ssh = "${bindir}/ssh.${BPN} ${sysconfdir}/ssh/ssh_config"
130FILES_${PN}-sshd = "${sbindir}/sshd ${sysconfdir}/init.d/sshd ${systemd_unitdir}/system"
131FILES_${PN}-sshd += "${sysconfdir}/ssh/moduli ${sysconfdir}/ssh/sshd_config ${sysconfdir}/ssh/sshd_config_readonly ${sysconfdir}/default/volatiles/99_sshd ${sysconfdir}/pam.d/sshd"
132FILES_${PN}-sftp = "${bindir}/sftp"
133FILES_${PN}-sftp-server = "${libexecdir}/sftp-server"
134FILES_${PN}-misc = "${bindir}/ssh* ${libexecdir}/ssh*"
135FILES_${PN}-keygen = "${bindir}/ssh-keygen"
136
137RDEPENDS_${PN} += "${PN}-scp ${PN}-ssh ${PN}-sshd ${PN}-keygen"
138RDEPENDS_${PN}-sshd += "${PN}-keygen ${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'pam-plugin-keyinit pam-plugin-loginuid', '', d)}"
139RDEPENDS_${PN}-ptest += "${PN}-sftp ${PN}-misc ${PN}-sftp-server make"
140
141RPROVIDES_${PN}-ssh = "ssh"
142RPROVIDES_${PN}-sshd = "sshd"
143
144RCONFLICTS_${PN} = "dropbear"
145RCONFLICTS_${PN}-sshd = "dropbear"
146RCONFLICTS_${PN}-keygen = "ssh-keygen"
147
148CONFFILES_${PN}-sshd = "${sysconfdir}/ssh/sshd_config"
149CONFFILES_${PN}-ssh = "${sysconfdir}/ssh/ssh_config"
150
151ALTERNATIVE_PRIORITY = "90"
152ALTERNATIVE_${PN}-scp = "scp"
153ALTERNATIVE_${PN}-ssh = "ssh"
154