dropbear.inc 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. SUMMARY = "A lightweight SSH and SCP implementation"
  2. HOMEPAGE = "http://matt.ucc.asn.au/dropbear/dropbear.html"
  3. SECTION = "console/network"
  4. # some files are from other projects and have others license terms:
  5. # public domain, OpenSSH 3.5p1, OpenSSH3.6.1p2, PuTTY
  6. LICENSE = "MIT & BSD-3-Clause & BSD-2-Clause & PD"
  7. LIC_FILES_CHKSUM = "file://LICENSE;md5=25cf44512b7bc8966a48b6b1a9b7605f"
  8. DEPENDS = "zlib virtual/crypt"
  9. RPROVIDES_${PN} = "ssh sshd"
  10. RCONFLICTS_${PN} = "openssh-sshd openssh"
  11. DEPENDS += "${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'libpam', '', d)}"
  12. SRC_URI = "http://matt.ucc.asn.au/dropbear/releases/dropbear-${PV}.tar.bz2 \
  13. file://0001-urandom-xauth-changes-to-options.h.patch \
  14. file://init \
  15. file://dropbearkey.service \
  16. file://dropbear@.service \
  17. file://dropbear.socket \
  18. file://dropbear.default \
  19. ${@bb.utils.contains('DISTRO_FEATURES', 'pam', '${PAM_SRC_URI}', '', d)} \
  20. ${@bb.utils.contains('PACKAGECONFIG', 'disable-weak-ciphers', 'file://dropbear-disable-weak-ciphers.patch', '', d)} "
  21. PAM_SRC_URI = "file://0005-dropbear-enable-pam.patch \
  22. file://0006-dropbear-configuration-file.patch \
  23. file://dropbear"
  24. PAM_PLUGINS = "libpam-runtime \
  25. pam-plugin-deny \
  26. pam-plugin-permit \
  27. pam-plugin-unix \
  28. "
  29. RDEPENDS_${PN} += "${@bb.utils.contains('DISTRO_FEATURES', 'pam', '${PAM_PLUGINS}', '', d)}"
  30. inherit autotools update-rc.d systemd
  31. CVE_PRODUCT = "dropbear_ssh"
  32. INITSCRIPT_NAME = "dropbear"
  33. INITSCRIPT_PARAMS = "defaults 10"
  34. SYSTEMD_SERVICE_${PN} = "dropbear.socket"
  35. SBINCOMMANDS = "dropbear dropbearkey dropbearconvert"
  36. BINCOMMANDS = "dbclient ssh scp"
  37. EXTRA_OEMAKE = 'MULTI=1 SCPPROGRESS=1 PROGRAMS="${SBINCOMMANDS} ${BINCOMMANDS}"'
  38. PACKAGECONFIG ?= "disable-weak-ciphers"
  39. PACKAGECONFIG[system-libtom] = "--disable-bundled-libtom,--enable-bundled-libtom,libtommath libtomcrypt"
  40. PACKAGECONFIG[disable-weak-ciphers] = ""
  41. EXTRA_OECONF += "\
  42. ${@bb.utils.contains('DISTRO_FEATURES', 'pam', '--enable-pam', '--disable-pam', d)}"
  43. # This option appends to CFLAGS and LDFLAGS from OE
  44. # This is causing [textrel] QA warning
  45. EXTRA_OECONF += "--disable-harden"
  46. do_install() {
  47. install -d ${D}${sysconfdir} \
  48. ${D}${sysconfdir}/init.d \
  49. ${D}${sysconfdir}/default \
  50. ${D}${sysconfdir}/dropbear \
  51. ${D}${bindir} \
  52. ${D}${sbindir} \
  53. ${D}${localstatedir}
  54. install -m 0644 ${WORKDIR}/dropbear.default ${D}${sysconfdir}/default/dropbear
  55. install -m 0755 dropbearmulti ${D}${sbindir}/
  56. for i in ${BINCOMMANDS}
  57. do
  58. # ssh and scp symlinks are created by update-alternatives
  59. if [ $i = ssh ] || [ $i = scp ]; then continue; fi
  60. ln -s ${sbindir}/dropbearmulti ${D}${bindir}/$i
  61. done
  62. for i in ${SBINCOMMANDS}
  63. do
  64. ln -s ./dropbearmulti ${D}${sbindir}/$i
  65. done
  66. sed -e 's,/etc,${sysconfdir},g' \
  67. -e 's,/usr/sbin,${sbindir},g' \
  68. -e 's,/var,${localstatedir},g' \
  69. -e 's,/usr/bin,${bindir},g' \
  70. -e 's,/usr,${prefix},g' ${WORKDIR}/init > ${D}${sysconfdir}/init.d/dropbear
  71. chmod 755 ${D}${sysconfdir}/init.d/dropbear
  72. if [ "${@bb.utils.filter('DISTRO_FEATURES', 'pam', d)}" ]; then
  73. install -d ${D}${sysconfdir}/pam.d
  74. install -m 0644 ${WORKDIR}/dropbear ${D}${sysconfdir}/pam.d/
  75. fi
  76. # deal with systemd unit files
  77. install -d ${D}${systemd_unitdir}/system
  78. install -m 0644 ${WORKDIR}/dropbearkey.service ${D}${systemd_unitdir}/system
  79. install -m 0644 ${WORKDIR}/dropbear@.service ${D}${systemd_unitdir}/system
  80. install -m 0644 ${WORKDIR}/dropbear.socket ${D}${systemd_unitdir}/system
  81. sed -i -e 's,@BASE_BINDIR@,${base_bindir},g' \
  82. -e 's,@BINDIR@,${bindir},g' \
  83. -e 's,@SBINDIR@,${sbindir},g' \
  84. ${D}${systemd_unitdir}/system/dropbear.socket ${D}${systemd_unitdir}/system/*.service
  85. }
  86. inherit update-alternatives
  87. ALTERNATIVE_PRIORITY = "20"
  88. ALTERNATIVE_${PN} = "${@bb.utils.filter('BINCOMMANDS', 'scp ssh', d)}"
  89. ALTERNATIVE_TARGET = "${sbindir}/dropbearmulti"
  90. pkg_postrm_append_${PN} () {
  91. if [ -f "${sysconfdir}/dropbear/dropbear_rsa_host_key" ]; then
  92. rm ${sysconfdir}/dropbear/dropbear_rsa_host_key
  93. fi
  94. if [ -f "${sysconfdir}/dropbear/dropbear_dss_host_key" ]; then
  95. rm ${sysconfdir}/dropbear/dropbear_dss_host_key
  96. fi
  97. }
  98. FILES_${PN} += "${bindir}"