how-to-setup-pgp-integration.md 11 KB

How to Setup PGP Integration

For development purposes, it's possible to set up PGP integration for a local Zammad instance. However, since the approach uses self-generated test keys, this is considered unsafe for production. You've been warned!

Configure PGP Integration

Navigate to the System > Integrations > PGP section in GUI, and turn on the toggle switch on top to activate the feature.

Note: In case your local gpg binary cannot be found or it's a wrong version, you may receive an error message on top. Please try to fix it before proceeding by either installing or updating your GnuPG installation.

Upload Sender Private Key

  1. In the same screen, click on the Add Key button.
  2. Paste the following text in the Paste Key box:

    -----BEGIN PGP PRIVATE KEY BLOCK-----
    
    lQdGBGSlac8BEAC84D3lTlKmCzG4UGcjBvZcW08+yez3/j3Va5vO7kmfwTF+XB5q
    ZH7K8g1PsGGipOLLseS0yml670SZvaEojth1wQwLSDUj/oSyVoJ8yqMNr9sVsSo3
    ASUl5vOGsIXj17WFnUzzahAnvFms9eLodgF80eSETXXqMFRyFztSvvphkyJ+uUeM
    r5EgjwBmbGtYb0BEiyiB7aeCoShRDCOGILL0eyCIDa6LCR+I1Ny00/pl0QeX9mte
    al7TySOu4bLS39r0qlMWvVveJ/mjY5SxFgrq0MvY46D7zLTALH2HEiK2c0/nqZsn
    XSN4RlSE2bQg9Cx35XG/Irh1ySgXtyFV9vEu+dlEWBEqbkHNPcKSrljbLlIUHjin
    b1f036fYASXbgrHolCa+bsNcoRrlmnYJEREnLh8rNnwBy8forRVcH6hVDchqsMqW
    tBWusEPEukZxljEBgtMxqUV/kmN/wfz7zviEL3OkomnpBVsmrFZpDUNAHX8knufe
    U6zY9JkZ78ZRKvIGNZ6E/ULR9QJsnCk9DmggdWkNDrtUVV+MEICwzH6472bnaY2S
    i3NLVlcnAVJa5gE4WBp4WL6ZbnqFF3CAxwb4hl9z5uCj7SBCifO8EirU+j5CJxC5
    7LYvjvB2c8qRoERQEJ1T72p3rfhXbvHdLRufKNeRyV8zFnF93UmJY2ZWvQARAQAB
    /gcDAnPEI9sMemUZ8VBVFXSPBJCvJ7PmzkP64FtBGAbzEtSw/Etd5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ZXgDnRy25Y5lYK2Zirdb3t7RpHqNaoHvX3yAmVd+q0/xOz4
    CRytM7d2eZS/+N2Un0N8PgnlG2iNqh1EyBeSJl4ymblBMmLAY2S2jCuhCMSxhNsf
    bZODG9sysuKmtp1mkomvIcyfDCuly1KXqYzIGj6bfG9VoAuXkMoZpCAFDDKyz84M
    z5ff/7RxRmha7GGVBK5SMCsxE8iILmorWeiQuYBci54f5RP3lM/Q13DcKRZH3f5y
    9sHJw60hIvYahqu7aKX9bSTmbpJwAO6qJaBQVdmuxFST7ZfbNuImpBTTYiyjgyM7
    JPZvEA7+QmR2jgCwGd7p7s8kTmKafLtOaStBuU5t/Njp9Qt+rowldf7qeR3M9AGc
    MrE+5Urqc/L7uyjGjKu0Mzt/pZPwzXFUGnUz7/sxU5qGfeRjsnnuDIWovp6fsdrA
    k8SAZaKfoQfMISau8lvcnEd5gg/V2Attr+B+NI2HMuXKXA==
    =u7b7
    -----END PGP PRIVATE KEY BLOCK-----
    
  3. Enter zammad in Passphrase box.

  4. Click on the Add button.

The test sender private key above was generated for the following sender email address: zammad@localhost. In case your sender address is different, please see below on how to re-generate it.

Upload Recipient Public Key

  1. In the same screen, click again on the Add Key button.
  2. Paste the following text in the Paste Key box:

    -----BEGIN PGP PUBLIC KEY BLOCK-----
    
    mQINBGSw/p0BEADbEp2iLw5bFQ7J+GeFZKfVV6N6ETUiieWMmoRLrTYkHlpSqfVS
    v4xhDI+QSIZU/VZV7FlowaOEATQUDwtZ8ou16tWPqIe0G+NiumXyzjiH4Rhpx/Yp
    djJlFcVYfMIqRtd6zsYUkXqVA5ByAXeMkJaE/PQ//GwcPzqv5dEfxn0Jykfc4MRc
    rYsryg7QfrMJ8zLTmn2VpIAfjB54/EIEafSmmLYhX5MAI8U4AHnONG1xw3CC32sj
    rkaPHejhaVirAILEAs7+lnBT7hZInfCtjrEzprs/muJD9CIMcN5YWUXFwLmZsqvq
    DUi+rJnGdqS2q2G3RhndFr1aQiN7Eox7W4UDvDf7fxCp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v6
    OlAtaSHCL89LOyTbP0sE2SVTT733qShfyZcQo+eTzJ9/7cwLNHrc1X5rcLdgAZyQ
    k7UHXuUKdmcLbt0t5nyyITWEGD+gI1pq73w/EXIt6TUn5r//5OrQVD0ln4744Euc
    dqLOvmePJn5lE4jEooMS
    =gFIf
    -----END PGP PUBLIC KEY BLOCK-----
    
  3. Leave Passphrase box empty.

  4. Click on the Add button.

