anonaddy / docker

AnonAddy Docker image
MIT License
519 stars 56 forks source link

Unable to sign emails as integrated GPG doesn't allow GPG keys without passphrases #244

Open foux opened 1 year ago

foux commented 1 year ago

Support guidelines

I've found a bug and checked that ...

Description

I'm trying to encrypt my mails. So :

  1. I have entered my public key on the UI
  2. I have created the keys on the server using docker compose exec --user anonaddy anonaddy gpg --full-gen-key, I've even tried docker compose exec --user anonaddy anonaddy gpg --full-gen-key --passphrase=''
  3. Impossible to finish the key creation, as GPG requires a passphrase
  4. As there is a passphrase, AnonAddy can't use the key and we get this error :
    [2023-11-25 16:50:35] production.ERROR: encrypt-sign failed {"exception":"[object] (Exception(code: 0): encrypt-sign failed at /var/www/anonaddy/app/CustomMailDriver/Mime/Crypto/OpenPGPEncrypter.php:248)

Expected behaviour

We should either be able to create GPG keys with passphrase, or be able to create GPG keys without passphrase (hte former solution is of course the better)

Actual behaviour

Unable to send crypted emails

Steps to reproduce

  1. Try to create a private key usable by AnonAddy

Docker info

Client: Docker Engine - Community
 Version:    24.0.7
 Context:    default
 Debug Mode: false
 Plugins:
  compose: Docker Compose (Docker Inc.)
    Version:  v2.21.0
    Path:     /usr/libexec/docker/cli-plugins/docker-compose

Server:
 Containers: 9
  Running: 8
  Paused: 0
  Stopped: 1
 Images: 27
 Server Version: 24.0.7
 Storage Driver: overlay2
  Backing Filesystem: btrfs
  Supports d_type: true
  Using metacopy: false
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: systemd
 Cgroup Version: 2
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
 Runtimes: io.containerd.runc.v2 runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: d8f198a4ed8892c764191ef7b3b06d8a2eeb5c7f
 runc version: v1.1.10-0-g18a0cb0
 init version: de40ad0
 Security Options:
  apparmor
  seccomp
   Profile: builtin
  cgroupns
 Kernel Version: 6.1.0-13-amd64
 Operating System: Debian GNU/Linux 12 (bookworm)
 OSType: linux
 Architecture: x86_64
 CPUs: 2
 Total Memory: 7.569GiB
 Name: loki.tfdn.cloud
 ID: VB2P:V632:YDDX:SI2C:AWXR:GYRL:J23G:MINA:LNDD:5I7V:3QS7:XSSV
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Experimental: true
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

Docker Compose config

N/A

Logs

[2023-11-25 16:50:35] 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/Notifications/Channels/MailChannel.php(67): 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(109): Illuminate\\Notifications\\NotificationSender->withLocale()
#8 /var/www/anonaddy/vendor/laravel/framework/src/Illuminate/Notifications/ChannelManager.php(54): Illuminate\\Notifications\\NotificationSender->sendNow()
#9 /var/www/anonaddy/vendor/laravel/framework/src/Illuminate/Notifications/SendQueuedNotifications.php(112): Illuminate\\Notifications\\ChannelManager->sendNow()
#10 /var/www/anonaddy/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Illuminate\\Notifications\\SendQueuedNotifications->handle()
#11 /var/www/anonaddy/vendor/laravel/framework/src/Illuminate/Container/Util.php(41): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#12 /var/www/anonaddy/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\\Container\\Util::unwrapIfClosure()
#13 /var/www/anonaddy/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): Illuminate\\Container\\BoundMethod::callBoundMethod()
#14 /var/www/anonaddy/vendor/laravel/framework/src/Illuminate/Container/Container.php(662): Illuminate\\Container\\BoundMethod::call()
#15 /var/www/anonaddy/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(128): Illuminate\\Container\\Container->call()
#16 /var/www/anonaddy/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(141): Illuminate\\Bus\\Dispatcher->Illuminate\\Bus\\{closure}()
#17 /var/www/anonaddy/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(116): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#18 /var/www/anonaddy/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(132): Illuminate\\Pipeline\\Pipeline->then()
#19 /var/www/anonaddy/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(124): Illuminate\\Bus\\Dispatcher->dispatchNow()
#20 /var/www/anonaddy/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(141): Illuminate\\Queue\\CallQueuedHandler->Illuminate\\Queue\\{closure}()
#21 /var/www/anonaddy/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(116): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#22 /var/www/anonaddy/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(126): Illuminate\\Pipeline\\Pipeline->then()
#23 /var/www/anonaddy/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(70): Illuminate\\Queue\\CallQueuedHandler->dispatchThroughMiddleware()
#24 /var/www/anonaddy/vendor/laravel/framework/src/Illuminate/Queue/Jobs/Job.php(98): Illuminate\\Queue\\CallQueuedHandler->call()
#25 /var/www/anonaddy/vendor/laravel/framework/src/Illuminate/Queue/SyncQueue.php(43): Illuminate\\Queue\\Jobs\\Job->fire()
#26 /var/www/anonaddy/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(253): Illuminate\\Queue\\SyncQueue->push()


### Additional info

_No response_
foux commented 1 year ago

The only solution I've found so far is to create the key outside of the AnonAddy docker container, and import it with docker compose exec --user anonaddy anonaddy gpg --import