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.
PHP coolifydatabasesdeploymentdockerdocker-composeinertiajslaravelmariadbmysqlnextjsnodejsphppostgresredisself-hostedself-hostingserverstatic-sitesveltesvelte5
Fix: Encrypt private SSH keys in the DB
peaklabs-dev3aee8e030e61
diff --git a/app/Models/PrivateKey.php b/app/Models/PrivateKey.phpindex b047af6bb1..7cb58657c7 100644--- a/app/Models/PrivateKey.php+++ b/app/Models/PrivateKey.php@@ -32,6 +32,10 @@ class PrivateKey extends BaseModel'team_id',];+ protected $casts = [+ 'private_key' => 'encrypted',+ ];+protected static function booted(){static::saving(function ($key) {diff --git a/database/migrations/2024_09_16_111428_encrypt_existing_private_keys.php b/database/migrations/2024_09_16_111428_encrypt_existing_private_keys.phpnew file mode 100644index 0000000000..e2297cf375--- /dev/null+++ b/database/migrations/2024_09_16_111428_encrypt_existing_private_keys.php@@ -0,0 +1,19 @@+<?php++use Illuminate\Database\Migrations\Migration;+use Illuminate\Support\Facades\DB;+use Illuminate\Support\Facades\Crypt;++class EncryptExistingPrivateKeys extends Migration+{+ public function up()+ {+ DB::table('private_keys')->chunkById(100, function ($keys) {+ foreach ($keys as $key) {+ DB::table('private_keys')+ ->where('id', $key->id)+ ->update(['private_key' => Crypt::encryptString($key->private_key)]);+ }+ });+ }+}