>
> My server is a standard Debian :
>
> [email protected]:~$ cat /etc/debian_version 
> 7.3
>
>
> I looked into the man page of bash and it says this :
>
> *Bash attempts to determine when it is being run with its standard input 
> connected to a network connection, as  when*
> *       executed by the remote shell daemon, usually rshd, or the secure 
> shell daemon sshd.  If bash determines it is being*
> *       run in this fashion, it reads and executes commands from ~/.bashrc 
> and ~/.bashrc, if  these  files  exist  and  are*
> *       readable.   It  will not do this if invoked as sh.  The --norc 
> option may be used to inhibit this behavior, and the*
> *       --rcfile option may be used to force another file to be read, but 
> rshd does not generally  invoke  the  shell  with*
> *       those options or allow them to be specified.*
>
> I added some echo commands to my .bashrc to do some checks :
>
> This is the begining of my /home/rvm_admin/.bashrc file :
>
> # ~/.bashrc: executed by bash(1) for non-login shells.
> # see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
> # for examples
>
> # These are my echo command checks
> echo '=== Execution of /home/rvm_admin/.bashrc ==='
> [[ $- == *i* ]] && echo 'Interactive' || echo 'Not interactive'
> shopt -q login_shell && echo 'Login shell' || echo 'Not login shell'
> echo "Agent forwarding ? => SSH_AUTH_SOCK = $SSH_AUTH_SOCK"
> echo '=== End of echo commands by Douglas ==='
>
>
> # If not running interactively, don't do anything
> case $- in
>     *i*) ;;
>       *) return;;
> esac
>
>
> ...
>
> As you can see the original standard .bashrc file will do nothing if the 
> shell is a non-intercative one.
>
> I made two more tests :
> 1 - standard login ssh connection
> 2 - execute a custom capistrano's task
>
> Here it is the output of my first test :
>

=== Lancement du script /etc/profile.d/rvm.sh ===
=== Execution of /home/rvm_admin/.bashrc ===
Interactive
Login shell
Agent forwarding ? => SSH_AUTH_SOCK = /tmp/ssh-KayxUr7HFP/agent.12938
=== End of echo commands by Douglas ===

 Here is the custom capistrano's task I execute :

    desc "Check if agent forwarding is working"
    task :forwarding do
      on roles(:all) do |h|
        if test("env | grep SSH_AUTH_SOCK")
          info "Agent forwarding is up to #{h}"
        else
          error "Agent forwarding is NOT up to #{h}"
        end
      end
    end

Here it is the output I got :

douglas@bilbo:/var/www/odpf$ bundle exec cap production test_odpf:forwarding
DEBUG [592e7884] Running /usr/bin/env env | grep SSH_AUTH_SOCK on myserver.
net
DEBUG [592e7884] Command: env | grep SSH_AUTH_SOCK
DEBUG [592e7884] === Execution of /home/rvm_admin/.bashrc ===
DEBUG [592e7884] Not interactive
DEBUG [592e7884] Not login shell
DEBUG [592e7884] Agent forwarding ? => SSH_AUTH_SOCK = 
DEBUG [592e7884] === End of echo commands by Douglas ===
DEBUG [592e7884] Finished in 0.612 seconds with exit status 1 (failed).
ERROR Agent forwarding is NOT up to myserver.net

At least I can see that agent forwarding is not working when I run a 
capistrano's task.
Though if I perform this test,  it works :

douglas@bilbo:/var/www/odpf$ ssh -p 8888 -A [email protected] 'git 
ls-remote [email protected]:mycount/myapp.git'
Host key fingerprint is 83:50:33:be:08:34:e6:f4:00:68:ac:57:d0:74:c0:a8
+--[ RSA 2048]----+
|       .X=C..    |
|      o  .+..    |
|     D ...OE     |
|      o....*     |
|      ..S = .    |
|       . - .     |
|        . .      |
|                 |
|                 |
+-----------------+


=== Execution of /home/rvm_admin/.bashrc ===
Not interactive
Not login shell
Agent forwarding ? => SSH_AUTH_SOCK = /tmp/ssh-dJ9dOKEhxE/agent.13224
=== End of echo commands by Douglas ===
e415894551dc656f79e95cdf3051223123553d40 HEAD
d872b0402c015ee40ac469e24ac78c1cffd6b8c4 refs/heads/xxxxxx
6a0f8618f17aabbe1e801be9f9a57f55dd84f6b4 refs/heads/xxxxxx
a81b96a9362ad28bd3aef3d6014e6e6791ee3a6c refs/heads/xxxxxx
0d097d9f87f8516bfec3985b6c8b1b5ed011c7b2 refs/heads/xxxxxx
0116b9fd3cd8b38e932832baf68f926be2513618 refs/heads/xxxxxx
e415894551dc656f79e95cdf3051223123553d40 refs/heads/xxxxxx
dafa8fd1c86426b2ced0f4a47c9bc7e8172540f8 refs/heads/xxxxxx
e33a87233763e7b4a1deb3c552fe02cbe18f3501 refs/heads/xxxxxx
696a9f5f79e01f1c1e0f29b6f8cb512519b489f1 refs/heads/xxxxxx
f337186b34723b3b9d1beb71f16161086ea30f44 refs/heads/xxxxxx
e415894551dc656f79e95cdf3051223123553d40 refs/heads/xxxxxx
e3d0196766ffacccce698817dfee4fea17f0ed9f refs/heads/xxxxxx
1e4c3c504a64699d8518ab67bca8f67e3bbcab51 refs/heads/xxxxxx
700ab704ec38a99fea44b013ccac97eb9168b866 refs/heads/xxxxxx
09496198b4dc93cffeaf7137c8f94aafa36e7148 refs/heads/xxxxxx

I don't understand why the agent-forwarding works in one case, but not with 
capistrano ?


-- 
You received this message because you are subscribed to the Google Groups 
"Capistrano" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/capistrano/0f513186-7594-4695-bb61-1721731c8211%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to