Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Email forwarding fails after pgp key expired #566

Closed
pacroix opened this issue Dec 3, 2023 · 4 comments
Closed

Email forwarding fails after pgp key expired #566

pacroix opened this issue Dec 3, 2023 · 4 comments

Comments

@pacroix
Copy link

pacroix commented Dec 3, 2023

Version: v1.0.3 selfhosted

I recently started getting failed deliveries for one of my recipients with the only comment being to check the logs. After digging around a bit, I found out that the pgp key I'm using for this email had expired. I then renewed the key on my local machine, deleted the existing key in addy.io and uploaded it again.
However, forwarding to this recipient still does not work when encryption is enabled. Forwarding to other recipients, each using their own pgp key, works without a problem. I have also checked the server's key ring, but it contains the updated key.
I can't imagine, that I am the first person with an expired pgp key, but I don't know how else to renew the key without changing to a new one. And if not at least a more detailed error code would be nice to have.

Screenshot of the failed delivery tab. Another thing here: I can't download the email, even though I had the option enabled (or I'm looking in the wrong place)
failed_delivery

Supervisor log:

2023-12-03 22:03:26 App\Mail\ForwardEmail .......................... RUNNING
2023-12-03 22:03:26 App\Mail\ForwardEmail .................... 172.61ms FAIL
2023-12-03 22:12:17 App\Notifications\FailedDeliveryNotification ... RUNNING
2023-12-03 22:12:17 App\Notifications\FailedDeliveryNotification  81.57ms FAIL

Laravel log:

[2023-12-03 22:03:26] production.ERROR: encrypt-sign failed {"exception":"[object] (Exception(code: 0): encrypt-sign failed at /var/www/anonaddy/app/CustomMailDriver/Mime/Crypto/OpenPGPEncrypter.php:248)
[stacktrace]
#0 /var/www/anonaddy/app/CustomMailDriver/Mime/Crypto/OpenPGPEncrypter.php(248): gnupg->encryptsign()
#1 /var/www/anonaddy/app/CustomMailDriver/Mime/Crypto/OpenPGPEncrypter.php(151): App\\CustomMailDriver\\Mime\\Crypto\\OpenPGPEncrypter->pgpEncryptAndSignString()
#2 /var/www/anonaddy/app/CustomMailDriver/CustomMailer.php(80): App\\CustomMailDriver\\Mime\\Crypto\\OpenPGPEncrypter->encrypt()
#3 /var/www/anonaddy/vendor/laravel/framework/src/Illuminate/Mail/Mailable.php(205): App\\CustomMailDriver\\CustomMailer->send()
#4 /var/www/anonaddy/vendor/laravel/framework/src/Illuminate/Support/Traits/Localizable.php(19): Illuminate\\Mail\\Mailable->Illuminate\\Mail\\{closure}()
#5 /var/www/anonaddy/vendor/laravel/framework/src/Illuminate/Mail/Mailable.php(198): Illuminate\\Mail\\Mailable->withLocale()
@willbrowningme
Copy link
Member

Thanks, I've just pushed a fix for this by moving it within the try/catch block.

@pacroix
Copy link
Author

pacroix commented Dec 5, 2023

Thank you for looking into this, but the error is still occurring and unfortunately there is still no more meaningful error message, apart from the message to check the logs.

[2023-12-05 23:15:06] production.ERROR: encrypt-sign failed {"exception":"[object] (Exception(code: 0): encrypt-sign failed at /var/www/anonaddy/app/CustomMailDriver/Mime/Crypto/OpenPGPEncrypter.php:248)
[stacktrace]
#0 /var/www/anonaddy/app/CustomMailDriver/Mime/Crypto/OpenPGPEncrypter.php(248): gnupg->encryptsign()
#1 /var/www/anonaddy/app/CustomMailDriver/Mime/Crypto/OpenPGPEncrypter.php(151): App\\CustomMailDriver\\Mime\\Crypto\\OpenPGPEncrypter->pgpEncryptAndSignString()
#2 /var/www/anonaddy/app/CustomMailDriver/CustomMailer.php(71): App\\CustomMailDriver\\Mime\\Crypto\\OpenPGPEncrypter->encrypt()
#3 /var/www/anonaddy/vendor/laravel/framework/src/Illuminate/Notifications/Channels/MailChannel.php(66): App\\CustomMailDriver\\CustomMailer->send()
#4 /var/www/anonaddy/vendor/laravel/framework/src/Illuminate/Notifications/NotificationSender.php(148): Illuminate\\Notifications\\Channels\\MailChannel->send()
#5 /var/www/anonaddy/vendor/laravel/framework/src/Illuminate/Notifications/NotificationSender.php(106): Illuminate\\Notifications\\NotificationSender->sendToNotifiable()
#6 /var/www/anonaddy/vendor/laravel/framework/src/Illuminate/Support/Traits/Localizable.php(19): Illuminate\\Notifications\\NotificationSender->Illuminate\\Notifications\\{closure}()
#7 /var/www/anonaddy/vendor/laravel/framework/src/Illuminate/Notifications/NotificationSender.php(101): Illuminate\\Notifications\\NotificationSender->withLocale()
#8 /var/www/anonaddy/vendor/laravel/framework/src/Illuminate/Notifications/ChannelManager.php(54): Illuminate\\Notifications\\NotificationSender->sendNow()

@willbrowningme
Copy link
Member

Did the email still get forwarded but with encryption turned off?

Did you receive a GPG key expired email notification and was encryption disabled for that recipient when viewing from the recipients page?

willbrowningme added a commit that referenced this issue Dec 6, 2023
@willbrowningme
Copy link
Member

I've just fixed it in this commit, I was only catching RuntimeException and not Exception which is why it wasn't working as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants