LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 10-15-2013, 03:26 PM   #1
prfaasse
LQ Newbie
 
Registered: Oct 2013
Location: Amsterdam
Distribution: Slackware
Posts: 3

Rep: Reputation: Disabled
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
------------------------------
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
gnupg pgp kmail bong.mau Linux - Security 0 05-03-2006 02:00 PM
KMail and PGP/GPG not working - doesn't ask for passphrase steve1401 Linux - General 2 02-08-2005 06:42 AM
PGP/Mime for MDK Kmail - Agypten kwalker Linux - Software 0 07-02-2004 01:53 AM
PGP & Kmail BashTin Linux - Software 9 04-09-2004 11:38 AM
KMail and PGP..... Unknown_User Linux - Software 1 02-08-2003 12:42 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 09:44 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration