[1/2] openssh: Introduce include directory for additional sshd config files

Message ID 20241207150400.2159-1-stefan.schantl@ipfire.org
State Accepted
Commit 1a4d5cfd92bb1f52e6670399ef94a36fe97cdf6a
Headers
Series [1/2] openssh: Introduce include directory for additional sshd config files |

Commit Message

Stefan Schantl Dec. 7, 2024, 3:03 p.m. UTC
  This patch adds the prosibility to place additional *.config files in /etc/ssh/sshd_config.d/
which will be included and loaded during the daemon startup process.

Because this files will not be overwritten by any update, they can be used to place custom
or other persistent settings.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
---
 config/rootfiles/common/openssh | 1 +
 config/ssh/sshd_config          | 3 +++
 lfs/openssh                     | 4 ++++
 3 files changed, 8 insertions(+)
  

Patch

diff --git a/config/rootfiles/common/openssh b/config/rootfiles/common/openssh
index f7b479f55..d25651348 100644
--- a/config/rootfiles/common/openssh
+++ b/config/rootfiles/common/openssh
@@ -8,6 +8,7 @@  etc/ssh/ssh_config
 #etc/ssh/ssh_host_rsa_key
 #etc/ssh/ssh_host_rsa_key.pub
 etc/ssh/sshd_config
+etc/ssh/sshd_config.d
 usr/bin/scp
 usr/bin/sftp
 usr/bin/ssh
diff --git a/config/ssh/sshd_config b/config/ssh/sshd_config
index e338f8cef..ce74cb851 100644
--- a/config/ssh/sshd_config
+++ b/config/ssh/sshd_config
@@ -57,4 +57,7 @@  TCPKeepAlive no
 # Add support for SFTP
 Subsystem	sftp	/usr/lib/openssh/sftp-server
 
+# Include additional sshd config files.
+Include /etc/ssh/sshd_config.d/*.conf
+
 # EOF
diff --git a/lfs/openssh b/lfs/openssh
index c14c8267c..b1c9a1635 100644
--- a/lfs/openssh
+++ b/lfs/openssh
@@ -91,5 +91,9 @@  $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
 	install -v -m 644 $(DIR_SRC)/config/ssh/ssh_config \
 		/etc/ssh/ssh_config
 
+	# Create directory for additional config
+	# config files.
+	mkdir -pv /etc/ssh/sshd_config.d/
+
 	@rm -rf $(DIR_APP)
 	@$(POSTBUILD)