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" |
| 3 | SECTION = "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 |
| 7 | LICENSE = "MIT & BSD-3-Clause & BSD-2-Clause & PD" |
| 8 | LIC_FILES_CHKSUM = "file://LICENSE;md5=a5ec40cafba26fc4396d0b550f824e01" |
| 9 | |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 10 | DEPENDS = "zlib virtual/crypt" |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 11 | RPROVIDES_${PN} = "ssh sshd" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 12 | |
| 13 | DEPENDS += "${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'libpam', '', d)}" |
| 14 | |
| 15 | SRC_URI = "http://matt.ucc.asn.au/dropbear/releases/dropbear-${PV}.tar.bz2 \ |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 16 | file://CVE-2018-15599.patch \ |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 17 | file://0001-urandom-xauth-changes-to-options.h.patch \ |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 18 | file://init \ |
| 19 | file://dropbearkey.service \ |
| 20 | file://dropbear@.service \ |
| 21 | file://dropbear.socket \ |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 22 | file://dropbear.default \ |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 23 | ${@bb.utils.contains('DISTRO_FEATURES', 'pam', '${PAM_SRC_URI}', '', d)} " |
| 24 | |
| 25 | PAM_SRC_URI = "file://0005-dropbear-enable-pam.patch \ |
| 26 | file://0006-dropbear-configuration-file.patch \ |
| 27 | file://dropbear" |
| 28 | |
| 29 | PAM_PLUGINS = "libpam-runtime \ |
| 30 | pam-plugin-deny \ |
| 31 | pam-plugin-permit \ |
| 32 | pam-plugin-unix \ |
| 33 | " |
| 34 | RDEPENDS_${PN} += "${@bb.utils.contains('DISTRO_FEATURES', 'pam', '${PAM_PLUGINS}', '', d)}" |
| 35 | |
| 36 | inherit autotools update-rc.d systemd |
| 37 | |
| 38 | INITSCRIPT_NAME = "dropbear" |
| 39 | INITSCRIPT_PARAMS = "defaults 10" |
| 40 | |
| 41 | SYSTEMD_SERVICE_${PN} = "dropbear.socket" |
| 42 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 43 | SBINCOMMANDS = "dropbear dropbearkey dropbearconvert" |
| 44 | BINCOMMANDS = "dbclient ssh scp" |
| 45 | EXTRA_OEMAKE = 'MULTI=1 SCPPROGRESS=1 PROGRAMS="${SBINCOMMANDS} ${BINCOMMANDS}"' |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 46 | |
| 47 | PACKAGECONFIG ?= "" |
| 48 | PACKAGECONFIG[system-libtom] = "--disable-bundled-libtom,--enable-bundled-libtom,libtommath libtomcrypt" |
| 49 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 50 | EXTRA_OECONF += "\ |
| 51 | ${@bb.utils.contains('DISTRO_FEATURES', 'pam', '--enable-pam', '--disable-pam', d)}" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 52 | |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 53 | # This option appends to CFLAGS and LDFLAGS from OE |
| 54 | # This is causing [textrel] QA warning |
| 55 | EXTRA_OECONF += "--disable-harden" |
| 56 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 57 | do_install() { |
| 58 | install -d ${D}${sysconfdir} \ |
| 59 | ${D}${sysconfdir}/init.d \ |
| 60 | ${D}${sysconfdir}/default \ |
| 61 | ${D}${sysconfdir}/dropbear \ |
| 62 | ${D}${bindir} \ |
| 63 | ${D}${sbindir} \ |
| 64 | ${D}${localstatedir} |
| 65 | |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 66 | install -m 0644 ${WORKDIR}/dropbear.default ${D}${sysconfdir}/default/dropbear |
| 67 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 68 | install -m 0755 dropbearmulti ${D}${sbindir}/ |
| 69 | ln -s ${sbindir}/dropbearmulti ${D}${bindir}/dbclient |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 70 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 71 | for i in ${SBINCOMMANDS} |
| 72 | do |
| 73 | ln -s ./dropbearmulti ${D}${sbindir}/$i |
| 74 | done |
| 75 | sed -e 's,/etc,${sysconfdir},g' \ |
| 76 | -e 's,/usr/sbin,${sbindir},g' \ |
| 77 | -e 's,/var,${localstatedir},g' \ |
| 78 | -e 's,/usr/bin,${bindir},g' \ |
| 79 | -e 's,/usr,${prefix},g' ${WORKDIR}/init > ${D}${sysconfdir}/init.d/dropbear |
| 80 | chmod 755 ${D}${sysconfdir}/init.d/dropbear |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 81 | if [ "${@bb.utils.filter('DISTRO_FEATURES', 'pam', d)}" ]; then |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 82 | install -d ${D}${sysconfdir}/pam.d |
| 83 | install -m 0644 ${WORKDIR}/dropbear ${D}${sysconfdir}/pam.d/ |
| 84 | fi |
| 85 | |
| 86 | # deal with systemd unit files |
| 87 | install -d ${D}${systemd_unitdir}/system |
| 88 | install -m 0644 ${WORKDIR}/dropbearkey.service ${D}${systemd_unitdir}/system |
| 89 | install -m 0644 ${WORKDIR}/dropbear@.service ${D}${systemd_unitdir}/system |
| 90 | install -m 0644 ${WORKDIR}/dropbear.socket ${D}${systemd_unitdir}/system |
| 91 | sed -i -e 's,@BASE_BINDIR@,${base_bindir},g' \ |
| 92 | -e 's,@BINDIR@,${bindir},g' \ |
| 93 | -e 's,@SBINDIR@,${sbindir},g' \ |
| 94 | ${D}${systemd_unitdir}/system/dropbear.socket ${D}${systemd_unitdir}/system/*.service |
| 95 | } |
| 96 | |
| 97 | inherit update-alternatives |
| 98 | |
| 99 | ALTERNATIVE_PRIORITY = "20" |
| 100 | ALTERNATIVE_${PN} = "scp ssh" |
| 101 | |
| 102 | ALTERNATIVE_TARGET = "${sbindir}/dropbearmulti" |
| 103 | |
| 104 | pkg_postrm_append_${PN} () { |
| 105 | if [ -f "${sysconfdir}/dropbear/dropbear_rsa_host_key" ]; then |
| 106 | rm ${sysconfdir}/dropbear/dropbear_rsa_host_key |
| 107 | fi |
| 108 | if [ -f "${sysconfdir}/dropbear/dropbear_dss_host_key" ]; then |
| 109 | rm ${sysconfdir}/dropbear/dropbear_dss_host_key |
| 110 | fi |
| 111 | } |