|
|
@ -10,21 +10,26 @@ use App\Facades\Install; |
|
|
|
|
|
|
|
use Log; |
|
|
|
|
|
|
|
class InstallUfwCommand extends Command |
|
|
|
/** |
|
|
|
* |
|
|
|
* |
|
|
|
* |
|
|
|
*/ |
|
|
|
class Fail2banCommand extends Command |
|
|
|
{ |
|
|
|
/** |
|
|
|
* The signature of the command. |
|
|
|
* |
|
|
|
* @var string |
|
|
|
*/ |
|
|
|
protected $signature = 'install:nginx'; |
|
|
|
protected $signature = 'fail2ban {--add} {--remove} {configuration}'; |
|
|
|
|
|
|
|
/** |
|
|
|
* The description of the command. |
|
|
|
* |
|
|
|
* @var string |
|
|
|
*/ |
|
|
|
protected $description = 'Install mariadb and set configuration'; |
|
|
|
protected $description = 'add and remove configuration'; |
|
|
|
|
|
|
|
/** |
|
|
|
* Execute the console command. |
|
|
@ -33,24 +38,14 @@ class InstallUfwCommand extends Command |
|
|
|
*/ |
|
|
|
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 { |
|
|
|
$this->error('Install ufw...failed'); |
|
|
|
|
|
|
|
|
|
|
|
exec('service fail2ban restart'); |
|
|
|
} |
|
|
|
} |
|
|
|
} |