Browse Source

adding

release/0.1
Björn 4 years ago
parent
commit
7c2bdf6968
6 changed files with 18 additions and 79 deletions
  1. +0
    -0
      app/Commands/Certs.php
  2. +1
    -1
      app/Commands/CertsInstallCommand.php
  3. +14
    -19
      app/Commands/Fail2banCommand.php
  4. +0
    -56
      app/Commands/InstallUfwCommand.php
  5. +2
    -2
      app/Commands/MariadbInstallCommand.php
  6. +1
    -1
      app/Commands/PhpFpmInstallCommand.php

app/Commands/NginxCertsCommand.php → app/Commands/Certs.php View File


app/Commands/LetsEncryptInstallCommand.php → app/Commands/CertsInstallCommand.php View File

@ -42,7 +42,7 @@ class LetsEncryptInstallCommand extends Command
exec('apt-get update 2>&1'); exec('apt-get update 2>&1');
exec('apt-get install certbot python3-certbot-nginx 2>&1'); exec('apt-get install certbot python3-certbot-nginx 2>&1');
if (Install::isReady('nginx')) {
if (Install::isReady('certbot')) {
// get status of nginx // get status of nginx
exec('nginx -v 2>&1', $output); exec('nginx -v 2>&1', $output);

+ 14
- 19
app/Commands/Fail2banCommand.php View File

@ -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');
} }
} }
} }

+ 0
- 56
app/Commands/InstallUfwCommand.php View File

@ -1,56 +0,0 @@
<?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');
// 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');
}
}
}

app/Commands/InstallMariadbCommand.php → app/Commands/MariadbInstallCommand.php View File

@ -10,14 +10,14 @@ use App\Facades\Install;
use Log; use Log;
class InstallMariadbCommand extends Command
class MariadbInstallCommand extends Command
{ {
/** /**
* The signature of the command. * The signature of the command.
* *
* @var string * @var string
*/ */
protected $signature = 'install:nginx';
protected $signature = 'mariadb:install';
/** /**
* The description of the command. * The description of the command.

app/Commands/InstallPhpFpmCommand.php → app/Commands/PhpFpmInstallCommand.php View File

@ -17,7 +17,7 @@ class InstallPhpFpmCommand extends Command
* *
* @var string * @var string
*/ */
protected $signature = 'install:php-fpm';
protected $signature = 'php-fpm:install';
/** /**
* The description of the command. * The description of the command.

Loading…
Cancel
Save