protected function generateSSHKey()
{
$key = tempnam(storage_path('app/tmp/'), 'sshkey');
unlink($key);
$process = new Process('tools.GenerateSSHKey', ['key_file' => $key]);
$process->run();
if (!$process->isSuccessful()) {
throw new \RuntimeException($process->getErrorOutput());
}
$this->attributes['private_key'] = file_get_contents($key);
$this->attributes['public_key'] = file_get_contents($key . '.pub');
unlink($key);
unlink($key . '.pub');
}