public inbox for openembedded-core@lists.openembedded.org
 help / color / mirror / Atom feed
From: Joshua Watt <jpewhacker@gmail.com>
To: "Ulrich Ölmann" <u.oelmann@pengutronix.de>,
	openembedded-core@lists.openembedded.org
Subject: Re: [PATCH] openssh: Atomically generate host keys
Date: Tue, 20 Jun 2017 09:07:21 -0500	[thread overview]
Message-ID: <1497967641.21055.1.camel@gmail.com> (raw)
In-Reply-To: <20170620085256.okya3zax2xhdshiz@pengutronix.de>

On Tue, 2017-06-20 at 10:52 +0200, Ulrich Ölmann wrote:
> On Tue, May 23, 2017 at 03:37:16PM +0100, Burton, Ross wrote:
> > On 7 May 2017 at 02:33, Joshua Watt <jpewhacker@gmail.com> wrote:
> > > diff --git a/meta/recipes-
> > > connectivity/openssh/openssh/sshdgenkeys.service
> > > b/meta/recipes-connectivity/openssh/openssh/sshdgenkeys.service
> > > index 148e6ad..af56404 100644
> > > --- a/meta/recipes-
> > > connectivity/openssh/openssh/sshdgenkeys.service
> > > +++ b/meta/recipes-
> > > connectivity/openssh/openssh/sshdgenkeys.service
> > > @@ -1,22 +1,14 @@
> > >  [Unit]
> > >  Description=OpenSSH Key Generation
> > >  RequiresMountsFor=/var /run
> > > -ConditionPathExists=!/var/run/ssh/ssh_host_rsa_key
> > > -ConditionPathExists=!/var/run/ssh/ssh_host_dsa_key
> > > -ConditionPathExists=!/var/run/ssh/ssh_host_ecdsa_key
> > > -ConditionPathExists=!/var/run/ssh/ssh_host_ed25519_key
> > > -ConditionPathExists=!/etc/ssh/ssh_host_rsa_key
> > > -ConditionPathExists=!/etc/ssh/ssh_host_dsa_key
> > > -ConditionPathExists=!/etc/ssh/ssh_host_ecdsa_key
> > > -ConditionPathExists=!/etc/ssh/ssh_host_ed25519_key
> > > 
> > 
> > Can you not continue to use ConditionPathExists to only run this
> > unit if it
> > needs to run?  You can prepend the argument with | to make them
> > logical OR
> > instead of logical AND, if I'm reading this documentation
> > correctly.
> 
> Am I right that if we have a read-write mounted root-FS with already
> existing
> keys in /etc/ssh the service unit will nevertheless be started on
> _every_ boot
> now as the files which are checked for existance in /var/run/ssh are
> missing?

Yes. The service is actually run when the first ssh connection is made
(not at boot time), but it will do so on the first connection every
boot cycle. I don't know a way to do a complex conditional in systemd,
so this does the superset and makes sshd-check-key figure out if the
key actually needs generating or not. Perhaps there is a better way to
do this with the systemd conditional syntax that I am not aware of?
Ideally, the conditional checks in the systemd unit would be able to
use the SYSCONFDIR from /etc/default/ssh, but I'm not sure if that is
possible.

> 
> Best regards
> Ulrich
> -- 
> Pengutronix
> e.K.                           |                             |
> Industrial Linux Solutions                 | http://www.pengutronix.d
> e/  |
> Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-
> 0    |
> Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-
> 5555 |



  reply	other threads:[~2017-06-20 14:07 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-07  1:33 [PATCH] openssh: Atomically generate host keys Joshua Watt
2017-05-09  2:24 ` (No subject) Joshua Watt
2017-05-09  2:24   ` [PATCH v2] openssh: Atomically generate host keys Joshua Watt
2017-05-22 13:08 ` [PATCH] " Joshua Watt
2017-05-23 14:37 ` Burton, Ross
2017-05-23 15:29   ` Joshua Watt
2017-05-23 17:23     ` Randy Witt
2017-05-23 17:56       ` Joshua Watt
2017-05-23 19:56         ` Joshua Watt
2017-05-24 10:03           ` Peter Kjellerstedt
2017-05-24 13:38             ` Joshua Watt
2017-05-25  2:17               ` [meta-oe][PATCH v3] " Joshua Watt
2017-05-25  9:21                 ` Ian Arkver
2017-05-26  1:52               ` [meta-oe][PATCH v4] " Joshua Watt
2017-05-26 18:02                 ` Andre McCurdy
2017-05-26  1:54               ` [meta-oe][PATCH v5] " Joshua Watt
2017-05-26 13:33                 ` Leonardo Sandoval
2017-05-26 13:33                   ` Joshua Watt
2017-05-31  2:34               ` [PATCH v6] " Joshua Watt
2017-05-31  2:45                 ` Otavio Salvador
2017-06-01  3:05               ` [PATCH v7] " Joshua Watt
2017-06-07  3:30                 ` Joshua Watt
2017-06-12 12:25                   ` Joshua Watt
2017-06-12 12:25                   ` Joshua Watt
2017-06-14  3:31               ` [PATCH v8] " Joshua Watt
2017-06-14  3:38                 ` Joshua Watt
2017-06-14  3:55               ` [PATCH v9] " Joshua Watt
2017-07-13 12:15               ` [PATCH v10] " Joshua Watt
2017-09-28 13:40               ` [PATCH v11] " Joshua Watt
2017-06-20  8:52   ` [PATCH] " Ulrich Ölmann
2017-06-20 14:07     ` Joshua Watt [this message]
2017-05-25  2:31 ` ✗ patchtest: failure for openssh: Atomically generate host keys (rev3) Patchwork
2017-05-26  2:01 ` ✗ patchtest: failure for openssh: Atomically generate host keys (rev4) Patchwork
2017-07-13 12:31 ` ✗ patchtest: failure for openssh: Atomically generate host keys (rev10) Patchwork

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=1497967641.21055.1.camel@gmail.com \
    --to=jpewhacker@gmail.com \
    --cc=openembedded-core@lists.openembedded.org \
    --cc=u.oelmann@pengutronix.de \
    /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