This commit is contained in:
Bozhidar 2024-09-27 16:44:36 +03:00
parent 6241f2c85c
commit 55b8d6e356
3 changed files with 55 additions and 1 deletions

View file

@ -52,7 +52,7 @@ class EmailDomainResource extends Resource
->label('DKIM Setup')
->form(function (Domain $record) {
return [
Forms\Components\Livewire::make(DkimSetup::class, [
Forms\Components\Livewire::make('email::dkim-setup', [
'domain' => $record->domain,
]),
];

View file

@ -18,6 +18,56 @@ class DkimSetup extends Component
]);
}
public function verify()
{
$getMainDomain = '';
$parseDomain = explode('.', $this->domain);
if (count($parseDomain) > 2) {
$getMainDomain = $parseDomain[1] . '.' . $parseDomain[2];
} else {
$getMainDomain = $this->domain;
}
$checks = [];
$checkOne = shell_exec('dig @1.1.1.1 +short MX '.$getMainDomain);
$checkOnePass = false;
if (str_contains($checkOne, '10 '.$this->domain)) {
$checkOnePass = true;
}
$checks[] = [
'check' => 'MX',
'pass' => $checkOnePass,
'result'=>$checkOne
];
$checkTwo = shell_exec('dig @1.1.1.1 +short A '.$this->domain);
$checkTwo = trim($checkTwo);
$getIpOfDomain = gethostbyname($this->domain);
$checkTwoPass = false;
if ($checkTwo == $getIpOfDomain) {
$checkTwoPass = true;
}
$checks[] = [
'check'=>'IP',
'pass'=>$checkTwoPass,
'result'=>$checkTwo
];
$checkThree = shell_exec('dig @1.1.1.1 +short -x ' . $getIpOfDomain);
$checkThree = trim($checkThree);
$checkTreePass = false;
if ($checkThree == $this->domain) {
$checkTreePass = true;
}
$checks[] = [
'check'=>'Reverse DNS',
'pass'=>$checkTreePass,
'result'=>$checkThree
];
return $checks;
}
public function secure()
{
$output = DkimDomainSetup::run($this->domain);

View file

@ -5,7 +5,9 @@ namespace Modules\Email\App\Providers;
use BladeUI\Icons\Factory;
use Illuminate\Support\Facades\Blade;
use Illuminate\Support\ServiceProvider;
use Livewire\Livewire;
use Modules\Email\App\Console\SetupEmailServer;
use Modules\Email\App\Http\Livewire\DkimSetup;
class EmailServiceProvider extends ServiceProvider
{
@ -40,6 +42,8 @@ class EmailServiceProvider extends ServiceProvider
});
$this->app->register(RouteServiceProvider::class);
Livewire::component('email::dkim-setup', DkimSetup::class);
}
/**