[2/2,v2] use custom SSH configuration in LFS file

Message ID 11288423-9893-0123-64b2-f0299377ca18@link38.eu
State Superseded
Headers
Series [1/2,v2] add hardened SSH server configuration |

Commit Message

Peter Müller Sept. 9, 2018, 3:01 a.m. UTC
  Use custom OpenSSH server configuration file (see first patch
of this series) instead of upstream one.

Partially fixes #11538

Signed-off-by: Peter Müller <peter.mueller@link38.eu>
---
 lfs/openssh | 21 ++++-----------------
 1 file changed, 4 insertions(+), 17 deletions(-)
  

Patch

diff --git a/lfs/openssh b/lfs/openssh
index a88b2d126..d60ec7ce5 100644
--- a/lfs/openssh
+++ b/lfs/openssh
@@ -82,23 +82,10 @@  $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
 
 	cd $(DIR_APP) && make $(MAKETUNING)
 	cd $(DIR_APP) && make install
-	sed -i -e 's/^#\?Port .*$$/Port 22/' \
-		-e 's/^#\?Protocol .*$$/Protocol 2/' \
-		-e 's/^#\?LoginGraceTime .*$$/LoginGraceTime 30s/' \
-		-e 's/^#\?PubkeyAuthentication .*$$/PubkeyAuthentication yes/' \
-		-e 's/^#\?PasswordAuthentication .*$$/PasswordAuthentication no/' \
-		-e 's/^#\?MaxStartups .*$$/MaxStartups 5/' \
-		-e 's/^#\?IgnoreUserKnownHosts .*$$/IgnoreUserKnownHosts yes/' \
-		-e 's/^#\?UsePAM .*$$//' \
-		-e 's/^#\?X11Forwarding .*$$/X11Forwarding no/' \
-		-e 's/^#\?SyslogFacility AUTH .*$$/SyslogFacility AUTH/' \
-		-e 's/^#\?LogLevel INFO .*$$/LogLevel INFO/' \
-		-e 's/^#\?AllowTcpForwarding .*$$/AllowTcpForwarding no/' \
-		-e 's/^#\?PermitRootLogin .*$$/PermitRootLogin yes/' \
-		-e 's|^#\?HostKey /etc/ssh/ssh_host_dsa_key$$||' \
-		-e 's|^#\?HostKey /etc/ssh/ssh_host_ecdsa_key$$||' \
-		-e 's|^#\?HostKey /etc/ssh/ssh_host_ed25519_key$$||' \
-		-e 's|^#\?HostKey /etc/ssh/ssh_host_rsa_key$$|HostKey /etc/ssh/ssh_host_ecdsa_key\nHostKey /etc/ssh/ssh_host_ed25519_key\nHostKey /etc/ssh/ssh_host_rsa_key|' \
+
+	# install custom OpenSSH server configuration
+	install -v -m 644 $(DIR_SRC)/config/ssh/sshd_config \
 		/etc/ssh/sshd_config
+
 	@rm -rf $(DIR_APP)
 	@$(POSTBUILD)