3

I'm getting a little frustrated here, maybe you got an idea what the problem could be:

  • I have a buildprocess with a few reprepro commands at the end
  • The buildscript is executed with sudo

    ( cd "$PUBLISHDIR" && \
    reprepro -Vb . -C untested remove squeeze foobar && \
    reprepro -Vb . -C untested includedeb squeeze ./foobar_*.deb && \
    reprepro -Vb . -C untested list squeeze foobar )
    
  • I have gpg set up and the key is added. the agent is running

    ps lax | grep gpg-agent
    
    1  1002 25345     1  20   0  19284   996 -      Ss   ?          0:00 /usr/bin/gpg-agent --daemon --sh
    
  • My gpg-agent.conf is set up too

    # ignore-cache-for-signing
    enable-ssh-support
    write-env-file /home/daily/.gnupg/gpg-agent-info
    default-cache-ttl 31536000
    default-cache-ttl-ssh 31536000
    max-cache-ttl 31536000
    max-cache-ttl-ssh 31536000
    debug-all
    
  • And i start the agent like this in the .bashrc

    GNUPGHOME=~/.gnupg
    GPGAGENT=/usr/bin/gpg-agent
    PID_FILE=$GNUPGHOME/gpg-agent-info
    
    if grep -qs '^[[:space:]]*use-agent' "$GNUPGHOME/gpg.conf" "$GNUPGHOME/options" && test -x $GPGAGENT & then
      if [ -r "$PID_FILE" ]; then
        . "$PID_FILE"
        count=`ps lax | grep "/usr/bin/gpg-agent" | grep "$SSH_AGENT_PID" | wc -l`
        if [ $count -eq 0 ]; then
          if ! $GPGAGENT 2>/dev/null; then
            $GPGAGENT --daemon --sh > "$PID_FILE"
            . "$PID_FILE"
            echo "INFO::agent started"
          fi
        else
          echo "INFO::agent already running"
        fi
      fi
    fi
    ssh-add
    

But no matter how often I run the whole process, it will always ask me for the passphrase during the sign-process of reprepro. I thought the agent would cache this passphrase and next execution it will be stored and not beeing asked anymore... but it does ask for the passphrase... again and again...

can anyone think of a mistake or something else maybe why it always asks for the passphrase?

6
  • 1
    You are running the gpg-agent as a different user than the build script. Are you sure you have sudo preserving the environment as necessary?
    – depquid
    Commented Jun 18, 2013 at 17:08
  • well, don't really know if that matters. I just put a sudo in front of the calls of the agent in the .bashrc. It asked me for my sudo passwords of course when i logged in and started the agent with id 29338. echo $GPG_AGENT_INFO said "/tmp/gpg-aitI9v/S.gpg-agent:29338:1" means i started the agent as sudo and started the reprepro as sudo. still asking for the passphrase during signing process... thanks for any more help or ideas...!
    – Preexo
    Commented Jun 18, 2013 at 17:25
  • 1
    Where did you run echo $GPG_AGENT_INFO from? Try putting it in your build script and see what it says.
    – depquid
    Commented Jun 18, 2013 at 17:30
  • @depquid Make that an answer so that this question can be marked answered. Commented Jun 18, 2013 at 22:20
  • @HaukeLaging Is it answered? I know what the problem is, but I don't know that the solution has been determined yet. If properly configured, sudo -E might work, but I'm not sure it's secure.
    – depquid
    Commented Jun 19, 2013 at 13:31

0

You must log in to answer this question.

Browse other questions tagged .