diff options
author | David Runge <dave@sleepmap.de> | 2015-10-22 23:47:55 +0200 |
---|---|---|
committer | David Runge <dave@sleepmap.de> | 2015-10-22 23:47:55 +0200 |
commit | 3d7be9b249ddaff33cf363846578d429cfefd60a (patch) | |
tree | a1d39dae5186d35beaee389e9508260d315686d9 /bin | |
parent | 3fd1308ec86aa941bbed02c299ab5d57a48ee404 (diff) | |
parent | 995892dc2105fa5c89b7f7ae32db46104b5c9e56 (diff) | |
download | dotfiles-3d7be9b249ddaff33cf363846578d429cfefd60a.tar.gz dotfiles-3d7be9b249ddaff33cf363846578d429cfefd60a.tar.bz2 dotfiles-3d7be9b249ddaff33cf363846578d429cfefd60a.tar.xz dotfiles-3d7be9b249ddaff33cf363846578d429cfefd60a.zip |
Merge branch 'master' of sleepmap.de:dotfiles
* 'master' of sleepmap.de:dotfiles:
.tmux.conf: Adding tmux > 2.1 mouse scrolling options.
.gitignore: Adding make/ folder to the list of ignored folder.
.gitignore: Adding bin/pass2offlineimapc, as it will be re-generated upon usage.
.gitignore: Adding .mutt/gpg-auto.rc, as it will have to be re-generated via script before useage of mutt.
bin/generate_pgp_auto: Adding script to generate mutt send-hooks for mail addresses with valid gpg keys, to be able to automatically send encrypted mail.
.mutt/gpg.rc: Updating correct settings for gpg.
.zsh.after/export.zsh: Fixing some typos and adding additional comments. Adding XDG_RUNTIME_DIR for tmux's TMUX_TMPDIR. Moving SSH_AUTH_SOCK to XDG_RUNTIME_DIR. Separating ssh-agent and gpg-agent again. Setting GPG_TTY to current tty. Setting GPG_AGENT_INFO to empty string, so gpg-agent can be found.
.config/khal/khal.conf, .vdirsyncer/config: Changing name of calendar.
.mutt/gpg.rc: Updating pgp settings to be compliant with gnupg > 2.1.
.local/share/applications/pd.desktop: Shifting from pd-extended to pd.
.tmux.conf: Adding new (post 2.1) mouse mode
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/generate_pgp_auto | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/bin/generate_pgp_auto b/bin/generate_pgp_auto new file mode 100755 index 0000000..d9db27b --- /dev/null +++ b/bin/generate_pgp_auto @@ -0,0 +1,69 @@ +#!/bin/bash +# ~/.mutt/generate_pgp_auto +# Generate mutt pgp_auto* send-hooks from gpg pubring. +# Redirect output to file and source that in muttrc. +# Add the global hook _before_ sourcing the list: +# send-hook . 'reset pgp_autoencrypt' +# -=*# created by erAck #*=- CopyLeft Eike Rathke 2008-01-08T01:36+0100 + +# At least in an UTF-8 environment sed gets confused by 8-bit characters in +# real names and doesn't match the address anymore, an empty LANG variable +# works around. +LANG= + +# Output file +output="$HOME/.mutt/gpg-auto.rc" + +# if the file exists, delete it +if [ -f "${output}" ]; then + rm "${output}" +fi + +# 2nd gpg colon field: +# d := disabled (deprecated - use the 'D' in field 12 instead) +# e := expired +# r := revoked + +# Note that the following lines are part of the sed script passed by the shell +# and may not contain the ' character! Hence the double backslash in mail +# addresses to escape the regex . dot meta character for Mutt. +#gpg --list-keys --with-colons --fixed-list-mode --no-secmem-warning +gpg --list-keys --with-colons --fixed-list-mode --no-secmem-warning | sed -ne ' + +:START + +# ignore d|e|r keys +/^pub:[der]:/ b IGNORE + +# ignore disabled keys, D in last field (12) +/^pub:.*D[^:]*:$/ b IGNORE + +# take keys with encryption capability (E in last field), ignore without and +# other records like ^tru: +#/^pub:.*E[^:]*:$/ ! b IGNORE + +# extract uids and convert address to mutt hook and print +:EXTRACT +# ignore non-uid or no address +/^uid:[^der]:[^<]*<\([^:>]\+@[^:>]\+\)>/ ! b NUSKIP +# extract address +# somehow the colon part after \)> is needed to not produce a trailing : in output +# sed buffer problem? +s/^uid:[^der]:[^<]*<\([^:>]\+@[^:>]\+\)>[^:]*:/\1/ +# escape dot meta characters, with escaped backslash for mutt +s/\./\\\\./g +# print hook +s/\(.*\)/send-hook "!~l ~t \1" "set crypt_autoencrypt"/p +:NUSKIP +n +/^pub:/ b START +b EXTRACT + +# ignore entire key with uid/sub/... until next pub is encountered +:IGNORE +n +/^pub:/ b START +b IGNORE + +' | egrep -v 'WhatYouDontWantInThisList@example\\\\\.org' | sort -u > ${output} +# Note the triple escaped backslash! |