|
@ -10,21 +10,26 @@ use App\Facades\Install; |
|
|
|
|
|
|
|
|
use Log; |
|
|
use Log; |
|
|
|
|
|
|
|
|
class InstallUfwCommand extends Command |
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* |
|
|
|
|
|
* |
|
|
|
|
|
* |
|
|
|
|
|
*/ |
|
|
|
|
|
class Fail2banCommand extends Command |
|
|
{ |
|
|
{ |
|
|
/** |
|
|
/** |
|
|
* The signature of the command. |
|
|
* The signature of the command. |
|
|
* |
|
|
* |
|
|
* @var string |
|
|
* @var string |
|
|
*/ |
|
|
*/ |
|
|
protected $signature = 'install:nginx'; |
|
|
|
|
|
|
|
|
protected $signature = 'fail2ban {--add} {--remove} {configuration}'; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* The description of the command. |
|
|
* The description of the command. |
|
|
* |
|
|
* |
|
|
* @var string |
|
|
* @var string |
|
|
*/ |
|
|
*/ |
|
|
protected $description = 'Install mariadb and set configuration'; |
|
|
|
|
|
|
|
|
protected $description = 'add and remove configuration'; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* Execute the console command. |
|
|
* Execute the console command. |
|
@ -33,24 +38,14 @@ class InstallUfwCommand extends Command |
|
|
*/ |
|
|
*/ |
|
|
public function handle() |
|
|
public function handle() |
|
|
{ |
|
|
{ |
|
|
$this->line('Install ufw...'); |
|
|
|
|
|
|
|
|
$this->line('kk'); |
|
|
|
|
|
|
|
|
exec('apt update 2>&1'); |
|
|
|
|
|
exec('apt install -y ufw 2>&1'); |
|
|
|
|
|
|
|
|
|
|
|
exec('ufw allow ssh'); |
|
|
|
|
|
|
|
|
|
|
|
// starting
|
|
|
|
|
|
exec('service ufw start'); |
|
|
|
|
|
exec('echo "y" | ufw enable'); |
|
|
|
|
|
|
|
|
|
|
|
if (Install::isReady('ufw')) { |
|
|
|
|
|
$status = "Install ufw...success"; |
|
|
|
|
|
|
|
|
|
|
|
$this->info($status); |
|
|
|
|
|
Log::info($status); |
|
|
|
|
|
|
|
|
if ($configuration) { |
|
|
|
|
|
$this->error('Configuration...not found!'); |
|
|
} else { |
|
|
} else { |
|
|
$this->error('Install ufw...failed'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
exec('service fail2ban restart'); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |