Compare commits

..

30 commits

Author SHA1 Message Date
Vincent BRIDIER
5a3111dd13
Merge branch 'trunk' 2022-09-26 07:43:27 +02:00
Vincent BRIDIER
2937f36217
Merge branch 'develop' into trunk 2022-09-26 07:43:17 +02:00
Vincent BRIDIER
3628312002
Merge branch 'trunk' 2022-09-22 13:56:56 +02:00
Vincent BRIDIER
51cfb3d8b4
Merge branch 'develop' into trunk 2022-09-22 13:56:45 +02:00
Vincent BRIDIER
8283e91ece
Merge branch 'trunk' 2022-09-22 12:50:23 +02:00
Vincent BRIDIER
d83956029d
Merge branch 'develop' into trunk 2022-09-22 12:50:10 +02:00
Vincent BRIDIER
3a75f1ca28
Merge branch 'trunk' 2022-09-21 15:54:27 +02:00
Vincent BRIDIER
f1c5c5ba41
Merge branch 'develop' into trunk 2022-09-21 15:54:15 +02:00
Vincent BRIDIER
09d3033b86
Merge branch 'trunk' 2022-09-21 13:19:02 +02:00
Vincent BRIDIER
82b004113e
Merge branch 'develop' into trunk 2022-09-21 13:18:37 +02:00
Vincent BRIDIER
29558da930
Merge branch 'trunk' 2022-04-29 16:06:10 +02:00
Vincent BRIDIER
4469be3b12
Merge branch 'develop' into trunk 2022-04-29 16:05:49 +02:00
Vincent BRIDIER
07906acd2b
Merge branch 'trunk' 2022-04-27 17:31:17 +02:00
Vincent BRIDIER
4e4e36500d
Merge branch 'develop' into trunk 2022-04-27 17:30:51 +02:00
Vincent BRIDIER
a73e05cc62 Merge branch 'develop' into 'trunk'
Ticket 631: refactorisation de projects formulaire + ajout des valeurs old en...

See merge request service-web-lab/ldc-web!1
2022-04-27 14:06:29 +00:00
Vincent BRIDIER
c0b99a822c Merge branch 'trunk' 2022-01-24 07:59:56 +01:00
Vincent BRIDIER
594f946436 Merge branch 'develop' into trunk 2022-01-24 07:59:35 +01:00
Vincent BRIDIER
29327cfde8 Merge branch 'trunk' 2022-01-17 14:38:23 +01:00
Vincent BRIDIER
eb88dfb508 Merge branch 'develop' into trunk 2022-01-17 14:38:00 +01:00
Vincent BRIDIER
3917a2c55e Merge branch 'trunk' 2021-08-10 09:10:34 +02:00
Vincent BRIDIER
8d655e6eb2 Merge branch 'develop' into trunk 2021-08-10 09:10:13 +02:00
Vincent BRIDIER
3ba66da3e0 Merge branch 'trunk' 2021-08-04 11:55:55 +02:00
Vincent BRIDIER
66b936fb1c Merge branch 'develop' into trunk 2021-08-04 11:55:39 +02:00
Vincent BRIDIER
a4160b64c4 Merge branch 'trunk' 2021-08-04 09:53:53 +02:00
Vincent BRIDIER
a643cc5540 Merge branch 'develop' into trunk 2021-08-04 09:53:33 +02:00
Vincent BRIDIER
4b76902940 Merge branch 'trunk' 2021-08-04 09:48:39 +02:00
Vincent BRIDIER
85d36ee4ae Merge branch 'develop' into trunk 2021-08-04 09:48:21 +02:00
Vincent BRIDIER
6fb04f45ce Merge branch 'develop' into trunk 2021-08-04 09:47:06 +02:00
Vincent BRIDIER
7fd5ca8e52 Merge branch 'trunk' 2021-08-03 16:56:13 +02:00
Vincent BRIDIER
758f88fdee Merge branch 'develop' into trunk 2021-08-03 16:55:57 +02:00
7 changed files with 5 additions and 353 deletions

