blob: dcbda741c3aad5efee0d3115fc9c97a9226c2d77 [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"
3SECTION = "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
7LICENSE = "MIT & BSD-3-Clause & BSD-2-Clause & PD"
8LIC_FILES_CHKSUM = "file://LICENSE;md5=a5ec40cafba26fc4396d0b550f824e01"
9
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080010DEPENDS = "zlib virtual/crypt"
Brad Bishop6e60e8b2018-02-01 10:27:11 -050011RPROVIDES_${PN} = "ssh sshd"
Brad Bishop15ae2502019-06-18 21:44:24 -040012RCONFLICTS_${PN} = "openssh-sshd openssh"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050013
14DEPENDS += "${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'libpam', '', d)}"
15
16SRC_URI = "http://matt.ucc.asn.au/dropbear/releases/dropbear-${PV}.tar.bz2 \
17 file://0001-urandom-xauth-changes-to-options.h.patch \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050018 file://init \
19 file://dropbearkey.service \
20 file://dropbear@.service \
21 file://dropbear.socket \
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080022 file://dropbear.default \
Brad Bishopc8f47122019-06-24 09:36:18 -040023 ${@bb.utils.contains('DISTRO_FEATURES', 'pam', '${PAM_SRC_URI}', '', d)} \
24 ${@bb.utils.contains('PACKAGECONFIG', 'disable-weak-ciphers', 'file://dropbear-disable-weak-ciphers.patch', '', d)} "
Patrick Williamsc124f4f2015-09-15 14:41:29 -050025
26PAM_SRC_URI = "file://0005-dropbear-enable-pam.patch \
27 file://0006-dropbear-configuration-file.patch \
28 file://dropbear"
29
30PAM_PLUGINS = "libpam-runtime \
31 pam-plugin-deny \
32 pam-plugin-permit \
33 pam-plugin-unix \
34 "
35RDEPENDS_${PN} += "${@bb.utils.contains('DISTRO_FEATURES', 'pam', '${PAM_PLUGINS}', '', d)}"
36
37inherit autotools update-rc.d systemd
38
Brad Bishopc342db32019-05-15 21:57:59 -040039CVE_PRODUCT = "dropbear_ssh"
40
Patrick Williamsc124f4f2015-09-15 14:41:29 -050041INITSCRIPT_NAME = "dropbear"
42INITSCRIPT_PARAMS = "defaults 10"
43
44SYSTEMD_SERVICE_${PN} = "dropbear.socket"
45
Patrick Williamsc124f4f2015-09-15 14:41:29 -050046SBINCOMMANDS = "dropbear dropbearkey dropbearconvert"
47BINCOMMANDS = "dbclient ssh scp"
48EXTRA_OEMAKE = 'MULTI=1 SCPPROGRESS=1 PROGRAMS="${SBINCOMMANDS} ${BINCOMMANDS}"'
Patrick Williamsc0f7c042017-02-23 20:41:17 -060049
Brad Bishopc8f47122019-06-24 09:36:18 -040050PACKAGECONFIG ?= "disable-weak-ciphers"
Patrick Williamsc0f7c042017-02-23 20:41:17 -060051PACKAGECONFIG[system-libtom] = "--disable-bundled-libtom,--enable-bundled-libtom,libtommath libtomcrypt"
Brad Bishopc8f47122019-06-24 09:36:18 -040052PACKAGECONFIG[disable-weak-ciphers] = ""
Patrick Williamsc0f7c042017-02-23 20:41:17 -060053
Patrick Williamsc124f4f2015-09-15 14:41:29 -050054EXTRA_OECONF += "\
55 ${@bb.utils.contains('DISTRO_FEATURES', 'pam', '--enable-pam', '--disable-pam', d)}"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050056
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080057# This option appends to CFLAGS and LDFLAGS from OE
58# This is causing [textrel] QA warning
59EXTRA_OECONF += "--disable-harden"
60
Patrick Williamsc124f4f2015-09-15 14:41:29 -050061do_install() {
62 install -d ${D}${sysconfdir} \
63 ${D}${sysconfdir}/init.d \
64 ${D}${sysconfdir}/default \
65 ${D}${sysconfdir}/dropbear \
66 ${D}${bindir} \
67 ${D}${sbindir} \
68 ${D}${localstatedir}
69
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080070 install -m 0644 ${WORKDIR}/dropbear.default ${D}${sysconfdir}/default/dropbear
71
Patrick Williamsc124f4f2015-09-15 14:41:29 -050072 install -m 0755 dropbearmulti ${D}${sbindir}/
73 ln -s ${sbindir}/dropbearmulti ${D}${bindir}/dbclient
Brad Bishop6e60e8b2018-02-01 10:27:11 -050074
Patrick Williamsc124f4f2015-09-15 14:41:29 -050075 for i in ${SBINCOMMANDS}
76 do
77 ln -s ./dropbearmulti ${D}${sbindir}/$i
78 done
79 sed -e 's,/etc,${sysconfdir},g' \
80 -e 's,/usr/sbin,${sbindir},g' \
81 -e 's,/var,${localstatedir},g' \
82 -e 's,/usr/bin,${bindir},g' \
83 -e 's,/usr,${prefix},g' ${WORKDIR}/init > ${D}${sysconfdir}/init.d/dropbear
84 chmod 755 ${D}${sysconfdir}/init.d/dropbear
Brad Bishop6e60e8b2018-02-01 10:27:11 -050085 if [ "${@bb.utils.filter('DISTRO_FEATURES', 'pam', d)}" ]; then
Patrick Williamsc124f4f2015-09-15 14:41:29 -050086 install -d ${D}${sysconfdir}/pam.d
87 install -m 0644 ${WORKDIR}/dropbear ${D}${sysconfdir}/pam.d/
88 fi
89
90 # deal with systemd unit files
91 install -d ${D}${systemd_unitdir}/system
92 install -m 0644 ${WORKDIR}/dropbearkey.service ${D}${systemd_unitdir}/system
93 install -m 0644 ${WORKDIR}/dropbear@.service ${D}${systemd_unitdir}/system
94 install -m 0644 ${WORKDIR}/dropbear.socket ${D}${systemd_unitdir}/system
95 sed -i -e 's,@BASE_BINDIR@,${base_bindir},g' \
96 -e 's,@BINDIR@,${bindir},g' \
97 -e 's,@SBINDIR@,${sbindir},g' \
98 ${D}${systemd_unitdir}/system/dropbear.socket ${D}${systemd_unitdir}/system/*.service
99}
100
101inherit update-alternatives
102
103ALTERNATIVE_PRIORITY = "20"
104ALTERNATIVE_${PN} = "scp ssh"
105
106ALTERNATIVE_TARGET = "${sbindir}/dropbearmulti"
107
108pkg_postrm_append_${PN} () {
109 if [ -f "${sysconfdir}/dropbear/dropbear_rsa_host_key" ]; then
110 rm ${sysconfdir}/dropbear/dropbear_rsa_host_key
111 fi
112 if [ -f "${sysconfdir}/dropbear/dropbear_dss_host_key" ]; then
113 rm ${sysconfdir}/dropbear/dropbear_dss_host_key
114 fi
115}