<?php
|
|
|
|
namespace App\Commands;
|
|
|
|
use Illuminate\Console\Scheduling\Schedule;
|
|
use LaravelZero\Framework\Commands\Command;
|
|
use Illuminate\Support\Facades\File;
|
|
|
|
use App\Facades\Install;
|
|
|
|
use Log;
|
|
|
|
class InstallUfwCommand extends Command
|
|
{
|
|
/**
|
|
* The signature of the command.
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $signature = 'install:nginx';
|
|
|
|
/**
|
|
* The description of the command.
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $description = 'Install mariadb and set configuration';
|
|
|
|
/**
|
|
* Execute the console command.
|
|
*
|
|
* @return mixed
|
|
*/
|
|
public function handle()
|
|
{
|
|
$this->line('Install ufw...');
|
|
|
|
exec('apt update 2>&1');
|
|
exec('apt install -y ufw 2>&1');
|
|
|
|
exec('ufw allow ssh');
|
|
exec('ufw allow "Nginx Full"');
|
|
exec('ufw allow "OpenSSH"');
|
|
|
|
// starting
|
|
exec('service ufw start');
|
|
exec('echo "y" | ufw enable');
|
|
|
|
if (Install::isReady('ufw')) {
|
|
$status = "Install ufw...success";
|
|
|
|
$this->info($status);
|
|
Log::info($status);
|
|
} else {
|
|
$this->error('Install ufw...failed');
|
|
}
|
|
}
|
|
}
|