blob: a30f98faa42fdc9f3bc2a07467e0f5b1a0e5d1aa [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001SUMMARY = "A lightweight SSH and SCP implementation"
2HOMEPAGE = "http://matt.ucc.asn.au/dropbear/dropbear.html"
3SECTION = "console/network"
4
5# some files are from other projects and have others license terms:
6# public domain, OpenSSH 3.5p1, OpenSSH3.6.1p2, PuTTY
7LICENSE = "MIT & BSD-3-Clause & BSD-2-Clause & PD"
Andrew Geissler475cb722020-07-10 16:00:51 -05008LIC_FILES_CHKSUM = "file://LICENSE;md5=25cf44512b7bc8966a48b6b1a9b7605f"
Patrick Williamsc124f4f2015-09-15 14:41:29 -05009
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080010DEPENDS = "zlib virtual/crypt"
Brad Bishop6e60e8b2018-02-01 10:27:11 -050011RPROVIDES_${PN} = "ssh sshd"
Brad Bishop15ae2502019-06-18 21:44:24 -040012RCONFLICTS_${PN} = "openssh-sshd openssh"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050013
14DEPENDS += "${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'libpam', '', d)}"
15
16SRC_URI = "http://matt.ucc.asn.au/dropbear/releases/dropbear-${PV}.tar.bz2 \
17 file://0001-urandom-xauth-changes-to-options.h.patch \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050018 file://init \
19 file://dropbearkey.service \
20 file://dropbear@.service \
21 file://dropbear.socket \
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080022 file://dropbear.default \
Brad Bishopc8f47122019-06-24 09:36:18 -040023 ${@bb.utils.contains('DISTRO_FEATURES', 'pam', '${PAM_SRC_URI}', '', d)} \
24 ${@bb.utils.contains('PACKAGECONFIG', 'disable-weak-ciphers', 'file://dropbear-disable-weak-ciphers.patch', '', d)} "
Patrick Williamsc124f4f2015-09-15 14:41:29 -050025
26PAM_SRC_URI = "file://0005-dropbear-enable-pam.patch \
27 file://0006-dropbear-configuration-file.patch \
28 file://dropbear"
29
30PAM_PLUGINS = "libpam-runtime \
31 pam-plugin-deny \
32 pam-plugin-permit \
33 pam-plugin-unix \
34 "
35RDEPENDS_${PN} += "${@bb.utils.contains('DISTRO_FEATURES', 'pam', '${PAM_PLUGINS}', '', d)}"
36
37inherit autotools update-rc.d systemd
38
Brad Bishopc342db32019-05-15 21:57:59 -040039CVE_PRODUCT = "dropbear_ssh"
40
Patrick Williamsc124f4f2015-09-15 14:41:29 -050041INITSCRIPT_NAME = "dropbear"
42INITSCRIPT_PARAMS = "defaults 10"
43
44SYSTEMD_SERVICE_${PN} = "dropbear.socket"
45
Patrick Williamsc124f4f2015-09-15 14:41:29 -050046SBINCOMMANDS = "dropbear dropbearkey dropbearconvert"
47BINCOMMANDS = "dbclient ssh scp"
48EXTRA_OEMAKE = 'MULTI=1 SCPPROGRESS=1 PROGRAMS="${SBINCOMMANDS} ${BINCOMMANDS}"'
Patrick Williamsc0f7c042017-02-23 20:41:17 -060049
Brad Bishopc8f47122019-06-24 09:36:18 -040050PACKAGECONFIG ?= "disable-weak-ciphers"
Patrick Williamsc0f7c042017-02-23 20:41:17 -060051PACKAGECONFIG[system-libtom] = "--disable-bundled-libtom,--enable-bundled-libtom,libtommath libtomcrypt"
Brad Bishopc8f47122019-06-24 09:36:18 -040052PACKAGECONFIG[disable-weak-ciphers] = ""
Patrick Williamsc0f7c042017-02-23 20:41:17 -060053
Patrick Williamsc124f4f2015-09-15 14:41:29 -050054EXTRA_OECONF += "\
55 ${@bb.utils.contains('DISTRO_FEATURES', 'pam', '--enable-pam', '--disable-pam', d)}"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050056
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080057# This option appends to CFLAGS and LDFLAGS from OE
58# This is causing [textrel] QA warning
59EXTRA_OECONF += "--disable-harden"
60
Andrew Geisslerd1e89492021-02-12 15:35:20 -060061# musl does not implement wtmp/logwtmp APIs
62EXTRA_OECONF_append_libc-musl = " --disable-wtmp --disable-lastlog"
63
Patrick Williamsc124f4f2015-09-15 14:41:29 -050064do_install() {
65 install -d ${D}${sysconfdir} \
66 ${D}${sysconfdir}/init.d \
67 ${D}${sysconfdir}/default \
68 ${D}${sysconfdir}/dropbear \
69 ${D}${bindir} \
70 ${D}${sbindir} \
71 ${D}${localstatedir}
72
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080073 install -m 0644 ${WORKDIR}/dropbear.default ${D}${sysconfdir}/default/dropbear
74
Patrick Williamsc124f4f2015-09-15 14:41:29 -050075 install -m 0755 dropbearmulti ${D}${sbindir}/
Brad Bishop6e60e8b2018-02-01 10:27:11 -050076
Brad Bishop79641f22019-09-10 07:20:22 -040077 for i in ${BINCOMMANDS}
78 do
79 # ssh and scp symlinks are created by update-alternatives
80 if [ $i = ssh ] || [ $i = scp ]; then continue; fi
81 ln -s ${sbindir}/dropbearmulti ${D}${bindir}/$i
82 done
Patrick Williamsc124f4f2015-09-15 14:41:29 -050083 for i in ${SBINCOMMANDS}
84 do
85 ln -s ./dropbearmulti ${D}${sbindir}/$i
86 done
87 sed -e 's,/etc,${sysconfdir},g' \
88 -e 's,/usr/sbin,${sbindir},g' \
89 -e 's,/var,${localstatedir},g' \
90 -e 's,/usr/bin,${bindir},g' \
91 -e 's,/usr,${prefix},g' ${WORKDIR}/init > ${D}${sysconfdir}/init.d/dropbear
92 chmod 755 ${D}${sysconfdir}/init.d/dropbear
Brad Bishop6e60e8b2018-02-01 10:27:11 -050093 if [ "${@bb.utils.filter('DISTRO_FEATURES', 'pam', d)}" ]; then
Patrick Williamsc124f4f2015-09-15 14:41:29 -050094 install -d ${D}${sysconfdir}/pam.d
95 install -m 0644 ${WORKDIR}/dropbear ${D}${sysconfdir}/pam.d/
96 fi
97
98 # deal with systemd unit files
99 install -d ${D}${systemd_unitdir}/system
100 install -m 0644 ${WORKDIR}/dropbearkey.service ${D}${systemd_unitdir}/system
101 install -m 0644 ${WORKDIR}/dropbear@.service ${D}${systemd_unitdir}/system
102 install -m 0644 ${WORKDIR}/dropbear.socket ${D}${systemd_unitdir}/system
103 sed -i -e 's,@BASE_BINDIR@,${base_bindir},g' \
104 -e 's,@BINDIR@,${bindir},g' \
105 -e 's,@SBINDIR@,${sbindir},g' \
106 ${D}${systemd_unitdir}/system/dropbear.socket ${D}${systemd_unitdir}/system/*.service
107}
108
109inherit update-alternatives
110
111ALTERNATIVE_PRIORITY = "20"
Brad Bishop79641f22019-09-10 07:20:22 -0400112ALTERNATIVE_${PN} = "${@bb.utils.filter('BINCOMMANDS', 'scp ssh', d)}"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500113
114ALTERNATIVE_TARGET = "${sbindir}/dropbearmulti"
115
116pkg_postrm_append_${PN} () {
117 if [ -f "${sysconfdir}/dropbear/dropbear_rsa_host_key" ]; then
118 rm ${sysconfdir}/dropbear/dropbear_rsa_host_key
119 fi
120 if [ -f "${sysconfdir}/dropbear/dropbear_dss_host_key" ]; then
121 rm ${sysconfdir}/dropbear/dropbear_dss_host_key
122 fi
123}
Brad Bishop79641f22019-09-10 07:20:22 -0400124
125FILES_${PN} += "${bindir}"