2 # Copyright (C) 2006-2020 OpenWrt.org
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
8 include $(TOPDIR
)/rules.mk
14 PKG_SOURCE
:=$(PKG_NAME
)-$(PKG_VERSION
).
tar.bz2
16 http
://matt.ucc.asn.au
/dropbear
/releases
/ \
17 https
://dropbear.nl
/mirror
/releases
/
18 PKG_HASH
:=48235d10b37775dbda59341ac0c4b239b82ad6318c31568b985730c788aac53b
21 PKG_LICENSE_FILES
:=LICENSE libtomcrypt
/LICENSE libtommath
/LICENSE
22 PKG_CPE_ID
:=cpe
:/a
:matt_johnston
:dropbear_ssh_server
25 PKG_ASLR_PIE_REGULAR
:=1
30 PKG_CONFIG_DEPENDS
:= \
31 CONFIG_TARGET_INIT_PATH CONFIG_DROPBEAR_ECC CONFIG_DROPBEAR_ECC_FULL \
32 CONFIG_DROPBEAR_CURVE25519 CONFIG_DROPBEAR_ZLIB \
33 CONFIG_DROPBEAR_ED25519 CONFIG_DROPBEAR_CHACHA20POLY1305 \
34 CONFIG_DROPBEAR_UTMP CONFIG_DROPBEAR_PUTUTLINE \
35 CONFIG_DROPBEAR_DBCLIENT CONFIG_DROPBEAR_SCP CONFIG_DROPBEAR_ASKPASS
37 include $(INCLUDE_DIR
)/package.mk
40 STAMP_CONFIGURED
:=$(strip $(STAMP_CONFIGURED
))_
$(shell echo
$(CONFIG_TARGET_INIT_PATH
) |
$(MKHASH
) md5
)
43 define Package
/dropbear
/Default
44 URL
:=http
://matt.ucc.asn.au
/dropbear
/
47 define Package
/dropbear
/config
48 source
"$(SOURCE)/Config.in"
51 define Package
/dropbear
52 $(call Package
/dropbear
/Default
)
55 TITLE
:=Small SSH2 client
/server
56 DEPENDS
:= +DROPBEAR_ZLIB
:zlib
58 $(if
$(CONFIG_DROPBEAR_SCP
),ALTERNATIVES
+= \
59 100:/usr
/bin
/scp
:/usr
/sbin
/dropbear
,)
60 $(if
$(CONFIG_DROPBEAR_DBCLIENT
),ALTERNATIVES
+= \
61 100:/usr
/bin
/ssh
:/usr
/sbin
/dropbear
,)
65 define Package
/dropbear
/description
66 A small SSH2 server
/client designed for small memory environments.
69 define Package
/dropbear
/conffiles
70 $(if
$(CONFIG_DROPBEAR_ED25519
),/etc
/dropbear
/dropbear_ed25519_host_key
)
71 $(if
$(CONFIG_DROPBEAR_ECC
),/etc
/dropbear
/dropbear_ecdsa_host_key
)
72 /etc
/dropbear
/dropbear_rsa_host_key
76 define Package
/dropbearconvert
77 $(call Package
/dropbear
/Default
)
80 TITLE
:=Utility for converting SSH keys
81 DEPENDS
:= +DROPBEAR_ZLIB
:zlib
90 $(if
$(CONFIG_DROPBEAR_UTMP
),,--disable-utmp
) \
94 $(if
$(CONFIG_DROPBEAR_PUTUTLINE
),,--disable-pututline
) \
95 --disable-pututxline \
96 $(if
$(CONFIG_DROPBEAR_ZLIB
),,--disable-zlib
) \
97 --enable-bundled-libtom
99 ##############################################################################
101 # option|value - add option to localoptions.h
102 # !!option|value - replace option in sysoptions.h
104 ##############################################################################
106 # remove protocol idented software version number:
108 # disable legacy/unsafe methods and unused functionality:
109 # - DROPBEAR_CLI_NETCAT
113 DEFAULT_PATH|
"$(TARGET_INIT_PATH)" \
114 !!LOCAL_IDENT|
"SSH-2.0-dropbear" \
115 DROPBEAR_CLI_NETCAT|
0 \
120 ##############################################################################
122 # option|config|enabled|disabled = add option to localoptions.h
123 # !!option|config|enabled|disabled = replace option in sysoptions.h
125 # option := (config) ? enabled : disabled
127 ##############################################################################
130 DROPBEAR_CURVE25519|CONFIG_DROPBEAR_CURVE25519|
1|
0 \
131 DROPBEAR_ED25519|CONFIG_DROPBEAR_ED25519|
1|
0 \
132 DROPBEAR_CHACHA20POLY1305|CONFIG_DROPBEAR_CHACHA20POLY1305|
1|
0 \
133 DROPBEAR_ECDSA|CONFIG_DROPBEAR_ECC|
1|
0 \
134 DROPBEAR_ECDH|CONFIG_DROPBEAR_ECC|
1|
0 \
135 !!DROPBEAR_ECC_384|CONFIG_DROPBEAR_ECC_FULL|
1|
0 \
136 !!DROPBEAR_ECC_521|CONFIG_DROPBEAR_ECC_FULL|
1|
0 \
137 DROPBEAR_CLI_ASKPASS_HELPER|CONFIG_DROPBEAR_ASKPASS|
1|
0 \
140 TARGET_CFLAGS
+= -DARGTYPE
=3 -ffunction-sections
-fdata-sections
-flto
141 TARGET_LDFLAGS
+= -Wl
,--gc-sections
-flto
=jobserver
143 db_opt_add
=echo
'\#define $(1) $(2)' >> $(PKG_BUILD_DIR
)/localoptions.h
144 db_opt_replace
=$(ESED
) 's,^(\#define $(1)) .*$$$$,\1 $(2),g' $(PKG_BUILD_DIR
)/sysoptions.h
146 define Build
/Configure
/dropbear_headers
147 $(strip $(foreach s
,$(DB_OPT_COMMON
), \
148 $(if
$(filter !!%,$(word 1,$(subst |
, ,$(s
)))), \
149 $(call db_opt_replace
,$(patsubst !!%,%,$(word 1,$(subst |
, ,$(s
)))),$(word 2,$(subst |
, ,$(s
)))), \
150 $(call db_opt_add
,$(word 1,$(subst |
, ,$(s
))),$(word 2,$(subst |
, ,$(s
)))) \
154 $(strip $(foreach s
,$(DB_OPT_CONFIG
), \
155 $(if
$(filter !!%,$(word 1,$(subst |
, ,$(s
)))), \
156 $(call db_opt_replace
,$(patsubst !!%,%,$(word 1,$(subst |
, ,$(s
)))),$(if
$($(word 2,$(subst |
, ,$(s
)))),$(word 3,$(subst |
, ,$(s
))),$(word 4,$(subst |
, ,$(s
))))), \
157 $(call db_opt_add
,$(word 1,$(subst |
, ,$(s
))),$(if
$($(word 2,$(subst |
, ,$(s
)))),$(word 3,$(subst |
, ,$(s
))),$(word 4,$(subst |
, ,$(s
))))) \
162 define Build
/Configure
163 : > $(PKG_BUILD_DIR
)/localoptions.h
165 $(Build
/Configure
/Default
)
167 $(Build
/Configure
/dropbear_headers
)
169 # Enforce rebuild of svr-chansession.c
170 rm -f
$(PKG_BUILD_DIR
)/svr-chansession.o
172 # Rebuild them on config change
173 +$(MAKE
) -C
$(PKG_BUILD_DIR
)/libtomcrypt
clean
174 +$(MAKE
) -C
$(PKG_BUILD_DIR
)/libtommath
clean
178 +$(MAKE
) $(PKG_JOBS
) -C
$(PKG_BUILD_DIR
) \
179 $(TARGET_CONFIGURE_OPTS
) \
180 PROGRAMS
="dropbear $(if $(CONFIG_DROPBEAR_DBCLIENT),dbclient,) dropbearkey $(if $(CONFIG_DROPBEAR_SCP),scp,)" \
181 MULTI
=1 SCPPROGRESS
=1
182 +$(MAKE
) $(PKG_JOBS
) -C
$(PKG_BUILD_DIR
) \
183 $(TARGET_CONFIGURE_OPTS
) \
184 PROGRAMS
="dropbearconvert"
187 define Package
/dropbear
/install
188 $(INSTALL_DIR
) $(1)/usr
/sbin
189 $(INSTALL_BIN
) $(PKG_BUILD_DIR
)/dropbearmulti
$(1)/usr
/sbin
/dropbear
190 $(INSTALL_DIR
) $(1)/usr
/bin
191 $(if
$(CONFIG_DROPBEAR_DBCLIENT
),$(LN
) ..
/sbin
/dropbear
$(1)/usr
/bin
/dbclient
,)
192 $(LN
) ..
/sbin
/dropbear
$(1)/usr
/bin
/dropbearkey
193 $(INSTALL_DIR
) $(1)/etc
/config
194 $(INSTALL_CONF
) .
/files
/dropbear.config
$(1)/etc
/config
/dropbear
195 $(INSTALL_DIR
) $(1)/etc
/init.d
196 $(INSTALL_BIN
) .
/files
/dropbear.init
$(1)/etc
/init.d
/dropbear
197 $(INSTALL_DIR
) $(1)/usr
/lib
/opkg
/info
198 $(INSTALL_DIR
) $(1)/etc
/dropbear
199 $(INSTALL_DIR
) $(1)/lib
/preinit
200 $(INSTALL_DATA
) .
/files
/dropbear.failsafe
$(1)/lib
/preinit
/99_10_failsafe_dropbear
201 $(if
$(CONFIG_DROPBEAR_ED25519
),touch
$(1)/etc
/dropbear
/dropbear_ed25519_host_key
)
202 $(if
$(CONFIG_DROPBEAR_ECC
),touch
$(1)/etc
/dropbear
/dropbear_ecdsa_host_key
)
203 touch
$(1)/etc
/dropbear
/dropbear_rsa_host_key
206 define Package
/dropbearconvert
/install
207 $(INSTALL_DIR
) $(1)/usr
/bin
208 $(INSTALL_BIN
) $(PKG_BUILD_DIR
)/dropbearconvert
$(1)/usr
/bin
/dropbearconvert
211 $(eval
$(call BuildPackage
,dropbear
))
212 $(eval
$(call BuildPackage
,dropbearconvert
))