mail: Enable direct pgp decryption

When called over systemd, pass will not display a pin-entry field to
decrypt the necessary passwords for email synching.

This prepares automatic background synching.
This commit is contained in:
Marty Oehme 2020-09-24 14:22:03 +02:00
parent 407ad0473f
commit c5cd2b6a8d
Signed by: Marty
GPG key ID: B7538B8F50A1C800
3 changed files with 10 additions and 10 deletions

View file

@ -1,7 +1,7 @@
local accounts = {} local accounts = {}
local status, gmailuser = pipe_from('pass show misc/aerc-gmail-app-password | grep username | cut -d: -f2') local status, gmailuser = pipe_from('gpg2 --decrypt --no-tty --quiet --no-verbose --for-your-eyes-only --pinentry-mode ask ~/.local/share/pass/misc/aerc-gmail-app-password.gpg | grep username | cut -d: -f2')
local status, gmailpass = pipe_from('pass show misc/aerc-gmail-app-password | head -n1') local status, gmailpass = pipe_from('gpg2 --decrypt --no-tty --quiet --no-verbose --for-your-eyes-only --pinentry-mode ask ~/.local/share/pass/misc/aerc-gmail-app-password.gpg | head -n1')
-- Setup an imap account called gmail -- Setup an imap account called gmail
accounts.gmail = IMAP { accounts.gmail = IMAP {
server = "imap.gmail.com", server = "imap.gmail.com",

View file

@ -19,6 +19,11 @@ CONTINUOUS=false
-- only used in case server does not support IDLE mode -- only used in case server does not support IDLE mode
UPDATE_TIME=120 UPDATE_TIME=120
-- implement simple wait function in case server does not support IDLE mode
function sleep(n)
os.execute("sleep " .. tonumber(n))
end
-- will set filters to be grabbed from XDG-compliant filter directory -- will set filters to be grabbed from XDG-compliant filter directory
-- can be overridden with env var IMAPFILTER_FILTERDIR -- can be overridden with env var IMAPFILTER_FILTERDIR
function getConfigDir() function getConfigDir()
@ -63,11 +68,6 @@ assert(configDir, "No configuration directory found. Ensure " .. os.getenv("HOME
accounts = loadfile(configDir .. "/accounts.lua")() accounts = loadfile(configDir .. "/accounts.lua")()
assert(accounts, "No accounts configured. Ensure accounts.lua exists and returns a table of accounts.") assert(accounts, "No accounts configured. Ensure accounts.lua exists and returns a table of accounts.")
-- implement simple wait function in case server does not support IDLE mode
function sleep(n)
os.execute("sleep " .. tonumber(n))
end
-- immediately act on the filters once -- immediately act on the filters once
applyFilters(getFilterDir()) applyFilters(getFilterDir())

View file

@ -3,8 +3,8 @@
IMAPAccount gmail IMAPAccount gmail
# Address to connect to # Address to connect to
Host imap.gmail.com Host imap.gmail.com
UserCmd "pass show misc/aerc-gmail-app-password | grep username | cut -d: -f2" UserCmd "gpg2 --decrypt --no-tty --quiet --no-verbose --for-your-eyes-only --pinentry-mode ask ~/.local/share/pass/misc/aerc-gmail-app-password.gpg | grep username | cut -d: -f2"
PassCmd "pass show misc/aerc-gmail-app-password | head -n1" PassCmd "gpg2 --decrypt --no-tty --quiet --no-verbose --for-your-eyes-only --pinentry-mode ask ~/.local/share/pass/misc/aerc-gmail-app-password.gpg | head -n1"
# To store the password in an encrypted file use PassCmd instead of Pass # To store the password in an encrypted file use PassCmd instead of Pass
# PassCmd "gpg2 -q --for-your-eyes-only --no-tty -d ~/.mailpass.gpg" # PassCmd "gpg2 -q --for-your-eyes-only --no-tty -d ~/.mailpass.gpg"
# #
@ -25,7 +25,7 @@ Inbox ~/documents/mail/Inbox
# define generous maximum size to store locally # define generous maximum size to store locally
MaxSize 50M MaxSize 50M
Channel gmail-general Channel gmail
Far :gmail-remote: Far :gmail-remote:
Near :mail-local: Near :mail-local:
# Exclude everything under the internal [Gmail] folder, except the interesting folders # Exclude everything under the internal [Gmail] folder, except the interesting folders