gpg-mailgate 删除电子邮件内容

gpg-mailgate 删除电子邮件内容

我已经安装gpg-mailgate这个存储库在我的服务器上,如安装文件。

它似乎确实部分起作用了。正如预期的那样,当向我的服务器上没有可用 GPG 公钥的帐户发送电子邮件时,gpg-mailgate 只会转发该电子邮件。在标题中,有一个 gpg-mailgate 状态,表示没有可用的公钥,因此该邮件尚未加密。

我在配置文件中指定了电子邮件地址和相应的公钥,并向该帐户发送电子邮件,根据标题信息,它起作用了。它说它已经使用保存的公钥加密了消息。然而,它似乎只是删除了电子邮件的正文。电子邮件仍然到达服务器上正确的电子邮件帐户,但正文中没有任何文本。

我怎样才能让它正常工作?

编辑:

/etc/postfix/master.cf

smtp      inet  n       -       n       -       -       smtpd
submission inet n       -       n       -       -       smtpd
  -o smtpd_tls_security_level=encrypt
  -o smtpd_sasl_auth_enable=yes
smtps     inet  n       -       n       -       -       smtpd
  -o smtpd_tls_wrappermode=yes
  -o smtpd_sasl_auth_enable=yes
pickup    unix  n       -       n       60      1       pickup
cleanup   unix  n       -       n       -       0       cleanup
qmgr      unix  n       -       n       300     1       qmgr
tlsmgr    unix  -       -       n       1000?   1       tlsmgr
rewrite   unix  -       -       n       -       -       trivial-rewrite
bounce    unix  -       -       n       -       0       bounce
defer     unix  -       -       n       -       0       bounce
trace     unix  -       -       n       -       0       bounce
verify    unix  -       -       n       -       1       verify
flush     unix  n       -       n       1000?   0       flush
proxymap  unix  -       -       n       -       -       proxymap
proxywrite unix -       -       n       -       1       proxymap
smtp      unix  -       -       n       -       -       smtp
relay     unix  -       -       n       -       -       smtp
showq     unix  n       -       n       -       -       showq
error     unix  -       -       n       -       -       error
retry     unix  -       -       n       -       -       error
discard   unix  -       -       n       -       -       discard
local     unix  -       n       n       -       -       local
virtual   unix  -       n       n       -       -       virtual
lmtp      unix  -       -       n       -       -       lmtp
anvil     unix  -       -       n       -       1       anvil
scache    unix  -       -       n       -       1       scache

gpg-mailgate    unix    -   n   n   -   -   pipe
    flags= user=nobody argv=/usr/local/bin/gpg-mailgate.py ${recipient}

127.0.0.1:10028 inet    n   -   n   -   10  smtpd
    -o content_filter=
    -o receive_override_options=no_unknown_recipient_checks,no_header_body_checks
    -o smtpd_helo_restrictions=
    -o smtpd_client_restrictions=
    -o smtpd_sender_restrictions=
    -o smtpd_recipient_restrictions=permit_mynetworks,reject
    -o mynetworks=127.0.0.0/8
    -o smtpd_authorized_xforward_hosts=127.0.0.0/8

/etc/gpg-mailgate.conf

[default]
# whether gpg-mailgate should add a header after it has processed an email
# this may be useful for debugging purposes
add_header = yes

# whether we should only sign emails if they are explicitly defined in
#  the key mappings below ([keymap] section)
# this means gpg-mailgate won't automatically detect PGP recipients
keymap_only = yes

[gpg]
# the directory where gpg-mailgate public keys are stored
# (see INSTALL for details)
keyhome = /var/gpg/.gnupg

[logging]
# For logging to syslog. 'file = syslog', otherwise use path to the file.
file = /tmp/gpg-mailgate.log
#verbose = yes

[relay]
# the relay settings to use for Postfix
# gpg-mailgate will submit email to this relay after it is done processing
# unless you alter the default Postfix configuration, you won't have to     modify this
host = 127.0.0.1
port = 10028

[database]
# uncomment the settings below if you want
#  to read keys from a gpg-mailgate-web database
#enabled = yes
#name = gpgmw
#host = localhost
#username = gpgmw
#password =

[keymap]
# You can find these by running the following command:
#   gpg --list-keys --keyid-format long [email protected]
# Which will return output similar to:
#   pub   1024D/AAAAAAAAAAAAAAAA 2007-10-22
#   uid                          Joe User <[email protected]>
#   sub   2048g/BBBBBBBBBBBBBBBB 2007-10-22
# You want the AAAAAAAAAAAAAAAA not BBBBBBBBBBBBBBBB.
#[email protected] = <gpg key id>

[email protected] = 88A512E52095FF45

