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