View file

@ -6,18 +6,6 @@ use Illuminate\Database\Eloquent\Model;
class LDCNetwork extends Model
{
/**
* The attributes that should be cast.
*
* @var array
*/
protected $casts = [
'cidr' => 'encrypted',
'first_ip' => 'encrypted',
'last_ip' => 'encrypted',
];
/**
* The table associated with the model.
*

View file

@ -18,35 +18,8 @@ class Project extends Model
* @var array
*/
protected $casts = [
'dev_login' => 'encrypted:array',
'prod_login' => 'encrypted:array',
'prod_document_root' => 'encrypted',
'dev_document_root' => 'encrypted',
'prod_unix_user' => 'encrypted',
'prod_unix_pwd' => 'encrypted',
'dev_unix_user' => 'encrypted',
'dev_unix_pwd' => 'encrypted',
'prod_db_user' => 'encrypted',
'prod_db_pwd' => 'encrypted',
'dev_db_user' => 'encrypted',
'dev_db_pwd' => 'encrypted',
'prod_db_schema' => 'encrypted',
'dev_db_schema' => 'encrypted',
'prod_comment' => 'encrypted',
'dev_comment' => 'encrypted',
'prod_eai' => 'encrypted',
'dev_eai' => 'encrypted',
'prod_whitelist_fw' => 'encrypted',
'dev_whitelist_fw' => 'encrypted',
'dev_htaccess_user' => 'encrypted',
'dev_htaccess_pwd' => 'encrypted',
'prod_ga_id' => 'encrypted',
'prod_laravel_app_key' => 'encrypted',
'dev_laravel_app_key' => 'encrypted',
'prod_smtp_config' => 'encrypted',
'prod_smtp_key' => 'encrypted',
'prod_haproxy_id' => 'encrypted',
'dev_haproxy_id' => 'encrypted',
'dev_login' => 'array',
'prod_login' => 'array',
'https' => 'boolean'
];

View file

@ -14,8 +14,7 @@ class ProjectStatusChecker extends Model
protected $casts = [
'code' => 'array',
'sitemap' => 'boolean',
'robots' => 'boolean',
'code' => 'encrypted'
'robots' => 'boolean'
];
/**

View file

@ -11,21 +11,6 @@ class Server extends Model
{
use CastsEnums;
/**
* The attributes that should be cast.
*
* @var array
*/
protected $casts = [
'virtual_ip' => 'encrypted',
'ssh' => 'encrypted',
'infraweb_ip' => 'encrypted',
'title' => 'encrypted',
'name' => 'encrypted',
'function' => 'encrypted',
'comment' => 'encrypted',
];
/**
* Map attribute names to enum classes.
*

View file

@ -6,17 +6,6 @@ use Illuminate\Database\Eloquent\Model;
class ServiceAccount extends Model
{
/**
* The attributes that should be cast.
*
* @var array
*/
protected $casts = [
'account' => 'encrypted',
'password' => 'encrypted',
'url' => 'encrypted',
];
/**
* The attributes that are mass assignable.
*

View file

@ -1,282 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Crypt;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Facades\DB;
class EncryptSensitiveData extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
// * Transform varchar 255 to text
Schema::table('projects', function (Blueprint $table) {
$table->text('prod_document_root')->change();
$table->text('dev_document_root')->change();
$table->text('prod_unix_user')->change();
$table->text('prod_unix_pwd')->change();
$table->text('dev_unix_user')->change();
$table->text('dev_unix_pwd')->change();
$table->text('prod_db_user')->change();
$table->text('prod_db_pwd')->change();
$table->text('dev_db_user')->change();
$table->text('dev_db_pwd')->change();
$table->text('prod_db_schema')->change();
$table->text('dev_db_schema')->change();
$table->text('prod_comment')->change();
$table->text('dev_comment')->change();
$table->text('prod_eai')->change();
$table->text('dev_eai')->change();
$table->text('prod_whitelist_fw')->change();
$table->text('dev_whitelist_fw')->change();
$table->text('dev_htaccess_user')->change();
$table->text('dev_htaccess_pwd')->change();
$table->text('prod_ga_id')->change();
$table->text('prod_laravel_app_key')->change();
$table->text('dev_laravel_app_key')->change();
$table->text('prod_smtp_config')->change();
$table->text('prod_smtp_key')->change();
$table->text('prod_haproxy_id')->change();
$table->text('dev_haproxy_id')->change();
});
Schema::table('servers', function (Blueprint $table) {
$table->text('virtual_ip')->change();
$table->text('ssh')->change();
$table->text('infraweb_ip')->change();
$table->text('title')->change();
$table->text('name')->change();
$table->text('function')->change();
$table->text('comment')->nullable()->change();
});
Schema::table('ldc_networks', function (Blueprint $table) {
$table->text('cidr')->change();
$table->text('first_ip')->change();
$table->text('last_ip')->change();
$table->timestamp('updated_at')->nullable()->default(null)->change();
});
Schema::table('service_accounts', function (Blueprint $table) {
$table->text('account')->change();
$table->text('password')->change();
$table->text('url')->change();
});
Schema::table('users', function (Blueprint $table) {
$table->text('totp_secret')->change();
});
// * encrypt columns
DB::table('projects')->get()->map(function (object $row) {
DB::table('projects')->where('id', $row->id)
->update([
'dev_login' => Crypt::encryptString($row->dev_login),
'prod_login' => Crypt::encryptString($row->prod_login),
'prod_document_root' => Crypt::encryptString($row->prod_document_root),
'dev_document_root' => Crypt::encryptString($row->dev_document_root),
'prod_unix_user' => Crypt::encryptString($row->prod_unix_user),
'prod_unix_pwd' => Crypt::encryptString($row->prod_unix_pwd),
'dev_unix_user' => Crypt::encryptString($row->dev_unix_user),
'dev_unix_pwd' => Crypt::encryptString($row->dev_unix_pwd),
'prod_db_user' => Crypt::encryptString($row->prod_db_user),
'prod_db_pwd' => Crypt::encryptString($row->prod_db_pwd),
'dev_db_user' => Crypt::encryptString($row->dev_db_user),
'dev_db_pwd' => Crypt::encryptString($row->dev_db_pwd),
'prod_db_schema' => Crypt::encryptString($row->prod_db_schema),
'dev_db_schema' => Crypt::encryptString($row->dev_db_schema),
'prod_comment' => Crypt::encryptString($row->prod_comment),
'dev_comment' => Crypt::encryptString($row->dev_comment),
'prod_eai' => Crypt::encryptString($row->prod_eai),
'dev_eai' => Crypt::encryptString($row->dev_eai),
'prod_whitelist_fw' => Crypt::encryptString($row->prod_whitelist_fw),
'dev_whitelist_fw' => Crypt::encryptString($row->dev_whitelist_fw),
'dev_htaccess_user' => Crypt::encryptString($row->dev_htaccess_user),
'dev_htaccess_pwd' => Crypt::encryptString($row->dev_htaccess_pwd),
'prod_ga_id' => Crypt::encryptString($row->prod_ga_id),
'prod_laravel_app_key' => Crypt::encryptString($row->prod_laravel_app_key),
'dev_laravel_app_key' => Crypt::encryptString($row->dev_laravel_app_key),
'prod_smtp_config' => Crypt::encryptString($row->prod_smtp_config),
'prod_smtp_key' => Crypt::encryptString($row->prod_smtp_key),
'prod_haproxy_id' => Crypt::encryptString($row->prod_haproxy_id),
'dev_haproxy_id' => Crypt::encryptString($row->dev_haproxy_id),
]);
});
DB::table('servers')->get()->map(function (object $row) {
DB::table('servers')->where('id', $row->id)
->update([
'virtual_ip' => Crypt::encryptString($row->virtual_ip),
'ssh' => Crypt::encryptString($row->ssh),
'infraweb_ip' => Crypt::encryptString($row->infraweb_ip),
'title' => Crypt::encryptString($row->title),
'name' => Crypt::encryptString($row->name),
'function' => Crypt::encryptString($row->function),
'comment' => Crypt::encryptString($row->comment),
]);
});
DB::table('ldc_networks')->get()->map(function (object $row) {
DB::table('ldc_networks')->where('id', $row->id)
->update([
'cidr' => Crypt::encryptString($row->cidr),
'first_ip' => Crypt::encryptString($row->first_ip),
'last_ip' => Crypt::encryptString($row->last_ip),
]);
});
DB::table('project_status_checkers')->get()->map(function (object $row) {
DB::table('project_status_checkers')->where('id', $row->id)
->update([
'code' => Crypt::encryptString($row->code)
]);
});
DB::table('service_accounts')->get()->map(function (object $row) {
DB::table('service_accounts')->where('id', $row->id)
->update([
'account' => Crypt::encryptString($row->account),
'password' => Crypt::encryptString($row->password),
'url' => Crypt::encryptString($row->url)
]);
});
DB::table('users')->get()->map(function (object $row) {
DB::table('users')->where('id', $row->id)
->update([
'totp_secret' => Crypt::encryptString($row->totp_secret),
]);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
// * decrypt columns
DB::table('projects')->get()->map(function (object $row) {
DB::table('projects')->where('id', $row->id)
->update([
'dev_login' => Crypt::decryptString($row->dev_login),
'prod_login' => Crypt::decryptString($row->prod_login),
'prod_document_root' => Crypt::decryptString($row->prod_document_root),
'dev_document_root' => Crypt::decryptString($row->dev_document_root),
'prod_unix_user' => Crypt::decryptString($row->prod_unix_user),
'prod_unix_pwd' => Crypt::decryptString($row->prod_unix_pwd),
'dev_unix_user' => Crypt::decryptString($row->dev_unix_user),
'dev_unix_pwd' => Crypt::decryptString($row->dev_unix_pwd),
'prod_db_user' => Crypt::decryptString($row->prod_db_user),
'prod_db_pwd' => Crypt::decryptString($row->prod_db_pwd),
'dev_db_user' => Crypt::decryptString($row->dev_db_user),
'dev_db_pwd' => Crypt::decryptString($row->dev_db_pwd),
'prod_db_schema' => Crypt::decryptString($row->prod_db_schema),
'dev_db_schema' => Crypt::decryptString($row->dev_db_schema),
'prod_comment' => Crypt::decryptString($row->prod_comment),
'dev_comment' => Crypt::decryptString($row->dev_comment),
'prod_eai' => Crypt::decryptString($row->prod_eai),
'dev_eai' => Crypt::decryptString($row->dev_eai),
'prod_whitelist_fw' => Crypt::decryptString($row->prod_whitelist_fw),
'dev_whitelist_fw' => Crypt::decryptString($row->dev_whitelist_fw),
'dev_htaccess_user' => Crypt::decryptString($row->dev_htaccess_user),
'dev_htaccess_pwd' => Crypt::decryptString($row->dev_htaccess_pwd),
'prod_ga_id' => Crypt::decryptString($row->prod_ga_id),
'prod_laravel_app_key' => Crypt::decryptString($row->prod_laravel_app_key),
'dev_laravel_app_key' => Crypt::decryptString($row->dev_laravel_app_key),
'prod_smtp_config' => Crypt::decryptString($row->prod_smtp_config),
'prod_smtp_key' => Crypt::decryptString($row->prod_smtp_key),
'prod_haproxy_id' => Crypt::decryptString($row->prod_haproxy_id),
'dev_haproxy_id' => Crypt::decryptString($row->dev_haproxy_id),
]);
});
DB::table('servers')->get()->map(function (object $row) {
DB::table('servers')->where('id', $row->id)
->update([
'virtual_ip' => Crypt::decryptString($row->virtual_ip),
'ssh' => Crypt::decryptString($row->ssh),
'infraweb_ip' => Crypt::decryptString($row->infraweb_ip),
'title' => Crypt::decryptString($row->title),
'name' => Crypt::decryptString($row->name),
'function' => Crypt::decryptString($row->function),
'comment' => Crypt::decryptString($row->comment),
]);
});
DB::table('ldc_networks')->get()->map(function (object $row) {
DB::table('ldc_networks')->where('id', $row->id)
->update([
'cidr' => Crypt::decryptString($row->cidr),
'first_ip' => Crypt::decryptString($row->first_ip),
'last_ip' => Crypt::decryptString($row->last_ip),
]);
});
DB::table('project_status_checkers')->get()->map(function (object $row) {
DB::table('project_status_checkers')->where('id', $row->id)
->update([
'code' => Crypt::decryptString($row->code)
]);
});
DB::table('service_accounts')->get()->map(function (object $row) {
DB::table('service_accounts')->where('id', $row->id)
->update([
'account' => Crypt::decryptString($row->account),
'password' => Crypt::decryptString($row->password),
'url' => Crypt::decryptString($row->url)
]);
});
DB::table('users')->get()->map(function (object $row) {
DB::table('users')->where('id', $row->id)
->update([
'totp_secret' => Crypt::decryptString($row->totp_secret),
]);
});
Schema::table('users', function (Blueprint $table) {
$table->string('totp_secret', 100)->change();
});
Schema::table('ldc_networks', function (Blueprint $table) {
$table->string('cidr', 50)->change();
$table->string('first_ip', 50)->change();
$table->string('last_ip', 50)->change();
});
Schema::table('projects', function (Blueprint $table) {
$table->string('prod_document_root')->change();
$table->string('dev_document_root')->change();
$table->string('prod_unix_user')->change();
$table->string('prod_unix_pwd')->change();
$table->string('dev_unix_user')->change();
$table->string('dev_unix_pwd')->change();
$table->string('prod_db_user')->change();
$table->string('prod_db_pwd')->change();
$table->string('dev_db_user')->change();
$table->string('dev_db_pwd')->change();
$table->string('prod_db_schema')->change();
$table->string('dev_db_schema')->change();
$table->string('prod_comment')->change();
$table->string('dev_comment')->change();
$table->string('prod_eai')->change();
$table->string('dev_eai')->change();
$table->string('prod_whitelist_fw')->change();
$table->string('dev_whitelist_fw')->change();
$table->string('dev_htaccess_user')->change();
$table->string('dev_htaccess_pwd')->change();
$table->string('prod_ga_id', 50)->change();
$table->string('prod_laravel_app_key')->change();
$table->string('dev_laravel_app_key')->change();
$table->string('prod_smtp_config')->change();
$table->string('prod_smtp_key')->change();
$table->string('prod_haproxy_id')->change();
$table->string('dev_haproxy_id')->change();
});
Schema::table('servers', function (Blueprint $table) {
$table->string('virtual_ip', 20)->change();
$table->string('ssh', 50)->change();
$table->string('infraweb_ip', 20)->change();
$table->string('title', 50)->change();
$table->string('name', 50)->change();
$table->string('function', 50)->change();
$table->string('comment')->nullable()->change();
});
Schema::table('service_accounts', function (Blueprint $table) {
$table->string('account')->change();
$table->string('password')->change();
$table->string('url')->change();
});
}
}

View file

@ -66,7 +66,7 @@
$data = [
'name' => 'dev_login',
'url' => $project->dev_bo_url ?? '',
'type' => $project->type->value ?? '',
'type' => $project->type ?? '',
'dataList' => json_decode(old('dev_login', json_encode(optional($project ?? null)->dev_login ?? [])))
];
@endphp
@ -78,7 +78,7 @@
$data = [
'name' => 'prod_login',
'url' => $project->prod_bo_url ?? '',
'type' => $project->type->value ?? '',
'type' => $project->type ?? '',
'dataList' => json_decode(old('prod_login', json_encode(optional($project ?? null)->prod_login ?? [])))
];
@endphp