This commit is contained in:
Bozhidar 2024-10-02 17:21:45 +03:00
parent 5d42587168
commit 732606270a
12 changed files with 250 additions and 4 deletions

View file

@ -69,7 +69,7 @@ class SetupEmailServer extends Command
$postfixMysqlVirtualMailboxMapsCf = PhyreBlade::render('email::server.postfix.sql.mysql_virtual_mailbox_maps.cf',$mysqlDbDetails); $postfixMysqlVirtualMailboxMapsCf = PhyreBlade::render('email::server.postfix.sql.mysql_virtual_mailbox_maps.cf',$mysqlDbDetails);
file_put_contents('/etc/postfix/sql/mysql_virtual_mailbox_maps.cf', $postfixMysqlVirtualMailboxMapsCf); file_put_contents('/etc/postfix/sql/mysql_virtual_mailbox_maps.cf', $postfixMysqlVirtualMailboxMapsCf);
$findDkim = DomainDkim::where('domain_name', setting('email.hostname'))->first(); $findDkim = DomainDkim::where('domain_name', setting('email.domain'))->first();
$postfixMainCf = PhyreBlade::render('email::server.postfix.main.cf', [ $postfixMainCf = PhyreBlade::render('email::server.postfix.main.cf', [
'hostName' => setting('email.hostname'), 'hostName' => setting('email.hostname'),
'domain' => setting('email.domain'), 'domain' => setting('email.domain'),

View file

@ -0,0 +1,67 @@
<?php
namespace Modules\Email\App\Filament\Resources;
use Modules\Email\App\Filament\Resources\DomainDkimResource\Pages;
use Modules\Email\App\Filament\Resources\DomainDkimResource\RelationManagers;
use Modules\Email\App\Models\DomainDkim;
use Filament\Forms;
use Filament\Forms\Form;
use Filament\Resources\Resource;
use Filament\Tables;
use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\SoftDeletingScope;
class DomainDkimResource extends Resource
{
protected static ?string $model = DomainDkim::class;
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
public static function form(Form $form): Form
{
return $form
->schema([
//
]);
}
public static function table(Table $table): Table
{
return $table
->columns([
Tables\Columns\TextColumn::make('domain_name'),
Tables\Columns\TextColumn::make('description'),
Tables\Columns\TextColumn::make('selector'),
// Tables\Columns\TextColumn::make('private_key'),
])
->filters([
//
])
->actions([
Tables\Actions\EditAction::make(),
])
->bulkActions([
Tables\Actions\BulkActionGroup::make([
Tables\Actions\DeleteBulkAction::make(),
]),
]);
}
public static function getRelations(): array
{
return [
//
];
}
public static function getPages(): array
{
return [
'index' => Pages\ListDomainDkims::route('/'),
'create' => Pages\CreateDomainDkim::route('/create'),
'edit' => Pages\EditDomainDkim::route('/{record}/edit'),
];
}
}

View file

@ -0,0 +1,12 @@
<?php
namespace Modules\Email\App\Filament\Resources\DomainDkimResource\Pages;
use Modules\Email\App\Filament\Resources\DomainDkimResource;
use Filament\Actions;
use Filament\Resources\Pages\CreateRecord;
class CreateDomainDkim extends CreateRecord
{
protected static string $resource = DomainDkimResource::class;
}

View file

@ -0,0 +1,19 @@
<?php
namespace Modules\Email\App\Filament\Resources\DomainDkimResource\Pages;
use Modules\Email\App\Filament\Resources\DomainDkimResource;
use Filament\Actions;
use Filament\Resources\Pages\EditRecord;
class EditDomainDkim extends EditRecord
{
protected static string $resource = DomainDkimResource::class;
protected function getHeaderActions(): array
{
return [
Actions\DeleteAction::make(),
];
}
}

View file

@ -0,0 +1,19 @@
<?php
namespace Modules\Email\App\Filament\Resources\DomainDkimResource\Pages;
use Modules\Email\App\Filament\Resources\DomainDkimResource;
use Filament\Actions;
use Filament\Resources\Pages\ListRecords;
class ListDomainDkims extends ListRecords
{
protected static string $resource = DomainDkimResource::class;
protected function getHeaderActions(): array
{
return [
Actions\CreateAction::make(),
];
}
}

View file

@ -0,0 +1,66 @@
<?php
namespace Modules\Email\App\Filament\Resources;
use Faker\Provider\Text;
use Modules\Email\App\Filament\Resources\DomainDkimSigningResource\Pages;
use Modules\Email\App\Filament\Resources\DomainDkimSigningResource\RelationManagers;
use Modules\Email\App\Models\DomainDkimSigning;
use Filament\Forms;
use Filament\Forms\Form;
use Filament\Resources\Resource;
use Filament\Tables;
use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\SoftDeletingScope;
class DomainDkimSigningResource extends Resource
{
protected static ?string $model = DomainDkimSigning::class;
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
public static function form(Form $form): Form
{
return $form
->schema([
//
]);
}
public static function table(Table $table): Table
{
return $table
->columns([
Tables\Columns\TextColumn::make('author'),
Tables\Columns\TextColumn::make('dkim.domain_name'),
])
->filters([
//
])
->actions([
Tables\Actions\EditAction::make(),
])
->bulkActions([
Tables\Actions\BulkActionGroup::make([
Tables\Actions\DeleteBulkAction::make(),
]),
]);
}
public static function getRelations(): array
{
return [
//
];
}
public static function getPages(): array
{
return [
'index' => Pages\ListDomainDkimSignings::route('/'),
'create' => Pages\CreateDomainDkimSigning::route('/create'),
'edit' => Pages\EditDomainDkimSigning::route('/{record}/edit'),
];
}
}

View file

@ -0,0 +1,12 @@
<?php
namespace Modules\Email\App\Filament\Resources\DomainDkimSigningResource\Pages;
use Modules\Email\App\Filament\Resources\DomainDkimSigningResource;
use Filament\Actions;
use Filament\Resources\Pages\CreateRecord;
class CreateDomainDkimSigning extends CreateRecord
{
protected static string $resource = DomainDkimSigningResource::class;
}

View file

@ -0,0 +1,19 @@
<?php
namespace Modules\Email\App\Filament\Resources\DomainDkimSigningResource\Pages;
use Modules\Email\App\Filament\Resources\DomainDkimSigningResource;
use Filament\Actions;
use Filament\Resources\Pages\EditRecord;
class EditDomainDkimSigning extends EditRecord
{
protected static string $resource = DomainDkimSigningResource::class;
protected function getHeaderActions(): array
{
return [
Actions\DeleteAction::make(),
];
}
}

View file

@ -0,0 +1,19 @@
<?php
namespace Modules\Email\App\Filament\Resources\DomainDkimSigningResource\Pages;
use Modules\Email\App\Filament\Resources\DomainDkimSigningResource;
use Filament\Actions;
use Filament\Resources\Pages\ListRecords;
class ListDomainDkimSignings extends ListRecords
{
protected static string $resource = DomainDkimSigningResource::class;
protected function getHeaderActions(): array
{
return [
Actions\CreateAction::make(),
];
}
}

View file

@ -15,14 +15,16 @@ class DkimSetup extends Component
{ {
$secure = $this->secure(); $secure = $this->secure();
$verify = $this->verify(); $verify = $this->verify();
$mainDomain = $this->getMainDomain();
return view('email::livewire.dkim-setup', [ return view('email::livewire.dkim-setup', [
'secure' => $secure, 'secure' => $secure,
'verify' => $verify, 'verify' => $verify,
'mainDomain' => $mainDomain,
]); ]);
} }
public function verify() public function getMainDomain()
{ {
$getMainDomain = ''; $getMainDomain = '';
$parseDomain = explode('.', $this->domain); $parseDomain = explode('.', $this->domain);
@ -32,6 +34,12 @@ class DkimSetup extends Component
$getMainDomain = $this->domain; $getMainDomain = $this->domain;
} }
return $getMainDomain;
}
public function verify()
{
$getMainDomain = $this->getMainDomain();
$checks = []; $checks = [];
$checkOne = shell_exec('dig @1.1.1.1 +short MX '.$getMainDomain); $checkOne = shell_exec('dig @1.1.1.1 +short MX '.$getMainDomain);
$checkOnePass = false; $checkOnePass = false;

View file

@ -17,4 +17,9 @@ class DomainDkimSigning extends Model
protected $table = 'domain_dkim_signings'; protected $table = 'domain_dkim_signings';
public function dkim()
{
return $this->belongsTo(DomainDkim::class);
}
} }

View file

@ -39,13 +39,13 @@
@endif @endif
<div> <div>
You do not have a DMARC record, please add a TXT record to your domain _dmarc.multiweber.com with the following value: You do not have a DMARC record, please add a TXT record to your domain _dmarc.{{$mainDomain}} with the following value:
<br /> <br />
v=DMARC1; p=none v=DMARC1; p=none
</div> </div>
<div> <div>
You do not have a SPF record, please add the following one to your domain multiweber.com: You do not have a SPF record, please add the following one to your domain {{$mainDomain}}:
<br /> <br />
v=spf1 a mx ip4:91.107.217.103 ~all v=spf1 a mx ip4:91.107.217.103 ~all
</div> </div>