The test recipient public key above was generated for the following customer email address: nicole.braun@zammad.org. In case your recipient address is different, please see below how to re-generate it.

Create a Test Email Ticket with Encrypted & Signed Content

  1. Go to new ticket screen.
  2. Switch to the Send Email article type.
  3. Provide a Title.
  4. Choose a Customer called Nicole Braun.
  5. Provide some Text.
  6. Choose Users for the Group.
  7. Verify that both Encrypt and Sign toggle buttons are now active.
  8. Click on the Create button.
  9. Verify that the first article has a Security attribute in article metadata with PGP: Encrypted / Signed value.

Re-generate Test Keys

You will need a recent installation of gpg utility (GnuPG) for the following commands.

Generate Sender Key

  1. Make a temporary GPG keyring for the following commands:

    GNUPGHOME=$(mktemp -d)
    export GNUPGHOME
    

On systems with GnuPG version higher than 2.3.0, please set the following configuration option before generating new keys, so they can be backwards compatible:

   echo "default-preference-list SHA512 SHA384 SHA256 SHA224 AES256 AES192 AES CAST5 ZLIB BZIP2 ZIP Uncompressed" > "$GNUPGHOME/gpg.conf"
  1. Generate the private key:

    gpg --quick-generate-key "zammad@localhost" rsa4096 sign,encr 10y
    

Where zammad@localhost is the key UID, rsa4096 key algorithm, sign,encr key usage and 10y key expiration date relative to current time.

Provide the key passphrase when asked, confirm it and remember it for later.

  1. Export the private key in armor-ASCII format:

    gpg --output "zammad@localhost.asc" --armor --export-secret-key "zammad@localhost"
    

Where zammad@localhost.asc is the file output for the private key and zammad@localhost the key UID.

Provide the key passphrase when asked.

  1. Clean up the temporary GPG keyring:

    rm -rf $GNUPGHOME
    unset GNUPGHOME
    

You can now upload your new test sender private key. Either upload the actual text file (zammad@localhost.asc) or paste its contents in the appropriate box. Remember that the private key export includes the public key information as well, there is no need to import them separately. Also, you will have to provide the passphrase for the private key during the upload to Zammad.

Generate Recipient Key

  1. Make a temporary GPG keyring for the following commands:

    GNUPGHOME=$(mktemp -d)
    export GNUPGHOME
    

On systems with GnuPG version higher than 2.3.0, please set the following configuration option before generating new keys, so they can be backwards compatible:

   echo "default-preference-list SHA512 SHA384 SHA256 SHA224 AES256 AES192 AES CAST5 ZLIB BZIP2 ZIP Uncompressed" > "$GNUPGHOME/gpg.conf"
  1. Generate the private key:

    gpg --quick-generate-key "Nicole Braun <nicole.braun@zammad.org>" rsa4096 sign,encr 10y
    

Where Nicole Braun <nicole.braun@zammad.org> is the key UID, rsa4096 key algorithm, sign,encr key usage and 10y key expiration date relative to current time.

Provide the key passphrase when asked and confirm it.

  1. Export the public key in armor-ASCII format:

    gpg --output "nicole.braun@zammad.org.pub.asc" --armor --export "Nicole Braun <nicole.braun@zammad.org>"
    

Where nicole.braun@zammad.org.pub.asc is the file output for the public key and Nicole Braun <nicole.braun@zammad.org> the key UID.

  1. Clean up the temporary GPG keyring:

    rm -rf $GNUPGHOME
    unset GNUPGHOME
    

You can now upload your new test recipient public key. Either upload the actual text file (nicole.braun@zammad.org.pub.asc) or paste its content in the appropriate box. Note that in this case you should NOT upload the generated private key since the public key may be used only for encryption.

Other Useful GnuPG commands

List Keys in the GPG Keyring

gpg --list-keys

Show Info About a Keyfile

gpg --show-key path/to/keyfile.asc

With preferences included in the verbose mode:

gpg --list-options show-pref-verbose --show-key path/to/keyfile.asc

Delete a Private Key from the GPG Keyring

gpg --delete-secret-key zammad@localhost

Delete a Public Key from the GPG Keyring

gpg --delete-key zammad@localhost