A guide to split-gpg2 + Sequoia

If you run split-gpg2, pairing it with Sequoia-PGP is well worth considering. Written in Rust, Sequoia eliminates the memory-safety risks inherent to C-based tools like GnuPG. It also implements the modern RFC 9580 standard - offering forward-looking security like post-quantum cryptography - while GnuPG still largely sticks to the legacy RFC 4880.

Because Sequoia’s keystore differs from GnuPG’s keyring, we’ll use Sequoia’s drop-in wrapper, gpg-sq. This gives you the familiar gpg2 flags and arguments while bridging both.

  • Keys generated in either tool work transparently.
  • Keys imported via gpg-sq --import are accessible to native sq commands (like sq decrypt).
  • Sequoia PGP has excellent documentation

While work on some compatibility issues is an ongoing effort, this guide should help you get up and running using both tools. If anyone has edge cases where standard /bin/gpg is still necessary, I’d love to hear your thoughts.

Qubes documentation on split-gpg2

Sequoia PGP

Create Template

In dom0:
qvm-clone debian-13-xfce debian-13-xfce-gpg2

In debian-13-xfce-gpg2 terminal:
sudo apt install split-gpg2 sq sequoia-chameleon-gnupg

NOTE: gpg-sq gpgv-sq python3-splitgpg2 dependencies are also installed
NOTE: The command line tool sq installed here (not sequoia-sq in fedora) has been part of the Debian distro since bookworm (Debian 12).

Verify sq installed
sq version
Output at time of writing:
sq 1.3.1 using sequoia-openpgp 2.0.0 with cryptographic backend Nettle 3.10 (Cv448: true, OCB: true). On fedora: sq 1.5.0 using sequoia-openpgp 2.4.1 with cryptographic backend OpenSSL 3.5.9

Create VMs

Create gpg-client and gpg-server based on the template. In dom0:
qvm-create --label purple --property netvm=YOUR_PREFERENCE --template debian-13-xfce-gpg2 gpg-client

qvm-create --label black --property netvm="" --template debian-13-xfce-gpg2 gpg-server

Create Policy

In the Qubes documentation for split-gpg2, there’s a RPC policy file created, but I prefer using tags and a policy.d to suit since the flexibility I needed was casting a pretty wide net allowing @anyvm to ping my gpg-server. I post on it here.

Create policy for the split-gpg2-client tag:
In dom0:
sudo nano /etc/qubes/policy.d/30-user-gpg2.policy
Add to policy:
qubes.Gpg2 * @tag:split-gpg2-client @anyvm ask default_target=gpg-server
qubes.Gpg2 * @anyvm @anyvm deny

NOTE: In use, a qubes.Gpg2 pop-up confirmation prompt will appear twice when a client requests a Gpg2 action. This is normal and gives the maximum transparency and security, but I guess for some workflows it could be a PITA for a pop-up every time. Policy can be adapted.

Create Tag for Policy

To allow any gpg-client to interact with gpg-server, a tag needs to be added. In dom0:
qvm-tags gpg-client add split-gpg2-client
See Qubes tags doc to verify tags

Enable Service

In dom0 (note gpg-client needs to be running for this to take):
qvm-service -e gpg-client split-gpg2-client

Create Environment Variable

In gpg-client template (thanks to @xyhhx):
mkdir -p ~/.config/environment.d
cat << 'EOF' > ~/.config/environment.d/qubes-split-gpg2.conf
SPLIT_GPG2_SERVER_DOMAIN=gpg-server
EOF
NOTE: client needed a restart for it to take

Verify the variable is in place. In client:
systemctl --user show-environment | grep SPLIT_GPG2
Output should be:
SPLIT_GPG2_SERVER-DOMAIN=gpg-server

DONE

Additional Clients

If you prefer, the original gpg-client can be deleted and other VMs can be designated as gpg-clients.

Example:
If the target client is any DispVM based on default-dvm, the split-gpg2 and sequoia packages need to be installed in the parent template (fedora-44-xfce) using:
sudo dnf install split-gpg2 sequoia-sq sequoia-chameleon-gnupg

In addition, a tag needs to be created and the service enabled for default-dvm. In dom0:
qvm-tags default-dvm add split-gpg2-client
qvm-service -e default-dvm split-gpg2-client

NOTE: The Environment Variable also needs to put in place in any gpg-client (see above). In the default-dvm example, this needs to happen in default-dvm template.

Restart

Verify sq installed (see above)

Comments and suggestions are very welcome.

4 Likes

