|
@ -40,18 +40,27 @@ class LetsEncryptAddCommand extends Command |
|
|
{ |
|
|
{ |
|
|
$domains = $this->argument('domain'); |
|
|
$domains = $this->argument('domain'); |
|
|
|
|
|
|
|
|
|
|
|
// adding flags
|
|
|
$domainFlags = ''; |
|
|
$domainFlags = ''; |
|
|
|
|
|
|
|
|
|
|
|
// add file for domain
|
|
|
|
|
|
$saved = []; |
|
|
|
|
|
|
|
|
|
|
|
// create flags
|
|
|
foreach($domains as $domain) { |
|
|
foreach($domains as $domain) { |
|
|
$domainFlags .= '-d '.$domain.' '; |
|
|
$domainFlags .= '-d '.$domain.' '; |
|
|
|
|
|
$saved[$domain] = '/etc/letsencrypt/live/'.$domain.'/fullchain.pem'; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
exec('certbot --non-interactive --agree-tos -m '.$this->argument('email').' --nginx '.$domainFlags, $output); |
|
|
exec('certbot --non-interactive --agree-tos -m '.$this->argument('email').' --nginx '.$domainFlags, $output); |
|
|
$this->line(implode("\n", $output)); |
|
|
$this->line(implode("\n", $output)); |
|
|
|
|
|
|
|
|
foreach($output as $line) { |
|
|
|
|
|
//Congratulations!
|
|
|
|
|
|
//check for string
|
|
|
|
|
|
|
|
|
foreach($saved as $domain => $file) { |
|
|
|
|
|
if (file_exists($file)) { |
|
|
|
|
|
$this->info($domain.'...Success!'); |
|
|
|
|
|
} else { |
|
|
|
|
|
$this->error($domain.'...Failed!'); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |