From: Henning Schild <henning.schild@siemens.com>
To: Harald Seiler <hws@denx.de>
Cc: <isar-users@googlegroups.com>
Subject: Re: [PATCH] meta: Add recipe to regenerate ssh host keys
Date: Wed, 26 Sep 2018 10:31:38 +0200 [thread overview]
Message-ID: <20180926103138.1241c7f1@md1pvb1c.ad001.siemens.net> (raw)
In-Reply-To: <72b02e7ac7ff8a3079d8b988e541da37396363c3.camel@denx.de>
Am Tue, 25 Sep 2018 17:53:19 +0200
schrieb Harald Seiler <hws@denx.de>:
> 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.
>
> Signed-off-by: Harald Seiler <hws@denx.de>
> ---
> meta/recipes-support/sshd-regen-keys/files/postinst | 4 ++++
> .../sshd-regen-keys/files/sshd-regen-keys.service | 19
> +++++++++++++++++++ .../sshd-regen-keys/sshd-regen-keys.bb
> | 15 +++++++++++++++ 3 files changed, 38 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.bb
>
> 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.bb
> b/meta/recipes-support/sshd-regen-keys/sshd-regen-keys.bb new file
> mode 100644 index 0000000..3b196c2
> --- /dev/null
> +++ b/meta/recipes-support/sshd-regen-keys/sshd-regen-keys.bb
I think a PV would be useful. sshd-regen-keys_0.1.bb
> @@ -0,0 +1,15 @@
> +# This software is a part of ISAR.
> +
> +DESCRIPTION = "Systemd service to regenerate sshd keys"
> +MAINTAINER = "isar-users <isar-users@googlegroups.com>"
> +DEBIAN_DEPENDS = "openssh-server"
systemd is missing here ... yes you can still get debian without it,
also with Isar
Maybe something to add to IMAGE_INSTALL of one of the ci targets to get
test-coverage. But wait what others think about that idea.
Henning
> +
> +SRC_URI = "file://postinst \
> + file://sshd-regen-keys.service"
> +
> +inherit dpkg-raw
> +
> +do_install() {
> + sudo install -v -d -m 755 "${D}/lib/systemd/system"
> + sudo install -v -m 644 "${WORKDIR}/sshd-regen-keys.service"
> "${D}/lib/systemd/system/sshd-regen-keys.service" +}
>
next prev parent reply other threads:[~2018-09-26 8:31 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-25 15:53 Harald Seiler
2018-09-26 8:31 ` Henning Schild [this message]
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
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=20180926103138.1241c7f1@md1pvb1c.ad001.siemens.net \
--to=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