From: Clemens Gruber <clemens.gruber@pqgruber.com>
To: ptxdist@pengutronix.de
Cc: Michael Olbrich <m.olbrich@pengutronix.de>
Subject: Re: [ptxdist] [PATCH] openssh: improve rc.once.d script and harden sshd_config
Date: Fri, 7 Aug 2015 12:55:24 +0200 [thread overview]
Message-ID: <20150807105524.GA11298@pqgruber.com> (raw)
In-Reply-To: <20150807104548.GA24388@pengutronix.de>
Hi Michael,
On Fri, Aug 07, 2015 at 12:45:48PM +0200, Michael Olbrich wrote:
> Forgot the attachment...
>
> Michael
>
> --
> Pengutronix e.K. | |
> Industrial Linux Solutions | http://www.pengutronix.de/ |
> Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
> Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
> #!/bin/sh
>
> PATH=/sbin:/bin:/usr/sbin:/usr/bin
>
> get_hostkeys() {
> [ -f /etc/ssh/sshd_config ] || return
> sed -n 's/^HostKey[ \t][ \t]*\(.*\)/\1/p' /etc/ssh/sshd_config
> }
>
> host_keys_required() {
> hostkeys="$(get_hostkeys)"
> if [ "$hostkeys" ]; then
> echo "$hostkeys"
> else
> # No HostKey directives found, so we pick some defaults
> echo /etc/ssh/ssh_host_ed25519_key
> echo /etc/ssh/ssh_host_rsa_key
> fi
> }
>
> create_key() {
> msg="$1"
> shift
> hostkeys="$1"
> shift
> file="$1"
> shift
>
> if echo "$hostkeys" | grep -x "$file" >/dev/null; then
> echo "$msg; this may take some time ..."
> rm -f $file &&
> ssh-keygen -q -f "$file" -N '' "$@" || return
> echo "$msg; done."
> fi
> }
>
> create_keys() {
> hostkeys="$(host_keys_required)"
>
> create_key "Creating DSA key" \
> "$hostkeys" /etc/ssh/ssh_host_dsa_key -t dsa &&
> create_key "Creating ECDSA key" \
> "$hostkeys" /etc/ssh/ssh_host_ecdsa_key -t ecdsa &&
> create_key "Creating ED25519 key" \
> "$hostkeys" /etc/ssh/ssh_host_ed25519_key -t ed25519 &&
> create_key "Creating RSA key" \
> "$hostkeys" /etc/ssh/ssh_host_rsa_key -t rsa -b 4096
> }
>
> if ! create_keys; then
> echo "Generating SSH keys failed!"
> exit 1
> fi
Looks good to me. I'll rebase my changes on the new sshd_config, include your
rc.once.d changes and send a new patch!
Would you like the users of ptxdist master to test this in the meantime or do
you prefer merging it after your vacation?
Happy holidays!
Clemens
--
ptxdist mailing list
ptxdist@pengutronix.de
prev parent reply other threads:[~2015-08-07 10:55 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-17 21:54 Clemens Gruber
2015-08-07 10:13 ` Michael Olbrich
2015-08-07 10:45 ` Michael Olbrich
2015-08-07 10:55 ` Clemens Gruber [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=20150807105524.GA11298@pqgruber.com \
--to=clemens.gruber@pqgruber.com \
--cc=m.olbrich@pengutronix.de \
--cc=ptxdist@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