Archived
1
0

SSH server & endpoint

This commit is contained in:
Will O'Beirne
2020-03-16 13:02:33 -05:00
committed by Asher
parent 5f63d2b822
commit 3463d56114
10 changed files with 526 additions and 8 deletions

View File

@ -44,6 +44,12 @@ export const generateCertificate = async (): Promise<{ cert: string; certKey: st
return paths
}
export const generateSshHostKey = async (): Promise<string> => {
// Just reuse the SSL cert as the SSH host key
const { certKey } = await generateCertificate()
return certKey
}
export const generatePassword = async (length = 24): Promise<string> => {
const buffer = Buffer.alloc(Math.ceil(length / 2))
await util.promisify(crypto.randomFill)(buffer)