diff mbox series

[v2] openssh: add variable for key path

Message ID 20260125091540.8808-1-patrick.vogelaar.dev@mailbox.org
State Accepted, archived
Commit addd80ddfd892eb4513f323d369d210935416e05
Headers show
Series [v2] openssh: add variable for key path | expand

Commit Message

Patrick Vogelaar Jan. 25, 2026, 9:15 a.m. UTC
This patch adds a variable for the key directory path. This is especially
useful when working with a read-only file system where you want to
specify the location e.g. on a r/w partition. To be consistent, the
change was also done for the read write path.

For changing the path simply create a bbappend and override the
variable.

Signed-off-by: Patrick Vogelaar <patrick.vogelaar.dev@mailbox.org>
---
 .../openssh/openssh_10.2p1.bb                    | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

Comments

Antonin Godard Jan. 29, 2026, 11:17 a.m. UTC | #1
Hi,

On Sun Jan 25, 2026 at 10:15 AM CET, Patrick Vogelaar via lists.openembedded.org wrote:
> This patch adds a variable for the key directory path. This is especially
> useful when working with a read-only file system where you want to
> specify the location e.g. on a r/w partition. To be consistent, the
> change was also done for the read write path.
>
> For changing the path simply create a bbappend and override the
> variable.
>
> Signed-off-by: Patrick Vogelaar <patrick.vogelaar.dev@mailbox.org>
> ---
>  .../openssh/openssh_10.2p1.bb                    | 16 ++++++++++------
>  1 file changed, 10 insertions(+), 6 deletions(-)
>
> diff --git a/meta/recipes-connectivity/openssh/openssh_10.2p1.bb b/meta/recipes-connectivity/openssh/openssh_10.2p1.bb
> index 866129573f..d8ea487ae3 100644
> --- a/meta/recipes-connectivity/openssh/openssh_10.2p1.bb
> +++ b/meta/recipes-connectivity/openssh/openssh_10.2p1.bb
> @@ -99,6 +99,10 @@ CACHED_CONFIGUREVARS += "ac_cv_path_PATH_PASSWD_PROG=${bindir}/passwd"
>  # We don't want to depend on libblockfile
>  CACHED_CONFIGUREVARS += "ac_cv_header_maillock_h=no"
>  
> +# This allows overriding the key location
> +OPENSSH_HOST_KEY_DIR_READONLY_CONFIG ?= "/var/run/ssh"
> +OPENSSH_HOST_KEY_DIR ?= "/etc/ssh"

Thanks for the patch, it was merged in master. As a follow-up, could you
send patches to document these variables in
https://git.yoctoproject.org/yocto-docs/tree/documentation/ref-manual/variables.rst?

And add a note here
https://git.yoctoproject.org/yocto-docs/tree/documentation/migration-guides/release-notes-6.0.rst#n24?

Thanks!
Antonin
Patrick Vogelaar Jan. 31, 2026, 10:01 a.m. UTC | #2
Hi Antonin,

> Antonin Godard <antonin.godard@bootlin.com> hat am 29.01.2026 12:17 CET geschrieben:
> 
>  
> Hi,
> 
> On Sun Jan 25, 2026 at 10:15 AM CET, Patrick Vogelaar via lists.openembedded.org wrote:
> > This patch adds a variable for the key directory path. This is especially
> > useful when working with a read-only file system where you want to
> > specify the location e.g. on a r/w partition. To be consistent, the
> > change was also done for the read write path.
> >
> > For changing the path simply create a bbappend and override the
> > variable.
> >
> > Signed-off-by: Patrick Vogelaar <patrick.vogelaar.dev@mailbox.org>
> > ---
> >  .../openssh/openssh_10.2p1.bb                    | 16 ++++++++++------
> >  1 file changed, 10 insertions(+), 6 deletions(-)
> >
> > diff --git a/meta/recipes-connectivity/openssh/openssh_10.2p1.bb b/meta/recipes-connectivity/openssh/openssh_10.2p1.bb
> > index 866129573f..d8ea487ae3 100644
> > --- a/meta/recipes-connectivity/openssh/openssh_10.2p1.bb
> > +++ b/meta/recipes-connectivity/openssh/openssh_10.2p1.bb
> > @@ -99,6 +99,10 @@ CACHED_CONFIGUREVARS += "ac_cv_path_PATH_PASSWD_PROG=${bindir}/passwd"
> >  # We don't want to depend on libblockfile
> >  CACHED_CONFIGUREVARS += "ac_cv_header_maillock_h=no"
> >  
> > +# This allows overriding the key location
> > +OPENSSH_HOST_KEY_DIR_READONLY_CONFIG ?= "/var/run/ssh"
> > +OPENSSH_HOST_KEY_DIR ?= "/etc/ssh"
> 
> Thanks for the patch, it was merged in master. As a follow-up, could you
> send patches to document these variables in
> https://git.yoctoproject.org/yocto-docs/tree/documentation/ref-manual/variables.rst?
> 
> And add a note here
> https://git.yoctoproject.org/yocto-docs/tree/documentation/migration-guides/release-notes-6.0.rst#n24?

I will send a patch that documents the variable. But I don't know where to put it in the release notes. Can you guide me to the section where this would fit in.

