From: "Maxim Yu. Osipov" <mosipov@ilbers.de>
To: Harald Seiler <hws@denx.de>, Henning Schild <henning.schild@siemens.com>
Cc: isar-users@googlegroups.com
Subject: Re: [PATCH v4] meta: Add recipe to regenerate ssh host keys
Date: Wed, 17 Oct 2018 15:12:30 +0300 [thread overview]
Message-ID: <5a1aa08f-4c4c-111b-3bb0-1eb441a7bb7e@ilbers.de> (raw)
In-Reply-To: <b2acf3f531562e40e4e4a054400da929b0519552.camel@denx.de>
On 10/9/18 3:13 PM, Harald Seiler wrote:
> sshd-regen-keys is a systemd unit that will run
> at first boot and force sshd to generate new
> host keys.
>
> This prevents all devices using the same keys.
>
> Also adds sshd-regen-keys to qemuamd64-buster.conf
> to ensure CI coverage.
Applied to the 'next',
Thanks,
Maixm.
> Signed-off-by: Harald Seiler <hws@denx.de>
> ---
> This version removes an unnecessary sudo in do_install
>
> meta-isar/conf/multiconfig/qemuamd64-buster.conf | 2 ++
> meta/recipes-support/sshd-regen-keys/files/postinst | 4 ++++
> .../sshd-regen-keys/files/sshd-regen-keys.service | 19 +++++++++++++++++++
> .../sshd-regen-keys/sshd-regen-keys_0.1.bb | 14 ++++++++++++++
> 4 files changed, 39 insertions(+)
> create mode 100644 meta/recipes-support/sshd-regen-keys/files/postinst
> create mode 100644 meta/recipes-support/sshd-regen-keys/files/sshd-regen-keys.service
> create mode 100644 meta/recipes-support/sshd-regen-keys/sshd-regen-keys_0.1.bb
>
> diff --git a/meta-isar/conf/multiconfig/qemuamd64-buster.conf b/meta-isar/conf/multiconfig/qemuamd64-buster.conf
> index 059ea00..bd18fcc 100644
> --- a/meta-isar/conf/multiconfig/qemuamd64-buster.conf
> +++ b/meta-isar/conf/multiconfig/qemuamd64-buster.conf
> @@ -11,6 +11,8 @@ IMAGE_TYPE ?= "wic-img"
> WKS_FILE ?= "sdimage-efi"
> IMAGER_INSTALL += "${GRUB_BOOTLOADER_INSTALL}"
>
> +IMAGE_INSTALL += "sshd-regen-keys"
> +
> QEMU_ARCH ?= "x86_64"
> QEMU_MACHINE ?= "q35"
> QEMU_CPU ?= ""
> diff --git a/meta/recipes-support/sshd-regen-keys/files/postinst b/meta/recipes-support/sshd-regen-keys/files/postinst
> new file mode 100644
> index 0000000..ae722a7
> --- /dev/null
> +++ b/meta/recipes-support/sshd-regen-keys/files/postinst
> @@ -0,0 +1,4 @@
> +#!/bin/sh
> +set -e
> +
> +systemctl enable sshd-regen-keys.service
> diff --git a/meta/recipes-support/sshd-regen-keys/files/sshd-regen-keys.service b/meta/recipes-support/sshd-regen-keys/files/sshd-regen-keys.service
> new file mode 100644
> index 0000000..3b8231f
> --- /dev/null
> +++ b/meta/recipes-support/sshd-regen-keys/files/sshd-regen-keys.service
> @@ -0,0 +1,19 @@
> +[Unit]
> +Description=Regenerate sshd host keys
> +DefaultDependencies=no
> +Conflicts=shutdown.target
> +After=systemd-remount-fs.service
> +Before=shutdown.target sshd.service
> +ConditionPathIsReadWrite=/etc
> +
> +[Service]
> +Type=oneshot
> +RemainAfterExit=yes
> +Environment=DEBIAN_FRONTEND=noninteractive
> +ExecStart=/bin/sh -c "rm -v /etc/ssh/ssh_host_*_key*; dpkg-reconfigure openssh-server"
> +ExecStartPost=-/bin/systemctl disable sshd-regen-keys.service
> +StandardOutput=syslog
> +StandardError=syslog
> +
> +[Install]
> +WantedBy=sysinit.target
> diff --git a/meta/recipes-support/sshd-regen-keys/sshd-regen-keys_0.1.bb b/meta/recipes-support/sshd-regen-keys/sshd-regen-keys_0.1.bb
> new file mode 100644
> index 0000000..02e9e25
> --- /dev/null
> +++ b/meta/recipes-support/sshd-regen-keys/sshd-regen-keys_0.1.bb
> @@ -0,0 +1,14 @@
> +# This software is a part of ISAR.
> +inherit dpkg-raw
> +
> +DESCRIPTION = "Systemd service to regenerate sshd keys"
> +MAINTAINER = "isar-users <isar-users@googlegroups.com>"
> +DEBIAN_DEPENDS = "openssh-server, systemd"
> +
> +SRC_URI = "file://postinst \
> + file://sshd-regen-keys.service"
> +
> +do_install() {
> + install -v -d -m 755 "${D}/lib/systemd/system"
> + install -v -m 644 "${WORKDIR}/sshd-regen-keys.service" "${D}/lib/systemd/system/sshd-regen-keys.service"
> +}
>
--
Maxim Osipov
ilbers GmbH
Maria-Merian-Str. 8
85521 Ottobrunn
Germany
+49 (151) 6517 6917
mosipov@ilbers.de
http://ilbers.de/
Commercial register Munich, HRB 214197
General Manager: Baurzhan Ismagulov
prev parent reply other threads:[~2018-10-17 12:12 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-25 15:53 [PATCH] " Harald Seiler
2018-09-26 8:31 ` Henning Schild
2018-10-02 8:43 ` [PATCH v2] " Harald Seiler
2018-10-02 17:56 ` [PATCH] " Henning Schild
2018-10-09 8:42 ` [PATCH v3] " Harald Seiler
2018-10-09 12:13 ` [PATCH v4] " Harald Seiler
2018-10-17 12:12 ` Maxim Yu. Osipov [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5a1aa08f-4c4c-111b-3bb0-1eb441a7bb7e@ilbers.de \
--to=mosipov@ilbers.de \
--cc=henning.schild@siemens.com \
--cc=hws@denx.de \
--cc=isar-users@googlegroups.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox