Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

fix(ssl): use mountPath parameter not a hardcoded path

peaklabs-dev80fc7c7b97fa
diff --git a/app/Actions/Database/StartPostgresql.php b/app/Actions/Database/StartPostgresql.php
index 29780f1642..9ce953491a 100644
--- a/app/Actions/Database/StartPostgresql.php
+++ b/app/Actions/Database/StartPostgresql.php
@@ -79,6 +79,7 @@ class StartPostgresql
caCert: $caCert->ssl_certificate,
caKey: $caCert->ssl_private_key,
configurationDir: $this->configuration_dir,
+ mountPath: '/var/lib/postgresql/certs',
);
}
}
diff --git a/app/Helpers/SslHelper.php b/app/Helpers/SslHelper.php
index 960c90a1bc..b410cb4f82 100644
--- a/app/Helpers/SslHelper.php
+++ b/app/Helpers/SslHelper.php
@@ -24,7 +24,8 @@ class SslHelper
?string $caCert = null,
?string $caKey = null,
bool $isCaCertificate = false,
- ?string $configurationDir = null
+ ?string $configurationDir = null,
+ ?string $mountPath = null
): SslCertificate {
try {
@@ -115,17 +116,17 @@ class SslHelper
'subject_alternative_names' => $subjectAlternativeNames,
]);
- if ($configurationDir && $resourceType && $resourceId) {
+ if ($configurationDir && $mountPath && $resourceType && $resourceId) {
$model = app($resourceType)->find($resourceId);
$model->fileStorages()
->where('resource_type', $model->getMorphClass())
->where('resource_id', $model->id)
->get()
- ->filter(function ($storage) {
+ ->filter(function ($storage) use ($mountPath) {
return in_array($storage->mount_path, [
- '/var/lib/postgresql/certs/server.crt',
- '/var/lib/postgresql/certs/server.key',
+ $mountPath.'/server.crt',
+ $mountPath.'/server.key',
]);
})
->each(function ($storage) {
@@ -134,7 +135,7 @@ class SslHelper
$model->fileStorages()->create([
'fs_path' => $configurationDir.'/ssl/server.crt',
- 'mount_path' => '/var/lib/postgresql/certs/server.crt',
+ 'mount_path' => $mountPath.'/server.crt',
'content' => $certificateStr,
'is_directory' => false,
'chmod' => '644',
@@ -144,7 +145,7 @@ class SslHelper
$model->fileStorages()->create([
'fs_path' => $configurationDir.'/ssl/server.key',
- 'mount_path' => '/var/lib/postgresql/certs/server.key',
+ 'mount_path' => $mountPath.'/server.key',
'content' => $privateKeyStr,
'is_directory' => false,
'chmod' => '600',