From patchwork Mon Mar 11 17:18:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Enrico Scholz X-Patchwork-Id: 40801 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 24B81C54E60 for ; Mon, 11 Mar 2024 17:19:12 +0000 (UTC) Received: from smtpout.cvg.de (smtpout.cvg.de [87.128.211.67]) by mx.groups.io with SMTP id smtpd.web10.669.1710177550574426040 for ; Mon, 11 Mar 2024 10:19:11 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="dkim: message contains an insecure body length tag" header.i=@sigma-chemnitz.de header.s=v2022040800 header.b=qQrvZS6m; spf=pass (domain: sigma-chemnitz.de, ip: 87.128.211.67, mailfrom: enrico.scholz@sigma-chemnitz.de) Received: from mail-mta-3.intern.sigma-chemnitz.de (mail-mta-3.intern.sigma-chemnitz.de [192.168.12.71]) by mail-out-3.intern.sigma-chemnitz.de (8.17.1/8.17.1) with ESMTPS id 42BHJ8ib107338 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=OK) for ; Mon, 11 Mar 2024 18:19:09 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sigma-chemnitz.de; s=v2022040800; t=1710177549; bh=TZOCIo2HtQHcx0cH7h7khJDa7zS/0r0dXOBR64mXZzI=; l=9117; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=qQrvZS6mKNFqMcTN4KRnt6ytIQcnGBm+nSlGD3qURbsZaSwnK8aRTK49tYX96dxYm mt0uBXQY0Rnfixv0TllDchHtYJxiX/d+bfXo1eaD4xbQNHHIUXU0nS1shfl/dyVYdg l+ajtRWZIKX43INW/LhPUIlDy5U9RjSRXI3n96KaH9nmf3nxYUAF5C2luE7HamVZDy krUx3RjYfg1TlGtVpU9NAynfbWXOW4lynLZuNuxEignQq3g6+UvJMzGRiuP3HoE2/C 3BHMnLCESqzGjjbBJ5VZNu42B81K+hsXeBzSHWTKBLbeeqqXpSC02Lrnn4LoldMFH1 piBpQ3qktwtUA== Received: from reddoxx.intern.sigma-chemnitz.de (reddoxx.sigma.local [192.168.16.32]) by mail-mta-3.intern.sigma-chemnitz.de (8.17.1/8.17.1) with ESMTP id 42BHJ0Vx279268 for from enrico.scholz@sigma-chemnitz.de; Mon, 11 Mar 2024 18:19:02 +0100 Received: from mail-msa-2.intern.sigma-chemnitz.de ([192.168.12.72]) by reddoxx.intern.sigma-chemnitz.de with ESMTP id E65WEYYM0G; Mon, 11 Mar 2024 18:18:59 +0100 Received: from ensc-pc.intern.sigma-chemnitz.de (ensc-pc.intern.sigma-chemnitz.de [192.168.3.24]) by mail-msa-2.intern.sigma-chemnitz.de (8.17.1/8.17.1) with ESMTPS id 42BHIxUb164811 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Mon, 11 Mar 2024 18:18:59 +0100 Received: from ensc by ensc-pc.intern.sigma-chemnitz.de with local (Exim 4.97.1) (envelope-from ) id 1rjjIh-00000008xuJ-0n9u; Mon, 11 Mar 2024 18:18:59 +0100 From: Enrico Scholz To: openembedded-core@lists.openembedded.org Cc: Enrico Scholz Subject: [PATCH 1/7] openssh: replace complete configuration files by patch Date: Mon, 11 Mar 2024 18:18:42 +0100 Message-ID: X-Mailer: git-send-email 2.44.0 In-Reply-To: References: MIME-Version: 1.0 Sender: Enrico Scholz X-REDDOXX-Id: 65ef3d03b121c496daa8ef71 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Mon, 11 Mar 2024 17:19:12 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/196957 From: Enrico Scholz Instead of shipping the whole configuration files for openssh, add small patch includes configuration snippets from subdirectories. This allows us to keep the original upstream configuration which is mainly useful for documentation purposes. It makes it more easy to identify OE specific setup. Signed-off-by: Enrico Scholz --- .../openssh/openssh/include-conf.patch | 32 +++++ .../openssh/openssh/ssh_config | 48 ------- .../openssh/openssh/sshd_config | 119 ------------------ .../openssh/openssh_9.6p1.bb | 5 +- 4 files changed, 33 insertions(+), 171 deletions(-) create mode 100644 meta/recipes-connectivity/openssh/openssh/include-conf.patch delete mode 100644 meta/recipes-connectivity/openssh/openssh/ssh_config delete mode 100644 meta/recipes-connectivity/openssh/openssh/sshd_config diff --git a/meta/recipes-connectivity/openssh/openssh/include-conf.patch b/meta/recipes-connectivity/openssh/openssh/include-conf.patch new file mode 100644 index 000000000000..3e0bd2957e25 --- /dev/null +++ b/meta/recipes-connectivity/openssh/openssh/include-conf.patch @@ -0,0 +1,32 @@ +Include configuration snippets from subdirectory. + +NOTE: first configuration option wins. + +Upstream-Status: Inappropriate + +Index: openssh-9.5p1/ssh_config +=================================================================== +--- openssh-9.5p1.orig/ssh_config ++++ openssh-9.5p1/ssh_config +@@ -5,6 +5,8 @@ + # users, and the values can be changed in per-user configuration files + # or on the command line. + ++Include /etc/ssh/ssh_config.d/*.conf ++ + # Configuration data is parsed as follows: + # 1. command line options + # 2. user-specific file +Index: openssh-9.5p1/sshd_config +=================================================================== +--- openssh-9.5p1.orig/sshd_config ++++ openssh-9.5p1/sshd_config +@@ -10,6 +10,8 @@ + # possible, but leave them commented. Uncommented options override the + # default value. + ++Include /etc/ssh/sshd_config.d/*.conf ++ + #Port 22 + #AddressFamily any + #ListenAddress 0.0.0.0 diff --git a/meta/recipes-connectivity/openssh/openssh/ssh_config b/meta/recipes-connectivity/openssh/openssh/ssh_config deleted file mode 100644 index cb2774a163ed..000000000000 --- a/meta/recipes-connectivity/openssh/openssh/ssh_config +++ /dev/null @@ -1,48 +0,0 @@ -# $OpenBSD: ssh_config,v 1.35 2020/07/17 03:43:42 dtucker Exp $ - -# This is the ssh client system-wide configuration file. See -# ssh_config(5) for more information. This file provides defaults for -# users, and the values can be changed in per-user configuration files -# or on the command line. - -# Configuration data is parsed as follows: -# 1. command line options -# 2. user-specific file -# 3. system-wide file -# Any configuration value is only changed the first time it is set. -# Thus, host-specific definitions should be at the beginning of the -# configuration file, and defaults at the end. - -# Site-wide defaults for some commonly used options. For a comprehensive -# list of available options, their meanings and defaults, please see the -# ssh_config(5) man page. - -Include /etc/ssh/ssh_config.d/*.conf - -# Host * -# ForwardAgent no -# ForwardX11 no -# PasswordAuthentication yes -# HostbasedAuthentication no -# GSSAPIAuthentication no -# GSSAPIDelegateCredentials no -# BatchMode no -# CheckHostIP yes -# AddressFamily any -# ConnectTimeout 0 -# StrictHostKeyChecking ask -# IdentityFile ~/.ssh/id_rsa -# IdentityFile ~/.ssh/id_dsa -# IdentityFile ~/.ssh/id_ecdsa -# IdentityFile ~/.ssh/id_ed25519 -# Port 22 -# Ciphers aes128-ctr,aes192-ctr,aes256-ctr,aes128-cbc,3des-cbc -# MACs hmac-md5,hmac-sha1,umac-64@openssh.com -# EscapeChar ~ -# Tunnel no -# TunnelDevice any:any -# PermitLocalCommand no -# VisualHostKey no -# ProxyCommand ssh -q -W %h:%p gateway.example.com -# RekeyLimit 1G 1h -# UserKnownHostsFile ~/.ssh/known_hosts.d/%k diff --git a/meta/recipes-connectivity/openssh/openssh/sshd_config b/meta/recipes-connectivity/openssh/openssh/sshd_config deleted file mode 100644 index e9eaf9315775..000000000000 --- a/meta/recipes-connectivity/openssh/openssh/sshd_config +++ /dev/null @@ -1,119 +0,0 @@ -# $OpenBSD: sshd_config,v 1.104 2021/07/02 05:11:21 dtucker Exp $ - -# This is the sshd server system-wide configuration file. See -# sshd_config(5) for more information. - -# This sshd was compiled with PATH=/usr/bin:/bin:/usr/sbin:/sbin - -# The strategy used for options in the default sshd_config shipped with -# OpenSSH is to specify options with their default value where -# possible, but leave them commented. Uncommented options override the -# default value. - -Include /etc/ssh/sshd_config.d/*.conf - -#Port 22 -#AddressFamily any -#ListenAddress 0.0.0.0 -#ListenAddress :: - -#HostKey /etc/ssh/ssh_host_rsa_key -#HostKey /etc/ssh/ssh_host_ecdsa_key -#HostKey /etc/ssh/ssh_host_ed25519_key - -# Ciphers and keying -#RekeyLimit default none - -# Logging -#SyslogFacility AUTH -#LogLevel INFO - -# Authentication: - -#LoginGraceTime 2m -#PermitRootLogin prohibit-password -#StrictModes yes -#MaxAuthTries 6 -#MaxSessions 10 - -#PubkeyAuthentication yes - -# The default is to check both .ssh/authorized_keys and .ssh/authorized_keys2 -# but this is overridden so installations will only check .ssh/authorized_keys -AuthorizedKeysFile .ssh/authorized_keys - -#AuthorizedPrincipalsFile none - -#AuthorizedKeysCommand none -#AuthorizedKeysCommandUser nobody - -# For this to work you will also need host keys in /etc/ssh/ssh_known_hosts -#HostbasedAuthentication no -# Change to yes if you don't trust ~/.ssh/known_hosts for -# HostbasedAuthentication -#IgnoreUserKnownHosts no -# Don't read the user's ~/.rhosts and ~/.shosts files -#IgnoreRhosts yes - -# To disable tunneled clear text passwords, change to no here! -#PasswordAuthentication yes -#PermitEmptyPasswords no - -# Change to yes to enable keyboard-interactive authentication (beware issues -# with some PAM modules and threads) -KbdInteractiveAuthentication no - -# Kerberos options -#KerberosAuthentication no -#KerberosOrLocalPasswd yes -#KerberosTicketCleanup yes -#KerberosGetAFSToken no - -# GSSAPI options -#GSSAPIAuthentication no -#GSSAPICleanupCredentials yes - -# Set this to 'yes' to enable PAM authentication, account processing, -# and session processing. If this is enabled, PAM authentication will -# be allowed through the KbdInteractiveAuthentication and -# PasswordAuthentication. Depending on your PAM configuration, -# PAM authentication via KbdInteractiveAuthentication may bypass -# the setting of "PermitRootLogin without-password". -# If you just want the PAM account and session checks to run without -# PAM authentication, then enable this but set PasswordAuthentication -# and KbdInteractiveAuthentication to 'no'. -#UsePAM no - -#AllowAgentForwarding yes -#AllowTcpForwarding yes -#GatewayPorts no -#X11Forwarding no -#X11DisplayOffset 10 -#X11UseLocalhost yes -#PermitTTY yes -#PrintMotd yes -#PrintLastLog yes -#TCPKeepAlive yes -#PermitUserEnvironment no -Compression no -ClientAliveInterval 15 -ClientAliveCountMax 4 -#UseDNS no -#PidFile /var/run/sshd.pid -#MaxStartups 10:30:100 -#PermitTunnel no -#ChrootDirectory none -#VersionAddendum none - -# no default banner path -#Banner none - -# override default of no subsystems -Subsystem sftp /usr/libexec/sftp-server - -# Example of overriding settings on a per-user basis -#Match User anoncvs -# X11Forwarding no -# AllowTcpForwarding no -# PermitTTY no -# ForceCommand cvs server diff --git a/meta/recipes-connectivity/openssh/openssh_9.6p1.bb b/meta/recipes-connectivity/openssh/openssh_9.6p1.bb index edd8e8c2d18f..d500ca6019fe 100644 --- a/meta/recipes-connectivity/openssh/openssh_9.6p1.bb +++ b/meta/recipes-connectivity/openssh/openssh_9.6p1.bb @@ -12,8 +12,6 @@ DEPENDS = "zlib openssl virtual/crypt" DEPENDS += "${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'libpam', '', d)}" SRC_URI = "http://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-${PV}.tar.gz \ - file://sshd_config \ - file://ssh_config \ file://init \ ${@bb.utils.contains('DISTRO_FEATURES', 'pam', '${PAM_SRC_URI}', '', d)} \ file://sshd.service \ @@ -23,6 +21,7 @@ SRC_URI = "http://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-${PV}.tar file://volatiles.99_sshd \ file://run-ptest \ file://fix-potential-signed-overflow-in-pointer-arithmatic.patch \ + file://include-conf.patch \ file://sshd_check_keys \ file://add-test-support-for-busybox.patch \ file://0001-regress-banner.sh-log-input-and-output-files-on-erro.patch \ @@ -101,8 +100,6 @@ CACHED_CONFIGUREVARS += "ac_cv_header_maillock_h=no" do_configure:prepend () { export LD="${CC}" - install -m 0644 ${WORKDIR}/sshd_config ${B}/ - install -m 0644 ${WORKDIR}/ssh_config ${B}/ } do_compile_ptest() { From patchwork Mon Mar 11 17:18:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Enrico Scholz X-Patchwork-Id: 40798 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 158C5C54E58 for ; Mon, 11 Mar 2024 17:19:12 +0000 (UTC) Received: from smtpout.cvg.de (smtpout.cvg.de [87.128.211.67]) by mx.groups.io with SMTP id smtpd.web11.624.1710177545754415177 for ; Mon, 11 Mar 2024 10:19:08 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="dkim: message contains an insecure body length tag" header.i=@sigma-chemnitz.de header.s=v2022040800 header.b=zx2W5+KJ; spf=pass (domain: sigma-chemnitz.de, ip: 87.128.211.67, mailfrom: enrico.scholz@sigma-chemnitz.de) Received: from mail-mta-3.intern.sigma-chemnitz.de (mail-mta-3.intern.sigma-chemnitz.de [192.168.12.71]) by mail-out-2.intern.sigma-chemnitz.de (8.17.1/8.17.1) with ESMTPS id 42BHJ3vm166679 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=OK) for ; Mon, 11 Mar 2024 18:19:03 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sigma-chemnitz.de; s=v2022040800; t=1710177543; bh=5pS4uC4ictL1nG4AVp3kw+LDUJAODwhk30KVGmTMQ98=; l=2621; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=zx2W5+KJeRT84UZ3Fsnobi203zhPnUtVvuidawLUpn89KagRTQ7/OMq+oCrC4KcVK PxX1o5Prnmtlvimwlkb+z4vFzlrWUCtoSGub7gesZGU8b5E6c/7GEXQJ73ue35fnxW 3WA5napYsLWHoNpeXZwpYlvn2gpz1B1RW1nbWMa9uMLSBLHiHFjLsggvufR1yy1cKA +wkTo7Cqw1hAuofQmrcUswshE9Gn82377P74P/6NPmiLV897Vv/IRlFPSdJUxbUcO8 XignahVOGw7075PxhkOuK2pwbGQT9bGvZFYQnJ9vnjwi+CU1lDMRECC6aLyyIOUFxF A5ipmxBdWkM2A== Received: from reddoxx.intern.sigma-chemnitz.de (reddoxx.sigma.local [192.168.16.32]) by mail-mta-3.intern.sigma-chemnitz.de (8.17.1/8.17.1) with ESMTP id 42BHJ0X7279260 for from enrico.scholz@sigma-chemnitz.de; Mon, 11 Mar 2024 18:19:00 +0100 Received: from mail-msa-3.intern.sigma-chemnitz.de ([192.168.12.73]) by reddoxx.intern.sigma-chemnitz.de with ESMTP id 0S4GN8JZDX; Mon, 11 Mar 2024 18:18:59 +0100 Received: from ensc-pc.intern.sigma-chemnitz.de (ensc-pc.intern.sigma-chemnitz.de [192.168.3.24]) by mail-msa-3.intern.sigma-chemnitz.de (8.15.2/8.15.2) with ESMTPS id 42BHIxtr105398 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Mon, 11 Mar 2024 18:18:59 +0100 Received: from ensc by ensc-pc.intern.sigma-chemnitz.de with local (Exim 4.97.1) (envelope-from ) id 1rjjIh-00000008xuM-0yAS; Mon, 11 Mar 2024 18:18:59 +0100 From: Enrico Scholz To: openembedded-core@lists.openembedded.org Cc: Enrico Scholz Subject: [PATCH 2/7] openssh-config: initial checkin Date: Mon, 11 Mar 2024 18:18:43 +0100 Message-ID: <507a19c6164d34669ff09794134257835063af64.1710177387.git.enrico.scholz@sigma-chemnitz.de> X-Mailer: git-send-email 2.44.0 In-Reply-To: References: MIME-Version: 1.0 Sender: Enrico Scholz X-REDDOXX-Id: 65ef3d03b121c496daa8ef76 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Mon, 11 Mar 2024 17:19:12 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/196953 From: Enrico Scholz Place OE specific openssh setup (which was removed in a previous patch) in a configuration snippet. Signed-off-by: Enrico Scholz --- .../openssh/openssh-config.bb | 30 +++++++++++++++++++ .../openssh/openssh-config/80-oe.conf | 5 ++++ .../openssh/openssh_9.6p1.bb | 2 ++ 3 files changed, 37 insertions(+) create mode 100644 meta/recipes-connectivity/openssh/openssh-config.bb create mode 100644 meta/recipes-connectivity/openssh/openssh-config/80-oe.conf diff --git a/meta/recipes-connectivity/openssh/openssh-config.bb b/meta/recipes-connectivity/openssh/openssh-config.bb new file mode 100644 index 000000000000..2ef6a770fcfe --- /dev/null +++ b/meta/recipes-connectivity/openssh/openssh-config.bb @@ -0,0 +1,30 @@ +SUMMARY = "OE openssh configuration" +DESCRIPTION = "Provides openssh configuration snippets which correspond to IMAGE_FEATURE" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" + +SRC_URI = "\ + file://80-oe.conf \ +" + +do_install() { + d=${D}${sysconfdir}/ssh/sshd_config.d + install -d "$d" + install -p -m 0644 \ + ${WORKDIR}/80-oe.conf \ + "$d"/ +} + +python populate_packages:prepend() { + dir = d.expand('${sysconfdir}/ssh/sshd_config.d') + + do_split_packages(d, dir, '^60-(.*)\.conf', + output_pattern='${PN}-%s', + description="openssh config for '%s' feature", + extra_depends='', + prepend=True) +} + +PACKAGES_DYNAMIC = "${PN}-*" + +FILES:${PN} = "${sysconfdir}/ssh/sshd_config.d/80-oe.conf" diff --git a/meta/recipes-connectivity/openssh/openssh-config/80-oe.conf b/meta/recipes-connectivity/openssh/openssh-config/80-oe.conf new file mode 100644 index 000000000000..9a92d3c8d197 --- /dev/null +++ b/meta/recipes-connectivity/openssh/openssh-config/80-oe.conf @@ -0,0 +1,5 @@ +KbdInteractiveAuthentication no + +Compression no +ClientAliveInterval 15 +ClientAliveCountMax 4 diff --git a/meta/recipes-connectivity/openssh/openssh_9.6p1.bb b/meta/recipes-connectivity/openssh/openssh_9.6p1.bb index d500ca6019fe..406b349f8283 100644 --- a/meta/recipes-connectivity/openssh/openssh_9.6p1.bb +++ b/meta/recipes-connectivity/openssh/openssh_9.6p1.bb @@ -191,6 +191,8 @@ RCONFLICTS:${PN}-sshd = "dropbear" CONFFILES:${PN}-sshd = "${sysconfdir}/ssh/sshd_config" CONFFILES:${PN}-ssh = "${sysconfdir}/ssh/ssh_config" +RRECOMMENDS:${PN} += "openssh-config" + ALTERNATIVE_PRIORITY = "90" ALTERNATIVE:${PN}-scp = "scp" ALTERNATIVE:${PN}-ssh = "ssh" From patchwork Mon Mar 11 17:18:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Enrico Scholz X-Patchwork-Id: 40802 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 45737C54E66 for ; Mon, 11 Mar 2024 17:19:12 +0000 (UTC) Received: from smtpout.cvg.de (smtpout.cvg.de [87.128.211.67]) by mx.groups.io with SMTP id smtpd.web10.667.1710177547400488275 for ; Mon, 11 Mar 2024 10:19:08 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="dkim: message contains an insecure body length tag" header.i=@sigma-chemnitz.de header.s=v2022040800 header.b=OuRi6aZ/; spf=pass (domain: sigma-chemnitz.de, ip: 87.128.211.67, mailfrom: enrico.scholz@sigma-chemnitz.de) Received: from mail-mta-3.intern.sigma-chemnitz.de (mail-mta-3.intern.sigma-chemnitz.de [192.168.12.71]) by mail-out-3.intern.sigma-chemnitz.de (8.17.1/8.17.1) with ESMTPS id 42BHJ30X107334 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=OK) for ; Mon, 11 Mar 2024 18:19:03 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sigma-chemnitz.de; s=v2022040800; t=1710177543; bh=tgXBssyGW9CpmKGiKb1CgNAqUjcV+vM5BAA+0hhbaK0=; l=2163; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=OuRi6aZ/+6U1ZzOPHa8gFekuqumFHPzbBkqlUC6q2hbad35mwNoS/Ls38Ewwf2zwq DZX4BdglkAwhHarUP8rfiRs8nWV0u7NgpUk++HLrPP8YrMKUTgK4NrjFjPQc4i9Ppf itRXACUC5NVmWB/R/tdDIeL8sCDcXAMRp2Xc2ECdPaV6cVvi/ZXrGQXmtEmVGObQQa Dfinu9KleEhlQANC8Z3Mqy1C+i7IuMFJLqnVcXYL50w4WM75Yy1pNHf1IxrZ83hCfP QxqEdb73nAsGdchucNs8H/EyjlKDwB9EZUvpbDIZM4AucSyy6rkTDK6jmQbMN8ZBrK u9gHs5AdQCKNA== Received: from reddoxx.intern.sigma-chemnitz.de (reddoxx.sigma.local [192.168.16.32]) by mail-mta-3.intern.sigma-chemnitz.de (8.17.1/8.17.1) with ESMTP id 42BHJ0qf279256 for from enrico.scholz@sigma-chemnitz.de; Mon, 11 Mar 2024 18:19:00 +0100 Received: from mail-msa-3.intern.sigma-chemnitz.de ([192.168.12.73]) by reddoxx.intern.sigma-chemnitz.de with ESMTP id 6NP30Y5Y47; Mon, 11 Mar 2024 18:18:59 +0100 Received: from ensc-pc.intern.sigma-chemnitz.de (ensc-pc.intern.sigma-chemnitz.de [192.168.3.24]) by mail-msa-3.intern.sigma-chemnitz.de (8.15.2/8.15.2) with ESMTPS id 42BHIxok105399 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Mon, 11 Mar 2024 18:18:59 +0100 Received: from ensc by ensc-pc.intern.sigma-chemnitz.de with local (Exim 4.97.1) (envelope-from ) id 1rjjIh-00000008xuR-1AFX; Mon, 11 Mar 2024 18:18:59 +0100 From: Enrico Scholz To: openembedded-core@lists.openembedded.org Cc: Enrico Scholz Subject: [PATCH 3/7] openssh: move configuration tweaking in configuration recipe Date: Mon, 11 Mar 2024 18:18:44 +0100 Message-ID: X-Mailer: git-send-email 2.44.0 In-Reply-To: References: MIME-Version: 1.0 Sender: Enrico Scholz X-REDDOXX-Id: 65ef3d03b121c496daa8ef7c List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Mon, 11 Mar 2024 17:19:12 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/196954 From: Enrico Scholz Instead of applying DISTRO_FEATURE based setup directly to sshd_config, add it to our configuration snippet. Signed-off-by: Enrico Scholz --- meta/recipes-connectivity/openssh/openssh-config.bb | 10 ++++++++++ meta/recipes-connectivity/openssh/openssh_9.6p1.bb | 8 -------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/meta/recipes-connectivity/openssh/openssh-config.bb b/meta/recipes-connectivity/openssh/openssh-config.bb index 2ef6a770fcfe..312a1c903f63 100644 --- a/meta/recipes-connectivity/openssh/openssh-config.bb +++ b/meta/recipes-connectivity/openssh/openssh-config.bb @@ -13,6 +13,16 @@ do_install() { install -p -m 0644 \ ${WORKDIR}/80-oe.conf \ "$d"/ + + f=$d/80-oe.conf + + if [ "${@bb.utils.filter('DISTRO_FEATURES', 'pam', d)}" ]; then + echo "UsePAM yes" >> "$f" + fi + + if [ "${@bb.utils.filter('DISTRO_FEATURES', 'x11', d)}" ]; then + echo "X11Forwarding yes" >> "$f" + fi } python populate_packages:prepend() { diff --git a/meta/recipes-connectivity/openssh/openssh_9.6p1.bb b/meta/recipes-connectivity/openssh/openssh_9.6p1.bb index 406b349f8283..e792b459d838 100644 --- a/meta/recipes-connectivity/openssh/openssh_9.6p1.bb +++ b/meta/recipes-connectivity/openssh/openssh_9.6p1.bb @@ -109,11 +109,6 @@ do_compile_ptest() { do_install:append () { if [ "${@bb.utils.filter('DISTRO_FEATURES', 'pam', d)}" ]; then install -D -m 0644 ${WORKDIR}/sshd ${D}${sysconfdir}/pam.d/sshd - sed -i -e 's:#UsePAM no:UsePAM yes:' ${D}${sysconfdir}/ssh/sshd_config - fi - - if [ "${@bb.utils.filter('DISTRO_FEATURES', 'x11', d)}" ]; then - sed -i -e 's:#X11Forwarding no:X11Forwarding yes:' ${D}${sysconfdir}/ssh/sshd_config fi install -d ${D}${sysconfdir}/init.d @@ -188,9 +183,6 @@ RPROVIDES:${PN}-sshd = "sshd" RCONFLICTS:${PN} = "dropbear" RCONFLICTS:${PN}-sshd = "dropbear" -CONFFILES:${PN}-sshd = "${sysconfdir}/ssh/sshd_config" -CONFFILES:${PN}-ssh = "${sysconfdir}/ssh/ssh_config" - RRECOMMENDS:${PN} += "openssh-config" ALTERNATIVE_PRIORITY = "90" From patchwork Mon Mar 11 17:18:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Enrico Scholz X-Patchwork-Id: 40803 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4B4A4C54E60 for ; Mon, 11 Mar 2024 17:19:22 +0000 (UTC) Received: from smtpout.cvg.de (smtpout.cvg.de [87.128.211.67]) by mx.groups.io with SMTP id smtpd.web10.670.1710177553529188444 for ; Mon, 11 Mar 2024 10:19:14 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="dkim: message contains an insecure body length tag" header.i=@sigma-chemnitz.de header.s=v2022040800 header.b=sI2AjGHY; spf=pass (domain: sigma-chemnitz.de, ip: 87.128.211.67, mailfrom: enrico.scholz@sigma-chemnitz.de) Received: from mail-mta-3.intern.sigma-chemnitz.de (mail-mta-3.intern.sigma-chemnitz.de [192.168.12.71]) by mail-out-3.intern.sigma-chemnitz.de (8.17.1/8.17.1) with ESMTPS id 42BHJBO1107344 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=OK) for ; Mon, 11 Mar 2024 18:19:11 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sigma-chemnitz.de; s=v2022040800; t=1710177552; bh=AmH8cYv60/0VMV7hB0AHahDoy7sc65jAX/35Qmp313g=; l=1260; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=sI2AjGHY/LtKonBE31NuirmZ+kuF7DuzJCcO5WWwQwLERWAYdA6tYUcogL1XUL4EI 4m3MTlt2Fh+W3fZHsYMnYBX/o832jGBfh1c1/6rXYHjcKxqGCPMSmdYEaN84cEUzCh I0JI6fIlQW+DZVgH8Y8Ui1m1hZ7L28wHhv6UwOj2x7R9UZQQhZLH0jWP/xaaY23Eg8 LO4bqnRTV+rhtJZYhZIn7/JdcX7AbJJqtImOUWNAtYZB8rnu/bh9alMj9FNFIMPC18 Q4FKNMu/Th6Q7Swet/P3/ZYdZvOW2hUORf1P2Ir+SgHOcFQ+1h6DnsbNOLdrSGh+5Q DGmHyVmu8kCeQ== Received: from reddoxx.intern.sigma-chemnitz.de (reddoxx.sigma.local [192.168.16.32]) by mail-mta-3.intern.sigma-chemnitz.de (8.17.1/8.17.1) with ESMTP id 42BHJ0NP279267 for from enrico.scholz@sigma-chemnitz.de; Mon, 11 Mar 2024 18:19:02 +0100 Received: from mail-msa-2.intern.sigma-chemnitz.de ([192.168.12.72]) by reddoxx.intern.sigma-chemnitz.de with ESMTP id LH3MV0R2K8; Mon, 11 Mar 2024 18:18:59 +0100 Received: from ensc-pc.intern.sigma-chemnitz.de (ensc-pc.intern.sigma-chemnitz.de [192.168.3.24]) by mail-msa-2.intern.sigma-chemnitz.de (8.17.1/8.17.1) with ESMTPS id 42BHIxs7164812 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Mon, 11 Mar 2024 18:18:59 +0100 Received: from ensc by ensc-pc.intern.sigma-chemnitz.de with local (Exim 4.97.1) (envelope-from ) id 1rjjIh-00000008xuU-1Lrd; Mon, 11 Mar 2024 18:18:59 +0100 From: Enrico Scholz To: openembedded-core@lists.openembedded.org Cc: Enrico Scholz Subject: [PATCH 4/7] image: prepare openssh configuration Date: Mon, 11 Mar 2024 18:18:45 +0100 Message-ID: <5748988eada480a0d1db0546cfd95be6b2a1faf7.1710177387.git.enrico.scholz@sigma-chemnitz.de> X-Mailer: git-send-email 2.44.0 In-Reply-To: References: MIME-Version: 1.0 Sender: Enrico Scholz X-REDDOXX-Id: 65ef3d03b121c496daa8ef72 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Mon, 11 Mar 2024 17:19:22 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/196959 From: Enrico Scholz Add an OPENSSH_FEATURE_CONFIGURATION variable which will hold openssh configuration packages. Signed-off-by: Enrico Scholz --- meta/classes-recipe/core-image.bbclass | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/meta/classes-recipe/core-image.bbclass b/meta/classes-recipe/core-image.bbclass index 40fc15cb04f2..adf236e0693e 100644 --- a/meta/classes-recipe/core-image.bbclass +++ b/meta/classes-recipe/core-image.bbclass @@ -55,7 +55,7 @@ FEATURE_PACKAGES_tools-sdk = "packagegroup-core-sdk packagegroup-core-standalone FEATURE_PACKAGES_nfs-server = "packagegroup-core-nfs-server" FEATURE_PACKAGES_nfs-client = "packagegroup-core-nfs-client" FEATURE_PACKAGES_ssh-server-dropbear = "packagegroup-core-ssh-dropbear" -FEATURE_PACKAGES_ssh-server-openssh = "packagegroup-core-ssh-openssh" +FEATURE_PACKAGES_ssh-server-openssh = "packagegroup-core-ssh-openssh ${OPENSSH_FEATURE_CONFIGURATION}" FEATURE_PACKAGES_hwcodecs = "${MACHINE_HWCODECS}" @@ -83,4 +83,7 @@ CORE_IMAGE_EXTRA_INSTALL ?= "" IMAGE_INSTALL ?= "${CORE_IMAGE_BASE_INSTALL}" +OPENSSH_FEATURE_CONFIGURATION = "\ +" + inherit image From patchwork Mon Mar 11 17:18:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Enrico Scholz X-Patchwork-Id: 40800 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3815DC54E68 for ; Mon, 11 Mar 2024 17:19:12 +0000 (UTC) Received: from smtpout.cvg.de (smtpout.cvg.de [87.128.211.67]) by mx.groups.io with SMTP id smtpd.web11.625.1710177548700851030 for ; Mon, 11 Mar 2024 10:19:09 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="dkim: message contains an insecure body length tag" header.i=@sigma-chemnitz.de header.s=v2022040800 header.b=mb+VVZNY; spf=pass (domain: sigma-chemnitz.de, ip: 87.128.211.67, mailfrom: enrico.scholz@sigma-chemnitz.de) Received: from mail-mta-3.intern.sigma-chemnitz.de (mail-mta-3.intern.sigma-chemnitz.de [192.168.12.71]) by mail-out-2.intern.sigma-chemnitz.de (8.17.1/8.17.1) with ESMTPS id 42BHJ7gj166683 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=OK) for ; Mon, 11 Mar 2024 18:19:07 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sigma-chemnitz.de; s=v2022040800; t=1710177547; bh=ro9IudAkgFjqPllF9qSXqIiiJLHbpf1VcVxS8NwTe5c=; l=3137; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=mb+VVZNYnR2v3bF43BobfhPRbBkQiVtqc6LboHQYDAmawVuAt6MgrNdIWBvxAHUt9 Sqd2+1+hGdLFdk1zJrQ1wejkdEDDoVJ8CwbEPbJw1PptHGUyvewC45Tk3abdWwWMFv CF/qDThrtnba/ZS0vbFsynEkIErw2XBrM9SOhsbrp8EJ98YCvDxFbGDWghh99vmdd2 5nBJiQxjXuh342LnCBWXTul8kSiIfV4sfFC49kircNuz2lnW/EBCIqu29LWYLRY96s gf0nO8t0F4ctSQe0b4i9+IYUpQ/+6CbQqOeXhfjfYpIx//aGn7TzmKDPsPP1eBV1hf TDAOBJ5AVEuAQ== Received: from reddoxx.intern.sigma-chemnitz.de (reddoxx.sigma.local [192.168.16.32]) by mail-mta-3.intern.sigma-chemnitz.de (8.17.1/8.17.1) with ESMTP id 42BHIx9l279254 for from enrico.scholz@sigma-chemnitz.de; Mon, 11 Mar 2024 18:19:00 +0100 Received: from mail-msa-2.intern.sigma-chemnitz.de ([192.168.12.72]) by reddoxx.intern.sigma-chemnitz.de with ESMTP id AP636QMJDF; Mon, 11 Mar 2024 18:18:59 +0100 Received: from ensc-pc.intern.sigma-chemnitz.de (ensc-pc.intern.sigma-chemnitz.de [192.168.3.24]) by mail-msa-2.intern.sigma-chemnitz.de (8.17.1/8.17.1) with ESMTPS id 42BHIxn9164813 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Mon, 11 Mar 2024 18:18:59 +0100 Received: from ensc by ensc-pc.intern.sigma-chemnitz.de with local (Exim 4.97.1) (envelope-from ) id 1rjjIh-00000008xuX-1Vi0; Mon, 11 Mar 2024 18:18:59 +0100 From: Enrico Scholz To: openembedded-core@lists.openembedded.org Cc: Enrico Scholz Subject: [PATCH 5/7] openssh: replace 'allow-empty-password' rootfs scipt by configuration Date: Mon, 11 Mar 2024 18:18:46 +0100 Message-ID: X-Mailer: git-send-email 2.44.0 In-Reply-To: References: MIME-Version: 1.0 Sender: Enrico Scholz X-REDDOXX-Id: 65ef3d03b121c496daa8ef74 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Mon, 11 Mar 2024 17:19:12 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/196956 From: Enrico Scholz Install 'openssh-config-allow-empty-password' when corresponding IMAGE_FEATURES are active. Signed-off-by: Enrico Scholz --- meta/classes-recipe/core-image.bbclass | 1 + meta/classes-recipe/rootfs-postcommands.bbclass | 6 ------ meta/recipes-connectivity/openssh/openssh-config.bb | 2 ++ .../openssh/openssh-config/60-allow-empty-password.conf | 1 + 4 files changed, 4 insertions(+), 6 deletions(-) create mode 100644 meta/recipes-connectivity/openssh/openssh-config/60-allow-empty-password.conf diff --git a/meta/classes-recipe/core-image.bbclass b/meta/classes-recipe/core-image.bbclass index adf236e0693e..63e0e99b2a56 100644 --- a/meta/classes-recipe/core-image.bbclass +++ b/meta/classes-recipe/core-image.bbclass @@ -84,6 +84,7 @@ CORE_IMAGE_EXTRA_INSTALL ?= "" IMAGE_INSTALL ?= "${CORE_IMAGE_BASE_INSTALL}" OPENSSH_FEATURE_CONFIGURATION = "\ + ${@bb.utils.contains_any('IMAGE_FEATURES', [ 'debug-tweaks', 'allow-empty-password' ], 'openssh-config-allow-empty-password', '',d)} \ " inherit image diff --git a/meta/classes-recipe/rootfs-postcommands.bbclass b/meta/classes-recipe/rootfs-postcommands.bbclass index e81b69a239b5..88f88505b5ed 100644 --- a/meta/classes-recipe/rootfs-postcommands.bbclass +++ b/meta/classes-recipe/rootfs-postcommands.bbclass @@ -246,12 +246,6 @@ zap_empty_root_password () { # allow dropbear/openssh to accept logins from accounts with an empty password string # ssh_allow_empty_password () { - for config in sshd_config sshd_config_readonly; do - if [ -e ${IMAGE_ROOTFS}${sysconfdir}/ssh/$config ]; then - sed -i 's/^[#[:space:]]*PermitEmptyPasswords.*/PermitEmptyPasswords yes/' ${IMAGE_ROOTFS}${sysconfdir}/ssh/$config - fi - done - if [ -e ${IMAGE_ROOTFS}${sbindir}/dropbear ] ; then if grep -q DROPBEAR_EXTRA_ARGS ${IMAGE_ROOTFS}${sysconfdir}/default/dropbear 2>/dev/null ; then if ! grep -q "DROPBEAR_EXTRA_ARGS=.*-B" ${IMAGE_ROOTFS}${sysconfdir}/default/dropbear ; then diff --git a/meta/recipes-connectivity/openssh/openssh-config.bb b/meta/recipes-connectivity/openssh/openssh-config.bb index 312a1c903f63..20dfe086f8ab 100644 --- a/meta/recipes-connectivity/openssh/openssh-config.bb +++ b/meta/recipes-connectivity/openssh/openssh-config.bb @@ -4,6 +4,7 @@ LICENSE = "MIT" LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" SRC_URI = "\ + file://60-allow-empty-password.conf \ file://80-oe.conf \ " @@ -11,6 +12,7 @@ do_install() { d=${D}${sysconfdir}/ssh/sshd_config.d install -d "$d" install -p -m 0644 \ + ${WORKDIR}/60-allow-empty-password.conf \ ${WORKDIR}/80-oe.conf \ "$d"/ diff --git a/meta/recipes-connectivity/openssh/openssh-config/60-allow-empty-password.conf b/meta/recipes-connectivity/openssh/openssh-config/60-allow-empty-password.conf new file mode 100644 index 000000000000..04e75ab6cefa --- /dev/null +++ b/meta/recipes-connectivity/openssh/openssh-config/60-allow-empty-password.conf @@ -0,0 +1 @@ +PermitEmptyPasswords yes From patchwork Mon Mar 11 17:18:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Enrico Scholz X-Patchwork-Id: 40799 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 143E3C5475B for ; Mon, 11 Mar 2024 17:19:12 +0000 (UTC) Received: from smtpout.cvg.de (smtpout.cvg.de [87.128.211.67]) by mx.groups.io with SMTP id smtpd.web11.626.1710177550583664897 for ; Mon, 11 Mar 2024 10:19:11 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="dkim: message contains an insecure body length tag" header.i=@sigma-chemnitz.de header.s=v2022040800 header.b=eYNcd33S; spf=pass (domain: sigma-chemnitz.de, ip: 87.128.211.67, mailfrom: enrico.scholz@sigma-chemnitz.de) Received: from mail-mta-2.intern.sigma-chemnitz.de (mail-mta-2.intern.sigma-chemnitz.de [192.168.12.70]) by mail-out-3.intern.sigma-chemnitz.de (8.17.1/8.17.1) with ESMTPS id 42BHJ8vQ107339 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=OK) for ; Mon, 11 Mar 2024 18:19:09 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sigma-chemnitz.de; s=v2022040800; t=1710177549; bh=If8iq1JlfkrcWIWrFLFZWSQo7lDVj0CzSasoygqGluA=; l=3150; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=eYNcd33SAnlQYbr2xjpnYBjcI6qOSaWA9xHnhBFD/mGs/tQN7i0k02A8ZvFdAsF3k nuOL+ggKvKSMI+bkE4tknm9XNMKVVGIP9Hsx9XtMLIX+ypwmeIM0fR9arrrgDvXnX+ gVrdls8dhq2YzBv9lf+XCH3TFGq3+WrHwmYT1xXU/bSl4jv0IaNj/2AyrglM2t+Urv lYzrZuD6KPAK3wa+VJHTcj1RJWAoZSWtGR0YNS3+zLOS6bnxyarzT5Ppxj8dF3gTKw Uqin7fmKd1Yi0xoisCc/l1/aklvuk6NLOUDxRLP5p76fp7HDy4nBSy5zjspR8m2jdU l+Nd7qEmvMXsA== Received: from reddoxx.intern.sigma-chemnitz.de (reddoxx.sigma.local [192.168.16.32]) by mail-mta-2.intern.sigma-chemnitz.de (8.17.1/8.17.1) with ESMTP id 42BHJ0HG211298 for from enrico.scholz@sigma-chemnitz.de; Mon, 11 Mar 2024 18:19:02 +0100 Received: from mail-msa-2.intern.sigma-chemnitz.de ([192.168.12.72]) by reddoxx.intern.sigma-chemnitz.de with ESMTP id 652T3PVFF6; Mon, 11 Mar 2024 18:18:59 +0100 Received: from ensc-pc.intern.sigma-chemnitz.de (ensc-pc.intern.sigma-chemnitz.de [192.168.3.24]) by mail-msa-2.intern.sigma-chemnitz.de (8.17.1/8.17.1) with ESMTPS id 42BHIxup164820 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Mon, 11 Mar 2024 18:18:59 +0100 Received: from ensc by ensc-pc.intern.sigma-chemnitz.de with local (Exim 4.97.1) (envelope-from ) id 1rjjIh-00000008xua-1hBJ; Mon, 11 Mar 2024 18:18:59 +0100 From: Enrico Scholz To: openembedded-core@lists.openembedded.org Cc: Enrico Scholz Subject: [PATCH 6/7] openssh: replace 'allow-root-login' rootfs scipt by configuration Date: Mon, 11 Mar 2024 18:18:47 +0100 Message-ID: <2ac1ebb744fa62cd2e8691070d6af440b186c315.1710177387.git.enrico.scholz@sigma-chemnitz.de> X-Mailer: git-send-email 2.44.0 In-Reply-To: References: MIME-Version: 1.0 Sender: Enrico Scholz X-REDDOXX-Id: 65ef3d03b121c496daa8ef79 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Mon, 11 Mar 2024 17:19:12 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/196958 From: Enrico Scholz Install 'openssh-config-allow-root-login' when corresponding IMAGE_FEATURES are active. Signed-off-by: Enrico Scholz --- meta/classes-recipe/core-image.bbclass | 1 + meta/classes-recipe/rootfs-postcommands.bbclass | 6 ------ meta/recipes-connectivity/openssh/openssh-config.bb | 2 ++ .../openssh/openssh-config/60-allow-root-login.conf | 1 + 4 files changed, 4 insertions(+), 6 deletions(-) create mode 100644 meta/recipes-connectivity/openssh/openssh-config/60-allow-root-login.conf diff --git a/meta/classes-recipe/core-image.bbclass b/meta/classes-recipe/core-image.bbclass index 63e0e99b2a56..10a2905d9a27 100644 --- a/meta/classes-recipe/core-image.bbclass +++ b/meta/classes-recipe/core-image.bbclass @@ -85,6 +85,7 @@ IMAGE_INSTALL ?= "${CORE_IMAGE_BASE_INSTALL}" OPENSSH_FEATURE_CONFIGURATION = "\ ${@bb.utils.contains_any('IMAGE_FEATURES', [ 'debug-tweaks', 'allow-empty-password' ], 'openssh-config-allow-empty-password', '',d)} \ + ${@bb.utils.contains_any('IMAGE_FEATURES', [ 'debug-tweaks', 'allow-root-login' ], 'openssh-config-allow-root-login', '',d)} \ " inherit image diff --git a/meta/classes-recipe/rootfs-postcommands.bbclass b/meta/classes-recipe/rootfs-postcommands.bbclass index 88f88505b5ed..633f88de6ec8 100644 --- a/meta/classes-recipe/rootfs-postcommands.bbclass +++ b/meta/classes-recipe/rootfs-postcommands.bbclass @@ -268,12 +268,6 @@ ssh_allow_empty_password () { # allow dropbear/openssh to accept root logins # ssh_allow_root_login () { - for config in sshd_config sshd_config_readonly; do - if [ -e ${IMAGE_ROOTFS}${sysconfdir}/ssh/$config ]; then - sed -i 's/^[#[:space:]]*PermitRootLogin.*/PermitRootLogin yes/' ${IMAGE_ROOTFS}${sysconfdir}/ssh/$config - fi - done - if [ -e ${IMAGE_ROOTFS}${sbindir}/dropbear ] ; then if grep -q DROPBEAR_EXTRA_ARGS ${IMAGE_ROOTFS}${sysconfdir}/default/dropbear 2>/dev/null ; then sed -i '/^DROPBEAR_EXTRA_ARGS=/ s/-w//' ${IMAGE_ROOTFS}${sysconfdir}/default/dropbear diff --git a/meta/recipes-connectivity/openssh/openssh-config.bb b/meta/recipes-connectivity/openssh/openssh-config.bb index 20dfe086f8ab..d4ed661d8299 100644 --- a/meta/recipes-connectivity/openssh/openssh-config.bb +++ b/meta/recipes-connectivity/openssh/openssh-config.bb @@ -5,6 +5,7 @@ LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384 SRC_URI = "\ file://60-allow-empty-password.conf \ + file://60-allow-root-login.conf \ file://80-oe.conf \ " @@ -13,6 +14,7 @@ do_install() { install -d "$d" install -p -m 0644 \ ${WORKDIR}/60-allow-empty-password.conf \ + ${WORKDIR}/60-allow-root-login.conf \ ${WORKDIR}/80-oe.conf \ "$d"/ diff --git a/meta/recipes-connectivity/openssh/openssh-config/60-allow-root-login.conf b/meta/recipes-connectivity/openssh/openssh-config/60-allow-root-login.conf new file mode 100644 index 000000000000..1073982f77c1 --- /dev/null +++ b/meta/recipes-connectivity/openssh/openssh-config/60-allow-root-login.conf @@ -0,0 +1 @@ +PermitRootLogin yes From patchwork Mon Mar 11 17:18:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Enrico Scholz X-Patchwork-Id: 40804 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4AEAEC5475B for ; Mon, 11 Mar 2024 17:19:22 +0000 (UTC) Received: from smtpout.cvg.de (smtpout.cvg.de [87.128.211.67]) by mx.groups.io with SMTP id smtpd.web11.631.1710177554363938343 for ; Mon, 11 Mar 2024 10:19:14 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="dkim: message contains an insecure body length tag" header.i=@sigma-chemnitz.de header.s=v2022040800 header.b=w3ALzq2e; spf=pass (domain: sigma-chemnitz.de, ip: 87.128.211.67, mailfrom: enrico.scholz@sigma-chemnitz.de) Received: from mail-mta-3.intern.sigma-chemnitz.de (mail-mta-3.intern.sigma-chemnitz.de [192.168.12.71]) by mail-out-3.intern.sigma-chemnitz.de (8.17.1/8.17.1) with ESMTPS id 42BHJCvt107347 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=OK) for ; Mon, 11 Mar 2024 18:19:12 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sigma-chemnitz.de; s=v2022040800; t=1710177552; bh=dV7SpEEJicbrVcPKDN94EEOemxEIo/zHq9NynJ8iX1k=; l=6041; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=w3ALzq2eB7dS+0AfbpZ6+0f+xnEeG5VvJtjUWVaVvY21SvSSBtoCd32zWIu+tZE64 +iRjWwYJ5U+InNr7oSVwZWRrf3FsNx6vuHVj+1bwJm0L+65IbUv5/8ou/tx/kQeacO ViIgzAIrXFVfngRkQPpTfvJkok3gztEz1qU/S18ZYvmgI5Xx0ZrMlcf1ef0UkoXbVg s8yKQIUkixhZ1mcqPlI+bSC+m7fU2/wZrfsrt4fAhF4TxncVAQN0wPujEGSN/7spJU 47KNjnfGW91AntsGKq9iGd7i+0mcR6qa2A0sE2k61WycBOcL5KBNr6TOZNkp77Fv+K GFonx1AAOeG1Q== Received: from reddoxx.intern.sigma-chemnitz.de (reddoxx.sigma.local [192.168.16.32]) by mail-mta-3.intern.sigma-chemnitz.de (8.17.1/8.17.1) with ESMTP id 42BHJ0Xi279265 for from enrico.scholz@sigma-chemnitz.de; Mon, 11 Mar 2024 18:19:01 +0100 Received: from mail-msa-3.intern.sigma-chemnitz.de ([192.168.12.73]) by reddoxx.intern.sigma-chemnitz.de with ESMTP id QHK3HCDZG6; Mon, 11 Mar 2024 18:18:59 +0100 Received: from ensc-pc.intern.sigma-chemnitz.de (ensc-pc.intern.sigma-chemnitz.de [192.168.3.24]) by mail-msa-3.intern.sigma-chemnitz.de (8.15.2/8.15.2) with ESMTPS id 42BHIxlB105404 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Mon, 11 Mar 2024 18:18:59 +0100 Received: from ensc by ensc-pc.intern.sigma-chemnitz.de with local (Exim 4.97.1) (envelope-from ) id 1rjjIh-00000008xuh-1xXq; Mon, 11 Mar 2024 18:18:59 +0100 From: Enrico Scholz To: openembedded-core@lists.openembedded.org Cc: Enrico Scholz Subject: [PATCH 7/7] openssh: move read-only-rootfs setup in configuration snippet Date: Mon, 11 Mar 2024 18:18:48 +0100 Message-ID: <91d79edd41342bca563e8d6bf71d531921f4686f.1710177387.git.enrico.scholz@sigma-chemnitz.de> X-Mailer: git-send-email 2.44.0 In-Reply-To: References: MIME-Version: 1.0 Sender: Enrico Scholz X-REDDOXX-Id: 65ef3d03b121c496daa8ef7b List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Mon, 11 Mar 2024 17:19:22 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/196960 From: Enrico Scholz This patch replaces the duplicate 'sshd_config_readonly' configuration file and logic behind by an extra packages which is installed when corresponding IMAGE_FEATURES are set. **NOTE**: this causes a regression when host keys are added manually to the image. Users have to do | OPENSSH_FEATURE_CONFIGURATION:remove = "openssh-config-read-only-rootfs" in this case, or create a .bbappend for openssh-config which sets RO_KEYDIR. Signed-off-by: Enrico Scholz --- meta/classes-recipe/core-image.bbclass | 12 ++++++++++++ meta/classes-recipe/rootfs-postcommands.bbclass | 13 +------------ meta/recipes-connectivity/openssh/openssh-config.bb | 7 +++++++ meta/recipes-connectivity/openssh/openssh_9.6p1.bb | 7 +------ 4 files changed, 21 insertions(+), 18 deletions(-) diff --git a/meta/classes-recipe/core-image.bbclass b/meta/classes-recipe/core-image.bbclass index 10a2905d9a27..477b6ba47042 100644 --- a/meta/classes-recipe/core-image.bbclass +++ b/meta/classes-recipe/core-image.bbclass @@ -84,8 +84,20 @@ CORE_IMAGE_EXTRA_INSTALL ?= "" IMAGE_INSTALL ?= "${CORE_IMAGE_BASE_INSTALL}" OPENSSH_FEATURE_CONFIGURATION = "\ + ${@'openssh-config-read-only-rootfs' if etc_is_readonly(d) else ''} \ ${@bb.utils.contains_any('IMAGE_FEATURES', [ 'debug-tweaks', 'allow-empty-password' ], 'openssh-config-allow-empty-password', '',d)} \ ${@bb.utils.contains_any('IMAGE_FEATURES', [ 'debug-tweaks', 'allow-root-login' ], 'openssh-config-allow-root-login', '',d)} \ " +def etc_is_readonly(d): + features = (d.getVar('IMAGE_FEATURES') or "").split() + + if 'read-only-rootfs' not in features: + return False + + if 'stateless-rootfs' in features: + return True + + return 'overlayfs-etc' not in features + inherit image diff --git a/meta/classes-recipe/rootfs-postcommands.bbclass b/meta/classes-recipe/rootfs-postcommands.bbclass index 633f88de6ec8..ba6eb84e4055 100644 --- a/meta/classes-recipe/rootfs-postcommands.bbclass +++ b/meta/classes-recipe/rootfs-postcommands.bbclass @@ -188,21 +188,10 @@ read_only_rootfs_hook () { fi # If we're using openssh and the /etc/ssh directory has no pre-generated keys, - # we should configure openssh to use the configuration file /etc/ssh/sshd_config_readonly - # and the keys under /var/run/ssh. + # we should configure dropbear to use the keys under /var/lib/dropbear # If overlayfs-etc is used this is not done as /etc is treated as writable # If stateless-rootfs is enabled this is always done as we don't want to save keys then if ${@ 'true' if not bb.utils.contains('IMAGE_FEATURES', 'overlayfs-etc', True, False, d) or bb.utils.contains('IMAGE_FEATURES', 'stateless-rootfs', True, False, d) else 'false'}; then - if [ -d ${IMAGE_ROOTFS}/etc/ssh ]; then - if [ -e ${IMAGE_ROOTFS}/etc/ssh/ssh_host_rsa_key ]; then - echo "SYSCONFDIR=\${SYSCONFDIR:-/etc/ssh}" >> ${IMAGE_ROOTFS}/etc/default/ssh - echo "SSHD_OPTS=" >> ${IMAGE_ROOTFS}/etc/default/ssh - else - echo "SYSCONFDIR=\${SYSCONFDIR:-/var/run/ssh}" >> ${IMAGE_ROOTFS}/etc/default/ssh - echo "SSHD_OPTS='-f /etc/ssh/sshd_config_readonly'" >> ${IMAGE_ROOTFS}/etc/default/ssh - fi - fi - # Also tweak the key location for dropbear in the same way. if [ -d ${IMAGE_ROOTFS}/etc/dropbear ]; then if [ ! -e ${IMAGE_ROOTFS}/etc/dropbear/dropbear_rsa_host_key ]; then diff --git a/meta/recipes-connectivity/openssh/openssh-config.bb b/meta/recipes-connectivity/openssh/openssh-config.bb index d4ed661d8299..d2d0d9f4ad0d 100644 --- a/meta/recipes-connectivity/openssh/openssh-config.bb +++ b/meta/recipes-connectivity/openssh/openssh-config.bb @@ -9,6 +9,9 @@ SRC_URI = "\ file://80-oe.conf \ " +RO_KEYDIR ??= "/var/run/ssh" +KEY_ALGORITHMS ??= "rsa ecdsa ed25519" + do_install() { d=${D}${sysconfdir}/ssh/sshd_config.d install -d "$d" @@ -27,6 +30,10 @@ do_install() { if [ "${@bb.utils.filter('DISTRO_FEATURES', 'x11', d)}" ]; then echo "X11Forwarding yes" >> "$f" fi + + for alg in ${KEY_ALGORITHMS}; do + printf 'HostKey %s/ssh_host_%s_key\n' '${RO_KEYDIR}' "$alg" + done > $d/60-read-only-rootfs.conf } python populate_packages:prepend() { diff --git a/meta/recipes-connectivity/openssh/openssh_9.6p1.bb b/meta/recipes-connectivity/openssh/openssh_9.6p1.bb index e792b459d838..29bc132de8ef 100644 --- a/meta/recipes-connectivity/openssh/openssh_9.6p1.bb +++ b/meta/recipes-connectivity/openssh/openssh_9.6p1.bb @@ -121,11 +121,6 @@ do_install:append () { # Create config files for read-only rootfs install -d ${D}${sysconfdir}/ssh - install -m 644 ${D}${sysconfdir}/ssh/sshd_config ${D}${sysconfdir}/ssh/sshd_config_readonly - sed -i '/HostKey/d' ${D}${sysconfdir}/ssh/sshd_config_readonly - echo "HostKey /var/run/ssh/ssh_host_rsa_key" >> ${D}${sysconfdir}/ssh/sshd_config_readonly - echo "HostKey /var/run/ssh/ssh_host_ecdsa_key" >> ${D}${sysconfdir}/ssh/sshd_config_readonly - echo "HostKey /var/run/ssh/ssh_host_ed25519_key" >> ${D}${sysconfdir}/ssh/sshd_config_readonly install -d ${D}${systemd_system_unitdir} if ${@bb.utils.contains('PACKAGECONFIG','systemd-sshd-socket-mode','true','false',d)}; then @@ -165,7 +160,7 @@ PACKAGES =+ "${PN}-keygen ${PN}-scp ${PN}-ssh ${PN}-sshd ${PN}-sftp ${PN}-misc $ FILES:${PN}-scp = "${bindir}/scp.${BPN}" FILES:${PN}-ssh = "${bindir}/ssh.${BPN} ${sysconfdir}/ssh/ssh_config" FILES:${PN}-sshd = "${sbindir}/sshd ${sysconfdir}/init.d/sshd ${systemd_system_unitdir}" -FILES:${PN}-sshd += "${sysconfdir}/ssh/moduli ${sysconfdir}/ssh/sshd_config ${sysconfdir}/ssh/sshd_config_readonly ${sysconfdir}/default/volatiles/99_sshd ${sysconfdir}/pam.d/sshd" +FILES:${PN}-sshd += "${sysconfdir}/ssh/moduli ${sysconfdir}/ssh/sshd_config ${sysconfdir}/default/volatiles/99_sshd ${sysconfdir}/pam.d/sshd" FILES:${PN}-sshd += "${libexecdir}/${BPN}/sshd_check_keys" FILES:${PN}-sftp = "${bindir}/sftp" FILES:${PN}-sftp-server = "${libexecdir}/sftp-server"