[Buildroot] [RFC] openssh: add option to allow login as root

Esben Haabendal esben.haabendal at gmail.com
Tue Mar 19 11:41:56 UTC 2019


From: Esben Haabendal <esben at haabendal.dk>

What do you think. Is this kind of micro-management of a configuration
file something that I should keep out of tree?

/Esben
---
 package/openssh/Config.in  | 10 ++++++++++
 package/openssh/openssh.mk |  7 +++++++
 2 files changed, 17 insertions(+)

diff --git a/package/openssh/Config.in b/package/openssh/Config.in
index 683a9c0e5191..bc4f40efa3de 100644
--- a/package/openssh/Config.in
+++ b/package/openssh/Config.in
@@ -9,3 +9,13 @@ config BR2_PACKAGE_OPENSSH
 	  friends.
 
 	  http://www.openssh.com/
+
+if BR2_PACKAGE_OPENSSH
+
+config BR2_PACKAGE_OPENSSH_PERMIT_ROOT_LOGIN
+	bool "Allow SSH root login"
+	help
+	  Modify SSH server configuration to allow login as root.
+	  Warning: This might not be a good idea.  Use at own risk!
+
+endif
diff --git a/package/openssh/openssh.mk b/package/openssh/openssh.mk
index 4fef5caedb01..8d1c153a8752 100644
--- a/package/openssh/openssh.mk
+++ b/package/openssh/openssh.mk
@@ -88,4 +88,11 @@ endef
 
 OPENSSH_POST_INSTALL_TARGET_HOOKS += OPENSSH_INSTALL_SSH_COPY_ID
 
+ifeq ($(BR2_PACKAGE_OPENSSH_PERMIT_ROOT_LOGIN),y)
+define OPENSSH_INSTALL_PERMIT_ROOT_LOGIN
+	$(SED) 's/\#PermitRootLogin prohibit-password/PermitRootLogin yes/' $(TARGET_DIR)/etc/ssh/sshd_config
+endef
+OPENSSH_POST_INSTALL_TARGET_HOOKS += OPENSSH_INSTALL_PERMIT_ROOT_LOGIN
+endif
+
 $(eval $(autotools-package))
-- 
2.21.0



More information about the buildroot mailing list