为了避免IMAP服务器的随意邮箱窥探,我正在考虑“透明encryption”设置:
(见底部的理由)。
点(1)应该很容易给出procmail和一些过滤脚本。 我无法find涉及篡改IMAP服务器的(2)的现有技术(在我的情况下,dovecot:这可能意味着一个特殊用途的插件)。
想法,任何人?
理由:
通过这种设置,消息将在服务器上进行encryption, 但用户不必在其MUA上安装难以使用的(对于未启动的)GnuPG插件。 而一个拥有所有公钥/私钥对和邮箱的破解者在访问内容之前,仍然需要破解密码
默认情况下,%wvariables不可用,但可以添加它。
我稍微扩展了Dovecot wiki中给出的例子,以显示您可以处理密钥pipe理的一种方式。 这通过了一些低强度testing(我可以提供,阅读,移动邮件)。
#!/bin/bash # Keys generated using: # # fingerprint=$(echo -n "${imap_password}" | gpg2 --batch --passphrase-fd 0 --quick-gen-key "Mail encryption key <${imap_user}>" ed25519 2>&1 | fgrep 'revocation certificate stored as' | sed -e 's/.*\///' -e 's/\..*//') # echo -n "${imap_password}" | gpg2 --batch --passphrase-fd 0 --quick-add-key "${fingerprint}" cv25519 # # Call this from dovecot with: # # plugin { # mail_filter = mail-filter read %u %{userdb:pass} # mail_filter_out = mail-filter-out write %u # } # # And configure dovecot to pass the un-encrypted mail password through: # # passdb { # driver = passwd-file # args = scheme=CRYPT username_format=%u /etc/dovecot/users # override_fields = userdb_pass=%w # } export GNUPGHOME="/srv/mail/.gnupg" imap_user="$2" tempfile=$(mktemp) cat > "${tempfile}" if [ "$1" == "write" ]; then gpg2 --armor --batch --encrypt -r "${imap_user}" < "${tempfile}" elif [ "$1" == "read" ]; then imap_password="$3" echo -n "${imap_password}" | gpg2 --quiet --batch --passphrase-fd 0 --decrypt "${tempfile}" fi rm -f "${tempfile}"
在这方面显然有很大的提升空间 – 增加错误检查,不以明文缓冲磁盘上的消息,使用冒号定界输出正确地调用GPG,在磁盘上检测未encryption的邮件等等。
所以看起来这个dovecot插件符合这个法案:
https://wiki.dovecot.org/Plugins/MailFilter
除了不清楚它是否可以访问%Wmacros(纯文本密码 – 可能不是,因为它被保留到auth阶段)。