Browse Source

Update self-hosting instructions

Will 4 years ago
parent
commit
77d028fbbf

+ 1 - 1
.env.example

@@ -20,7 +20,7 @@ QUEUE_CONNECTION=redis
 SESSION_DRIVER=redis
 SESSION_DRIVER=redis
 SESSION_LIFETIME=10080
 SESSION_LIFETIME=10080
 SESSION_SECURE_COOKIE=true
 SESSION_SECURE_COOKIE=true
-SAME_SITE_COOKIES=strict
+SAME_SITE_COOKIES=lax
 
 
 REDIS_CLIENT=phpredis
 REDIS_CLIENT=phpredis
 REDIS_HOST=127.0.0.1
 REDIS_HOST=127.0.0.1

+ 24 - 1
SELF-HOSTING.md

@@ -674,7 +674,7 @@ Make sure to update the database settings and the AnonAddy variables, you can us
 
 
 `APP_KEY` will be generted in the next step, this is used by Laravel for securely encrypting values.
 `APP_KEY` will be generted in the next step, this is used by Laravel for securely encrypting values.
 
 
-For more information on Laravel configuration please visit - https://laravel.com/docs/6.x/installation#configuration
+For more information on Laravel configuration please visit - https://laravel.com/docs/8.x/installation#configuration
 
 
 For the `ANONADDY_DKIM_SIGNING_KEY` you only need to fill in this variable if you plan to add any custom domains through the web application.
 For the `ANONADDY_DKIM_SIGNING_KEY` you only need to fill in this variable if you plan to add any custom domains through the web application.
 
 
@@ -688,6 +688,10 @@ If you want to use the same key we already generated then you will need to add `
 sudo usermod -a -G opendkim johndoe
 sudo usermod -a -G opendkim johndoe
 ```
 ```
 
 
+Make sure to also run `sudo chmod g+r /path/to/dkim/private/key` so that your johndoe user has read permsissions for the file.
+
+You can test it by running `cat /path/to/dkim/private/key` as the johndoe user to see if it can be displayed.
+
 Then we will generate an app key, migrate the database, link the storage directory, restart the queue and install laravel passport.
 Then we will generate an app key, migrate the database, link the storage directory, restart the queue and install laravel passport.
 
 
 ```bash
 ```bash
@@ -861,6 +865,25 @@ dns_available yes
 ```
 ```
 
 
 
 
+## Updating
+
+In order to update you can run the following commands:
+
+```bash
+git pull origin master
+
+composer update
+npm update
+php artisan migrate
+
+php artisan config:cache
+php artisan view:cache
+php artisan route:cache
+php artisan queue:restart
+```
+
+This should pull in any updates from the GitHub repository and update your dependencies. It will then run any migrations before finally clearing the cache and restarting the queue workers.
+
 ## Adding DNSSEC
 ## Adding DNSSEC
 
 
 
 

+ 3 - 3
app/Console/Commands/CreateUser.php

@@ -2,15 +2,15 @@
 
 
 namespace App\Console\Commands;
 namespace App\Console\Commands;
 
 
-use Illuminate\Console\Command;
-use Ramsey\Uuid\Uuid;
 use App\Models\Recipient;
 use App\Models\Recipient;
 use App\Models\User;
 use App\Models\User;
 use App\Rules\NotDeletedUsername;
 use App\Rules\NotDeletedUsername;
 use App\Rules\NotLocalRecipient;
 use App\Rules\NotLocalRecipient;
 use App\Rules\RegisterUniqueRecipient;
 use App\Rules\RegisterUniqueRecipient;
+use Illuminate\Console\Command;
 use Illuminate\Support\Facades\Hash;
 use Illuminate\Support\Facades\Hash;
 use Illuminate\Support\Facades\Validator;
 use Illuminate\Support\Facades\Validator;
+use Ramsey\Uuid\Uuid;
 
 
 class CreateUser extends Command
 class CreateUser extends Command
 {
 {
@@ -90,7 +90,7 @@ class CreateUser extends Command
         ]);
         ]);
 
 
         $this->info('Created user: '.$user->username.' with userid: '.$user->id);
         $this->info('Created user: '.$user->username.' with userid: '.$user->id);
-        $this->info('This user can now reset their password (default password is userid)');
+        $this->info('This user can now reset their password (the default password is their guserid)');
 
 
         return 0;
         return 0;
     }
     }

+ 7 - 5
app/Mail/ForwardEmail.php

@@ -52,7 +52,7 @@ class ForwardEmail extends Mailable implements ShouldQueue
         $this->alias = $alias;
         $this->alias = $alias;
         $this->sender = $emailData->sender;
         $this->sender = $emailData->sender;
         $this->displayFrom = $emailData->display_from;
         $this->displayFrom = $emailData->display_from;
-        $this->replyToAddress = $emailData->reply_to_address ?? null;
+        $this->replyToAddress = $emailData->reply_to_address ?? $this->sender;
         $this->emailSubject = $emailData->subject;
         $this->emailSubject = $emailData->subject;
         $this->emailText = $emailData->text;
         $this->emailText = $emailData->text;
         $this->emailHtml = $emailData->html;
         $this->emailHtml = $emailData->html;
@@ -88,16 +88,18 @@ class ForwardEmail extends Mailable implements ShouldQueue
      */
      */
     public function build()
     public function build()
     {
     {
-        $replyToEmail = $this->alias->local_part . '+' . Str::replaceLast('@', '=', $this->sender) . '@' . $this->alias->domain;
+        $replyToEmail = $this->alias->local_part . '+' . Str::replaceLast('@', '=', $this->replyToAddress) . '@' . $this->alias->domain;
 
 
         if ($this->alias->isCustomDomain()) {
         if ($this->alias->isCustomDomain()) {
             if ($this->alias->aliasable->isVerifiedForSending()) {
             if ($this->alias->aliasable->isVerifiedForSending()) {
                 $this->fromEmail = $this->alias->email;
                 $this->fromEmail = $this->alias->email;
                 $returnPath = $this->alias->email;
                 $returnPath = $this->alias->email;
 
 
-                $this->dkimSigner = new Swift_Signers_DKIMSigner(config('anonaddy.dkim_signing_key'), $this->alias->domain, config('anonaddy.dkim_selector'));
-                $this->dkimSigner->ignoreHeader('List-Unsubscribe');
-                $this->dkimSigner->ignoreHeader('Return-Path');
+                if (config('anonaddy.dkim_signing_key')) {
+                    $this->dkimSigner = new Swift_Signers_DKIMSigner(config('anonaddy.dkim_signing_key'), $this->alias->domain, config('anonaddy.dkim_selector'));
+                    $this->dkimSigner->ignoreHeader('List-Unsubscribe');
+                    $this->dkimSigner->ignoreHeader('Return-Path');
+                }
             } else {
             } else {
                 $this->fromEmail = config('mail.from.address');
                 $this->fromEmail = config('mail.from.address');
                 $returnPath = config('anonaddy.return_path');
                 $returnPath = config('anonaddy.return_path');

+ 4 - 2
app/Mail/ReplyToEmail.php

@@ -62,8 +62,10 @@ class ReplyToEmail extends Mailable implements ShouldQueue
                 $this->fromEmail = $this->alias->email;
                 $this->fromEmail = $this->alias->email;
                 $returnPath = $this->alias->email;
                 $returnPath = $this->alias->email;
 
 
-                $this->dkimSigner = new Swift_Signers_DKIMSigner(config('anonaddy.dkim_signing_key'), $this->alias->domain, config('anonaddy.dkim_selector'));
-                $this->dkimSigner->ignoreHeader('Return-Path');
+                if (config('anonaddy.dkim_signing_key')) {
+                    $this->dkimSigner = new Swift_Signers_DKIMSigner(config('anonaddy.dkim_signing_key'), $this->alias->domain, config('anonaddy.dkim_selector'));
+                    $this->dkimSigner->ignoreHeader('Return-Path');
+                }
             } else {
             } else {
                 $this->fromEmail = config('mail.from.address');
                 $this->fromEmail = config('mail.from.address');
                 $returnPath = config('anonaddy.return_path');
                 $returnPath = config('anonaddy.return_path');

+ 4 - 2
app/Mail/SendFromEmail.php

@@ -62,8 +62,10 @@ class SendFromEmail extends Mailable implements ShouldQueue
                 $this->fromEmail = $this->alias->email;
                 $this->fromEmail = $this->alias->email;
                 $returnPath = $this->alias->email;
                 $returnPath = $this->alias->email;
 
 
-                $this->dkimSigner = new Swift_Signers_DKIMSigner(config('anonaddy.dkim_signing_key'), $this->alias->domain, config('anonaddy.dkim_selector'));
-                $this->dkimSigner->ignoreHeader('Return-Path');
+                if (config('anonaddy.dkim_signing_key')) {
+                    $this->dkimSigner = new Swift_Signers_DKIMSigner(config('anonaddy.dkim_signing_key'), $this->alias->domain, config('anonaddy.dkim_selector'));
+                    $this->dkimSigner->ignoreHeader('Return-Path');
+                }
             } else {
             } else {
                 $this->fromEmail = config('mail.from.address');
                 $this->fromEmail = config('mail.from.address');
                 $returnPath = config('anonaddy.return_path');
                 $returnPath = config('anonaddy.return_path');