Skip to contentSkip to conversation

package: dropbear: add support for displaying /etc/motd

PATCH New Alexandru Ardelean 3 participants 8 messages May 23, 2019 – Jun 1, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package: dropbear: add support for displaying /etc/motd

When dropbear changed the way how to configure things, by providing a localoptions.h file, it also defaulted (somehow) to disable the display of /etc/motd by default.

This can be configured by adding a #define DO_MOTD 1 in the localoptions.h, which requires it's own BR2_PACKAGE_DROPBEAR_MOTD Kconfig option.

By default, support for displaying /etc/motd on login is disabled.

---
 package/dropbear/Config.in   | 6 ++++++
 package/dropbear/dropbear.mk | 8 ++++++++
 2 files changed, 14 insertions(+)
package/dropbear/Config.in +6 -0
index 62f77bad9d..936379d10c 100644
@@ -56,6 +56,12 @@ config BR2_PACKAGE_DROPBEAR_LASTLOG
 	  Enable logging of dropbear access to lastlog. Notice that
 	  Buildroot does not generate lastlog by default.
 
+config BR2_PACKAGE_DROPBEAR_MOTD
+	bool "display motd on login"
+	help
+	  Add support for displaying the contents of /etc/motd
+	  when a user logs into a SSH session.
+
 config BR2_PACKAGE_DROPBEAR_LEGACY_CRYPTO
 	bool "enable legacy crypto"
 	help
package/dropbear/dropbear.mk +8 -0
index e10c851606..d16b578b2d 100644
@@ -71,6 +71,10 @@ define DROPBEAR_ENABLE_REVERSE_DNS
 	echo '#define DO_HOST_LOOKUP 1'                 >> $(@D)/localoptions.h
 endef
 
+define DROPBEAR_ENABLE_MOTD
+	echo '#define DO_MOTD 1'                        >> $(@D)/localoptions.h
+endef
+
 define DROPBEAR_BUILD_FEATURED
 	echo '#define DROPBEAR_SMALL_CODE 0'            >> $(@D)/localoptions.h
 	echo '#define DROPBEAR_TWOFISH128 1'            >> $(@D)/localoptions.h
@@ -124,6 +128,10 @@ ifneq ($(BR2_PACKAGE_DROPBEAR_LASTLOG),y)
 DROPBEAR_CONF_OPTS += --disable-lastlog
 endif
 
+ifeq ($(BR2_PACKAGE_DROPBEAR_MOTD),y)
+DROPBEAR_POST_EXTRACT_HOOKS += DROPBEAR_ENABLE_MOTD
+endif
+
 define DROPBEAR_INSTALL_TARGET_CMDS
 	$(INSTALL) -m 755 $(@D)/dropbearmulti $(TARGET_DIR)/usr/sbin/dropbear
 	for f in $(DROPBEAR_TARGET_BINS); do \
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/1 package: dropbear: add support for displaying /etc/motd

Hello Alexandru,

Quoted 11 lines · On Thu, 23 May 2019 15:11:15 +0300 Alexandru Ardelean <[email protected]>…

When dropbear changed the way how to configure things, by providing a localoptions.h file, it also defaulted (somehow) to disable the display of /etc/motd by default.

This can be configured by adding a #define DO_MOTD 1 in the localoptions.h, which requires it's own BR2_PACKAGE_DROPBEAR_MOTD Kconfig option.

By default, support for displaying /etc/motd on login is disabled.

Thanks for your patch.

package/dropbear/Config.in config BR2_PACKAGE_DROPBEAR_LASTLOG · line 63

Quoted 5 lines
package/dropbear/Config.in +5 -0
+config BR2_PACKAGE_DROPBEAR_MOTD
+	bool "display motd on login"
+	help
+	  Add support for displaying the contents of /etc/motd
+	  when a user logs into a SSH session.

In fact, I am a bit worried by all those additional dropbear options to tweak "minor" details of the dropbear configuration.

Perhaps we should bite the bullet and add an option like this:

config BR2_PACKAGE_DROPBEAR_CONFIG_FILE
string "path to dropbear config file"
help
Path to a file whose contents will be appended to Dropbear localoptions.h. It can be used to tweak the Dropbear configuration.

And then, in the .mk:

