Nalin Dahyabhai nalin@redhat.com writes:
On Tue, Jul 27, 2004 at 11:45:40AM -0500, Harry Putnam wrote:
Maybe this other problem regarding ssh I've been noticing is related. In past releases I've been able to put the appropriate pub id's in an ~/.ssh/authorized_keys file and start the ssh-agent while starting X.
How were you doing this?
But creating a file authorized_keys that contains host_reader@/home/reader/.ssh/id_rsa.pub (and id_dsa.pub host_reader@/root/.ssh/id_rsa.pub (and id_dsa.pub)
Then puting that same file in /home/reader/.ssh and /root/.ssh (along with the public ids for: host_fwobsd@/home/reader/.ssh host_fwobsd@/root/.ssh/id_rsa.pub and id_dsa.pub
Note there is no output from: sudo diff /root/.ssh/authorized_keys \ /home/reader/.ssh/authorized_keys
Then all my xterms have ssh-agent running.
How are you verifying that?
I have written a section in /etc/profile.local.sh (my own invention) that is slurped from /etc/profile if caller is root or reader. That is, at a console login this section is read if user is root or reader. And if that is the case the user is queried for some info. Namely the pass code when ssh-add gets run. Consequently any processes started from that login shell (including startx) have the agent running.
That entry looks like:
#!/bin/sh
## SSH_AGENT setup for certain users ## Ask only non ssh and certain users logins if they want this. ## If answered yes then ssh-agent will be running for ## this shell and any processes it spawns can access ## The ssh-agent variables left in /etc/ssh/local_env/SSH_AGENT_ENV.local SSHAGENT=/usr/bin/ssh-agent SSHAGENTARGS="-s" SSH_ADD=/usr/bin/ssh-add SSH_AGENT_ENV=$HOME/.ssh/SSH_AGENT_ENV
trap "kill -KILL $SSH_AGENT_PID && rm -f $SSH_AGENT_ENV" 0
current_user=$(id -un) if [ $current_user = reader -o $current_user = root ];then if [ ! "$SSH_CLIENT" ];then echo "Do you want an authenticated ssh-agent running?" echo "If yes, type `y <ENTER>'. Anything else will" echo "continue login with out ssh-agent." echo -n "ssh-agent? > " read answer if [ "$answer" = y ];then if [ -z "$SSH_AUTH_SOCK" -a -x "$SSHAGENT" ]; then echo "Passed -z SSH_AUTH_SOCK TEST" echo "Running $SSHAGENT $SSHAGENTARGS into $SSH_AGENT_ENV" echo "and sourcing it" $SSHAGENT $SSHAGENTARGS |tee $SSH_AGENT_ENV . $SSH_AGENT_ENV echo "Now running $SSH_ADD" $SSH_ADD fi fi fi fi
and any xterm I open and type `ssh-agent --list' responds with:
SSH_AUTH_SOCK=/tmp/ssh-ZLkKhp5346/agent.5346; export SSH_AUTH_SOCK; SSH_AGENT_PID=5347; export SSH_AGENT_PID; echo Agent pid 5347;
[..]
Further, if I call ssh reader@fwobsd (a remote machine on home lan) it responds with a terminal (no login)
If I login as root answer the above query and ssh root@fwobsd, it responds with a shell (no login)
Hmm. Works from here. Does running ssh with the -v flag give any indication why pubkey authentication fails?
Not that I notice but the output is appended at the end.
When you're prompted for a password,
is ssh requesting your login password or the passphrase to your private key?
Its requesting a normal login password.
Now, some further info. You may notice in the script above any incoming logins originating from ssh will not be queried and hence will not have ssh-agent running. if [ ! "$SSH_CLIENT" ];then
That is coded that way to avoid having all that querying and other output crop up on real remote ssh logins or worse on scp logins where it would completely dork them (scp).
So you might think then that one would not expect a `ssh root@localhost' to bring up a terminal with ssh-agent running. And it doesn't as evidenced below.
The problem is it used too. Prior to FC3. I haven't changed the script in any way. So in the past the calling user terminal must have passed the agent pid to the new root term. (or something similar)
I'm thinking the way SHELL vars are handled in ssh exchange may have changed as has some other behaviors. Maybe something similar to the new `trusted' variables.
reader $ ssh -v root@localhost OpenSSH_3.8.1p1, OpenSSL 0.9.7a Feb 19 2003 debug1: Reading configuration data /etc/ssh/ssh_config debug1: Applying options for * debug1: Connecting to localhost [127.0.0.1] port 22. debug1: Connection established. debug1: identity file /home/reader/.ssh/identity type -1 debug1: identity file /home/reader/.ssh/id_rsa type 1 debug1: identity file /home/reader/.ssh/id_dsa type 2 debug1: Remote protocol version 1.99, remote software version OpenSSH_3.8.1p1 debug1: match: OpenSSH_3.8.1p1 pat OpenSSH* debug1: Enabling compatibility mode for protocol 2.0 debug1: Local version string SSH-2.0-OpenSSH_3.8.1p1 debug1: SSH2_MSG_KEXINIT sent debug1: SSH2_MSG_KEXINIT received debug1: kex: server->client aes128-cbc hmac-md5 none debug1: kex: client->server aes128-cbc hmac-md5 none debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP debug1: SSH2_MSG_KEX_DH_GEX_INIT sent debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY debug1: Host 'localhost' is known and matches the RSA host key. debug1: Found key in /home/reader/.ssh/known_hosts:2 debug1: ssh_rsa_verify: signature correct debug1: SSH2_MSG_NEWKEYS sent debug1: expecting SSH2_MSG_NEWKEYS debug1: SSH2_MSG_NEWKEYS received debug1: SSH2_MSG_SERVICE_REQUEST sent debug1: SSH2_MSG_SERVICE_ACCEPT received debug1: Authentications that can continue: publickey,gssapi-with-mic,password debug1: Next authentication method: gssapi-with-mic debug1: Authentications that can continue: publickey,gssapi-with-mic,password debug1: Authentications that can continue: publickey,gssapi-with-mic,password debug1: Next authentication method: publickey debug1: Offering public key: /home/reader/.ssh/id_rsa debug1: Authentications that can continue: publickey,gssapi-with-mic,password debug1: Offering public key: /home/reader/.ssh/id_dsa debug1: Authentications that can continue: publickey,gssapi-with-mic,password debug1: Trying private key: /home/reader/.ssh/identity debug1: Next authentication method: password root@localhost's password: