diff --git a/web/Modules/Email/App/Filament/Resources/DomainsResource/Pages/ListDomains.php b/web/Modules/Email/App/Filament/Resources/DomainsResource/Pages/ListDomains.php new file mode 100644 index 0000000..d44ce0d --- /dev/null +++ b/web/Modules/Email/App/Filament/Resources/DomainsResource/Pages/ListDomains.php @@ -0,0 +1,19 @@ +schema([ + + + + + ]); + } + + public static function table(Table $table): Table + { + return $table + ->columns([ + Tables\Columns\TextColumn::make('domain') + ->searchable() + ->sortable(), + ]) + ->filters([ + // + ]) + ->actions([ + Tables\Actions\Action::make('dkimSetup') + ->label('DKIM Setup') + ->action(function (Domain $record) { + $output = DkimDomainSetup::run($record->domain); + dd($output); + }) + ->icon('heroicon-o-pencil'), + ]) + ->bulkActions([ +// Tables\Actions\BulkActionGroup::make([ +// Tables\Actions\DeleteBulkAction::make(), +// ]), + ]); + } + + public static function getRelations(): array + { + return [ + // + ]; + } + + public static function getPages(): array + { + return [ + 'index' => Pages\ListDomains::route('/'), + ]; + } +} diff --git a/web/Modules/Email/DkimDomainSetup.php b/web/Modules/Email/DkimDomainSetup.php new file mode 100644 index 0000000..809ae26 --- /dev/null +++ b/web/Modules/Email/DkimDomainSetup.php @@ -0,0 +1,34 @@ + file_get_contents($dkimPrivateKeyFile), + 'text' => file_get_contents($dkimTextFile), + ]; + } + + shell_exec('sudo mkdir -p /etc/opendkim/keys/'.$domain); + shell_exec('sudo chown -R opendkim:opendkim /etc/opendkim/keys/'.$domain); + shell_exec('sudo chmod go-rw /etc/opendkim/keys/'.$domain); + + $output = shell_exec('sudo opendkim-genkey -b 2048 -D /etc/opendkim/keys/'.$domain.' -h rsa-sha256 -r -s dkim -d '.$domain.' -v'); + + $dkimPrivateKey = file_get_contents($dkimPrivateKeyFile); + $dkimText = file_get_contents($dkimTextFile); + + return [ + 'privateKey' => $dkimPrivateKey, + 'text' => $dkimText, + ]; + } +} diff --git a/web/Modules/Email/shell/install.sh b/web/Modules/Email/shell/install.sh index 2444a5b..761e2b7 100644 --- a/web/Modules/Email/shell/install.sh +++ b/web/Modules/Email/shell/install.sh @@ -3,7 +3,7 @@ sudo apt-get update -y sudo DEBIAN_FRONTEND=noninteractive apt-get --no-install-recommends install dovecot-core dovecot-imapd dovecot-pop3d dovecot-lmtpd dovecot-mysql dovecot-sieve dovecot-managesieved -yq sudo DEBIAN_FRONTEND=noninteractive apt-get --no-install-recommends install postfix postfix-mysql -yq sudo apt-get --no-install-recommends install mailutils -yq -sudo apt-get --no-install-recommends install opendkim opendkim-tools -yq +sudo apt-get --no-install-recommends install opendkim opendkim-tools postfix-policyd-spf-python postfix-pcre -yq sudo apt-get --no-install-recommends install spamassassin spamc -yq sudo apt-get --no-install-recommends install clamav clamav-daemon -yq sudo apt-get --no-install-recommends install amavisd-new -yq @@ -14,6 +14,10 @@ ufw allow 587 ufw allow 465 ufw allow 993 +mkdir -p /etc/opendkim/keys +chown -R opendkim:opendkim /etc/opendkim +chmod go-rw /etc/opendkim/keys + echo "Done!" diff --git a/web/resources/views/filament/job-queue-notifications.blade.php b/web/resources/views/filament/job-queue-notifications.blade.php index 47c2f7c..c43991b 100644 --- a/web/resources/views/filament/job-queue-notifications.blade.php +++ b/web/resources/views/filament/job-queue-notifications.blade.php @@ -2,7 +2,7 @@ {{-- @if(auth()->id()) -