REBELinBLUE\Deployer\Project::regeneratePublicKey PHP Method

regeneratePublicKey() protected method

Generates an SSH key and sets the private/public key properties.
protected regeneratePublicKey ( )
    protected function regeneratePublicKey()
    {
        $key = tempnam(storage_path('app/tmp/'), 'sshkey');
        file_put_contents($key, $this->private_key);
        chmod($key, 0600);
        $process = new Process('tools.RegeneratePublicSSHKey', ['key_file' => $key]);
        $process->run();
        if (!$process->isSuccessful()) {
            throw new \RuntimeException($process->getErrorOutput());
        }
        $this->attributes['public_key'] = file_get_contents($key . '.pub');
        unlink($key);
        unlink($key . '.pub');
    }