From 732606270a919be3c9892eadede4ece3dd73bc5c Mon Sep 17 00:00:00 2001 From: Bozhidar Date: Wed, 2 Oct 2024 17:21:45 +0300 Subject: [PATCH] update --- .../Email/App/Console/SetupEmailServer.php | 2 +- .../Filament/Resources/DomainDkimResource.php | 67 +++++++++++++++++++ .../Pages/CreateDomainDkim.php | 12 ++++ .../Pages/EditDomainDkim.php | 19 ++++++ .../Pages/ListDomainDkims.php | 19 ++++++ .../Resources/DomainDkimSigningResource.php | 66 ++++++++++++++++++ .../Pages/CreateDomainDkimSigning.php | 12 ++++ .../Pages/EditDomainDkimSigning.php | 19 ++++++ .../Pages/ListDomainDkimSignings.php | 19 ++++++ .../Email/App/Http/Livewire/DkimSetup.php | 10 ++- .../Email/App/Models/DomainDkimSigning.php | 5 ++ .../views/livewire/dkim-setup.blade.php | 4 +- 12 files changed, 250 insertions(+), 4 deletions(-) create mode 100644 web/Modules/Email/App/Filament/Resources/DomainDkimResource.php create mode 100644 web/Modules/Email/App/Filament/Resources/DomainDkimResource/Pages/CreateDomainDkim.php create mode 100644 web/Modules/Email/App/Filament/Resources/DomainDkimResource/Pages/EditDomainDkim.php create mode 100644 web/Modules/Email/App/Filament/Resources/DomainDkimResource/Pages/ListDomainDkims.php create mode 100644 web/Modules/Email/App/Filament/Resources/DomainDkimSigningResource.php create mode 100644 web/Modules/Email/App/Filament/Resources/DomainDkimSigningResource/Pages/CreateDomainDkimSigning.php create mode 100644 web/Modules/Email/App/Filament/Resources/DomainDkimSigningResource/Pages/EditDomainDkimSigning.php create mode 100644 web/Modules/Email/App/Filament/Resources/DomainDkimSigningResource/Pages/ListDomainDkimSignings.php diff --git a/web/Modules/Email/App/Console/SetupEmailServer.php b/web/Modules/Email/App/Console/SetupEmailServer.php index c40e15b..4fe9925 100644 --- a/web/Modules/Email/App/Console/SetupEmailServer.php +++ b/web/Modules/Email/App/Console/SetupEmailServer.php @@ -69,7 +69,7 @@ class SetupEmailServer extends Command $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); - $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', [ 'hostName' => setting('email.hostname'), 'domain' => setting('email.domain'), diff --git a/web/Modules/Email/App/Filament/Resources/DomainDkimResource.php b/web/Modules/Email/App/Filament/Resources/DomainDkimResource.php new file mode 100644 index 0000000..3652f43 --- /dev/null +++ b/web/Modules/Email/App/Filament/Resources/DomainDkimResource.php @@ -0,0 +1,67 @@ +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'), + ]; + } +} diff --git a/web/Modules/Email/App/Filament/Resources/DomainDkimResource/Pages/CreateDomainDkim.php b/web/Modules/Email/App/Filament/Resources/DomainDkimResource/Pages/CreateDomainDkim.php new file mode 100644 index 0000000..6291644 --- /dev/null +++ b/web/Modules/Email/App/Filament/Resources/DomainDkimResource/Pages/CreateDomainDkim.php @@ -0,0 +1,12 @@ +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'), + ]; + } +} diff --git a/web/Modules/Email/App/Filament/Resources/DomainDkimSigningResource/Pages/CreateDomainDkimSigning.php b/web/Modules/Email/App/Filament/Resources/DomainDkimSigningResource/Pages/CreateDomainDkimSigning.php new file mode 100644 index 0000000..63a138c --- /dev/null +++ b/web/Modules/Email/App/Filament/Resources/DomainDkimSigningResource/Pages/CreateDomainDkimSigning.php @@ -0,0 +1,12 @@ +secure(); $verify = $this->verify(); + $mainDomain = $this->getMainDomain(); return view('email::livewire.dkim-setup', [ 'secure' => $secure, 'verify' => $verify, + 'mainDomain' => $mainDomain, ]); } - public function verify() + public function getMainDomain() { $getMainDomain = ''; $parseDomain = explode('.', $this->domain); @@ -32,6 +34,12 @@ class DkimSetup extends Component $getMainDomain = $this->domain; } + return $getMainDomain; + } + public function verify() + { + $getMainDomain = $this->getMainDomain(); + $checks = []; $checkOne = shell_exec('dig @1.1.1.1 +short MX '.$getMainDomain); $checkOnePass = false; diff --git a/web/Modules/Email/App/Models/DomainDkimSigning.php b/web/Modules/Email/App/Models/DomainDkimSigning.php index 4fb8cd9..b6dc7c0 100644 --- a/web/Modules/Email/App/Models/DomainDkimSigning.php +++ b/web/Modules/Email/App/Models/DomainDkimSigning.php @@ -17,4 +17,9 @@ class DomainDkimSigning extends Model protected $table = 'domain_dkim_signings'; + + public function dkim() + { + return $this->belongsTo(DomainDkim::class); + } } diff --git a/web/Modules/Email/resources/views/livewire/dkim-setup.blade.php b/web/Modules/Email/resources/views/livewire/dkim-setup.blade.php index 2b0c084..9f18cfa 100644 --- a/web/Modules/Email/resources/views/livewire/dkim-setup.blade.php +++ b/web/Modules/Email/resources/views/livewire/dkim-setup.blade.php @@ -39,13 +39,13 @@ @endif
- 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:
v=DMARC1; p=none
- 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}}:
v=spf1 a mx ip4:91.107.217.103 ~all