Skip to content

Commit

Permalink
Server: Autogen ssh key if none detected
Browse files Browse the repository at this point in the history
  • Loading branch information
stephendade committed Jan 7, 2025
1 parent 3fdf9e8 commit 2fbee87
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions server/cloudUpload.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,12 @@ class cloudUpload {
}
})
}
// if pubKey is empty, create a new default ssh key
if (pubkey.length === 0) {
winston.info('No SSH keys found, creating new one')
execSync('< /dev/zero ssh-keygen -q -N ""')
pubkey.push(fs.readFileSync(os.homedir() + '/.ssh/id_rsa.pub', { encoding: 'utf8', flag: 'r' }))
}
return callback(this.options.doBinUpload,
this.options.binUploadLink, this.options.syncDeletions, pubkey)
}
Expand Down

0 comments on commit 2fbee87

Please sign in to comment.