Previously just existence of a key file was checked, which allowed
empty key files or invalid key files to persist. That would have
prevented dropbear server daemon startup.

Note: this does not always regenerate keys, only if rc-once is triggered
and run again for whatever reason.

Signed-off-by: Alexander Dahl <[email protected]>
---
 projectroot/etc/rc.once.d/dropbear | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/projectroot/etc/rc.once.d/dropbear 
b/projectroot/etc/rc.once.d/dropbear
index bfebccfc4..f716bd6ac 100644
--- a/projectroot/etc/rc.once.d/dropbear
+++ b/projectroot/etc/rc.once.d/dropbear
@@ -8,7 +8,8 @@ gen_key() {
        key_type=$1
        key_file=$2
 
-       [ -e "$key_file" ] && return
+       # do not overwrite valid key files
+       [ -s "$key_file" ] && dropbearkey -y -f "$key_file" > /dev/null 2>&1 && 
return
 
        rm -f $key_file > /dev/null 2>&1
 
-- 
2.30.2


_______________________________________________
ptxdist mailing list
[email protected]
To unsubscribe, send a mail with subject "unsubscribe" to 
[email protected]

Reply via email to