diff options
| author | Matthew Bullock <mbullock@thegoodpenguin.co.uk> | 2024-06-27 14:15:56 +0100 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2024-07-02 22:29:13 +0100 |
| commit | d6a4522e6754eebab205b748de5e2379a5013310 (patch) | |
| tree | 853fc8b7ae4cc206c39c67f283e96cd221144181 /meta | |
| parent | a65a3dd4aaa9cba5219ebd136c43a0a9994f6161 (diff) | |
| download | poky-d6a4522e6754eebab205b748de5e2379a5013310.tar.gz | |
openssh: allow configuration of hostkey type
Allow selection of host key types used by openssh via PACKAGECONFIG.
Any combination of hostkey-rsa, hostkey-ecdsa and hostkey-ed25519 can be
specified. Default to just generating ecdsa keys.
The current default generates all three keys. This can take a
significant amount of time on first boot. Having all three keys does not
significantly increase compatability. Also RSA keys are being deprecated
as they are no longer considered secure. Using just an ecdsa key reduces
key generation time by roughly 75%.
(From OE-Core rev: 0827c29566f3ea63715a9f9e4ee2639f4eabe0bd)
Signed-off-by: Matthew Bullock <mbullock@thegoodpenguin.co.uk>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
| -rw-r--r-- | meta/recipes-connectivity/openssh/openssh_9.7p1.bb | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/meta/recipes-connectivity/openssh/openssh_9.7p1.bb b/meta/recipes-connectivity/openssh/openssh_9.7p1.bb index ab453f7bbe..0bc14c5553 100644 --- a/meta/recipes-connectivity/openssh/openssh_9.7p1.bb +++ b/meta/recipes-connectivity/openssh/openssh_9.7p1.bb | |||
| @@ -56,7 +56,7 @@ DEPENDS += "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd', '', d) | |||
| 56 | 56 | ||
| 57 | # systemd-sshd-socket-mode means installing sshd.socket | 57 | # systemd-sshd-socket-mode means installing sshd.socket |
| 58 | # and systemd-sshd-service-mode corresponding to sshd.service | 58 | # and systemd-sshd-service-mode corresponding to sshd.service |
| 59 | PACKAGECONFIG ??= "systemd-sshd-socket-mode" | 59 | PACKAGECONFIG ??= "systemd-sshd-socket-mode hostkey-ecdsa" |
| 60 | PACKAGECONFIG[fido2] = "--with-security-key-builtin,--disable-security-key,libfido2" | 60 | PACKAGECONFIG[fido2] = "--with-security-key-builtin,--disable-security-key,libfido2" |
| 61 | PACKAGECONFIG[kerberos] = "--with-kerberos5,--without-kerberos5,krb5" | 61 | PACKAGECONFIG[kerberos] = "--with-kerberos5,--without-kerberos5,krb5" |
| 62 | PACKAGECONFIG[ldns] = "--with-ldns,--without-ldns,ldns" | 62 | PACKAGECONFIG[ldns] = "--with-ldns,--without-ldns,ldns" |
| @@ -64,6 +64,9 @@ PACKAGECONFIG[libedit] = "--with-libedit,--without-libedit,libedit" | |||
| 64 | PACKAGECONFIG[manpages] = "--with-mantype=man,--with-mantype=cat" | 64 | PACKAGECONFIG[manpages] = "--with-mantype=man,--with-mantype=cat" |
| 65 | PACKAGECONFIG[systemd-sshd-socket-mode] = "" | 65 | PACKAGECONFIG[systemd-sshd-socket-mode] = "" |
| 66 | PACKAGECONFIG[systemd-sshd-service-mode] = "" | 66 | PACKAGECONFIG[systemd-sshd-service-mode] = "" |
| 67 | PACKAGECONFIG[hostkey-rsa] = "" | ||
| 68 | PACKAGECONFIG[hostkey-ecdsa] = "" | ||
| 69 | PACKAGECONFIG[hostkey-ed25519] = "" | ||
| 67 | 70 | ||
| 68 | EXTRA_AUTORECONF += "--exclude=aclocal" | 71 | EXTRA_AUTORECONF += "--exclude=aclocal" |
| 69 | 72 | ||
| @@ -127,13 +130,31 @@ do_install:append () { | |||
| 127 | install -m 644 ${UNPACKDIR}/volatiles.99_sshd ${D}/${sysconfdir}/default/volatiles/99_sshd | 130 | install -m 644 ${UNPACKDIR}/volatiles.99_sshd ${D}/${sysconfdir}/default/volatiles/99_sshd |
| 128 | install -m 0755 ${S}/contrib/ssh-copy-id ${D}${bindir} | 131 | install -m 0755 ${S}/contrib/ssh-copy-id ${D}${bindir} |
| 129 | 132 | ||
| 133 | # Enable specific ssh host keys | ||
| 134 | sed -i '/HostKey/d' ${D}${sysconfdir}/ssh/sshd_config | ||
| 135 | if ${@bb.utils.contains('PACKAGECONFIG','hostkey-rsa','true','false',d)}; then | ||
| 136 | echo "HostKey /etc/ssh/ssh_host_rsa_key" >> ${D}${sysconfdir}/ssh/sshd_config | ||
| 137 | fi | ||
| 138 | if ${@bb.utils.contains('PACKAGECONFIG','hostkey-ecdsa','true','false',d)}; then | ||
| 139 | echo "HostKey /etc/ssh/ssh_host_ecdsa_key" >> ${D}${sysconfdir}/ssh/sshd_config | ||
| 140 | fi | ||
| 141 | if ${@bb.utils.contains('PACKAGECONFIG','hostkey-ed25519','true','false',d)}; then | ||
| 142 | echo "HostKey /etc/ssh/ssh_host_ed25519_key" >> ${D}${sysconfdir}/ssh/sshd_config | ||
| 143 | fi | ||
| 144 | |||
| 130 | # Create config files for read-only rootfs | 145 | # Create config files for read-only rootfs |
| 131 | install -d ${D}${sysconfdir}/ssh | 146 | install -d ${D}${sysconfdir}/ssh |
| 132 | install -m 644 ${D}${sysconfdir}/ssh/sshd_config ${D}${sysconfdir}/ssh/sshd_config_readonly | 147 | install -m 644 ${D}${sysconfdir}/ssh/sshd_config ${D}${sysconfdir}/ssh/sshd_config_readonly |
| 133 | sed -i '/HostKey/d' ${D}${sysconfdir}/ssh/sshd_config_readonly | 148 | sed -i '/HostKey/d' ${D}${sysconfdir}/ssh/sshd_config_readonly |
| 134 | echo "HostKey /var/run/ssh/ssh_host_rsa_key" >> ${D}${sysconfdir}/ssh/sshd_config_readonly | 149 | if ${@bb.utils.contains('PACKAGECONFIG','hostkey-rsa','true','false',d)}; then |
| 135 | echo "HostKey /var/run/ssh/ssh_host_ecdsa_key" >> ${D}${sysconfdir}/ssh/sshd_config_readonly | 150 | echo "HostKey /var/run/ssh/ssh_host_rsa_key" >> ${D}${sysconfdir}/ssh/sshd_config_readonly |
| 136 | echo "HostKey /var/run/ssh/ssh_host_ed25519_key" >> ${D}${sysconfdir}/ssh/sshd_config_readonly | 151 | fi |
| 152 | if ${@bb.utils.contains('PACKAGECONFIG','hostkey-ecdsa','true','false',d)}; then | ||
| 153 | echo "HostKey /var/run/ssh/ssh_host_ecdsa_key" >> ${D}${sysconfdir}/ssh/sshd_config_readonly | ||
| 154 | fi | ||
| 155 | if ${@bb.utils.contains('PACKAGECONFIG','hostkey-ed25519','true','false',d)}; then | ||
| 156 | echo "HostKey /var/run/ssh/ssh_host_ed25519_key" >> ${D}${sysconfdir}/ssh/sshd_config_readonly | ||
| 157 | fi | ||
| 137 | 158 | ||
| 138 | install -d ${D}${systemd_system_unitdir} | 159 | install -d ${D}${systemd_system_unitdir} |
| 139 | if ${@bb.utils.contains('PACKAGECONFIG','systemd-sshd-socket-mode','true','false',d)}; then | 160 | if ${@bb.utils.contains('PACKAGECONFIG','systemd-sshd-socket-mode','true','false',d)}; then |