`/etc/postfix/main.cf(替换了我的域名和 ssl 路径以供发布):

queue_directory = /var/spool/postfix
command_directory = /usr/bin
daemon_directory = /usr/lib/postfix/bin
data_directory = /var/lib/postfix
mail_owner = postfix

myhostname = www.myhostname.de
mydomain = myhostname.de
mydestination = localhost

unknown_local_recipient_reject_code = 550
alias_maps = hash:/etc/postfix/aliases
alias_database = $alias_maps
recipient_delimiter = +

home_mailbox = Maildir/
debug_peer_level = 2
debugger_command =
     PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
     ddd $daemon_directory/$process_name $process_id & sleep 5

sendmail_path = /usr/bin/sendmail
newaliases_path = /usr/bin/newaliases
mailq_path = /usr/bin/mailq
setgid_group = postdrop

html_directory = no
manpage_directory = /usr/share/man
sample_directory = /etc/postfix/sample
readme_directory = /usr/share/doc/postfix
inet_protocols = ipv4

virtual_mailbox_domains = mydomain1.de mydomain2.de …
virtual_mailbox_base = /mail
virtual_mailbox_maps = hash:/etc/postfix/vmailbox
virtual_minimum_uid = 50
virtual_uid_maps = static:73
virtual_gid_maps = static:73
virtual_alias_maps = hash:/etc/postfix/virtual
mailbox_size_limit = 102400000
virtual_mailbox_limit = 0

# SASL SUPPORT FOR CLIENTS
smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain = $myhostname
broken_sasl_auth_clients = no
smtpd_sasl_security_options = noanonymous
smtpd_recipient_restrictions =  permit_sasl_authenticated, permit_mynetworks, check_relay_domains
smtpd_tls_security_level=may
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_tls_auth_only = yes
smtpd_tls_cert_file = mycert
smtpd_tls_key_file = mykeyfile
smtpd_tls_loglevel = 1

content_filter = gpg-mailgate

版本:

$ postconf -d | grep mail_version
mail_version = 3.0.1
$ python2 --version
Python 2.7.10

编辑2:

(1)在未启用 gpg-mailgate 的情况下发送电子邮件时

/tmp/gpg-mailgate.log

Recipient ([email protected]) not in domain list.
No encrypted recipients.
Sending email to: <[email protected]>

(2)在启用 gpg-mailgate 的情况下发送电子邮件时

/tmp/gpg-mailgate.log

Encrypting email to: [email protected]
Sending email to: <[email protected]>

编辑3:

gpg-mailgate 已禁用;

Return-Path: <[email protected]>
X-Original-To: [email protected]
Delivered-To: [email protected]
Received: from www.phkr.de (localhost.localdomain [127.0.0.1])
    by www.phkr.de (Postfix) with ESMTP id 812B1160BFB
    for <[email protected]>; Wed, 24 Jun 2015 18:51:29 +0200 (CEST)
Received: from esa-public.zimt.uni-siegen.de (esa-public.zimt.uni-siegen.de
 [141.99.10.66]) by www.phkr.de (Postfix) with ESMTP id 3FAA915FC4E
 for <[email protected]>; Wed, 24 Jun 2015 18:51:29 +0200 (CEST)
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: A2DYBABE34pV/0ULY41bh2K5B4pjAQEBAQEBgQuETFUgHRYLAgsDAgECAUsNCAEBiC+nLo9flnaTP4FDBZQFlAOQBiaBSQELAYImgzUBAQE
X-IronPort-AV: E=Sophos;i="5.13,673,1427752800"; d="scan'208,217";a="22305746"
Received: from mail2.ad.uni-siegen.de (HELO mail.uni-siegen.de)
 ([141.99.11.69])
 by esa-private.zimt.uni-siegen.de with ESMTP/TLS/AES128-SHA;
 24 Jun 2015 18:51:27 +0200
Received: from phil-macbookpro.local (37.201.192.53) by mail.uni-siegen.de
 (141.99.11.69) with Microsoft SMTP Server (TLS) id 14.3.224.2; Wed, 24 Jun
 2015 18:51:26 +0200
Message-ID: <[email protected]>
Date: Wed, 24 Jun 2015 18:51:26 +0200
From: =?UTF-8?B?UGhpbCBLcsOkbWVy?= <[email protected]>
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10;
 rv:31.0) Gecko/20100101 Thunderbird/31.7.0
MIME-Version: 1.0
To: "[email protected]" <[email protected]>
Subject: Test
Content-Type: multipart/alternative;
 boundary="------------030808040405090507040509"
X-PMWin-Version: 3.1.2.0, Antivirus-Engine: 3.55.0, Antivirus-Data: 5.14G
X-GPG-Mailgate: Not encrypted, public key not found

--------------030808040405090507040509
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo
ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis
dis parturient montes, nascetur ridiculus mus. Donec quam felis,
ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa
quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget,
arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo.
Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras
dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend
tellus. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac,
enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a, tellus.
Phasellus viverra nulla ut metus varius laoreet. Quisque rutrum. Aenean
imperdiet. Etiam ultricies nisi vel augue. Curabitur ullamcorper
ultricies nisi. Nam eget dui. Etiam rhoncus. Maecenas tempus, tellus
eget condimentum rhoncus, sem quam semper libero, sit amet adipiscing
sem neque sed ipsum. Nam quam nunc, blandit vel, luctus pulvinar,
hendrerit id, lorem. Maecenas nec odio et ante tincidunt tempus. Donec
vitae sapien ut libero venenatis faucibus. Nullam quis ante. Etiam sit
amet orci eget eros faucibus tincidunt. Duis leo. Sed fringilla mauris
sit amet nibh. Donec sodales sagittis magna. Sed consequat, leo eget
bibendum sodales, augue velit cursus nunc,

--------------030808040405090507040509
Content-Type: text/html; charset="utf-8"
Content-Transfer-Encoding: 7bit

<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <meta http-equiv="content-type" content="text/html; charset=utf-8">
    Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean
    commodo ligula eget dolor. Aenean massa. Cum sociis natoque
    penatibus et magnis dis parturient montes, nascetur ridiculus mus.
    Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem.
    Nulla consequat massa quis enim. Donec pede justo, fringilla vel,
    aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut,
    imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede
    mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum
    semper nisi. Aenean vulputate eleifend tellus. Aenean leo ligula,
    porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem
    ante, dapibus in, viverra quis, feugiat a, tellus. Phasellus viverra
    nulla ut metus varius laoreet. Quisque rutrum. Aenean imperdiet.
    Etiam ultricies nisi vel augue. Curabitur ullamcorper ultricies
    nisi. Nam eget dui.
    Etiam rhoncus. Maecenas tempus, tellus eget condimentum rhoncus, sem
    quam semper libero, sit amet adipiscing sem neque sed ipsum. Nam
    quam nunc, blandit vel, luctus pulvinar, hendrerit id, lorem.
    Maecenas nec odio et ante tincidunt tempus. Donec vitae sapien ut
    libero venenatis faucibus. Nullam quis ante. Etiam sit amet orci
    eget eros faucibus tincidunt. Duis leo. Sed fringilla mauris sit
    amet nibh. Donec sodales sagittis magna. Sed consequat, leo eget
    bibendum sodales, augue velit cursus nunc,
  </body>
</html>

--------------030808040405090507040509--

gpg-mailgate 已启用:

Return-Path: <[email protected]>
X-Original-To: [email protected]
Delivered-To: [email protected]
Received: from www.phkr.de (localhost.localdomain [127.0.0.1])
    by www.phkr.de (Postfix) with ESMTP id A8008160BFB
    for <[email protected]>; Wed, 24 Jun 2015 18:54:06 +0200 (CEST)
Received: from esa-public.zimt.uni-siegen.de (esa-public.zimt.uni-siegen.de
 [141.99.10.65]) by www.phkr.de (Postfix) with ESMTP id 53AB5160BF9
 for <[email protected]>; Wed, 24 Jun 2015 18:54:06 +0200 (CEST)
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: A2DYBAA/4IpV/0cLY41bh2K5B4pjAQEBAQEBgQuETFUgHRYLAgsDAgECAUsNCAEBiC+nJY9flnWTP4FDBZQFlAOQBiaBSQELAYImgzUBAQE
X-IronPort-AV: E=Sophos;i="5.13,673,1427752800"; d="scan'208,217";a="22900624"
Received: from mail4.ad.uni-siegen.de (HELO mail.uni-siegen.de)
 ([141.99.11.71])
 by esa-private.zimt.uni-siegen.de with ESMTP/TLS/AES128-SHA;
 24 Jun 2015 18:54:05 +0200
Received: from phil-macbookpro.local (37.201.192.53) by mail.uni-siegen.de
 (141.99.11.71) with Microsoft SMTP Server (TLS) id 14.3.224.2; Wed, 24 Jun
 2015 18:54:05 +0200
Message-ID: <[email protected]>
Date: Wed, 24 Jun 2015 18:54:04 +0200
From: =?UTF-8?B?UGhpbCBLcsOkbWVy?= <[email protected]>
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10;
 rv:31.0) Gecko/20100101 Thunderbird/31.7.0
MIME-Version: 1.0
To: "[email protected]" <[email protected]>
Subject: Test
Content-Type: multipart/alternative;
 boundary="------------000505080606000302060009"
X-PMWin-Version: 3.1.2.0, Antivirus-Engine: 3.55.0, Antivirus-Data: 5.14G
X-GPG-Mailgate: Encrypted by GPG Mailgate

--------------000505080606000302060009
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit


--------------000505080606000302060009
Content-Type: text/html; charset="utf-8"
Content-Transfer-Encoding: 7bit


--------------000505080606000302060009--

相关内容