To follow up:

  1. One step that seems unavoidable, but very necessary, is to move a copy of a key from the Sequoia key store to the GnuPG’s keyring on the gpg-server. Without this, I haven’t found a way (yet) for the client to see the private key, and as a result it will fail any decryption. Note: this is only done on the isolated gpg-server and does not export a private key to the client.

sq key export --cert=<FINGERPRINT> | /bin/gpg --import

  1. The keys remain on the isolated gpg-server without password, just as they do with vanilla split-gpg2.
  2. Under some circumstances when you’re using dispVMs as a client, decryption will fail because GnuPG’s home directory (/home/user/.gnupg) doesn’t exist (output will let you know about it). Create it and set its permissions with the following and then repeat decrypt command:
    mkdir -p ~/.gnupg
    chmod 700 ~/.gnupg
  3. If you use gpg-sq to import a key on to the gpg-server, you won’t be able to edit key with gpg-sq --edit-key to remove the password because --edit-key is not yet implemented in Sequoia Chameleon, and gpg2 --edit-key can’t see a gpg-sq imported key. Workaround is (after gpg-sq --import) use:
    sq key password --clear-password --cert=<FINGERPRINT>
    Or use gpg2 commands for import and key edit.
  4. Other commands not yet implemented in Sequoia Chameleon:

gpg-sq --delete-secret-key
gpg-sq --delete-key

2 Likes

With neomutt

To use neomutt with this setup, I cloned the debian-13-xfce-gpg2 template in my original post, and created a client based on that.

I won’t get into neomutt config in detail, but just the PGP config I find works for encrypt/decrypt/sign in the split-gpg2 with Sequoia setup in my original post, along with some other bits I found useful. Some of them will not directly impact the way split-gpg2 acts with neomutt, but I’ll just splash all of the PGP config I have, and you can pick through it.

If anyone has some input or changes specific to how split-gpg2 works with neomutt, they’re very welcome.

I found the following works well (add to ~/.config/neomutt/neomuttrc in the appVM)

#PGP
set pgp_default_key = "<FINGERPRINT>"
set pgp_sign_as = "<FINGERPRINT>"

# Decode PGP/MIME messages and extract attachments
set pgp_decode_command = "gpg-sq --status-fd=2 %?p?--passphrase-fd 0 --pinentry-mode=loopback? --no-verbose --quiet --batch --output - %f"

# Verify detached signature
set pgp_verify_command = "sq verify --signature-file %s -- %f"

# Sign message (text mode)
set pgp_sign_command = "sq sign --batch %?a?--signer %a? --mode text --signature-file - -- %f"

# Create clear-signed message
set pgp_clearsign_command = "sq sign --batch %?a?--signer %a? --cleartext -- %f"

# Decrypt message
set pgp_decrypt_command = "sq decrypt --batch --signatures 0 -- %f"

# Encrypt mesaage without signing
set pgp_encrypt_only_command = "/usr/libexec/neomutt/pgpewrap sq encrypt --batch --without-signature -- --for %r -- %f"

# Encrypt and sign message
set pgp_encrypt_sign_command = "/usr/libexec/neomutt/pgpewrap sq encrypt --batch %?a?--signer %a? -- --for %r -- %f"

# Import cert or public key
set pgp_import_command = "sq cert import -- %f"

# Export cert by recipient or keyID
set pgp_export_command = "sq cert export --cert %r"

# Identify and display info on a certificate
set pgp_verify_key_command = "sq pki identify --cert %r 2>&1"

# To recognize good-signature message
set pgp_good_sign = "^[\[:space:\]]\*Good signature from "

# To recognize successful decryption
set pgp_decryption_okay = "^[\[:space:\]]\*Encrypted using "

# Check command exit status
set pgp_check_exit = yes

# Disable checking the GPG decrypt status file
unset pgp_check_gpg_decrypt_status_fd

# To query and display public and secret keys
set pgp_list_pubring_command = "gpg-sq --no-verbose --batch --quiet --with-colons --with-fingerprint --with-fingerprint --list-keys %r"
set pgp_list_secring_command = "gpg-sq --no-verbose --batch --quiet --with-colons --with-fingerprint --with-fingerprint --list-secret-keys %r"

# Retain password for encrypt/sign in memory in seconds
set pgp_timeout = 600

# Encrypt and sign replies to encrypted messages
set crypt_replysignencrypted = yes

# Enable the GPGME backend
set crypt_use_gpgme = no

I think the community guide is relevant and useful. I just want to leave the information here that the GnuPG in most popular distros are patched to minimize divergence from OpenPGP spec.

1 Like