* [Buildroot] [PATCH] package/dropbear: add warning about volatile keys
@ 2015-08-25 21:43 Yann E. MORIN
2015-08-30 20:05 ` Peter Korsgaard
0 siblings, 1 reply; 5+ messages in thread
From: Yann E. MORIN @ 2015-08-25 21:43 UTC (permalink / raw)
To: buildroot
When the rootfs is read-only, keys will be generated in a volatile
location, which is inherently bad as host keys will change on each boot,
rendering virtually useless.
Add a warning so the user is at least aware of the issue.
Consign the rm output to oblivion, to avoid noisy output, now that we
have a proper warning.
Move the starting message after the symlink-block, to avoid messages
collision. Move the umask as well, sicne /etc/dropbear/ may be world
readable; just the private host keys should be ?00 (and dropbear handles
that by itself).
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Peter Korsgaard <jacmet@uclibc.org>
---
package/dropbear/S50dropbear | 12 +++++++-----
package/dropbear/dropbear.service | 6 ++++--
2 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/package/dropbear/S50dropbear b/package/dropbear/S50dropbear
index 765d6a3..b4e3c5c 100644
--- a/package/dropbear/S50dropbear
+++ b/package/dropbear/S50dropbear
@@ -9,9 +9,6 @@ test -r /etc/default/dropbear && . /etc/default/dropbear
start() {
DROPBEAR_ARGS="$DROPBEAR_ARGS -R"
- echo -n "Starting dropbear sshd: "
- umask 077
-
# If /etc/dropbear is a symlink to /var/run/dropbear, and
# - the filesystem is RO (i.e. we can not rm the symlink),
# create the directory pointed to by the symlink.
@@ -20,13 +17,18 @@ start() {
if [ -L /etc/dropbear \
-a "$(readlink /etc/dropbear)" = "/var/run/dropbear" ]
then
- if rm -f /etc/dropbear; then
+ if rm -f /etc/dropbear >/dev/null 2>&1; then
mkdir -p /etc/dropbear
else
- mkdir -p $(readlink /etc/dropbear)
+ echo "No persistent location to store SSH host keys. New keys will be"
+ echo "generated at each boot. Are you sure this is what you want to do?"
+ mkdir -p "$(readlink /etc/dropbear)"
fi
fi
+ echo -n "Starting dropbear sshd: "
+ umask 077
+
start-stop-daemon -S -q -p /var/run/dropbear.pid \
--exec /usr/sbin/dropbear -- $DROPBEAR_ARGS
[ $? = 0 ] && echo "OK" || echo "FAIL"
diff --git a/package/dropbear/dropbear.service b/package/dropbear/dropbear.service
index 9dcbf25..1eb42f9 100644
--- a/package/dropbear/dropbear.service
+++ b/package/dropbear/dropbear.service
@@ -11,10 +11,12 @@ After=syslog.target network.target auditd.service
ExecStartPre=/bin/sh -c '\
if [ -L /etc/dropbear \
-a "$(readlink /etc/dropbear)" = "/var/run/dropbear" ]; then \
- if rm -f /etc/dropbear; then \
+ if rm -f /etc/dropbear >/dev/null 2>&1; then \
mkdir -p /etc/dropbear; \
else \
- mkdir -p $(readlink /etc/dropbear); \
+ echo "No persistent location to store SSH host keys. New keys will be"; \
+ echo "generated at each boot. Are you sure this is what you want to do?"; \
+ mkdir -p "$(readlink /etc/dropbear)"; \
fi; \
fi'
ExecStart=/usr/sbin/dropbear -F -R
--
1.9.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [Buildroot] [PATCH] package/dropbear: add warning about volatile keys
2015-08-25 21:43 [Buildroot] [PATCH] package/dropbear: add warning about volatile keys Yann E. MORIN
@ 2015-08-30 20:05 ` Peter Korsgaard
2015-08-30 20:12 ` Yann E. MORIN
0 siblings, 1 reply; 5+ messages in thread
From: Peter Korsgaard @ 2015-08-30 20:05 UTC (permalink / raw)
To: buildroot
>>>>> "Yann" == Yann E MORIN <yann.morin.1998@free.fr> writes:
> When the rootfs is read-only, keys will be generated in a volatile
> location, which is inherently bad as host keys will change on each boot,
> rendering virtually useless.
+them
> Add a warning so the user is at least aware of the issue.
> Consign the rm output to oblivion, to avoid noisy output, now that we
> have a proper warning.
Is consign a English word? I changed it to 'hide' as I think that is clearer.
> Move the starting message after the symlink-block, to avoid messages
> collision. Move the umask as well, sicne /etc/dropbear/ may be world
> readable; just the private host keys should be ?00 (and dropbear handles
> that by itself).
> Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
> Cc: Peter Korsgaard <jacmet@uclibc.org>
Committed, thanks.
--
Bye, Peter Korsgaard
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Buildroot] [PATCH] package/dropbear: add warning about volatile keys
2015-08-30 20:05 ` Peter Korsgaard
@ 2015-08-30 20:12 ` Yann E. MORIN
2015-08-30 20:14 ` Yann E. MORIN
2015-08-30 21:40 ` Peter Korsgaard
0 siblings, 2 replies; 5+ messages in thread
From: Yann E. MORIN @ 2015-08-30 20:12 UTC (permalink / raw)
To: buildroot
Peter, All,
On 2015-08-30 22:05 +0200, Peter Korsgaard spake thusly:
> >>>>> "Yann" == Yann E MORIN <yann.morin.1998@free.fr> writes:
>
> > When the rootfs is read-only, keys will be generated in a volatile
> > location, which is inherently bad as host keys will change on each boot,
> > rendering virtually useless.
> +them
Ack.
> > Add a warning so the user is at least aware of the issue.
>
> > Consign the rm output to oblivion, to avoid noisy output, now that we
> > have a proper warning.
>
> Is consign a English word? I changed it to 'hide' as I think that is clearer.
Yes, it is:
http://www.merriam-webster.com/dictionary/consign
to put (something that is not wanted or used) in a place where old
things are stored or thrown away
Regards,
Yann E. MORIN.
--
.-----------------.--------------------.------------------.--------------------.
| Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ |
| +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. |
'------------------------------^-------^------------------^--------------------'
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Buildroot] [PATCH] package/dropbear: add warning about volatile keys
2015-08-30 20:12 ` Yann E. MORIN
@ 2015-08-30 20:14 ` Yann E. MORIN
2015-08-30 21:40 ` Peter Korsgaard
1 sibling, 0 replies; 5+ messages in thread
From: Yann E. MORIN @ 2015-08-30 20:14 UTC (permalink / raw)
To: buildroot
Peter, All,
On 2015-08-30 22:12 +0200, Yann E. MORIN spake thusly:
> On 2015-08-30 22:05 +0200, Peter Korsgaard spake thusly:
> > >>>>> "Yann" == Yann E MORIN <yann.morin.1998@free.fr> writes:
> > > Consign the rm output to oblivion, to avoid noisy output, now that we
> > > have a proper warning.
> >
> > Is consign a English word? I changed it to 'hide' as I think that is clearer.
>
> Yes, it is:
> http://www.merriam-webster.com/dictionary/consign
>
> to put (something that is not wanted or used) in a place where old
> things are stored or thrown away
Or even better yet:
to commit especially to a final destination or fate <a writer
consigned to oblivion>
Muhahaha! ;-)
Regards,
Yann E. MORIN.
--
.-----------------.--------------------.------------------.--------------------.
| Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ |
| +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. |
'------------------------------^-------^------------------^--------------------'
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Buildroot] [PATCH] package/dropbear: add warning about volatile keys
2015-08-30 20:12 ` Yann E. MORIN
2015-08-30 20:14 ` Yann E. MORIN
@ 2015-08-30 21:40 ` Peter Korsgaard
1 sibling, 0 replies; 5+ messages in thread
From: Peter Korsgaard @ 2015-08-30 21:40 UTC (permalink / raw)
To: buildroot
>>>>> "Yann" == Yann E MORIN <yann.morin.1998@free.fr> writes:
Hi,
>> > Consign the rm output to oblivion, to avoid noisy output, now that we
>> > have a proper warning.
>>
>> Is consign a English word? I changed it to 'hide' as I think that is clearer.
> Yes, it is:
> http://www.merriam-webster.com/dictionary/consign
Ok, thanks ;)
--
Venlig hilsen,
Peter Korsgaard
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-08-30 21:40 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-25 21:43 [Buildroot] [PATCH] package/dropbear: add warning about volatile keys Yann E. MORIN
2015-08-30 20:05 ` Peter Korsgaard
2015-08-30 20:12 ` Yann E. MORIN
2015-08-30 20:14 ` Yann E. MORIN
2015-08-30 21:40 ` Peter Korsgaard
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).