diff --git a/app/Commands/Fail2banDisableCommand.php b/app/Commands/Fail2banDisableCommand.php index 5d79259..38219af 100644 --- a/app/Commands/Fail2banDisableCommand.php +++ b/app/Commands/Fail2banDisableCommand.php @@ -9,7 +9,10 @@ use LaravelZero\Framework\Commands\Command; * Disable Fail2ban Configuration * * - * + * @author Björn Hase, Tentakelfabrik + * @license http://opensource.org/licenses/MIT The MIT License + * @link https://gitea.tentakelfabrik.de/Tentakelfabrik/mcp + * */ class Fail2banDisableCommand extends Command { diff --git a/app/Commands/Fail2banEnableCommand.php b/app/Commands/Fail2banEnableCommand.php index 074a5e3..5f11c80 100644 --- a/app/Commands/Fail2banEnableCommand.php +++ b/app/Commands/Fail2banEnableCommand.php @@ -9,7 +9,10 @@ use LaravelZero\Framework\Commands\Command; * Enable Fail2ban Configuration * * - * + * @author Björn Hase, Tentakelfabrik + * @license http://opensource.org/licenses/MIT The MIT License + * @link https://gitea.tentakelfabrik.de/Tentakelfabrik/mcp + * */ class Fail2banEnableCommand extends Command { @@ -61,7 +64,7 @@ class Fail2banEnableCommand extends Command copy($source, $destination); exec('service fail2ban restart'); - + $this->info('Fail2ban...'.$configuration.' enabled'); } } diff --git a/app/Commands/LetsEncryptAddCommand.php b/app/Commands/LetsEncryptAddCommand.php index 552dcc1..9870baf 100644 --- a/app/Commands/LetsEncryptAddCommand.php +++ b/app/Commands/LetsEncryptAddCommand.php @@ -9,7 +9,10 @@ use LaravelZero\Framework\Commands\Command; * Add LetsEncrypt Certificate * * - * + * @author Björn Hase, Tentakelfabrik + * @license http://opensource.org/licenses/MIT The MIT License + * @link https://gitea.tentakelfabrik.de/Tentakelfabrik/mcp + * */ class LetsEncryptAddCommand extends Command { diff --git a/app/Commands/LetsEncryptInstallCommand.php b/app/Commands/LetsEncryptInstallCommand.php index 998de0e..44e376d 100644 --- a/app/Commands/LetsEncryptInstallCommand.php +++ b/app/Commands/LetsEncryptInstallCommand.php @@ -5,9 +5,14 @@ namespace App\Commands; use Illuminate\Console\Scheduling\Schedule; use LaravelZero\Framework\Commands\Command; +use App\Facades\Install; + /** + * Install LetsEncrypt * - * + * @author Björn Hase, Tentakelfabrik + * @license http://opensource.org/licenses/MIT The MIT License + * @link https://gitea.tentakelfabrik.de/Tentakelfabrik/mcp * */ class LetsEncryptInstallCommand extends Command @@ -35,12 +40,15 @@ class LetsEncryptInstallCommand extends Command { $this->info('LetsEncrypt installing...'); - exec('apt update 2>&1'); - exec('apt-get install software-properties-common 2>&1'); - exec('add-apt-repository universe 2>&1'); - exec('add-apt-repository ppa:certbot/certbot 2>&1'); - exec('apt-get update 2>&1'); - exec('apt-get install certbot python3-certbot-nginx 2>&1'); + exec('apt update 2>&1', $output); + exec('apt-get install software-properties-common 2>&1', $output); + exec('add-apt-repository universe 2>&1', $output); + exec('add-apt-repository ppa:certbot/certbot 2>&1', $output); + exec('apt-get update 2>&1', $output); + exec('apt-get install certbot python3-certbot-nginx 2>&1', $output); + + // @TODO apt add a Warning for no good, in a later version output will be scanned for helpfull infos + $this->line(implode("\n", Install::filterAptMessages($output))); if (Install::isReady('certbot')) { $this->info('LetsEncrypt installing...Success! \o/'); diff --git a/app/Commands/NodejsInstallCommand.php b/app/Commands/NodejsInstallCommand.php index 427496d..428ab36 100644 --- a/app/Commands/NodejsInstallCommand.php +++ b/app/Commands/NodejsInstallCommand.php @@ -8,8 +8,11 @@ use LaravelZero\Framework\Commands\Command; use App\Facades\Install; /** + * Install Nodejs * - * + * @author Björn Hase, Tentakelfabrik + * @license http://opensource.org/licenses/MIT The MIT License + * @link https://gitea.tentakelfabrik.de/Tentakelfabrik/mcp * */ class NodejsInstallCommand extends Command diff --git a/app/Helpers/InstallHelper.php b/app/Helpers/InstallHelper.php index 3926b69..56309ef 100644 --- a/app/Helpers/InstallHelper.php +++ b/app/Helpers/InstallHelper.php @@ -3,9 +3,12 @@ namespace App\Helpers; /** + * Helper for install * + * @author Björn Hase, Tentakelfabrik + * @license http://opensource.org/licenses/MIT The MIT License + * @link https://gitea.tentakelfabrik.de/Tentakelfabrik/mcp * - * */ class InstallHelper { diff --git a/app/Helpers/NginxTemplateHelper.php b/app/Helpers/NginxTemplateHelper.php index 1c55f49..d7d9b7e 100644 --- a/app/Helpers/NginxTemplateHelper.php +++ b/app/Helpers/NginxTemplateHelper.php @@ -3,7 +3,8 @@ namespace App\Helpers; /** - * + * handle Templates for nginx + * * * @author Björn Hase, Tentakelfabrik * @license http://opensource.org/licenses/MIT The MIT License @@ -62,7 +63,7 @@ class NginxTemplateHelper } /** - * find templates + * find templates * * @return array * diff --git a/app/Helpers/NginxVhostHelper.php b/app/Helpers/NginxVhostHelper.php index 910f86b..cedf38f 100644 --- a/app/Helpers/NginxVhostHelper.php +++ b/app/Helpers/NginxVhostHelper.php @@ -3,9 +3,11 @@ namespace App\Helpers; /** + * hande nginx vhosts * - * - * + * @author Björn Hase, Tentakelfabrik + * @license http://opensource.org/licenses/MIT The MIT License + * @link https://gitea.tentakelfabrik.de/Tentakelfabrik/mcp * */ class NginxVhostHelper @@ -26,7 +28,7 @@ class NginxVhostHelper ]; /** - * + * get sites that are in sites-available * * * @return array @@ -38,7 +40,7 @@ class NginxVhostHelper } /** - * + * get sites that are in sites-enabled * * * @return array @@ -56,6 +58,8 @@ class NginxVhostHelper * ssl_certificate /etc/letsencrypt/live//fullchain.pem; * ssl_certificate_key /etc/letsencrypt/live//privkey.pem; * + * @param string $filename + * */ private function getCertificate($path) { @@ -72,7 +76,7 @@ class NginxVhostHelper preg_match(self::REGEX_SSL_CERTIFICATE, $content, $matches); preg_match(self::REGEX_SSL_CERTIFICATE_KEY, $content, $matches); - // check for ssl certificates + // check ssl certificates if (count($matches) >= 2) { $result['ssl'] = true; @@ -80,6 +84,7 @@ class NginxVhostHelper $result['ssl_certificate_exists'] = true; } + // getting expired exec('openssl x509 -noout -dates -in '.$path, $openssl); if (isset($openssl[1])) { @@ -91,6 +96,13 @@ class NginxVhostHelper return $result; } + /** + * get vhost + * + * @param string $filename + * @param array $enabled + * @return array + */ private function getVhost($filename, $enabled) { // getting full path @@ -109,6 +121,12 @@ class NginxVhostHelper return $result; } + /** + * find single vhost by filename + * + * @param string $filename + * @return array + */ public function findOneByFilename($filename) { // getting enabled @@ -117,8 +135,9 @@ class NginxVhostHelper } /** - * getting vhosts + * find all vhost * + * @return array */ public function find() { diff --git a/app/Helpers/TerminalHelper.php b/app/Helpers/TerminalHelper.php index fd7bb21..3d618a1 100644 --- a/app/Helpers/TerminalHelper.php +++ b/app/Helpers/TerminalHelper.php @@ -3,18 +3,22 @@ namespace App\Helpers; /** + * Helper for Terminal * - * + * @author Björn Hase, Tentakelfabrik + * @license http://opensource.org/licenses/MIT The MIT License + * @link https://gitea.tentakelfabrik.de/Tentakelfabrik/mcp * */ class TerminalHelper { /** + * show array and create for each confirm + * + * @param object $menu + * @param array $messages + * @param string $text * - * @param [type] $menu [description] - * @param [type] $messages [description] - * @param string $text [description] - * @return [type] [description] */ public function confirmArray($menu, $messages, $text = 'Ok', $field = NULL) {