54 lines
1.5 KiB
PHP
54 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class Fail2banSetting extends Model
|
|
{
|
|
protected $table = 'fail2ban_settings';
|
|
|
|
protected $fillable = [
|
|
'bantime','max_bantime','bantime_increment','bantime_factor',
|
|
'max_retry','findtime','cidr_v4','cidr_v6','external_mode',
|
|
];
|
|
|
|
protected $casts = [
|
|
'bantime' => 'integer',
|
|
'max_bantime' => 'integer',
|
|
'bantime_increment' => 'boolean',
|
|
'bantime_factor' => 'float',
|
|
'max_retry' => 'integer',
|
|
'findtime' => 'integer',
|
|
'cidr_v4' => 'integer',
|
|
'cidr_v6' => 'integer',
|
|
'external_mode' => 'boolean',
|
|
];
|
|
|
|
// /**
|
|
// * Gibt die erste Konfiguration oder Default-Werte zurück.
|
|
// */
|
|
// public static function current(): self
|
|
// {
|
|
// return static::first() ?? new static([
|
|
// 'bantime' => 3600,
|
|
// 'max_bantime' => 43200,
|
|
// 'bantime_increment' => true,
|
|
// 'bantime_factor' => 1.5,
|
|
// 'max_retry' => 5,
|
|
// 'findtime' => 600,
|
|
// 'cidr_v4' => 32,
|
|
// 'cidr_v6' => 128,
|
|
// 'external_mode' => false,
|
|
// ]);
|
|
// }
|
|
|
|
/**
|
|
* Konvertiert bool zu "true"/"false" (für Config-Dateien).
|
|
*/
|
|
public function boolToString(bool $val): string
|
|
{
|
|
return $val ? 'true' : 'false';
|
|
}
|
|
}
|