mirror of
https://github.com/PhyreApps/PhyrePanel.git
synced 2024-11-22 07:30:25 +00:00
update
This commit is contained in:
parent
12cc46eee8
commit
ee90204394
3 changed files with 23 additions and 3 deletions
|
@ -7,6 +7,7 @@ use BladeUI\Icons\Factory;
|
|||
use Illuminate\Support\Facades\Blade;
|
||||
use Illuminate\Support\Facades\Event;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Modules\LetsEncrypt\Console\Commands\LetsEncryptHttpAuthenticatorHook;
|
||||
use Modules\LetsEncrypt\LetsEncryptApacheVirtualHostConfig;
|
||||
use Modules\LetsEncrypt\Listeners\DomainIsCreatedListener;
|
||||
|
||||
|
@ -54,7 +55,9 @@ class LetsEncryptServiceProvider extends ServiceProvider
|
|||
*/
|
||||
protected function registerCommands(): void
|
||||
{
|
||||
// $this->commands([]);
|
||||
$this->commands([
|
||||
LetsEncryptHttpAuthenticatorHook::class,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -2,10 +2,11 @@
|
|||
|
||||
namespace Modules\LetsEncrypt\Console\Commands;
|
||||
|
||||
use App\Models\Domain;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class LetsencryptAuthenticatorHook extends Command
|
||||
class LetsEncryptHttpAuthenticatorHook extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
|
@ -33,8 +34,24 @@ class LetsencryptAuthenticatorHook extends Command
|
|||
$certbotValidation = $this->option('certbot-validation');
|
||||
$certbotDomain = $this->option('certbot-domain');
|
||||
|
||||
$findDomain = Domain::where('domain', $certbotDomain)->first();
|
||||
if (!$findDomain) {
|
||||
$this->error('Domain not found');
|
||||
return;
|
||||
}
|
||||
if (!is_dir($findDomain->domain_public)) {
|
||||
$this->error('Domain public directory not found');
|
||||
return;
|
||||
}
|
||||
|
||||
// .well-known/acme-challenge
|
||||
$acmeChallangePath = $findDomain->domain_public . '/.well-known/acme-challenge';
|
||||
if (!is_dir($acmeChallangePath)) {
|
||||
shell_exec('mkdir -p ' . $acmeChallangePath);
|
||||
}
|
||||
$authFilePath = $acmeChallangePath . '/' . $certbotToken;
|
||||
file_put_contents($authFilePath, $certbotValidation);
|
||||
|
||||
$this->info('Auth file created: ' . $authFilePath);
|
||||
|
||||
}
|
||||
}
|
0
web/Modules/LetsEncrypt/shell/hooks/pre/http-authenticator.sh
Normal file → Executable file
0
web/Modules/LetsEncrypt/shell/hooks/pre/http-authenticator.sh
Normal file → Executable file
Loading…
Reference in a new issue