public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Henning Schild <henning.schild@siemens.com>
To: Claudius Heine <claudius.heine.ext@siemens.com>
Cc: <isar-users@googlegroups.com>
Subject: Re: [PATCH 1/2] meta/classes/image: Introduce sshd host key assertion
Date: Wed, 29 May 2019 14:46:19 +0200	[thread overview]
Message-ID: <20190529144619.14deede9@md1za8fc.ad001.siemens.net> (raw)
In-Reply-To: <1436968b-b542-dc76-f971-e8bc9e3a626b@siemens.com>

Am Wed, 29 May 2019 14:43:10 +0200
schrieb Claudius Heine <claudius.heine.ext@siemens.com>:

> Hi Henning,
> 
> On 29/05/2019 13.52, [ext] Henning Schild wrote:
> > From: Henning Schild <henning.schild@siemens.com>
> > 
> > Images containing ssh host keys without some way of dealing with the
> > fact that those have to be generate at run-time not install-time are
> > invalid!
> > 
> > Introduce a check that our own package "sshd-regen-keys" is
> > installed when such keys are present (when an ssh daemon is
> > installed).
> > 
> > Suggest to install that package or find some other way of dealing
> > with the problem. But fail by default, since such an image is most
> > likely broken.
> > 
> > Signed-off-by: Henning Schild <henning.schild@siemens.com>
> > ---
> >   meta/classes/image-postproc-extension.bbclass | 14 ++++++++++++++
> >   1 file changed, 14 insertions(+)
> > 
> > diff --git a/meta/classes/image-postproc-extension.bbclass
> > b/meta/classes/image-postproc-extension.bbclass index
> > 625ba7d..5467bbc 100644 ---
> > a/meta/classes/image-postproc-extension.bbclass +++
> > b/meta/classes/image-postproc-extension.bbclass @@ -44,3 +44,17 @@
> > image_postprocess_mark() { update_etc_os_release \
> >           --build-id "${BUILD_ID}" --variant "${DESCRIPTION}"
> >   }
> > +
> > +ROOTFS_POSTPROCESS_COMMAND =+ "image_postprocess_sshd_key_regen"
> > +
> > +image_postprocess_sshd_key_regen() {
> > +    if ls ${WORKDIR}/rootfs/etc/ssh/ssh_host_*key* > /dev/null;
> > then  
> 
> ${WORKDIR}/rootfs -> ${IMAGE_ROOTFS}
> 
> If that file is not found, ls will complain on stderr:
>      ls: cannot access '...': No such file or directory
> so a '2>&1' would be needed.
> 
> (I would also rather use `stat -t` than ls.)
> 
> Merging those two ifs into one would also be nice.

Thanks, will do both.

Henning

> Otherwise looks good.
> 
> Claudius
> 
> > +        if [ ! -d
> > ${WORKDIR}/rootfs/usr/share/doc/sshd-regen-keys ]; then
> > +            bbwarn "Looks like you have ssh host keys in the image
> > but did "\
> > +                   "not install \"sshd-regen-keys\". This image
> > should not be "\
> > +                   "deployed more than once."
> > +            bberror "Install the package or forcefully remove this
> > check!"
> > +            exit 1
> > +        fi
> > +    fi
> > +}
> >   
> 


      reply	other threads:[~2019-05-29 12:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-29 11:52 Henning Schild
2019-05-29 11:52 ` [PATCH 2/2] rpi-stretch: install sshd-regen-keys since openssh-server is inside Henning Schild
2019-05-29 12:43 ` [PATCH 1/2] meta/classes/image: Introduce sshd host key assertion Claudius Heine
2019-05-29 12:46   ` Henning Schild [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=20190529144619.14deede9@md1za8fc.ad001.siemens.net \
    --to=henning.schild@siemens.com \
    --cc=claudius.heine.ext@siemens.com \
    --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