OpenSource CLI-App to install and handle stuff related to Web-Server
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

58 lines
1.2 KiB

4 years ago
  1. <?php
  2. namespace App\Commands;
  3. use Illuminate\Console\Scheduling\Schedule;
  4. use LaravelZero\Framework\Commands\Command;
  5. use Illuminate\Support\Facades\File;
  6. use App\Facades\Install;
  7. use Log;
  8. class InstallUfwCommand extends Command
  9. {
  10. /**
  11. * The signature of the command.
  12. *
  13. * @var string
  14. */
  15. protected $signature = 'install:nginx';
  16. /**
  17. * The description of the command.
  18. *
  19. * @var string
  20. */
  21. protected $description = 'Install mariadb and set configuration';
  22. /**
  23. * Execute the console command.
  24. *
  25. * @return mixed
  26. */
  27. public function handle()
  28. {
  29. $this->line('Install ufw...');
  30. exec('apt update 2>&1');
  31. exec('apt install -y ufw 2>&1');
  32. exec('ufw allow ssh');
  33. exec('ufw allow "Nginx Full"');
  34. exec('ufw allow "OpenSSH"');
  35. // starting
  36. exec('service ufw start');
  37. exec('echo "y" | ufw enable');
  38. if (Install::isReady('ufw')) {
  39. $status = "Install ufw...success";
  40. $this->info($status);
  41. Log::info($status);
  42. } else {
  43. $this->error('Install ufw...failed');
  44. }
  45. }
  46. }