> 
> Thanks!
> Antonin
> 
> -- 
> Antonin Godard, Bootlin
> Embedded Linux and Kernel engineering
> https://bootlin.com

Thanks
Patrick
Antonin Godard Feb. 2, 2026, 9:46 a.m. UTC | #3
Hi,

On Sat Jan 31, 2026 at 11:01 AM CET, Patrick Vogelaar via lists.openembedded.org wrote:
[...]
>> Thanks for the patch, it was merged in master. As a follow-up, could you
>> send patches to document these variables in
>> https://git.yoctoproject.org/yocto-docs/tree/documentation/ref-manual/variables.rst?
>> 
>> And add a note here
>> https://git.yoctoproject.org/yocto-docs/tree/documentation/migration-guides/release-notes-6.0.rst#n24?
>
> I will send a patch that documents the variable. But I don't know where to put it in the release notes. Can you guide me to the section where this would fit in.

Yes, it should be in this document:
https://git.yoctoproject.org/yocto-docs/tree/documentation/migration-guides/release-notes-6.0.rst

Under the bullet point "New variables"

Thanks,
Antonin
diff mbox series

Patch

diff --git a/meta/recipes-connectivity/openssh/openssh_10.2p1.bb b/meta/recipes-connectivity/openssh/openssh_10.2p1.bb
index 866129573f..d8ea487ae3 100644
--- a/meta/recipes-connectivity/openssh/openssh_10.2p1.bb
+++ b/meta/recipes-connectivity/openssh/openssh_10.2p1.bb
@@ -99,6 +99,10 @@  CACHED_CONFIGUREVARS += "ac_cv_path_PATH_PASSWD_PROG=${bindir}/passwd"
 # We don't want to depend on libblockfile
 CACHED_CONFIGUREVARS += "ac_cv_header_maillock_h=no"
 
+# This allows overriding the key location
+OPENSSH_HOST_KEY_DIR_READONLY_CONFIG ?= "/var/run/ssh"
+OPENSSH_HOST_KEY_DIR ?= "/etc/ssh"
+
 do_configure:prepend () {
 	export LD="${CC}"
 	install -m 0600 ${UNPACKDIR}/sshd_config ${B}/
@@ -113,24 +117,24 @@  sshd_hostkey_setup() {
 	# Enable specific ssh host keys
 	sed -i '/HostKey/d' ${D}${sysconfdir}/ssh/sshd_config
 	if ${@bb.utils.contains('PACKAGECONFIG','hostkey-rsa','true','false',d)}; then
-		echo "HostKey /etc/ssh/ssh_host_rsa_key" >> ${D}${sysconfdir}/ssh/sshd_config
+		echo "HostKey ${OPENSSH_HOST_KEY_DIR}/ssh_host_rsa_key" >> ${D}${sysconfdir}/ssh/sshd_config
 	fi
 	if ${@bb.utils.contains('PACKAGECONFIG','hostkey-ecdsa','true','false',d)}; then
-		echo "HostKey /etc/ssh/ssh_host_ecdsa_key" >> ${D}${sysconfdir}/ssh/sshd_config
+		echo "HostKey ${OPENSSH_HOST_KEY_DIR}/ssh_host_ecdsa_key" >> ${D}${sysconfdir}/ssh/sshd_config
 	fi
 	if ${@bb.utils.contains('PACKAGECONFIG','hostkey-ed25519','true','false',d)}; then
-		echo "HostKey /etc/ssh/ssh_host_ed25519_key" >> ${D}${sysconfdir}/ssh/sshd_config
+		echo "HostKey ${OPENSSH_HOST_KEY_DIR}/ssh_host_ed25519_key" >> ${D}${sysconfdir}/ssh/sshd_config
 	fi
 
 	sed -i '/HostKey/d' ${D}${sysconfdir}/ssh/sshd_config_readonly
 	if ${@bb.utils.contains('PACKAGECONFIG','hostkey-rsa','true','false',d)}; then
-		echo "HostKey /var/run/ssh/ssh_host_rsa_key" >> ${D}${sysconfdir}/ssh/sshd_config_readonly
+		echo "HostKey ${OPENSSH_HOST_KEY_DIR_READONLY_CONFIG}/ssh_host_rsa_key" >> ${D}${sysconfdir}/ssh/sshd_config_readonly
 	fi
 	if ${@bb.utils.contains('PACKAGECONFIG','hostkey-ecdsa','true','false',d)}; then
-		echo "HostKey /var/run/ssh/ssh_host_ecdsa_key" >> ${D}${sysconfdir}/ssh/sshd_config_readonly
+		echo "HostKey ${OPENSSH_HOST_KEY_DIR_READONLY_CONFIG}/ssh_host_ecdsa_key" >> ${D}${sysconfdir}/ssh/sshd_config_readonly
 	fi
 	if ${@bb.utils.contains('PACKAGECONFIG','hostkey-ed25519','true','false',d)}; then
-		echo "HostKey /var/run/ssh/ssh_host_ed25519_key" >> ${D}${sysconfdir}/ssh/sshd_config_readonly
+		echo "HostKey ${OPENSSH_HOST_KEY_DIR_READONLY_CONFIG}/ssh_host_ed25519_key" >> ${D}${sysconfdir}/ssh/sshd_config_readonly
 	fi
 }