diff --git a/app/Commands/NginxCertsCommand.php b/app/Commands/Certs.php similarity index 100% rename from app/Commands/NginxCertsCommand.php rename to app/Commands/Certs.php diff --git a/app/Commands/LetsEncryptInstallCommand.php b/app/Commands/CertsInstallCommand.php similarity index 96% rename from app/Commands/LetsEncryptInstallCommand.php rename to app/Commands/CertsInstallCommand.php index 2f855d9..42c3059 100644 --- a/app/Commands/LetsEncryptInstallCommand.php +++ b/app/Commands/CertsInstallCommand.php @@ -42,7 +42,7 @@ class LetsEncryptInstallCommand extends Command exec('apt-get update 2>&1'); exec('apt-get install certbot python3-certbot-nginx 2>&1'); - if (Install::isReady('nginx')) { + if (Install::isReady('certbot')) { // get status of nginx exec('nginx -v 2>&1', $output); diff --git a/app/Commands/Fail2banCommand.php b/app/Commands/Fail2banCommand.php index df2c704..1a42e9d 100644 --- a/app/Commands/Fail2banCommand.php +++ b/app/Commands/Fail2banCommand.php @@ -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'); } } } diff --git a/app/Commands/InstallUfwCommand.php b/app/Commands/InstallUfwCommand.php deleted file mode 100644 index df2c704..0000000 --- a/app/Commands/InstallUfwCommand.php +++ /dev/null @@ -1,56 +0,0 @@ -line('Install ufw...'); - - 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); - } else { - $this->error('Install ufw...failed'); - } - } -} diff --git a/app/Commands/InstallMariadbCommand.php b/app/Commands/MariadbInstallCommand.php similarity index 93% rename from app/Commands/InstallMariadbCommand.php rename to app/Commands/MariadbInstallCommand.php index d03ce6a..3e696d5 100644 --- a/app/Commands/InstallMariadbCommand.php +++ b/app/Commands/MariadbInstallCommand.php @@ -10,14 +10,14 @@ use App\Facades\Install; use Log; -class InstallMariadbCommand extends Command +class MariadbInstallCommand extends Command { /** * The signature of the command. * * @var string */ - protected $signature = 'install:nginx'; + protected $signature = 'mariadb:install'; /** * The description of the command. diff --git a/app/Commands/InstallPhpFpmCommand.php b/app/Commands/PhpFpmInstallCommand.php similarity index 96% rename from app/Commands/InstallPhpFpmCommand.php rename to app/Commands/PhpFpmInstallCommand.php index 4c81842..a0e1049 100644 --- a/app/Commands/InstallPhpFpmCommand.php +++ b/app/Commands/PhpFpmInstallCommand.php @@ -17,7 +17,7 @@ class InstallPhpFpmCommand extends Command * * @var string */ - protected $signature = 'install:php-fpm'; + protected $signature = 'php-fpm:install'; /** * The description of the command.