Patrick Williams | 92b42cb | 2022-09-03 06:53:57 -0500 | [diff] [blame] | 1 | SUMMARY = "A lightweight SSH and SCP implementation" |
| 2 | HOMEPAGE = "http://matt.ucc.asn.au/dropbear/dropbear.html" |
| 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." |
| 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" |
| 9 | LIC_FILES_CHKSUM = "file://LICENSE;md5=25cf44512b7bc8966a48b6b1a9b7605f" |
| 10 | |
| 11 | DEPENDS = "zlib virtual/crypt" |
| 12 | RPROVIDES:${PN} = "ssh sshd" |
| 13 | RCONFLICTS:${PN} = "openssh-sshd openssh" |
| 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 \ |
| 19 | file://init \ |
| 20 | file://dropbearkey.service \ |
| 21 | file://dropbear@.service \ |
| 22 | file://dropbear.socket \ |
| 23 | file://dropbear.default \ |
| 24 | ${@bb.utils.contains('DISTRO_FEATURES', 'pam', '${PAM_SRC_URI}', '', d)} \ |
Andrew Geissler | 87f5cff | 2022-09-30 13:13:31 -0500 | [diff] [blame] | 25 | ${@bb.utils.contains('PACKAGECONFIG', 'disable-weak-ciphers', 'file://dropbear-disable-weak-ciphers.patch', '', d)} \ |
| 26 | file://0007-Fix-X11-build-failure-use-DROPBEAR_PRIO_LOWDELAY.patch" |
Patrick Williams | 03907ee | 2022-05-01 06:28:52 -0500 | [diff] [blame] | 27 | |
| 28 | SRC_URI[sha256sum] = "3a038d2bbc02bf28bbdd20c012091f741a3ec5cbe460691811d714876aad75d1" |
Patrick Williams | 92b42cb | 2022-09-03 06:53:57 -0500 | [diff] [blame] | 29 | |
| 30 | PAM_SRC_URI = "file://0005-dropbear-enable-pam.patch \ |
| 31 | file://0006-dropbear-configuration-file.patch \ |
| 32 | file://dropbear" |
| 33 | |
| 34 | PAM_PLUGINS = "libpam-runtime \ |
| 35 | pam-plugin-deny \ |
| 36 | pam-plugin-permit \ |
| 37 | pam-plugin-unix \ |
| 38 | " |
| 39 | RDEPENDS:${PN} += "${@bb.utils.contains('DISTRO_FEATURES', 'pam', '${PAM_PLUGINS}', '', d)}" |
| 40 | |
| 41 | inherit autotools update-rc.d systemd |
| 42 | |
| 43 | CVE_PRODUCT = "dropbear_ssh" |
| 44 | |
| 45 | INITSCRIPT_NAME = "dropbear" |
| 46 | INITSCRIPT_PARAMS = "defaults 10" |
| 47 | |
| 48 | SYSTEMD_SERVICE:${PN} = "dropbear.socket" |
| 49 | |
| 50 | SBINCOMMANDS = "dropbear dropbearkey dropbearconvert" |
| 51 | BINCOMMANDS = "dbclient ssh scp" |
| 52 | EXTRA_OEMAKE = 'MULTI=1 SCPPROGRESS=1 PROGRAMS="${SBINCOMMANDS} ${BINCOMMANDS}"' |
| 53 | |
| 54 | PACKAGECONFIG ?= "disable-weak-ciphers" |
| 55 | PACKAGECONFIG[system-libtom] = "--disable-bundled-libtom,--enable-bundled-libtom,libtommath libtomcrypt" |
| 56 | PACKAGECONFIG[disable-weak-ciphers] = "" |
Andrew Geissler | 87f5cff | 2022-09-30 13:13:31 -0500 | [diff] [blame] | 57 | PACKAGECONFIG[enable-x11-forwarding] = "" |
Patrick Williams | 92b42cb | 2022-09-03 06:53:57 -0500 | [diff] [blame] | 58 | |
| 59 | EXTRA_OECONF += "\ |
| 60 | ${@bb.utils.contains('DISTRO_FEATURES', 'pam', '--enable-pam', '--disable-pam', d)}" |
| 61 | |
| 62 | # This option appends to CFLAGS and LDFLAGS from OE |
| 63 | # This is causing [textrel] QA warning |
| 64 | EXTRA_OECONF += "--disable-harden" |
| 65 | |
| 66 | # musl does not implement wtmp/logwtmp APIs |
| 67 | EXTRA_OECONF:append:libc-musl = " --disable-wtmp --disable-lastlog" |
| 68 | |
Andrew Geissler | 87f5cff | 2022-09-30 13:13:31 -0500 | [diff] [blame] | 69 | do_configure:append() { |
| 70 | echo "/* Dropbear features */" > ${B}/localoptions.h |
| 71 | if ${@bb.utils.contains('PACKAGECONFIG', 'enable-x11-forwarding', 'true', 'false', d)}; then |
| 72 | echo "#define DROPBEAR_X11FWD 1" >> ${B}/localoptions.h |
| 73 | fi |
| 74 | } |
| 75 | |
Patrick Williams | 92b42cb | 2022-09-03 06:53:57 -0500 | [diff] [blame] | 76 | do_install() { |
| 77 | install -d ${D}${sysconfdir} \ |
| 78 | ${D}${sysconfdir}/init.d \ |
| 79 | ${D}${sysconfdir}/default \ |
| 80 | ${D}${sysconfdir}/dropbear \ |
| 81 | ${D}${bindir} \ |
| 82 | ${D}${sbindir} \ |
| 83 | ${D}${localstatedir} |
| 84 | |
| 85 | install -m 0644 ${WORKDIR}/dropbear.default ${D}${sysconfdir}/default/dropbear |
| 86 | |
| 87 | install -m 0755 dropbearmulti ${D}${sbindir}/ |
| 88 | |
| 89 | for i in ${BINCOMMANDS} |
| 90 | do |
| 91 | # ssh and scp symlinks are created by update-alternatives |
| 92 | if [ $i = ssh ] || [ $i = scp ]; then continue; fi |
| 93 | ln -s ${sbindir}/dropbearmulti ${D}${bindir}/$i |
| 94 | done |
| 95 | for i in ${SBINCOMMANDS} |
| 96 | do |
| 97 | ln -s ./dropbearmulti ${D}${sbindir}/$i |
| 98 | done |
| 99 | sed -e 's,/etc,${sysconfdir},g' \ |
| 100 | -e 's,/usr/sbin,${sbindir},g' \ |
| 101 | -e 's,/var,${localstatedir},g' \ |
| 102 | -e 's,/usr/bin,${bindir},g' \ |
| 103 | -e 's,/usr,${prefix},g' ${WORKDIR}/init > ${D}${sysconfdir}/init.d/dropbear |
| 104 | chmod 755 ${D}${sysconfdir}/init.d/dropbear |
| 105 | if [ "${@bb.utils.filter('DISTRO_FEATURES', 'pam', d)}" ]; then |
| 106 | install -d ${D}${sysconfdir}/pam.d |
| 107 | install -m 0644 ${WORKDIR}/dropbear ${D}${sysconfdir}/pam.d/ |
| 108 | fi |
| 109 | |
| 110 | # deal with systemd unit files |
| 111 | install -d ${D}${systemd_system_unitdir} |
| 112 | install -m 0644 ${WORKDIR}/dropbearkey.service ${D}${systemd_system_unitdir} |
| 113 | install -m 0644 ${WORKDIR}/dropbear@.service ${D}${systemd_system_unitdir} |
| 114 | install -m 0644 ${WORKDIR}/dropbear.socket ${D}${systemd_system_unitdir} |
| 115 | sed -i -e 's,@BASE_BINDIR@,${base_bindir},g' \ |
| 116 | -e 's,@BINDIR@,${bindir},g' \ |
| 117 | -e 's,@SBINDIR@,${sbindir},g' \ |
| 118 | ${D}${systemd_system_unitdir}/dropbear.socket ${D}${systemd_system_unitdir}/*.service |
| 119 | } |
| 120 | |
| 121 | inherit update-alternatives |
| 122 | |
| 123 | ALTERNATIVE_PRIORITY = "20" |
| 124 | ALTERNATIVE:${PN} = "${@bb.utils.filter('BINCOMMANDS', 'scp ssh', d)}" |
| 125 | |
| 126 | ALTERNATIVE_TARGET = "${sbindir}/dropbearmulti" |
| 127 | |
| 128 | pkg_postrm:${PN} () { |
| 129 | if [ -f "${sysconfdir}/dropbear/dropbear_rsa_host_key" ]; then |
| 130 | rm ${sysconfdir}/dropbear/dropbear_rsa_host_key |
| 131 | fi |
| 132 | if [ -f "${sysconfdir}/dropbear/dropbear_dss_host_key" ]; then |
| 133 | rm ${sysconfdir}/dropbear/dropbear_dss_host_key |
| 134 | fi |
| 135 | } |
| 136 | |
| 137 | CONFFILES:${PN} = "${sysconfdir}/default/dropbear" |
| 138 | |
| 139 | FILES:${PN} += "${bindir}" |