mirror of
https://github.com/openwrt/packages.git
synced 2025-12-21 19:14:30 +04:00
openssh: Validate keys and regenerate if needed.
Imitate dropbear init.d-script and make sure we don't end up with corrupt keys. This can happen if we use a caching filesystem, like 'ubifs', and the DUT is powered off during boot-up. Signed-off-by: Markus Gothe <markus.gothe@genexis.eu>
This commit is contained in:
committed by
Michael Heimpold
parent
3ac8092a39
commit
69c29a5b26
@@ -12,6 +12,13 @@ start_service() {
|
|||||||
do
|
do
|
||||||
# check for keys
|
# check for keys
|
||||||
key=/etc/ssh/ssh_host_${type}_key
|
key=/etc/ssh/ssh_host_${type}_key
|
||||||
|
[ -f $key ] && {
|
||||||
|
[ -x /usr/bin/ssh-keygen ] && {
|
||||||
|
if ! /usr/bin/ssh-keygen -y -f $key > /dev/null 2>&1; then
|
||||||
|
rm -rf $key
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
}
|
||||||
[ ! -f $key ] && {
|
[ ! -f $key ] && {
|
||||||
# generate missing keys
|
# generate missing keys
|
||||||
[ -x /usr/bin/ssh-keygen ] && {
|
[ -x /usr/bin/ssh-keygen ] && {
|
||||||
|
|||||||
Reference in New Issue
Block a user