muttで一意の特定の受信者だけをGPGで暗号化するにはどうすればよいですか?

muttで一意の特定の受信者だけをGPGで暗号化するにはどうすればよいですか?

特定の受信者に送信するときにgpg暗号化を有効にしますが、他の受信者に送信するときは暗号化を無効にするトランスポートフックを設定しようとしています。ただし、特定の受信者が送信されると、送信フックがトリガーされるようです。どこかに受信者リストには、他の人がいるかどうかに関係なく表示されます。

理想的には暗号化すると暗号化し[email protected]ますが、暗号化すると暗号化しません。愚か[email protected], [email protected], [email protected]手動説明する

一致する項目が複数ある場合、muttrcで指定された順序で[send-hook]コマンドが実行されます。

だから私はmuttrcに以下を入れました:メッセージがに送信されたら、自動暗号化を有効にします[email protected]。ただし、受信者以外の人がいる場合は[email protected]自動暗号化が解除されます。

send-hook . unset crypt_autoencrypt
send-hook "!~l ~t ^foo@bar\\.com$" "set crypt_autoencrypt"
send-hook "!~l !~t ^foo@bar\\.com$" "unset crypt_autoencrypt"

しかし、うまくいかないようです。送信フックが個々の受信者を個別に解析していないようです。私がメッセージを送信しても、muttはメッセージを暗号化しようとします。[email protected], [email protected]

解決策

非常に醜いハッキングでこの問題を解決できます。

send-hook . unset crypt_autoencrypt
send-hook "!~l ~t ^foo@bar\\.com$" "set crypt_autoencrypt"
send-hook "!~l ~t [^r]\\.com$" "unset crypt_autoencrypt"

.com文字以外のアドレスに電子メールを送信すると、r暗号化されません。…r.comそれ以外のアドレスが多いようですが、[email protected]次のように3行目を展開する必要があります。

send-hook "!~l ~t '([^r]\\.com|[^a]r\\.com)$" "unset crypt_autoencrypt"

また、…r.com文字以外の文字が前にあるアドレスも除外されますa。私はこの順序を数回繰り返します。

最大の問題は、cc:アドレスに対してsend-hooksが実行されていないようで、電子メールがcc:に接続されている場合、3行目全体が意味をなさないことです[email protected]

ベストアンサー1

muttrcでは以下を使用してください。

set crypt_opportunistic_encrypt = yes

~から$ man 5 muttrc

crypt_opportunistic_encrypt
      Type: boolean
      Default: no

      Setting this variable will cause Mutt to automatically enable
      and disable encryption, based on whether all message recipient
      keys can be located by mutt.

      When this option is enabled, mutt will determine the encryption
      setting each time the TO, CC, and BCC lists are edited.  If
      $edit_headers is set, mutt will also do so each time the
      message is edited.

      While this is set, encryption settings can't be manually
      changed.  The pgp or smime menus provide an option to disable
      the option for a particular message.

      If $crypt_autoencrypt or $crypt_replyencrypt enable encryption
      for a message, this option will be disabled for the message.  It
      can be manually re-enabled in the pgp or smime menus.  (Crypto
      only)

また、cc:edアドレスの妥当性も確認してください。残念ながら、2番目の段落によると、これは多くの便利な設定よりも優先されます。たとえば、廃止されset pgp_autoinline = yesたがPGP / MIMEをサポートしていない古いクライアントに送信するために必要な1があります。

1Android用K-9+APGの。私が知っている限り、これはPGPで暗号化された電子メールを読むことができる唯一のFOSS Android電子メールクライアントですが、限られた方法でのみ可能です。 (編集者:K-9 + openkeychainはPGP / MIMEをサポートしています。)

おすすめ記事