diff --git a/app/Actions/SSL/CreateSSL.php b/app/Actions/SSL/CreateSSL.php
index 15f771b..3835659 100644
--- a/app/Actions/SSL/CreateSSL.php
+++ b/app/Actions/SSL/CreateSSL.php
@@ -24,7 +24,7 @@ public function create(Site $site, array $input): void
'type' => $input['type'],
'certificate' => $input['certificate'] ?? null,
'pk' => $input['private'] ?? null,
- 'expires_at' => $input['type'] === SslType::LETSENCRYPT ? now()->addMonths(3) : null,
+ 'expires_at' => $input['type'] === SslType::LETSENCRYPT ? now()->addMonths(3) : $input['expires_at'],
'status' => SslStatus::CREATING,
]);
$ssl->save();
@@ -53,6 +53,7 @@ protected function validate(array $input): void
if (isset($input['type']) && $input['type'] == SslType::CUSTOM) {
$rules['certificate'] = 'required';
$rules['private'] = 'required';
+ $rules['expires_at'] = 'required|date_format:Y-m-d|after_or_equal:'.now();
}
Validator::make($input, $rules)->validate();
diff --git a/app/SSH/Services/Webserver/scripts/nginx/create-custom-ssl.sh b/app/SSH/Services/Webserver/scripts/nginx/create-custom-ssl.sh
index aaa44fa..fb2a156 100644
--- a/app/SSH/Services/Webserver/scripts/nginx/create-custom-ssl.sh
+++ b/app/SSH/Services/Webserver/scripts/nginx/create-custom-ssl.sh
@@ -1,12 +1,12 @@
-if ! sudo mkdir __path__; then
+if ! sudo mkdir -p __path__; then
echo 'VITO_SSH_ERROR' && exit 1
fi
-if ! echo __certificate__ | sudo tee __certificate_path__; then
+if ! echo "__certificate__" | sudo tee __certificate_path__; then
echo 'VITO_SSH_ERROR' && exit 1
fi
-if ! echo __pk__ | sudo tee __pk_path__; then
+if ! echo "__pk__" | sudo tee __pk_path__; then
echo 'VITO_SSH_ERROR' && exit 1
fi
diff --git a/resources/views/ssls/partials/create-ssl.blade.php b/resources/views/ssls/partials/create-ssl.blade.php
index 4c57f87..82e5585 100644
--- a/resources/views/ssls/partials/create-ssl.blade.php
+++ b/resources/views/ssls/partials/create-ssl.blade.php
@@ -42,7 +42,9 @@ class="p-6"
type="text"
class="mt-1 w-full"
rows="5"
- />
+ >
+ {{ old("certificate") }}
+
@error("certificate")