gpg: cannot open ‘/dev/tty’: No such device or address error while encrypting/decrypting using PGP keys

Description

Environment

  • Campaign Classic
  • Campaign
  • Campaign Standard

Issue/Symptoms
Getting the following error when using the encrypt post-process command or the decrypt pre-process command.

gpg: cannot open '/dev/tty': No such device or address

Resolution

To fix the error mentioned above, you need to bypass the step where the system tries to output to /dev/tty, which either does not exists in the file system or the neolane user does not have rights to this directory. In the GPG command, add --no-tty to skip this step. E.g.:

etl
    preProcessCommand command="gpg --decrypt <b>--no-tty</b> --recipient \*\*\*\*\*\*\*\* &quot;$fileName&quot;" label="Decryption GPG" name="GPGdecrypt"/
    postProcessCommand command="gpg --encrypt <b>--no-tty</b> --recipient \*\*\*\*\*\*\* &quot;$fileName&quot;" label="Encryption GPG" name="GPGencrypt" suffix="gpg"/
/etl

Cause
This error happens because the system tries to output to /dev/tty, which either does not exists in the file system, or the neolane user does not have rights to this directory.

Also, check if the passphrase in preProcessCommand is present or not. If the passphrase is missing, then also we can get this error.

etl
        preProcessCommand name="GPGdecrypt" label ="Decryption GPG" command="gpg --decrypt --passphrase passphrase --recipient CampaignOperations@adobe.com &quot;$fileName&quot;"/
        postProcessCommand name="GPGencrypt" label ="Encryption GPG" command="gpg --encrypt --recipient comp_ops@xxx.com.au &quot;$fileName&quot;" suffix="gpg"/
/etl

On this page