Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | SUMMARY = "A lightweight SSH and SCP implementation" |
| 2 | HOMEPAGE = "http://matt.ucc.asn.au/dropbear/dropbear.html" |
Andrew Geissler | 90fd73c | 2021-03-05 15:25:55 -0600 | [diff] [blame] | 3 | DESCRIPTION = "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 Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 4 | SECTION = "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 |
| 8 | LICENSE = "MIT & BSD-3-Clause & BSD-2-Clause & PD" |
Andrew Geissler | 475cb72 | 2020-07-10 16:00:51 -0500 | [diff] [blame] | 9 | LIC_FILES_CHKSUM = "file://LICENSE;md5=25cf44512b7bc8966a48b6b1a9b7605f" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 10 | |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 11 | DEPENDS = "zlib virtual/crypt" |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 12 | RPROVIDES:${PN} = "ssh sshd" |
| 13 | RCONFLICTS:${PN} = "openssh-sshd openssh" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 14 | |
| 15 | DEPENDS += "${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'libpam', '', d)}" |
| 16 | |
| 17 | SRC_URI = "http://matt.ucc.asn.au/dropbear/releases/dropbear-${PV}.tar.bz2 \ |
| 18 | file://0001-urandom-xauth-changes-to-options.h.patch \ |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 19 | file://init \ |
| 20 | file://dropbearkey.service \ |
| 21 | file://dropbear@.service \ |
| 22 | file://dropbear.socket \ |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 23 | file://dropbear.default \ |
Brad Bishop | c8f4712 | 2019-06-24 09:36:18 -0400 | [diff] [blame] | 24 | ${@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 Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 26 | |
| 27 | PAM_SRC_URI = "file://0005-dropbear-enable-pam.patch \ |
| 28 | file://0006-dropbear-configuration-file.patch \ |
| 29 | file://dropbear" |
| 30 | |
| 31 | PAM_PLUGINS = "libpam-runtime \ |
| 32 | pam-plugin-deny \ |
| 33 | pam-plugin-permit \ |
| 34 | pam-plugin-unix \ |
| 35 | " |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 36 | RDEPENDS:${PN} += "${@bb.utils.contains('DISTRO_FEATURES', 'pam', '${PAM_PLUGINS}', '', d)}" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 37 | |
| 38 | inherit autotools update-rc.d systemd |
| 39 | |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 40 | CVE_PRODUCT = "dropbear_ssh" |
| 41 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 42 | INITSCRIPT_NAME = "dropbear" |
| 43 | INITSCRIPT_PARAMS = "defaults 10" |
| 44 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 45 | SYSTEMD_SERVICE:${PN} = "dropbear.socket" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 46 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 47 | SBINCOMMANDS = "dropbear dropbearkey dropbearconvert" |
| 48 | BINCOMMANDS = "dbclient ssh scp" |
| 49 | EXTRA_OEMAKE = 'MULTI=1 SCPPROGRESS=1 PROGRAMS="${SBINCOMMANDS} ${BINCOMMANDS}"' |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 50 | |
Brad Bishop | c8f4712 | 2019-06-24 09:36:18 -0400 | [diff] [blame] | 51 | PACKAGECONFIG ?= "disable-weak-ciphers" |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 52 | PACKAGECONFIG[system-libtom] = "--disable-bundled-libtom,--enable-bundled-libtom,libtommath libtomcrypt" |
Brad Bishop | c8f4712 | 2019-06-24 09:36:18 -0400 | [diff] [blame] | 53 | PACKAGECONFIG[disable-weak-ciphers] = "" |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 54 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 55 | EXTRA_OECONF += "\ |
| 56 | ${@bb.utils.contains('DISTRO_FEATURES', 'pam', '--enable-pam', '--disable-pam', d)}" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 57 | |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 58 | # This option appends to CFLAGS and LDFLAGS from OE |
| 59 | # This is causing [textrel] QA warning |
| 60 | EXTRA_OECONF += "--disable-harden" |
| 61 | |
Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame] | 62 | # musl does not implement wtmp/logwtmp APIs |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 63 | EXTRA_OECONF:append:libc-musl = " --disable-wtmp --disable-lastlog" |
Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame] | 64 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 65 | do_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 Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 74 | install -m 0644 ${WORKDIR}/dropbear.default ${D}${sysconfdir}/default/dropbear |
| 75 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 76 | install -m 0755 dropbearmulti ${D}${sbindir}/ |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 77 | |
Brad Bishop | 79641f2 | 2019-09-10 07:20:22 -0400 | [diff] [blame] | 78 | 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 Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 84 | 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 Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 94 | if [ "${@bb.utils.filter('DISTRO_FEATURES', 'pam', d)}" ]; then |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 95 | 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 Geissler | 5199d83 | 2021-09-24 16:47:35 -0500 | [diff] [blame] | 100 | 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 Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 104 | sed -i -e 's,@BASE_BINDIR@,${base_bindir},g' \ |
| 105 | -e 's,@BINDIR@,${bindir},g' \ |
| 106 | -e 's,@SBINDIR@,${sbindir},g' \ |
Andrew Geissler | 5199d83 | 2021-09-24 16:47:35 -0500 | [diff] [blame] | 107 | ${D}${systemd_system_unitdir}/dropbear.socket ${D}${systemd_system_unitdir}/*.service |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 108 | } |
| 109 | |
| 110 | inherit update-alternatives |
| 111 | |
| 112 | ALTERNATIVE_PRIORITY = "20" |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 113 | ALTERNATIVE:${PN} = "${@bb.utils.filter('BINCOMMANDS', 'scp ssh', d)}" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 114 | |
| 115 | ALTERNATIVE_TARGET = "${sbindir}/dropbearmulti" |
| 116 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 117 | pkg_postrm:${PN} () { |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 118 | 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 Bishop | 79641f2 | 2019-09-10 07:20:22 -0400 | [diff] [blame] | 125 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 126 | FILES:${PN} += "${bindir}" |