switch to gpg2 as default

This commit is contained in:
Luke 2018-02-13 13:00:48 -07:00
parent ac1f56dd18
commit a4dc0e041e
4 changed files with 5 additions and 10 deletions

View File

@ -4,12 +4,7 @@ Mutt is one of the most rewarding programs one can use, but can be a pain in the
## User interface
* The main scripts `mutt-wizard.sh` has options to add new email accounts, or remove unwanted ones. For email providers listed in the `autoconf/domains.csv` file, this will be 100% automatic and for other email addresses it will simply prompt you for you email's SMTP and IMAP server settings (which you can easily look up).
* The scripts will take that information and autogenerate mutt and offlineimap config files so you don't have to worry about them.
* It also creates a email-specific settings for your muttrc, which are outputed in the `accounts/` directory in your mutt directory.
* The script will automatically handle multiple accounts. Each will be assigned a number 1-9, and you can jump from one to another in mutt by pressing `i` and then that number. You can change the numbers by manually editing the macros in `personal.muttrc`.
* For most accounts, you can jump to sent mail with `gs`, drafts with `gd` and the inbox with `gi`. I haven't worked this out for every domain.
* It uses your gpg encryption to store your encrypted password in `credentials/`, where there are also two scripts that allow mutt and offlineIMAP to decrypt the passwords when needed.
The main script can take an email and autodetect its server settings, generating a muttrc and offlineimaprc profile automatically. I gives you options for add accounts to the system, detecting them, removing them and autodetecting mailboxes and generating shortcut keys in mutt.
### Will it work on my email? (95% yes)
@ -23,7 +18,7 @@ The email accounts that *won't* work with the script would include Proton Mail a
## Installation and Dependencies
dialog, neomutt and offlineimap should be installed. The contents of this repo should go directly in `~/.config/mutt/` and run from there. You also need to have a GPG public/private key pair for the wizard to automatically store your passwords. Otherwise you'll have to store them insecurely in plaintext files without the help of the wizard. As a note, if you uuse a distribution like Void that uses GPG2 and not GPG, you should symlink /usr/bin/gpg to /usr/bin/gpg2 or wherever the GPG2 binary lives.
dialog, neomutt and offlineimap should be installed. The contents of this repo should go directly in `~/.config/mutt/` and run from there. You also need to have a GPG public/private key pair for the wizard to automatically store your passwords. Otherwise you'll have to store them insecurely in plaintext files without the help of the wizard.
Just run `mutt-wizard.sh` for all the options.

View File

@ -1,4 +1,4 @@
#!/bin/bash
pass=$(gpg -d -q ~/.config/mutt/credentials/$1.gpg)
pass=$(gpg2 -d -q ~/.config/mutt/credentials/$1.gpg)
echo set smtp_pass=\"$pass\"
echo set imap_pass=\"$pass\"

View File

@ -4,7 +4,7 @@ home = os.path.expanduser("~")
def mailpasswd(acct):
acct = os.path.basename(acct)
path = "%s/.config/mutt/credentials/%s.gpg" % (home,acct)
args = ["gpg", "--use-agent", "--quiet", "--batch", "-d", path]
args = ["gpg2", "--use-agent", "--quiet", "--batch", "-d", path]
try:
return subprocess.check_output(args).strip()
except subprocess.CalledProcessError:

View File

@ -132,7 +132,7 @@ addAccount \
addAccount() {
# First, adding the encrypted password.
dialog --title "Luke's mutt/offlineIMAP password wizard" --passwordbox "Enter the password for the \"$title\" account." 10 60 2> /tmp/$title
gpg -r $gpgemail --encrypt /tmp/$title || (dialog --title "GPG decryption failed." --msgbox "GPG decryption failed. This is either because you do not have a GPG key pair or because your distro uses GPG2 and you thus need to symlink /usr/bin/gpg to /usr/bin/gpg2." 7 60 && break)
gpg2 -r $gpgemail --encrypt /tmp/$title || (dialog --title "GPG decryption failed." --msgbox "GPG decryption failed. This is either because you do not have a GPG key pair or because your distro uses GPG1 and you thus need to symlink /usr/bin/gpg2 to /usr/bin/gpg." 7 60 && break)
shred -u /tmp/$title
mv /tmp/$title.gpg ~/.config/mutt/credentials/