DROPBEAR_CONFIG_FILE = $(call qstrip,$(BR2_PACKAGE_DROPBEAR_CONFIG_FILE)) ifneq ($(DROPBEAR_CONFIG_FILE),)
define DROPBEAR_APPEND_CONFIG_FILE

	cat $(DROPBEAR_CONFIG_FILE) >> $(@D)/localoptions.h

endef
DROPBEAR_POST_EXTRACT_HOOKS += DROPBEAR_APPEND_CONFIG_FILE endif

This way, we have something that is much more flexible, as it allows you to define whatever Dropbear option you like.

Note: this is just a suggestion; I don't know what other maintainers/developers will think about it.

Best regards,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#2 lore raw

PATCH 1/1 package: dropbear: add support for displaying /etc/motd

Quoted 40 lines · Thomas Petazzoni

Hello Alexandru,

Quoted 11 lines · On Thu, 23 May 2019 15:11:15 +0300 Alexandru Ardelean <[email protected]>…

When dropbear changed the way how to configure things, by providing a localoptions.h file, it also defaulted (somehow) to disable the display of /etc/motd by default.

This can be configured by adding a #define DO_MOTD 1 in the localoptions.h, which requires it's own BR2_PACKAGE_DROPBEAR_MOTD Kconfig option.

By default, support for displaying /etc/motd on login is disabled.

Thanks for your patch.

package/dropbear/Config.in config BR2_PACKAGE_DROPBEAR_LASTLOG · line 63

Quoted 5 lines
package/dropbear/Config.in +5 -0
+config BR2_PACKAGE_DROPBEAR_MOTD
+     bool "display motd on login"
+     help
+       Add support for displaying the contents of /etc/motd
+       when a user logs into a SSH session.

In fact, I am a bit worried by all those additional dropbear options to tweak "minor" details of the dropbear configuration.

Perhaps we should bite the bullet and add an option like this:

config BR2_PACKAGE_DROPBEAR_CONFIG_FILE
string "path to dropbear config file"
help
Path to a file whose contents will be appended to Dropbear localoptions.h. It can be used to tweak the Dropbear configuration.

And then, in the .mk:

Quoted 8 lines

DROPBEAR_CONFIG_FILE = $(call qstrip,$(BR2_PACKAGE_DROPBEAR_CONFIG_FILE)) ifneq ($(DROPBEAR_CONFIG_FILE),)
define DROPBEAR_APPEND_CONFIG_FILE

        cat $(DROPBEAR_CONFIG_FILE) >> $(@D)/localoptions.h

endef
DROPBEAR_POST_EXTRACT_HOOKS += DROPBEAR_APPEND_CONFIG_FILE endif

I'd be fine with this approach as well.

Quoted 8 lines

This way, we have something that is much more flexible, as it allows you to define whatever Dropbear option you like.

Note: this is just a suggestion; I don't know what other maintainers/developers will think about it.

Best regards,

Thanks
Alex

Quoted 5 lines

Thomas
--
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

#3 lore raw

PATCH 1/1 package: dropbear: add support for displaying /etc/motd

In reply to Thomas Petazzoni
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Thomas" == Thomas Petazzoni <[email protected]> writes:

Hi,

Quoted 5 lines

This way, we have something that is much more flexible, as it allows you to define whatever Dropbear option you like.

Note: this is just a suggestion; I don't know what other maintainers/developers will think about it.

Agreed, if we want such finegrained configuration then that would be the way to go.

Signature · 1 line
Bye, Peter Korsgaard
#4 lore raw

PATCH 1/1 package: dropbear: add support for displaying /etc/motd

Quoted 5 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

"Peter" == Peter Korsgaard <[email protected]> writes:

"Thomas" == Thomas Petazzoni <[email protected]> writes:

Hi,

Quoted 8 lines
Quoted 5 lines

This way, we have something that is much more flexible, as it allows you to define whatever Dropbear option you like.

Note: this is just a suggestion; I don't know what other maintainers/developers will think about it.

Agreed, if we want such finegrained configuration then that would be the way to go.

Alexandru, will you send such a patch? In the mean time I have marked this patch as changes requested in patchwork.

Signature · 1 line
Bye, Peter Korsgaard
#5 lore raw

PATCH 1/1 package: dropbear: add support for displaying /etc/motd

