package/dropbear: fix when readlink is busybox'
PATCH 1/1 package/dropbear: fix when readlink is busybox'
Busybox' "readlink -f" does not canonicalise paths when the target is missing, while coreutils do.
Fix that by:
- making an absolute symlink
- dropping "-f" when calling readlink
Fixes #8276.
--- package/dropbear/S50dropbear | 2 +- package/dropbear/dropbear.mk | 2 +- package/dropbear/dropbear.service | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
package/dropbear/S50dropbear +1 -1
@@ -18,7 +18,7 @@ start() { # - the filesystem is RW (i.e. we can rm the symlink), # replace the symlink with an actual directory if [ -L /etc/dropbear \ - -a "$(readlink -f /etc/dropbear)" = "/var/run/dropbear" ] + -a "$(readlink /etc/dropbear)" = "/var/run/dropbear" ] then if rm -f /etc/dropbear; then mkdir -p /etc/dropbear
package/dropbear/dropbear.mk +1 -1
@@ -93,7 +93,7 @@ define DROPBEAR_INSTALL_TARGET_CMDS for f in $(DROPBEAR_TARGET_BINS); do \ ln -snf ../sbin/dropbear $(TARGET_DIR)/usr/bin/$$f ; \ done - ln -snf ../var/run/dropbear $(TARGET_DIR)/etc/dropbear + ln -snf /var/run/dropbear $(TARGET_DIR)/etc/dropbear endef $(eval $(autotools-package))
package/dropbear/dropbear.service +1 -1
@@ -10,7 +10,7 @@ After=syslog.target network.target auditd.service # replace the symlink with an actual directory ExecStartPre=/bin/sh -c '\ if [ -L /etc/dropbear \ - -a "$(readlink -f /etc/dropbear)" = "/var/run/dropbear" ]; then \ + -a "$(readlink /etc/dropbear)" = "/var/run/dropbear" ]; then \ if rm -f /etc/dropbear; then \ mkdir -p /etc/dropbear; \ else \
Signature · 1 line
1.9.1
PATCH 1/1 package/dropbear: fix when readlink is busybox'
Quoted 10 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Yann" == Yann E MORIN <[email protected]> writes:
Busybox' "readlink -f" does not canonicalise paths when the target is missing, while coreutils do.
Fix that by:
- making an absolute symlink
- dropping "-f" when calling readlinkFixes #8276.
Committed, thanks.
package/dropbear/S50dropbear start() { · line 24
Quoted 11 lines
package/dropbear/S50dropbear +1
-1@@ -18,7 +18,7 @@ start() { # - the filesystem is RW (i.e. we can rm the symlink), # replace the symlink with an actual directory if [ -L /etc/dropbear \ - -a "$(readlink -f /etc/dropbear)" = "/var/run/dropbear" ] + -a "$(readlink /etc/dropbear)" = "/var/run/dropbear" ] then if rm -f /etc/dropbear; then mkdir -p /etc/dropbear
Looking at the recent changes to S50dropbear, isn't it quite noisy with a RO rootfs? I would imagine those rm and mkdir calls complain with RO. Perhaps we should add 2>/dev/null to them?
Signature · 1 line
Bye, Peter Korsgaard
PATCH 1/1 package/dropbear: fix when readlink is busybox'
Peter, All,
On 2015-08-24 17:09 +0200, Peter Korsgaard spake thusly:
Quoted 13 lines
Quoted 10 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Yann" == Yann E MORIN <[email protected]> writes:
Busybox' "readlink -f" does not canonicalise paths when the target is missing, while coreutils do.
Fix that by:
- making an absolute symlink
- dropping "-f" when calling readlinkFixes #8276.
Committed, thanks.
Quoted 15 lines
package/dropbear/S50dropbear start() { · line 24
Quoted 11 lines
package/dropbear/S50dropbear +1
-1@@ -18,7 +18,7 @@ start() { # - the filesystem is RW (i.e. we can rm the symlink), # replace the symlink with an actual directory if [ -L /etc/dropbear \ - -a "$(readlink -f /etc/dropbear)" = "/var/run/dropbear" ] + -a "$(readlink /etc/dropbear)" = "/var/run/dropbear" ] then if rm -f /etc/dropbear; then mkdir -p /etc/dropbearLooking at the recent changes to S50dropbear, isn't it quite noisy with a RO rootfs? I would imagine those rm and mkdir calls complain with RO. Perhaps we should add 2>/dev/null to them?
Well, on a RO filesystem, we'd create /var/run/dropbear on each boot, and thus regenerate keys on each boot. This means keys from such a device can not really be trusted.
So I'd prefer we get the error messages, as a clue to the user that something is wrong. Maybe we could have had an explicit message, yes.
Regards,
Yann E. MORIN.
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | 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. | '------------------------------^-------^------------------^--------------------'
PATCH 1/1 package/dropbear: fix when readlink is busybox'
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Yann" == Yann E MORIN <[email protected]> writes:
Hi,
Quoted 7 lines
Quoted 3 lines
Looking at the recent changes to S50dropbear, isn't it quite noisy with a RO rootfs? I would imagine those rm and mkdir calls complain with RO. Perhaps we should add 2>/dev/null to them?
Well, on a RO filesystem, we'd create
/var/run/dropbearon each boot, and thus regenerate keys on each boot. This means keys from such a device can not really be trusted.
Well, with a RO filesystem you only have the option to either generate at each boot or bake in a hardcoded host key in the rootfs. Neither is really great for security.
Quoted 2 lines
So I'd prefer we get the error messages, as a clue to the user that something is wrong. Maybe we could have had an explicit message, yes.
Those fairly obscure messages are imho not really helpful - But on the other hand I'm not sure a dedicated message is really warranted.
Signature · 2 lines
Venlig hilsen, Peter Korsgaard
PATCH 1/1 package/dropbear: fix when readlink is busybox'
Peter, All,
On 2015-08-24 17:38 +0200, Peter Korsgaard spake thusly:
Quoted 8 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Yann" == Yann E MORIN <[email protected]> writes:
Hi,
Quoted 3 lines
Quoted 3 lines
Looking at the recent changes to S50dropbear, isn't it quite noisy with a RO rootfs? I would imagine those rm and mkdir calls complain with RO. Perhaps we should add 2>/dev/null to them?
Quoted 7 lines
Quoted 3 lines
Well, on a RO filesystem, we'd create
/var/run/dropbearon each boot, and thus regenerate keys on each boot. This means keys from such a device can not really be trusted.Well, with a RO filesystem you only have the option to either generate at each boot or bake in a hardcoded host key in the rootfs. Neither is really great for security.
Or, as some are doing (Paul for example), have /etc/dropbear point to a R/W location (e.g. a persistent FS done at first boot) and have the symlink overwritten by an overlay to point to that location.
Which is anyway something sane to do in most case of a R/O FS.
Quoted 5 lines
Quoted 2 lines
So I'd prefer we get the error messages, as a clue to the user that something is wrong. Maybe we could have had an explicit message, yes.
Those fairly obscure messages are imho not really helpful - But on the other hand I'm not sure a dedicated message is really warranted.
Maybe something along the lines of;
I have no persistent location to store SSH host keys. I will generate new ones on each boot.
Are you sure that's what you wanted to do?
Regards,
Yann E. MORIN.
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | 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. | '------------------------------^-------^------------------^--------------------'
PATCH 1/1 package/dropbear: fix when readlink is busybox'
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Yann" == Yann E MORIN <[email protected]> writes:
Hi,
Quoted 9 lines
Quoted 3 lines
Well, with a RO filesystem you only have the option to either generate at each boot or bake in a hardcoded host key in the rootfs. Neither is really great for security.
Or, as some are doing (Paul for example), have
/etc/dropbearpoint to a R/W location (e.g. a persistent FS done at first boot) and have the symlink overwritten by an overlay to point to that location.Which is anyway something sane to do in most case of a R/O FS.
Sure, or simply union mount a persistent R/W FS on top of /etc so you don't need to mess around with symlinks like I usually do.
Quoted 8 lines
Quoted 2 lines
Those fairly obscure messages are imho not really helpful - But on the other hand I'm not sure a dedicated message is really warranted.
Maybe something along the lines of;
I have no persistent location to store SSH host keys. I will generate new ones on each boot.
Are you sure that's what you wanted to do?
I don't feel strongly about it. If you think it is needed then that's fine by me. I think it sounds a bit odd to use the 'I' form, so perhaps something like this instead:
No persistent location to store SSH host keys. New keys will be generated at each boot. Are you sure this is what you want to do?
And perhaps the message should contain hints about how to fix this?
Signature · 2 lines
Venlig hilsen, Peter Korsgaard