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