2008-07-24 05:24:52 +00:00
|
|
|
#
|
2020-09-01 19:13:28 +00:00
|
|
|
# Copyright (C) 2006-2020 OpenWrt.org
|
2006-06-27 00:35:46 +00:00
|
|
|
#
|
|
|
|
# This is free software, licensed under the GNU General Public License v2.
|
|
|
|
# See /LICENSE for more information.
|
|
|
|
#
|
2005-03-21 08:12:49 +00:00
|
|
|
|
2005-03-06 03:53:29 +00:00
|
|
|
include $(TOPDIR)/rules.mk
|
|
|
|
|
2005-04-14 07:08:14 +00:00
|
|
|
PKG_NAME:=dropbear
|
2024-05-06 13:20:16 +00:00
|
|
|
PKG_VERSION:=2024.85
|
|
|
|
PKG_RELEASE:=1
|
2005-03-21 08:12:49 +00:00
|
|
|
|
2011-11-25 00:53:19 +00:00
|
|
|
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
|
2008-07-24 05:24:52 +00:00
|
|
|
PKG_SOURCE_URL:= \
|
2022-04-07 08:33:08 +00:00
|
|
|
https://matt.ucc.asn.au/dropbear/releases/ \
|
2013-10-15 13:10:32 +00:00
|
|
|
https://dropbear.nl/mirror/releases/
|
2024-05-06 13:20:16 +00:00
|
|
|
PKG_HASH:=86b036c433a69d89ce51ebae335d65c47738ccf90d13e5eb0fea832e556da502
|
2005-03-06 03:53:29 +00:00
|
|
|
|
2012-10-19 15:34:28 +00:00
|
|
|
PKG_LICENSE:=MIT
|
|
|
|
PKG_LICENSE_FILES:=LICENSE libtomcrypt/LICENSE libtommath/LICENSE
|
2024-04-26 14:09:32 +00:00
|
|
|
PKG_CPE_ID:=cpe:/a:dropbear_ssh_project:dropbear_ssh
|
2012-10-19 15:34:28 +00:00
|
|
|
|
2010-09-07 10:00:34 +00:00
|
|
|
PKG_BUILD_PARALLEL:=1
|
2019-10-27 13:56:27 +00:00
|
|
|
PKG_ASLR_PIE_REGULAR:=1
|
2023-02-02 20:33:38 +00:00
|
|
|
PKG_BUILD_FLAGS:=no-mips16 gc-sections lto
|
2019-03-25 18:40:38 +00:00
|
|
|
PKG_FIXUP:=autoreconf
|
2020-09-01 19:13:28 +00:00
|
|
|
PKG_FLAGS:=nonshared
|
2010-09-07 10:00:34 +00:00
|
|
|
|
2017-10-06 07:21:35 +00:00
|
|
|
PKG_CONFIG_DEPENDS:= \
|
2019-03-25 19:00:28 +00:00
|
|
|
CONFIG_TARGET_INIT_PATH CONFIG_DROPBEAR_ECC CONFIG_DROPBEAR_ECC_FULL \
|
2017-10-06 07:21:35 +00:00
|
|
|
CONFIG_DROPBEAR_CURVE25519 CONFIG_DROPBEAR_ZLIB \
|
2020-04-12 22:24:28 +00:00
|
|
|
CONFIG_DROPBEAR_ED25519 CONFIG_DROPBEAR_CHACHA20POLY1305 \
|
2024-01-09 00:40:01 +00:00
|
|
|
CONFIG_DROPBEAR_U2F CONFIG_DROPBEAR_ECDSA_SK CONFIG_DROPBEAR_ED25519_SK \
|
2019-04-18 02:20:19 +00:00
|
|
|
CONFIG_DROPBEAR_UTMP CONFIG_DROPBEAR_PUTUTLINE \
|
2021-07-15 22:44:53 +00:00
|
|
|
CONFIG_DROPBEAR_DBCLIENT CONFIG_DROPBEAR_SCP CONFIG_DROPBEAR_ASKPASS \
|
2024-01-09 00:40:01 +00:00
|
|
|
CONFIG_DROPBEAR_DBCLIENT_AGENTFORWARD CONFIG_DROPBEAR_AGENTFORWARD \
|
|
|
|
CONFIG_DROPBEAR_MODERN_ONLY
|
2014-03-29 16:59:26 +00:00
|
|
|
|
2006-06-21 02:32:39 +00:00
|
|
|
include $(INCLUDE_DIR)/package.mk
|
2005-03-06 03:53:29 +00:00
|
|
|
|
2016-02-08 14:28:57 +00:00
|
|
|
ifneq ($(DUMP),1)
|
2021-05-09 20:28:15 +00:00
|
|
|
STAMP_CONFIGURED:=$(strip $(STAMP_CONFIGURED))_$(shell echo $(CONFIG_TARGET_INIT_PATH) | $(MKHASH) md5)
|
2016-02-08 14:28:57 +00:00
|
|
|
endif
|
|
|
|
|
2006-09-23 17:41:58 +00:00
|
|
|
define Package/dropbear/Default
|
2022-04-07 08:33:08 +00:00
|
|
|
URL:=https://matt.ucc.asn.au/dropbear/
|
2006-09-23 17:41:58 +00:00
|
|
|
endef
|
|
|
|
|
2014-03-29 16:59:26 +00:00
|
|
|
define Package/dropbear/config
|
|
|
|
source "$(SOURCE)/Config.in"
|
|
|
|
endef
|
|
|
|
|
2006-05-10 19:06:22 +00:00
|
|
|
define Package/dropbear
|
2006-09-23 17:41:58 +00:00
|
|
|
$(call Package/dropbear/Default)
|
|
|
|
SECTION:=net
|
|
|
|
CATEGORY:=Base system
|
|
|
|
TITLE:=Small SSH2 client/server
|
2017-06-30 11:13:50 +00:00
|
|
|
DEPENDS:= +DROPBEAR_ZLIB:zlib
|
2023-12-03 16:11:38 +00:00
|
|
|
ALTERNATIVES:=100:/usr/bin/ssh-keygen:/usr/sbin/dropbear
|
2020-08-15 10:10:22 +00:00
|
|
|
$(if $(CONFIG_DROPBEAR_SCP),ALTERNATIVES+= \
|
|
|
|
100:/usr/bin/scp:/usr/sbin/dropbear,)
|
2020-07-20 22:26:42 +00:00
|
|
|
$(if $(CONFIG_DROPBEAR_DBCLIENT),ALTERNATIVES+= \
|
|
|
|
100:/usr/bin/ssh:/usr/sbin/dropbear,)
|
2018-06-25 05:16:09 +00:00
|
|
|
|
2007-09-07 08:34:51 +00:00
|
|
|
endef
|
|
|
|
|
|
|
|
define Package/dropbear/description
|
|
|
|
A small SSH2 server/client designed for small memory environments.
|
2006-05-10 19:06:22 +00:00
|
|
|
endef
|
2005-04-14 07:08:14 +00:00
|
|
|
|
2009-02-03 22:28:16 +00:00
|
|
|
define Package/dropbear/conffiles
|
2018-09-19 01:32:17 +00:00
|
|
|
/etc/config/dropbear
|
2024-01-09 00:40:02 +00:00
|
|
|
/etc/dropbear/authorized_keys
|
|
|
|
/etc/dropbear/dropbear_ecdsa_host_key
|
|
|
|
/etc/dropbear/dropbear_ed25519_host_key
|
|
|
|
/etc/dropbear/dropbear_rsa_host_key
|
2009-02-03 22:28:16 +00:00
|
|
|
endef
|
|
|
|
|
2006-05-10 19:06:22 +00:00
|
|
|
define Package/dropbearconvert
|
2006-09-23 17:41:58 +00:00
|
|
|
$(call Package/dropbear/Default)
|
|
|
|
SECTION:=utils
|
|
|
|
CATEGORY:=Utilities
|
|
|
|
TITLE:=Utility for converting SSH keys
|
2020-01-01 07:58:34 +00:00
|
|
|
DEPENDS:= +DROPBEAR_ZLIB:zlib
|
2006-05-10 19:06:22 +00:00
|
|
|
endef
|
|
|
|
|
2007-02-25 23:34:57 +00:00
|
|
|
CONFIGURE_ARGS += \
|
|
|
|
--disable-pam \
|
|
|
|
--enable-openpty \
|
|
|
|
--enable-syslog \
|
|
|
|
--disable-lastlog \
|
2016-05-09 16:23:37 +00:00
|
|
|
--disable-utmpx \
|
2016-04-27 09:13:58 +00:00
|
|
|
$(if $(CONFIG_DROPBEAR_UTMP),,--disable-utmp) \
|
2007-02-25 23:34:57 +00:00
|
|
|
--disable-wtmp \
|
|
|
|
--disable-wtmpx \
|
|
|
|
--disable-loginfunc \
|
2016-04-27 09:13:58 +00:00
|
|
|
$(if $(CONFIG_DROPBEAR_PUTUTLINE),,--disable-pututline) \
|
2007-02-25 23:34:57 +00:00
|
|
|
--disable-pututxline \
|
2017-06-30 11:13:50 +00:00
|
|
|
$(if $(CONFIG_DROPBEAR_ZLIB),,--disable-zlib) \
|
2011-03-02 14:20:51 +00:00
|
|
|
--enable-bundled-libtom
|
2007-02-25 23:34:57 +00:00
|
|
|
|
2020-11-25 03:12:41 +00:00
|
|
|
##############################################################################
|
|
|
|
#
|
2024-01-09 00:40:01 +00:00
|
|
|
# option,value - add option to localoptions.h
|
2024-05-06 13:20:16 +00:00
|
|
|
# !!option,value - replace option in src/sysoptions.h
|
2020-11-25 03:12:41 +00:00
|
|
|
#
|
|
|
|
##############################################################################
|
|
|
|
|
2024-01-09 00:40:01 +00:00
|
|
|
# adjust allowed shell list (if getusershell(3) is missing):
|
|
|
|
# - COMPAT_USER_SHELLS
|
2020-11-25 03:12:41 +00:00
|
|
|
# remove protocol idented software version number:
|
|
|
|
# - LOCAL_IDENT
|
|
|
|
# disable legacy/unsafe methods and unused functionality:
|
|
|
|
# - DROPBEAR_CLI_NETCAT
|
|
|
|
# - DROPBEAR_DSS
|
|
|
|
# - DO_MOTD
|
2024-01-09 00:40:01 +00:00
|
|
|
# - DROPBEAR_DH_GROUP14_SHA1
|
|
|
|
# - DROPBEAR_SHA1_HMAC
|
2020-11-25 03:12:41 +00:00
|
|
|
DB_OPT_COMMON = \
|
2024-01-09 00:40:01 +00:00
|
|
|
!!LOCAL_IDENT,"SSH-2.0-dropbear" \
|
2024-01-09 00:40:01 +00:00
|
|
|
COMPAT_USER_SHELLS,"/bin/ash","/bin/sh" \
|
2024-01-09 00:40:01 +00:00
|
|
|
DEFAULT_PATH,"$(TARGET_INIT_PATH)" \
|
2024-01-09 00:40:01 +00:00
|
|
|
DEFAULT_ROOT_PATH,"$(TARGET_INIT_PATH)" \
|
2024-01-09 00:40:01 +00:00
|
|
|
DROPBEAR_DSS,0 \
|
|
|
|
DROPBEAR_CLI_NETCAT,0 \
|
|
|
|
DO_MOTD,0 \
|
2024-01-09 00:40:01 +00:00
|
|
|
DROPBEAR_DH_GROUP14_SHA1,0 \
|
|
|
|
DROPBEAR_SHA1_HMAC,0 \
|
2020-11-25 03:12:41 +00:00
|
|
|
|
|
|
|
|
|
|
|
##############################################################################
|
|
|
|
#
|
2024-01-09 00:40:01 +00:00
|
|
|
# option,config,enabled,disabled = add option to localoptions.h
|
2024-05-06 13:20:16 +00:00
|
|
|
# !!option,config,enabled,disabled = replace option in src/sysoptions.h
|
2020-11-25 03:12:41 +00:00
|
|
|
#
|
|
|
|
# option := (config) ? enabled : disabled
|
|
|
|
#
|
|
|
|
##############################################################################
|
|
|
|
|
|
|
|
DB_OPT_CONFIG = \
|
2024-01-09 00:40:01 +00:00
|
|
|
!!DROPBEAR_ECC_384,CONFIG_DROPBEAR_ECC_FULL,1,0 \
|
|
|
|
!!DROPBEAR_ECC_521,CONFIG_DROPBEAR_ECC_FULL,1,0 \
|
|
|
|
DROPBEAR_CURVE25519,CONFIG_DROPBEAR_CURVE25519,1,0 \
|
|
|
|
DROPBEAR_CHACHA20POLY1305,CONFIG_DROPBEAR_CHACHA20POLY1305,1,0 \
|
|
|
|
DROPBEAR_ED25519,CONFIG_DROPBEAR_ED25519,1,0 \
|
|
|
|
DROPBEAR_ECDSA,CONFIG_DROPBEAR_ECC,1,0 \
|
|
|
|
DROPBEAR_ECDH,CONFIG_DROPBEAR_ECC,1,0 \
|
2024-01-09 00:40:01 +00:00
|
|
|
DROPBEAR_SK_KEYS,CONFIG_DROPBEAR_U2F,1,0 \
|
|
|
|
DROPBEAR_SK_ECDSA,CONFIG_DROPBEAR_ECDSA_SK,1,0 \
|
|
|
|
DROPBEAR_SK_ED25519,CONFIG_DROPBEAR_ED25519_SK,1,0 \
|
2024-01-09 00:40:01 +00:00
|
|
|
DROPBEAR_CLI_ASKPASS_HELPER,CONFIG_DROPBEAR_ASKPASS,1,0 \
|
|
|
|
DROPBEAR_CLI_AGENTFWD,CONFIG_DROPBEAR_DBCLIENT_AGENTFORWARD,1,0 \
|
|
|
|
DROPBEAR_SVR_AGENTFWD,CONFIG_DROPBEAR_AGENTFORWARD,1,0 \
|
2024-01-09 00:40:01 +00:00
|
|
|
DROPBEAR_AES128,CONFIG_DROPBEAR_MODERN_ONLY,0,1 \
|
|
|
|
DROPBEAR_AES256,CONFIG_DROPBEAR_MODERN_ONLY,0,1 \
|
|
|
|
DROPBEAR_ENABLE_CTR_MODE,CONFIG_DROPBEAR_MODERN_ONLY,0,1 \
|
|
|
|
DROPBEAR_RSA,CONFIG_DROPBEAR_MODERN_ONLY,0,1 \
|
|
|
|
DROPBEAR_RSA_SHA1,CONFIG_DROPBEAR_MODERN_ONLY,0,1 \
|
2020-11-25 03:12:41 +00:00
|
|
|
|
|
|
|
|
2023-02-02 20:33:38 +00:00
|
|
|
TARGET_CFLAGS += -DARGTYPE=3
|
2011-02-13 16:54:44 +00:00
|
|
|
|
2024-01-09 00:40:01 +00:00
|
|
|
xsedx:=$(shell printf '\027')
|
|
|
|
|
2020-11-25 04:33:25 +00:00
|
|
|
db_opt_add =echo '\#define $(1) $(2)' >> $(PKG_BUILD_DIR)/localoptions.h
|
2024-05-06 13:20:16 +00:00
|
|
|
db_opt_replace =$(ESED) '/^\#define $(1) .*$$$$/{h;:a;$$$$!n;/^\#.+$$$$/bb;/^$$$$/bb;H;ba;:b;x;s$(xsedx)^.+$$$$$(xsedx)\#define $(1) $(2)$(xsedx)p;x};p' -n $(PKG_BUILD_DIR)/src/sysoptions.h
|
2020-11-25 04:33:25 +00:00
|
|
|
|
2020-11-25 03:12:41 +00:00
|
|
|
define Build/Configure/dropbear_headers
|
|
|
|
$(strip $(foreach s,$(DB_OPT_COMMON), \
|
2024-01-09 00:40:01 +00:00
|
|
|
$(if $(filter !!%,$(word 1,$(subst $(comma),$(space),$(s)))), \
|
|
|
|
$(call db_opt_replace,$(patsubst !!%,%,$(word 1,$(subst $(comma),$(space),$(s)))),$(subst $(space),$(comma),$(wordlist 2,$(words $(subst $(comma),$(space),$(s))),$(subst $(comma),$(space),$(s))))), \
|
|
|
|
$(call db_opt_add,$(word 1,$(subst $(comma),$(space),$(s))),$(subst $(space),$(comma),$(wordlist 2,$(words $(subst $(comma),$(space),$(s))),$(subst $(comma),$(space),$(s))))) \
|
2020-11-25 03:12:41 +00:00
|
|
|
) ; \
|
|
|
|
))
|
|
|
|
|
|
|
|
$(strip $(foreach s,$(DB_OPT_CONFIG), \
|
2024-01-09 00:40:01 +00:00
|
|
|
$(if $(filter !!%,$(word 1,$(subst $(comma),$(space),$(s)))), \
|
|
|
|
$(call db_opt_replace,$(patsubst !!%,%,$(word 1,$(subst $(comma),$(space),$(s)))),$(if $($(word 2,$(subst $(comma),$(space),$(s)))),$(word 3,$(subst $(comma),$(space),$(s))),$(word 4,$(subst $(comma),$(space),$(s))))), \
|
|
|
|
$(call db_opt_add,$(word 1,$(subst $(comma),$(space),$(s))),$(if $($(word 2,$(subst $(comma),$(space),$(s)))),$(word 3,$(subst $(comma),$(space),$(s))),$(word 4,$(subst $(comma),$(space),$(s))))) \
|
2020-11-25 03:12:41 +00:00
|
|
|
) ; \
|
|
|
|
))
|
|
|
|
endef
|
|
|
|
|
2024-01-09 00:40:01 +00:00
|
|
|
define Build/Configure/dropbear_objects
|
|
|
|
grep -ERZl -e '($(subst $(space),|,$(strip $(sort $(patsubst !!%,%,$(foreach s,$(DB_OPT_COMMON) $(DB_OPT_CONFIG),$(word 1,$(subst $(comma),$(space),$(s)))))))))' \
|
|
|
|
$(PKG_BUILD_DIR)/ | sed -zE 's/^(.+)\.[^.]+$$$$/\1.o/' | sort -uV | xargs -0 -r rm -fv || :
|
|
|
|
endef
|
|
|
|
|
2014-03-29 17:10:52 +00:00
|
|
|
define Build/Configure
|
2024-01-09 00:40:01 +00:00
|
|
|
rm -f $(PKG_BUILD_DIR)/localoptions.h
|
2014-03-29 17:10:52 +00:00
|
|
|
$(Build/Configure/Default)
|
|
|
|
|
2024-01-09 00:40:01 +00:00
|
|
|
: > $(PKG_BUILD_DIR)/localoptions.h
|
2020-11-25 03:12:41 +00:00
|
|
|
$(Build/Configure/dropbear_headers)
|
2019-03-25 19:00:28 +00:00
|
|
|
|
2024-01-09 00:40:01 +00:00
|
|
|
# Enforce rebuild of files depending on configured options
|
|
|
|
$(Build/Configure/dropbear_objects)
|
2019-11-01 06:57:03 +00:00
|
|
|
|
|
|
|
# Rebuild them on config change
|
|
|
|
+$(MAKE) -C $(PKG_BUILD_DIR)/libtomcrypt clean
|
|
|
|
+$(MAKE) -C $(PKG_BUILD_DIR)/libtommath clean
|
2014-03-29 16:59:26 +00:00
|
|
|
endef
|
|
|
|
|
2006-05-11 17:33:51 +00:00
|
|
|
define Build/Compile
|
2012-09-23 09:50:01 +00:00
|
|
|
+$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
|
2006-08-04 05:30:27 +00:00
|
|
|
$(TARGET_CONFIGURE_OPTS) \
|
2024-01-09 00:40:01 +00:00
|
|
|
IGNORE_SPEED=1 \
|
2020-08-15 10:10:22 +00:00
|
|
|
PROGRAMS="dropbear $(if $(CONFIG_DROPBEAR_DBCLIENT),dbclient,) dropbearkey $(if $(CONFIG_DROPBEAR_SCP),scp,)" \
|
2005-04-14 07:08:14 +00:00
|
|
|
MULTI=1 SCPPROGRESS=1
|
2012-09-23 09:50:01 +00:00
|
|
|
+$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
|
2006-08-04 05:30:27 +00:00
|
|
|
$(TARGET_CONFIGURE_OPTS) \
|
2024-01-09 00:40:01 +00:00
|
|
|
IGNORE_SPEED=1 \
|
2006-01-31 13:33:25 +00:00
|
|
|
PROGRAMS="dropbearconvert"
|
2006-05-10 19:06:22 +00:00
|
|
|
endef
|
2008-07-24 05:24:52 +00:00
|
|
|
|
2006-05-10 19:06:22 +00:00
|
|
|
define Package/dropbear/install
|
2006-11-23 00:29:07 +00:00
|
|
|
$(INSTALL_DIR) $(1)/usr/sbin
|
2007-08-11 21:53:15 +00:00
|
|
|
$(INSTALL_BIN) $(PKG_BUILD_DIR)/dropbearmulti $(1)/usr/sbin/dropbear
|
2006-11-23 00:29:07 +00:00
|
|
|
$(INSTALL_DIR) $(1)/usr/bin
|
2019-04-18 02:20:19 +00:00
|
|
|
$(if $(CONFIG_DROPBEAR_DBCLIENT),$(LN) ../sbin/dropbear $(1)/usr/bin/dbclient,)
|
2014-11-06 19:35:34 +00:00
|
|
|
$(LN) ../sbin/dropbear $(1)/usr/bin/dropbearkey
|
2006-11-23 00:29:07 +00:00
|
|
|
$(INSTALL_DIR) $(1)/etc/config
|
2018-09-19 01:32:17 +00:00
|
|
|
$(INSTALL_CONF) ./files/dropbear.config $(1)/etc/config/dropbear
|
2006-11-23 00:29:07 +00:00
|
|
|
$(INSTALL_DIR) $(1)/etc/init.d
|
|
|
|
$(INSTALL_BIN) ./files/dropbear.init $(1)/etc/init.d/dropbear
|
2009-02-03 22:28:16 +00:00
|
|
|
$(INSTALL_DIR) $(1)/etc/dropbear
|
2020-01-15 20:31:12 +00:00
|
|
|
$(INSTALL_DIR) $(1)/lib/preinit
|
|
|
|
$(INSTALL_DATA) ./files/dropbear.failsafe $(1)/lib/preinit/99_10_failsafe_dropbear
|
2024-01-09 00:40:02 +00:00
|
|
|
$(foreach f,$(filter /etc/dropbear/%,$(Package/dropbear/conffiles)),$(if $(wildcard $(TOPDIR)/files/$(f)),chmod 0600 $(TOPDIR)/files/$(f) || :; ))
|
2006-05-10 19:06:22 +00:00
|
|
|
endef
|
|
|
|
|
|
|
|
define Package/dropbearconvert/install
|
2006-11-23 00:29:07 +00:00
|
|
|
$(INSTALL_DIR) $(1)/usr/bin
|
2007-08-11 21:53:15 +00:00
|
|
|
$(INSTALL_BIN) $(PKG_BUILD_DIR)/dropbearconvert $(1)/usr/bin/dropbearconvert
|
2006-05-10 19:06:22 +00:00
|
|
|
endef
|
|
|
|
|
|
|
|
$(eval $(call BuildPackage,dropbear))
|
|
|
|
$(eval $(call BuildPackage,dropbearconvert))
|