LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 05-29-2014, 11:22 PM   #1
Alpha90
Member
 
Registered: Jul 2012
Posts: 97

Rep: Reputation: Disabled
Systemd starts gpg-agent mysteriously and does not end it with the last login session


I am running an up to date arch linux 3.14.4 box with systemd 212-3 and gnupg 2.0.22. I do not know how long this perticular problem has been going on but I was troubleshooting something else with a new test user and found out after I logged out and back into my regular user that my test user session did not fully close because gpg-agent was running. I have been trying to figure out for days what is causing it. I log in through a tty and gpg-agent is already started so X isnt starting it. So i searched through my bash files both system files and local user and found no reference to gpg-agent. I disabled /etc/profile.d/gpg-agent.sh thinking that might be the problem however that did not work. Since it was a process that was started right after logind I disabled all my daemons, rebooted, and logged into root and gpg-agent still was started. I restarted again into emergency mode this time to see if it would load and it didnt. So something must load into multi-user mode that does not into emergency. How ever I can not figure out what that something is.

So I am looking for maybe a lead in the right direction or a solution to fix this problem. The onlything close to a solution.

I found via google was adding pgrep gpg-agent|kill to .bash_logout which feels alittle to hackerish like ducktaping a problem instead of fixing it.
 
Old 05-30-2014, 01:56 AM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by Alpha90 View Post
The onlything close to a solution. I found via google was adding pgrep gpg-agent|kill to .bash_logout which feels alittle to hackerish like ducktaping a problem instead of fixing it.
You're right about that.


Quote:
Originally Posted by Alpha90 View Post
(..) So something must load into multi-user mode that does not into emergency. How ever I can not figure out what that something is.
Couple of things to try: check its PPID and "walk the chain" of processes back. Find its PID and run a 'cat -v /proc/$PID/cmdline'. That could reveal switches to 'grep -r' directories for. (Not running Arch but so far stuff in /etc/kde/env and file /usr/bin/keychain matches and none of the systemd stuff.)
 
Old 05-30-2014, 02:16 AM   #3
Alpha90
Member
 
Registered: Jul 2012
Posts: 97

Original Poster
Rep: Reputation: Disabled
Checking the PPID was a good idea and thank you for telling me how to do that but in this case it did not help the PPID is 1. Checking the switches just lead to an env file that listed tmp directories where socket are.
 
Old 05-30-2014, 12:18 PM   #4
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
OK. Please post actual output of
Code:
\ps af -U $LOGNAME -opid,ppid,args --sort=pid # obfuscate or cut irrelevant parts
\ps --no-header -C gpg-agent -o pid|while read _PID; do strings -an1 /proc/$_PID/cmdline\
|sed -e "s|^-||g" -e "s|^-||g"|while read ARG; do [ "${ARG:0:1}" != "/" -a  ${#ARG} -gt 10 ] \
&& grep ${ARG} -r /etc/ /usr/ ; done; done
 
Old 05-30-2014, 03:21 PM   #5
Alpha90
Member
 
Registered: Jul 2012
Posts: 97

Original Poster
Rep: Reputation: Disabled
Actually I figured it out. my bash profile was sourcing an shell file that had 644 permissions but somehow was executed anyway. Moving the script got rid of the problem but I still am not sure why gpg-agent did not close when my last login session ended.
 
Old 05-30-2014, 03:33 PM   #6
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
No idea. Try killing it nicely (15) on exit before killing it good (9)?
 
Old 05-30-2014, 04:00 PM   #7
Alpha90
Member
 
Registered: Jul 2012
Posts: 97

Original Poster
Rep: Reputation: Disabled
so i would need to just kill the daemon if I wanted it to exit when the session ends?
 
  


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
gpg / gpg-agent -- Can't connect to /root/.gnupg/S.gpg-agent jrtayloriv Linux - Security 9 06-03-2019 10:06 AM
[SOLVED] What starts per-login-session dbus in Slackware? average_user Slackware 2 04-10-2013 01:23 PM
GPG: Bad session key gpg between gpg on linux and gpg gui on windows XP konqi Linux - Software 1 07-21-2009 09:37 AM
many instances of gpg-agent edgjerp Linux - Software 0 11-16-2006 03:11 AM
gpg-agent cbonar Linux - Security 0 12-13-2004 06:56 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 07:46 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