Quoted 9 lines · Peter Korsgaard
Quoted 8 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

"Peter" == Peter Korsgaard <[email protected]> writes:

"Thomas" == Thomas Petazzoni <[email protected]> writes:

Hi,

Quoted 2 lines

This way, we have something that is much more flexible, as it allows you to define whatever Dropbear option you like.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

Note: this is just a suggestion; I don't know what other maintainers/developers will think about it.

Agreed, if we want such finegrained configuration then that would be the way to go.

Alexandru, will you send such a patch? In the mean time I have marked this patch as changes requested in patchwork.

Yes.

Sorry for the late reply.
I left the thread unread (I do it as personal task-tracker), and I did not notice this mail.

Thanks
Alex

Quoted 3 lines

--
Bye, Peter Korsgaard

#6 lore raw

PATCH 1/1 dropbear: add build opt to provide file with localoptions.h

In reply to Alexandru Ardelean

From: Alexandru Ardelean <[email protected]>

Based on discussion here:
https://patchwork.ozlabs.org/patch/1104071/
Thomas suggested to implement an option to specify a file that gets appended to the localoptions.h of dropbear, as well as providing the code for this

This patch implements the changes.
The patch was tested successfully with the DO_MOTD option, which the initial patch tried to address.

---
Changelog v1 -> v2:
* re-implemented with suggestions from Thomas
* tested patch with #define DO_MOTD 1 option

 package/dropbear/Config.in   | 7 +++++++
 package/dropbear/dropbear.mk | 8 ++++++++
 2 files changed, 15 insertions(+)
package/dropbear/Config.in +7 -0
index 62f77bad9d..bc8d80ecf4 100644
@@ -66,4 +66,11 @@ config BR2_PACKAGE_DROPBEAR_LEGACY_CRYPTO
 	    DSA public keys
 	    Diffie-Hellman Group1 key exchange
 
+config BR2_PACKAGE_DROPBEAR_CONFIG_FILE
+	string "path to dropbear config file"
+	help
+	  Path to a file whose contents will be appended to Dropbear
+	  localoptions.h. It can be used to tweak the Dropbear
+	  configuration.
+
 endif
package/dropbear/dropbear.mk +8 -0
index d93faa48ea..86c7769c51 100644
@@ -124,6 +124,14 @@ ifneq ($(BR2_PACKAGE_DROPBEAR_LASTLOG),y)
 DROPBEAR_CONF_OPTS += --disable-lastlog
 endif
 
+DROPBEAR_CONFIG_FILE = $(call qstrip,$(BR2_PACKAGE_DROPBEAR_CONFIG_FILE))
+ifneq ($(DROPBEAR_CONFIG_FILE),)
+define DROPBEAR_APPEND_CONFIG_FILE
+	cat $(DROPBEAR_CONFIG_FILE) >> $(@D)/localoptions.h
+endef
+DROPBEAR_POST_EXTRACT_HOOKS += DROPBEAR_APPEND_CONFIG_FILE
+endif
+
 define DROPBEAR_INSTALL_TARGET_CMDS
 	$(INSTALL) -m 755 $(@D)/dropbearmulti $(TARGET_DIR)/usr/sbin/dropbear
 	for f in $(DROPBEAR_TARGET_BINS); do \
Signature · 1 line
2.20.1
#7 lore raw

PATCH 1/1 dropbear: add build opt to provide file with localoptions.h

Hello Alexandru,

Thanks for this new iteration!

Quoted 12 lines · On Wed, 29 May 2019 13:27:06 +0300 Alexandru Ardelean <[email protected]>…

From: Alexandru Ardelean <[email protected]>

Based on discussion here:
https://patchwork.ozlabs.org/patch/1104071/
Thomas suggested to implement an option to specify a file that gets appended to the localoptions.h of dropbear, as well as providing the code for this

This patch implements the changes.
The patch was tested successfully with the DO_MOTD option, which the initial patch tried to address.

Quoted 6 lines

---
Changelog v1 -> v2:
* re-implemented with suggestions from Thomas
* tested patch with #define DO_MOTD 1 option

I've applied to next, after renaming the option. To me BR2_PACKAGE_DROPBEAR_CONFIG_FILE sounded like the configuration file you would have in /etc/dropbear/ for example. I also reworked teh commit log.

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com