suggestion w.r.t. pgp <--> kmail
I've found his in both Slackware-13.37 and 14.0, so please forgive if this has already been addressed in 14.1 .
I have on both mentioned Slackware versions gotten pgp-signing and encryption working, but not quite out of the box. I found that there was on both versions two missing links, that made kmail -and kleopatra for that matter- unable to connect with pgp-agent. As a result kleopatra can not add/generate/import etc.. pgp keys, and kmail cannot ask the pgp-agent to encrypt/sign/decrypt mails.
In both versions, I managed to address this by adding two simple script files to the system. The script files are run at resp start and stop of a KDE session.
The file run at KDE start: starts -if needed- the gpg-agent and sets the environment vars so other apps in the KDE session can find the agent. The actual script file can be in either ~/kde/env or /etc/kde/env . The start script file (I've used the filename start-gpg-agent.sh) contains:
------------------------------
#!/bin/sh
GPG_AGENT=/usr/bin/gpg-agent
## Run gpg-agent only if not already running, and available
if [ -x "${GPG_AGENT}" ] ; then
# check validity of GPG_SOCKET (in case of session crash)
GPG_AGENT_INFO_FILE=${HOME}/.gpg-agent-info
if [ -f "${GPG_AGENT_INFO_FILE}" ]; then
GPG_AGENT_PID=`cat ${GPG_AGENT_INFO_FILE} | cut -f2 -d:`
GPG_PID_NAME=`ps -p ${GPG_AGENT_PID} -o comm=`
if [ ! "x${GPG_PID_NAME}" = "xgpg-agent" ]; then
rm -f "${GPG_AGENT_INFO_FILE}" 2>&1 >/dev/null
else
GPG_SOCKET=`cat "${GPG_AGENT_INFO_FILE}" | cut -f1 -d: | cut -f2 -d=`
if ! test -S "${GPG_SOCKET}" -a -O "${GPG_SOCKET}" ; then
rm -f "${GPG_AGENT_INFO_FILE}" 2>&1 >/dev/null
fi
fi
unset GPG_AGENT_PID GPG_SOCKET GPG_PID_NAME
fi
if [ -f "${GPG_AGENT_INFO_FILE}" ]; then
eval "$(cat \"${GPG_AGENT_INFO_FILE}\")"
eval "$(cut -d= -f 1 < \"${GPG_AGENT_INFO_FILE}\" | xargs echo export)"
export GPG_TTY=$(tty)
else
eval "$(${GPG_AGENT} -s --daemon --write-env-file ${GPG_OPTIONS})"
fi
fi
------------------------------
The file run at KDE stop: stops the gpg-agent that was started with the KDE session. Similarly, the file can be in either ~/.kde/shutdown or /etc/kde/shutdown. My file (named gpg-agent-shutdown.sh) contains:
------------------------------
#!/bin/sh
## The nice way
if test -n "${GPG_AGENT_INFO}"; then
GPG_AGENT_PID=`echo ${GPG_AGENT_INFO} | cut -d: -f2` && kill ${GPG_AGENT_PID} ||:
unset GPG_AGENT_INFO
fi
## The not so nice way
## NOTE: a root login will kill *all* users' gpg-agents
#killall gpg-agent
## clean/remove .gpg-agent-info
rm -f $HOME/.gpg-agent-info
------------------------------
|