* [PATCH] openssh: add variable for key path
@ 2026-01-02 11:34 Patrick Vogelaar
0 siblings, 0 replies; 2+ messages in thread
From: Patrick Vogelaar @ 2026-01-02 11:34 UTC (permalink / raw)
To: openembedded-core; +Cc: Patrick Vogelaar
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..e319f4ac24 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 in a bbappend
+RO_SSH_KEY_DIR ?= "/var/run/ssh"
+SSH_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 ${SSH_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 ${SSH_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 ${SSH_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 ${RO_SSH_KEY_DIR}/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 ${RO_SSH_KEY_DIR}/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 ${RO_SSH_KEY_DIR}/ssh_host_ed25519_key" >> ${D}${sysconfdir}/ssh/sshd_config_readonly
fi
}
--
2.43.0
^ permalink raw reply related [flat|nested] 2+ messages in thread* [PATCH] openssh: add variable for key path
@ 2026-01-02 11:27 Patrick Vogelaar
0 siblings, 0 replies; 2+ messages in thread
From: Patrick Vogelaar @ 2026-01-02 11:27 UTC (permalink / raw)
To: openembedded-core; +Cc: Patrick Vogelaar
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..e319f4ac24 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 in a bbappend
+RO_SSH_KEY_DIR ?= "/var/run/ssh"
+SSH_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 ${SSH_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 ${SSH_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 ${SSH_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 ${RO_SSH_KEY_DIR}/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 ${RO_SSH_KEY_DIR}/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 ${RO_SSH_KEY_DIR}/ssh_host_ed25519_key" >> ${D}${sysconfdir}/ssh/sshd_config_readonly
fi
}
--
2.43.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-01-02 12:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-02 11:34 [PATCH] openssh: add variable for key path Patrick Vogelaar
-- strict thread matches above, loose matches on Subject: below --
2026-01-02 11:27 Patrick Vogelaar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox