<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://rt-wiki.bestpractical.com/index.php?action=history&amp;feed=atom&amp;title=GnuPG</id>
	<title>GnuPG - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://rt-wiki.bestpractical.com/index.php?action=history&amp;feed=atom&amp;title=GnuPG"/>
	<link rel="alternate" type="text/html" href="https://rt-wiki.bestpractical.com/index.php?title=GnuPG&amp;action=history"/>
	<updated>2026-08-23T08:20:53Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.41.1</generator>
	<entry>
		<id>https://rt-wiki.bestpractical.com/index.php?title=GnuPG&amp;diff=1444&amp;oldid=prev</id>
		<title>Admin: 2 revisions imported</title>
		<link rel="alternate" type="text/html" href="https://rt-wiki.bestpractical.com/index.php?title=GnuPG&amp;diff=1444&amp;oldid=prev"/>
		<updated>2016-04-06T20:11:17Z</updated>

		<summary type="html">&lt;p&gt;2 revisions imported&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;opt::rt3::lib::RT::[[CryUserGContributed]] Perl opt::rt3::lib::RT::Crypt::[[GnuPG]](3)&lt;br /&gt;
&lt;br /&gt;
NAME&lt;br /&gt;
&lt;br /&gt;
 RT::Crypt::GnuPG - encrypt/decrypt and sign/verify email messages with the GNU Privacy Guard (GPG)&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
DESCRIPTION&lt;br /&gt;
&lt;br /&gt;
 This module provides support for encryption and signing of outgoing messages, as well as the decryption and verification of incoming email.&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
CONFIGURATION&lt;br /&gt;
&lt;br /&gt;
     You can control the configuration of this subsystem from RT&amp;#039;s configuration file.  Some options are available via the web interface, but to enable this functionality, you MUST start in the configuration file.&lt;br /&gt;
 &lt;br /&gt;
     There are two hashes, GnuPG and GnuPGOptions in the configuration file. The first one controls RT specific options. It enables you to enable/disable facility or change the format of messages. The second one is a hash with&lt;br /&gt;
     options for the &amp;#039;gnupg&amp;#039; utility. You can use it to define a keyserver, enable auto-retrieval keys and set almost any option &amp;#039;gnupg&amp;#039; supports on your system.&lt;br /&gt;
 &lt;br /&gt;
 %GnuPG&lt;br /&gt;
     Enabling GnuPG&lt;br /&gt;
 &lt;br /&gt;
     Set to true value to enable this subsystem:&lt;br /&gt;
 &lt;br /&gt;
         Set( %GnuPG,&lt;br /&gt;
             Enable =&amp;amp;gt; 1,&lt;br /&gt;
             ... other options ...&lt;br /&gt;
         );&lt;br /&gt;
 &lt;br /&gt;
     However, note that you must add the &amp;#039;Auth::GnuPG&amp;#039; email filter to enable the handling of incoming encrypted/signed messages.&lt;br /&gt;
 &lt;br /&gt;
     Format of outgoing messages&lt;br /&gt;
 &lt;br /&gt;
     Format of outgoing messages can be controlled using the &amp;#039;OutgoingMessagesFormat&amp;#039; option in the RT config:&lt;br /&gt;
 &lt;br /&gt;
         Set( %GnuPG,&lt;br /&gt;
             ... other options ...&lt;br /&gt;
             OutgoingMessagesFormat =&amp;amp;gt; &amp;#039;RFC&amp;#039;,&lt;br /&gt;
             ... other options ...&lt;br /&gt;
         );&lt;br /&gt;
 &lt;br /&gt;
     or&lt;br /&gt;
 &lt;br /&gt;
         Set( %GnuPG,&lt;br /&gt;
             ... other options ...&lt;br /&gt;
             OutgoingMessagesFormat =&amp;amp;gt; &amp;#039;Inline&amp;#039;,&lt;br /&gt;
             ... other options ...&lt;br /&gt;
         );&lt;br /&gt;
 &lt;br /&gt;
     This framework implements two formats of signing and encrypting of email messages:&lt;br /&gt;
 &lt;br /&gt;
     RFC This format is also known as GPG/MIME and described in RFC3156 and RFC1847.  Technique described in these RFCs is well supported by many mail user agents (MUA), but some MUAs support only inline signatures and&lt;br /&gt;
         encryption, so it&amp;#039;s possible to use inline format (see below).&lt;br /&gt;
 &lt;br /&gt;
     Inline&lt;br /&gt;
         This format doesn&amp;#039;t take advantage of MIME, but some mail clients do not support GPG/MIME.&lt;br /&gt;
 &lt;br /&gt;
         We sign text parts using clear signatures. For each attachments another attachment with a signature is added with &amp;#039;.sig&amp;#039; extension.&lt;br /&gt;
 &lt;br /&gt;
         Encryption of text parts is implemented using inline format, other parts are replaced with attachments with the filename extension &amp;#039;.pgp&amp;#039;.&lt;br /&gt;
 &lt;br /&gt;
         This format is discouraged because modern mail clients typically don&amp;#039;t support it well.&lt;br /&gt;
 &lt;br /&gt;
     Encrypting data in the database&lt;br /&gt;
 &lt;br /&gt;
     You can allow users to encrypt data in the database using option &amp;quot;AllowEncryptDataInDB&amp;quot;. By default it&amp;#039;s disabled.  Users must have rights to see and modify tickets to use this feature.&lt;br /&gt;
 &lt;br /&gt;
 %GnuPGOptions&lt;br /&gt;
     Use this hash to set options of the &amp;#039;gnupg&amp;#039; program. You can define almost any option you want which  gnupg supports, but never try to set options which change output format or gnupg&amp;#039;s commands, such as --sign (command),&lt;br /&gt;
     --list-options (option) and other.&lt;br /&gt;
 &lt;br /&gt;
     Some GnuPG options take arguments while others take none. (Such as  --use-agent).  For options without specific value use &amp;quot;undef&amp;quot; as hash value.  To disable these option just comment them out or delete them from the hash&lt;br /&gt;
 &lt;br /&gt;
         Set(%GnuPGOptions,&lt;br /&gt;
             &amp;#039;option-with-value&amp;#039; =&amp;amp;gt; &amp;#039;value&amp;#039;,&lt;br /&gt;
             &amp;#039;enabled-option-without-value&amp;#039; =&amp;amp;gt; undef,&lt;br /&gt;
             # &amp;#039;commented-option&amp;#039; =&amp;amp;gt; &amp;#039;value or undef&amp;#039;,&lt;br /&gt;
         );&lt;br /&gt;
 &lt;br /&gt;
     NOTE that options may contain &amp;#039;-&amp;#039; character and such options MUST be quoted, otherwise you can see quite cryptic error &amp;#039;gpg: Invalid option &amp;quot;--0&amp;quot;&amp;#039;.&lt;br /&gt;
 &lt;br /&gt;
     --homedir&lt;br /&gt;
         The GnuPG home directory, by default it is set to /opt/rt3/var/data/gpg.&lt;br /&gt;
 &lt;br /&gt;
         You can manage this data with the &amp;#039;gpg&amp;#039; commandline utility using the GNUPGHOME environment variable or --homedir option.  Other utilities may be used as well.&lt;br /&gt;
 &lt;br /&gt;
         In a standard installation, access to this directory should be granted to the web server user which is running RT&amp;#039;s web interface, but if you&amp;#039;re running cronjobs or other utilities that access RT directly via API and&lt;br /&gt;
         may generate encrypted/signed notifications then the users you execute these scripts under must have access too.&lt;br /&gt;
 &lt;br /&gt;
         However, granting access to the dir to many users makes your setup less secure, some features, such as auto-import of keys, may not be available if you do not.  To enable this features and suppress warnings about&lt;br /&gt;
         permissions on the dir use --no-permission-warning.&lt;br /&gt;
 &lt;br /&gt;
     --digest-algo&lt;br /&gt;
         This option is required in advance when RFC format for outgoing messages is used. We can not get default algorithm from gpg program so RT uses &amp;#039;SHA1&amp;#039; by default. You may want to override it. You can use MD5, SHA1,&lt;br /&gt;
         RIPEMD160, SHA256 or other, however use &amp;#039;gpg --version&amp;#039; command to get information about supported algorithms by your gpg. These algorithms are listed as hash-functions.&lt;br /&gt;
 &lt;br /&gt;
     --use-agent&lt;br /&gt;
         This option lets you use GPG Agent to cache the passphrase of RT&amp;#039;s key. See &amp;amp;lt;http://www.gnupg.org/documentation/manuals/gnupg/Invoking-GPG_002dAGENT.html&amp;amp;gt; for information about GPG Agent.&lt;br /&gt;
 &lt;br /&gt;
     --passphrase&lt;br /&gt;
         This option lets you set the passphrase of RT&amp;#039;s key directly. This option is special in that it isn&amp;#039;t passed directly to GPG, but is put into a file that GPG then reads (which is more secure). The downside is that&lt;br /&gt;
         anyone who has read access to your RT_SiteConfig.pm file can see the passphrase, thus we recommend the --use-agent option instead.&lt;br /&gt;
 &lt;br /&gt;
     other&lt;br /&gt;
         Read &amp;#039;man gpg&amp;#039; to get list of all options this program support.&lt;br /&gt;
 &lt;br /&gt;
 Per-queue options&lt;br /&gt;
     Using the web interface it&amp;#039;s possible to enable signing and/or encrypting by default. As an administrative user of RT, open &amp;#039;Configuration&amp;#039; then &amp;#039;Queues&amp;#039;, and select a queue. On the page you can see information about the&lt;br /&gt;
     queue&amp;#039;s keys at the bottom and two checkboxes to choose default actions.&lt;br /&gt;
 &lt;br /&gt;
     As well, encryption is enabled for autoreplies and other notifications when an encypted message enters system via mailgate interface even if queue&amp;#039;s option is disabled.&lt;br /&gt;
 &lt;br /&gt;
 Handling incoming messages&lt;br /&gt;
     To enable handling of encrypted and signed message in the RT you should add &amp;#039;Auth::GnuPG&amp;#039; mail plugin.&lt;br /&gt;
 &lt;br /&gt;
         Set(@MailPlugins, &amp;#039;Auth::MailFrom&amp;#039;, &amp;#039;Auth::GnuPG&amp;#039;, ...other filter...);&lt;br /&gt;
 &lt;br /&gt;
     See also &amp;#039;perldoc lib/RT/Interface/Email/Auth/GnuPG.pm&amp;#039;.&lt;br /&gt;
 &lt;br /&gt;
 Errors handling&lt;br /&gt;
     There are several global templates created in the database by default. RT uses these templates to send error messages to users or RT&amp;#039;s owner. These templates have &amp;#039;Error:&amp;#039; or &amp;#039;Error to RT owner:&amp;#039; prefix in the name. You&lt;br /&gt;
     can adjust the text of the messages using the web interface.&lt;br /&gt;
 &lt;br /&gt;
     Note that $TicketObj, $TransactionObj and other variable usually available in RT&amp;#039;s templates are not available in these templates, but each template used for errors reporting has set of available data structures you can&lt;br /&gt;
     use to build better messages. See default templates and descriptions below.&lt;br /&gt;
 &lt;br /&gt;
     As well, you can disable particular notification by deleting content of a template. You can delete a template too, but in this case you&amp;#039;ll see error messages in the logs when RT can not load template you&amp;#039;ve deleted.&lt;br /&gt;
 &lt;br /&gt;
     Problems with public keys&lt;br /&gt;
 &lt;br /&gt;
     Template &amp;#039;Error: public key&amp;#039; is used to inform the user that RT has problems with his public key and won&amp;#039;t be able to send him encrypted content. There are several reasons why RT can&amp;#039;t use a key. However, the actual reason&lt;br /&gt;
     is not sent to the user, but sent to RT owner using &amp;#039;Error to RT owner: public key&amp;#039;.&lt;br /&gt;
 &lt;br /&gt;
     The possible reasons: &amp;quot;Not Found&amp;quot;, &amp;quot;Ambiguous specification&amp;quot;, &amp;quot;Wrong key usage&amp;quot;, &amp;quot;Key revoked&amp;quot;, &amp;quot;Key expired&amp;quot;, &amp;quot;No CRL known&amp;quot;, &amp;quot;CRL too old&amp;quot;, &amp;quot;Policy mismatch&amp;quot;, &amp;quot;Not a secret key&amp;quot;, &amp;quot;Key not trusted&amp;quot; or &amp;quot;No specific reason&lt;br /&gt;
     given&amp;quot;.&lt;br /&gt;
 &lt;br /&gt;
     Due to limitations of GnuPG, it&amp;#039;s impossible to encrypt to an untrusted key, unless &amp;#039;always trust&amp;#039; mode is enabled.&lt;br /&gt;
 &lt;br /&gt;
     In the &amp;#039;Error: public key&amp;#039; template there are a few additional variables available:&lt;br /&gt;
 &lt;br /&gt;
     $Message - user friendly error message&lt;br /&gt;
     $Reason - short reason as listed above&lt;br /&gt;
     $Recipient - recipient&amp;#039;s identification&lt;br /&gt;
     $AddressObj - Email::Address object containing recipient&amp;#039;s email address&lt;br /&gt;
 &lt;br /&gt;
     A message can have several invalid recipients, to avoid sending many emails to the RT owner the system sends one message to the owner, grouped by recipient. In the &amp;#039;Error to RT owner: public key&amp;#039; template a @BadRecipients&lt;br /&gt;
     array is available where each element is a hash reference that describes one recipient using the same fields as described above. So it&amp;#039;s something like:&lt;br /&gt;
 &lt;br /&gt;
         @BadRecipients = (&lt;br /&gt;
             { Message =&amp;amp;gt; &amp;#039;...&amp;#039;, Reason =&amp;amp;gt; &amp;#039;...&amp;#039;, Recipient =&amp;amp;gt; &amp;#039;...&amp;#039;, ...},&lt;br /&gt;
             { Message =&amp;amp;gt; &amp;#039;...&amp;#039;, Reason =&amp;amp;gt; &amp;#039;...&amp;#039;, Recipient =&amp;amp;gt; &amp;#039;...&amp;#039;, ...},&lt;br /&gt;
             ...&lt;br /&gt;
         )&lt;br /&gt;
 &lt;br /&gt;
     Private key doesn&amp;#039;t exist&lt;br /&gt;
 &lt;br /&gt;
     Template &amp;#039;Error: no private key&amp;#039; is used to inform the user that he sent an encrypted email, but we have no private key to decrypt it.&lt;br /&gt;
 &lt;br /&gt;
     In this template $Message object of MIME::Entity class available. It&amp;#039;s the message RT received.&lt;br /&gt;
 &lt;br /&gt;
     Invalid data&lt;br /&gt;
 &lt;br /&gt;
     Template &amp;#039;Error: bad GnuPG data&amp;#039; used to inform the user that a message he sent has invalid data and can not be handled.&lt;br /&gt;
 &lt;br /&gt;
     There are several reasons for this error, but most of them are data corruption or absence of expected information.&lt;br /&gt;
 &lt;br /&gt;
     In this template @Messages array is available and contains list of error messages.&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
FOR DEVELOPERS&lt;br /&gt;
&lt;br /&gt;
 Documentation and references&lt;br /&gt;
     * RFC1847 - Security Multiparts for MIME: Multipart/Signed and Multipart/Encrypted.  Describes generic MIME security framework, &amp;quot;mulitpart/signed&amp;quot; and &amp;quot;multipart/encrypted&amp;quot; MIME types.&lt;br /&gt;
 &lt;br /&gt;
     * RFC3156 - MIME Security with Pretty Good Privacy (PGP), updates RFC2015.&lt;br /&gt;
 &lt;br /&gt;
 SignEncrypt Entity =&amp;amp;gt; MIME::Entity, [ Encrypt =&amp;amp;gt; 1, Sign =&amp;amp;gt; 1, ... ]&lt;br /&gt;
     Signs and/or encrypts an email message with GnuPG utility.&lt;br /&gt;
 &lt;br /&gt;
     Signing&lt;br /&gt;
         During signing you can pass &amp;quot;Signer&amp;quot; argument to set key we sign with this option overrides gnupg&amp;#039;s &amp;quot;default-key&amp;quot; option. If &amp;quot;Signer&amp;quot; argument is not provided then address of a message sender is used.&lt;br /&gt;
 &lt;br /&gt;
         As well you can pass &amp;quot;Passphrase&amp;quot;, but if value is undefined then &amp;quot;GetPassphrase&amp;quot; called to get it.&lt;br /&gt;
 &lt;br /&gt;
     Encrypting&lt;br /&gt;
         During encryption you can pass a &amp;quot;Recipients&amp;quot; array, otherwise &amp;quot;To&amp;quot;, &amp;quot;Cc&amp;quot; and &amp;quot;Bcc&amp;quot; fields of the message are used to fetch the list.&lt;br /&gt;
 &lt;br /&gt;
     Returns a hash with the following keys:&lt;br /&gt;
 &lt;br /&gt;
     * exit_code * error * logger * status * message&lt;br /&gt;
 &lt;br /&gt;
 VerifyDecrypt Entity =&amp;amp;gt; undef, [ Detach =&amp;amp;gt; 1, Passphrase =&amp;amp;gt; undef ]&lt;br /&gt;
 GetPassphrase [ Address =&amp;amp;gt; undef ]&lt;br /&gt;
     Returns passphrase, called whenever it&amp;#039;s required with Address as a named argument.&lt;br /&gt;
 &lt;br /&gt;
 ParseStatus&lt;br /&gt;
     Takes a string containing output of gnupg status stream. Parses it and returns array of hashes. Each element of array is a hash ref and represents line or group of lines in the status message.&lt;br /&gt;
 &lt;br /&gt;
     All hashes have Operation, Status and Message elements.&lt;br /&gt;
 &lt;br /&gt;
     Operation&lt;br /&gt;
         Classification of operations gnupg performs. Now we have support for Sign, Encrypt, Decrypt, Verify, PassphraseCheck, RecipientsCheck and Data values.&lt;br /&gt;
 &lt;br /&gt;
     Status&lt;br /&gt;
         Informs about success. Value is &amp;#039;DONE&amp;#039; on success, other values means that an operation failed, for example &amp;#039;ERROR&amp;#039;, &amp;#039;BAD&amp;#039;, &amp;#039;MISSING&amp;#039; and may be other.&lt;br /&gt;
 &lt;br /&gt;
     Message&lt;br /&gt;
         User friendly message.&lt;br /&gt;
 &lt;br /&gt;
     This parser is based on information from GnuPG distribution, see also docs/design_docs/gnupg_details_on_output_formats in the RT distribution.&lt;br /&gt;
 &lt;br /&gt;
 UseKeyForSigning&lt;br /&gt;
     Returns or sets identifier of the key that should be used for signing.&lt;br /&gt;
 &lt;br /&gt;
     Returns the current value when called without arguments.&lt;br /&gt;
 &lt;br /&gt;
     Sets new value when called with one argument and unsets if it&amp;#039;s undef.&lt;br /&gt;
 &lt;br /&gt;
 GetKeysForEncryption&lt;br /&gt;
     Takes identifier and returns keys suitable for encryption.&lt;br /&gt;
 &lt;br /&gt;
     Note that keys for which trust level is not set are also listed.&lt;br /&gt;
 &lt;br /&gt;
 KEY&lt;br /&gt;
     Signs a small message with the key, to make sure the key exists and we have a useable passphrase. The first argument MUST be a key identifier of the signer: either email address, key id or finger print.&lt;br /&gt;
 &lt;br /&gt;
     Returns a true value if all went well.&lt;br /&gt;
 &lt;br /&gt;
 Probe&lt;br /&gt;
     This routine returns true if RT&amp;#039;s GnuPG support is configured and working properly (and false otherwise).&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
perl v5.8.8 2009-05-28opt::rt3::lib::RT::Crypt::[[GnuPG]](3)&lt;/div&gt;</summary>
		<author><name>Admin</name></author>
	</entry>
</feed>