Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
bobimicroweber committed Sep 27, 2024
1 parent 6241f2c commit 55b8d6e
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public static function table(Table $table): Table
->label('DKIM Setup')
->form(function (Domain $record) {
return [
Forms\Components\Livewire::make(DkimSetup::class, [
Forms\Components\Livewire::make('email::dkim-setup', [
'domain' => $record->domain,
]),
];
Expand Down
50 changes: 50 additions & 0 deletions web/Modules/Email/App/Http/Livewire/DkimSetup.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,56 @@ public function render()
]);
}

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);
Expand Down
4 changes: 4 additions & 0 deletions web/Modules/Email/App/Providers/EmailServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
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
{
Expand Down Expand Up @@ -40,6 +42,8 @@ public function register(): void
});

$this->app->register(RouteServiceProvider::class);

Livewire::component('email::dkim-setup', DkimSetup::class);
}

/**
Expand Down

0 comments on commit 55b8d6e

Please sign in to comment.