blob: 78f9f9adbd912c434e8b4b8caec69332c89ab91d [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"
Andrew Geissler90fd73c2021-03-05 15:25:55 -06003DESCRIPTION = "Dropbear is a relatively small SSH server and client. It runs on a variety of POSIX-based platforms. Dropbear is open source software, distributed under a MIT-style license. Dropbear is particularly useful for "embedded"-type Linux (or other Unix) systems, such as wireless routers."
Patrick Williamsc124f4f2015-09-15 14:41:29 -05004SECTION = "console/network"
5
6# some files are from other projects and have others license terms:
7# public domain, OpenSSH 3.5p1, OpenSSH3.6.1p2, PuTTY
8LICENSE = "MIT & BSD-3-Clause & BSD-2-Clause & PD"
Andrew Geissler475cb722020-07-10 16:00:51 -05009LIC_FILES_CHKSUM = "file://LICENSE;md5=25cf44512b7bc8966a48b6b1a9b7605f"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050010
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080011DEPENDS = "zlib virtual/crypt"
Patrick Williams213cb262021-08-07 19:21:33 -050012RPROVIDES:${PN} = "ssh sshd"
13RCONFLICTS:${PN} = "openssh-sshd openssh"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050014
15DEPENDS += "${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'libpam', '', d)}"
16
17SRC_URI = "http://matt.ucc.asn.au/dropbear/releases/dropbear-${PV}.tar.bz2 \
18 file://0001-urandom-xauth-changes-to-options.h.patch \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050019 file://init \
20 file://dropbearkey.service \
21 file://dropbear@.service \
22 file://dropbear.socket \
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080023 file://dropbear.default \
Brad Bishopc8f47122019-06-24 09:36:18 -040024 ${@bb.utils.contains('DISTRO_FEATURES', 'pam', '${PAM_SRC_URI}', '', d)} \
25 ${@bb.utils.contains('PACKAGECONFIG', 'disable-weak-ciphers', 'file://dropbear-disable-weak-ciphers.patch', '', d)} "
Patrick Williamsc124f4f2015-09-15 14:41:29 -050026
27PAM_SRC_URI = "file://0005-dropbear-enable-pam.patch \
28 file://0006-dropbear-configuration-file.patch \
29 file://dropbear"
30
31PAM_PLUGINS = "libpam-runtime \
32 pam-plugin-deny \
33 pam-plugin-permit \
34 pam-plugin-unix \
35 "
Patrick Williams213cb262021-08-07 19:21:33 -050036RDEPENDS:${PN} += "${@bb.utils.contains('DISTRO_FEATURES', 'pam', '${PAM_PLUGINS}', '', d)}"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050037
38inherit autotools update-rc.d systemd
39
Brad Bishopc342db32019-05-15 21:57:59 -040040CVE_PRODUCT = "dropbear_ssh"
41
Patrick Williamsc124f4f2015-09-15 14:41:29 -050042INITSCRIPT_NAME = "dropbear"
43INITSCRIPT_PARAMS = "defaults 10"
44
Patrick Williams213cb262021-08-07 19:21:33 -050045SYSTEMD_SERVICE:${PN} = "dropbear.socket"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050046
Patrick Williamsc124f4f2015-09-15 14:41:29 -050047SBINCOMMANDS = "dropbear dropbearkey dropbearconvert"
48BINCOMMANDS = "dbclient ssh scp"
49EXTRA_OEMAKE = 'MULTI=1 SCPPROGRESS=1 PROGRAMS="${SBINCOMMANDS} ${BINCOMMANDS}"'
Patrick Williamsc0f7c042017-02-23 20:41:17 -060050
Brad Bishopc8f47122019-06-24 09:36:18 -040051PACKAGECONFIG ?= "disable-weak-ciphers"
Patrick Williamsc0f7c042017-02-23 20:41:17 -060052PACKAGECONFIG[system-libtom] = "--disable-bundled-libtom,--enable-bundled-libtom,libtommath libtomcrypt"
Brad Bishopc8f47122019-06-24 09:36:18 -040053PACKAGECONFIG[disable-weak-ciphers] = ""
Patrick Williamsc0f7c042017-02-23 20:41:17 -060054
Patrick Williamsc124f4f2015-09-15 14:41:29 -050055EXTRA_OECONF += "\
56 ${@bb.utils.contains('DISTRO_FEATURES', 'pam', '--enable-pam', '--disable-pam', d)}"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050057
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080058# This option appends to CFLAGS and LDFLAGS from OE
59# This is causing [textrel] QA warning
60EXTRA_OECONF += "--disable-harden"
61
Andrew Geisslerd1e89492021-02-12 15:35:20 -060062# musl does not implement wtmp/logwtmp APIs
Patrick Williams213cb262021-08-07 19:21:33 -050063EXTRA_OECONF:append:libc-musl = " --disable-wtmp --disable-lastlog"
Andrew Geisslerd1e89492021-02-12 15:35:20 -060064
Patrick Williamsc124f4f2015-09-15 14:41:29 -050065do_install() {
66 install -d ${D}${sysconfdir} \
67 ${D}${sysconfdir}/init.d \
68 ${D}${sysconfdir}/default \
69 ${D}${sysconfdir}/dropbear \
70 ${D}${bindir} \
71 ${D}${sbindir} \
72 ${D}${localstatedir}
73
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080074 install -m 0644 ${WORKDIR}/dropbear.default ${D}${sysconfdir}/default/dropbear
75
Patrick Williamsc124f4f2015-09-15 14:41:29 -050076 install -m 0755 dropbearmulti ${D}${sbindir}/
Brad Bishop6e60e8b2018-02-01 10:27:11 -050077
Brad Bishop79641f22019-09-10 07:20:22 -040078 for i in ${BINCOMMANDS}
79 do
80 # ssh and scp symlinks are created by update-alternatives
81 if [ $i = ssh ] || [ $i = scp ]; then continue; fi
82 ln -s ${sbindir}/dropbearmulti ${D}${bindir}/$i
83 done
Patrick Williamsc124f4f2015-09-15 14:41:29 -050084 for i in ${SBINCOMMANDS}
85 do
86 ln -s ./dropbearmulti ${D}${sbindir}/$i
87 done
88 sed -e 's,/etc,${sysconfdir},g' \
89 -e 's,/usr/sbin,${sbindir},g' \
90 -e 's,/var,${localstatedir},g' \
91 -e 's,/usr/bin,${bindir},g' \
92 -e 's,/usr,${prefix},g' ${WORKDIR}/init > ${D}${sysconfdir}/init.d/dropbear
93 chmod 755 ${D}${sysconfdir}/init.d/dropbear
Brad Bishop6e60e8b2018-02-01 10:27:11 -050094 if [ "${@bb.utils.filter('DISTRO_FEATURES', 'pam', d)}" ]; then
Patrick Williamsc124f4f2015-09-15 14:41:29 -050095 install -d ${D}${sysconfdir}/pam.d
96 install -m 0644 ${WORKDIR}/dropbear ${D}${sysconfdir}/pam.d/
97 fi
98
99 # deal with systemd unit files
Andrew Geissler5199d832021-09-24 16:47:35 -0500100 install -d ${D}${systemd_system_unitdir}
101 install -m 0644 ${WORKDIR}/dropbearkey.service ${D}${systemd_system_unitdir}
102 install -m 0644 ${WORKDIR}/dropbear@.service ${D}${systemd_system_unitdir}
103 install -m 0644 ${WORKDIR}/dropbear.socket ${D}${systemd_system_unitdir}
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500104 sed -i -e 's,@BASE_BINDIR@,${base_bindir},g' \
105 -e 's,@BINDIR@,${bindir},g' \
106 -e 's,@SBINDIR@,${sbindir},g' \
Andrew Geissler5199d832021-09-24 16:47:35 -0500107 ${D}${systemd_system_unitdir}/dropbear.socket ${D}${systemd_system_unitdir}/*.service
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500108}
109
110inherit update-alternatives
111
112ALTERNATIVE_PRIORITY = "20"
Patrick Williams213cb262021-08-07 19:21:33 -0500113ALTERNATIVE:${PN} = "${@bb.utils.filter('BINCOMMANDS', 'scp ssh', d)}"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500114
115ALTERNATIVE_TARGET = "${sbindir}/dropbearmulti"
116
Patrick Williams213cb262021-08-07 19:21:33 -0500117pkg_postrm:${PN} () {
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500118 if [ -f "${sysconfdir}/dropbear/dropbear_rsa_host_key" ]; then
119 rm ${sysconfdir}/dropbear/dropbear_rsa_host_key
120 fi
121 if [ -f "${sysconfdir}/dropbear/dropbear_dss_host_key" ]; then
122 rm ${sysconfdir}/dropbear/dropbear_dss_host_key
123 fi
124}
Brad Bishop79641f22019-09-10 07:20:22 -0400125
Patrick Williams213cb262021-08-07 19:21:33 -0500126FILES:${PN} += "${bindir}"