Initial Ladill Hosting app with Gitea deploy pipeline.
Deploy Ladill Hosting / deploy (push) Failing after 17s
Deploy Ladill Hosting / deploy (push) Failing after 17s
Shared web hosting extracted from the platform monolith, with CI deploy to /var/www/ladill-hosting matching Bird/Domains/Email. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\Infrastructure;
|
||||
|
||||
class ContaboInfrastructureSshKeyService
|
||||
{
|
||||
/**
|
||||
* @return array{public_key: string, private_key: string}
|
||||
*/
|
||||
public function generate(): array
|
||||
{
|
||||
$resource = openssl_pkey_new([
|
||||
'private_key_bits' => 4096,
|
||||
'private_key_type' => OPENSSL_KEYTYPE_RSA,
|
||||
]);
|
||||
|
||||
if ($resource === false) {
|
||||
throw new \RuntimeException('Failed to generate SSH key pair.');
|
||||
}
|
||||
|
||||
openssl_pkey_export($resource, $privateKey);
|
||||
$details = openssl_pkey_get_details($resource);
|
||||
$publicKey = $details['key'] ?? '';
|
||||
|
||||
if ($publicKey === '') {
|
||||
throw new \RuntimeException('Failed to export SSH public key.');
|
||||
}
|
||||
|
||||
return [
|
||||
'public_key' => trim($publicKey)."\n",
|
||||
'private_key' => $privateKey,
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user