🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #81742

Re: Authentication for rsync over ssh failing

#81742
From: John F. Morse
Date: Tue, 04 Aug 2009 20:49
211 lines
10307 bytes
Ray Banana wrote:
> Thus spake "John F. Morse" <john@example.invalid>
>  
>   
>> As I mentioned at the end of that paragraph, "There are no improper
>> ownerships nor permissions." This is the first thing that I checked.
>> drwx------  2 news news   136 2009-08-03 23:46 .ssh
>> -rw-------  1 news news  395 2009-08-03 20:09 authorized_keys
>>     
>
> Can you try ssh -v, as it will give you lots of debug information that
> might shed some light on the cause of this problem?
>   


That works.

------------------------------------------------------------------------

news@apache:~/.ssh$ ssh -v inn2
OpenSSH_5.1p1 Debian-5, OpenSSL 0.9.8g 19 Oct 2007
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Connecting to inn2 [xx.xx.xx.xx] port 22.
debug1: Connection established.
debug1: identity file /var/spool/news/.ssh/identity type -1
debug1: identity file /var/spool/news/.ssh/id_rsa type 1
debug1: Checking blacklist file /usr/share/ssh/blacklist.RSA-2048
debug1: Checking blacklist file /etc/ssh/blacklist.RSA-2048
debug1: identity file /var/spool/news/.ssh/id_dsa type -1
debug1: Remote protocol version 2.0, remote software version
OpenSSH_5.1p1 Debian-5
debug1: match: OpenSSH_5.1p1 Debian-5 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.1p1 Debian-5
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 'inn2' is known and matches the RSA host key.
debug1: Found key in /var/spool/news/.ssh/known_hosts:7
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,password
debug1: Next authentication method: publickey
debug1: Trying private key: /var/spool/news/.ssh/identity
debug1: Offering public key: /var/spool/news/.ssh/id_rsa
debug1: Server accepts key: pkalg ssh-rsa blen 277
debug1: read PEM private key done: type RSA
debug1: Authentication succeeded (publickey).
debug1: channel 0: new [client-session]
debug1: Requesting no-more-sessions@openssh.com
debug1: Entering interactive session.
debug1: Sending environment.
debug1: Sending env LANG = en_US.UTF-8
Linux inn2 2.6.26-2-486 #1 Sun Jun 21 04:15:19 UTC 2009 i586

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Sun Jul  5 10:06:28 2009 from n100.xanadu-bbs.net
news@inn2:~$

------------------------------------------------------------------------

But this doesn't work (here using two rsync -v verbose options for
additional debugging output):

news@apache:~/.ssh$ rsync -avvzn -e "ssh -i
/var/spool/news/.ssh/authorized_keys" news@inn2:/var/spool/news/testfile
/var/spool/news/.ssh/
opening connection using: ssh -i /var/spool/news/.ssh/authorized_keys -l
news inn2 rsync --server --sender -vvnlogDtprze.iL .
/var/spool/news/testfile
Enter passphrase for key '/var/spool/news/.ssh/authorized_keys':
news@inn2's password:
receiving incremental file list
delta-transmission enabled
testfile
total: matches=0  hash_hits=0  false_alarms=0 data=0

sent 14 bytes  received 108 bytes  18.77 bytes/sec
total size is 0  speedup is 0.00 (DRY RUN)
news@apache:~/.ssh$

------------------------------------------------------------------------

One caveat that bothers me from what I remember during my first
encounter with rsync a few years ago, is where it is stated rsync could
not copy files between two remotes. The rsync(1) man page states:

GENERAL
       Rsync  copies  files  either to or from a remote host, or locally
on the current host
       (it does not support copying files between two remote hosts).

I understand this to mean I cannot run rsync on computer A to copy files
from computer B to computer C, such as:

"news@A:~/.ssh rsync -avz news@B:/var/spool/news/testfile
news@C:/var/spool/news/testfile"

I do not think the restriction applies when I connect, via ssh, from
computer A to computer C, and run rsync on computer C to connect to
computer B to copy files from B to C.

But there may be some security built into rsync that is prohibiting
copying when the controlling is from a remote PC, in this case an
incoming ssh session from computer A. I don't know.

If you (or any other reader) can verify that it is indeed possible to
rsync from a remote computer, while running rsync in a ssh session from
a third computer, then I can go to the Apache server, plug in a monitor
and keyboard, and try the test there.

If this is indeed the problem, then after a successful test (from apache
with a monitor and keyboard), the rsync should be able to work with a
cron job on apache (since that would be "local").

To further back up my belief that ownerships, permissions, and the RSA
keys are all correct, here is a successful rcp/scp transfer (with -v)
from inn2 running on apache, via a remote ssh session:

------------------------------------------------------------------------

news@apache:~$ rcp news@inn2:/var/spool/news/testfile .
testfile                                                                         
100%    0     0.0KB/s   00:00   
news@apache:~$ rcp -v news@inn2:/var/spool/news/testfile .
Executing: program /usr/bin/ssh host inn2, user news, command scp -v -f
/var/spool/news/testfile
OpenSSH_5.1p1 Debian-5, OpenSSL 0.9.8g 19 Oct 2007
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Connecting to inn2 [xx.xx.xx.xx] port 22.
debug1: Connection established.
debug1: identity file /var/spool/news/.ssh/identity type -1
debug1: identity file /var/spool/news/.ssh/id_rsa type 1
debug1: Checking blacklist file /usr/share/ssh/blacklist.RSA-2048
debug1: Checking blacklist file /etc/ssh/blacklist.RSA-2048
debug1: identity file /var/spool/news/.ssh/id_dsa type -1
debug1: Remote protocol version 2.0, remote software version
OpenSSH_5.1p1 Debian-5
debug1: match: OpenSSH_5.1p1 Debian-5 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.1p1 Debian-5
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 'inn2' is known and matches the RSA host key.
debug1: Found key in /var/spool/news/.ssh/known_hosts:7
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,password
debug1: Next authentication method: publickey
debug1: Trying private key: /var/spool/news/.ssh/identity
debug1: Offering public key: /var/spool/news/.ssh/id_rsa
debug1: Server accepts key: pkalg ssh-rsa blen 277
debug1: read PEM private key done: type RSA
debug1: Authentication succeeded (publickey).
debug1: channel 0: new [client-session]
debug1: Requesting no-more-sessions@openssh.com
debug1: Entering interactive session.
debug1: Sending environment.
debug1: Sending env LANG = en_US.UTF-8
debug1: Sending command: scp -v -f /var/spool/news/testfile
Sending file modes: C0644 0 testfile
Sink: C0644 0 testfile
testfile                                                                         
100%    0     0.0KB/s   00:00   
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug1: client_input_channel_req: channel 0 rtype eow@openssh.com reply 0
debug1: channel 0: free: client-session, nchannels 1
debug1: fd 0 clearing O_NONBLOCK
debug1: fd 1 clearing O_NONBLOCK
Transferred: sent 2352, received 2408 bytes, in 0.1 seconds
Bytes per second: sent 19075.1, received 19529.3
debug1: Exit status 0
news@apache:~$

------------------------------------------------------------------------

The above worked great.

It seems that rsync is the problem, and rsync is needed because I only
want to copy the new daily report status files each day, not the
complete archive.


-- 
John
Technical Details
Message-ID: <h5a6rs$76m$1@optima5.xanadu-bbs.net>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.20141118.mbox.gz!border1.nntp.ams.giganews.com!nntp.giganews.com!news-out2.kabelfoon.nl!newsfeed.kabelfoon.nl!xindi.nntp.kabelfoon.nl!news.glorb.com!news2.glorb.com!optima2.xanadu-bbs.net!optima5.xanadu-bbs.net!not-for-mail
References: <h58ftm$ndc$1@optima5.xanadu-bbs.net> <80ocqwqgiy.fsf@banana.shacknet.nu> <h58lfi$oq5$1@optima5.xanadu-bbs.net> <80d47cxdyr.fsf@banana.shacknet.nu>

Show Full Headers
Complete Article Headers
Message-ID: <h5a6rs$76m$1@optima5.xanadu-bbs.net>
Subject: Re: Authentication for rsync over ssh failing
Date: Tue, 04 Aug 2009 15:49:00 -0500
From: "John F. Morse" <john@example.invalid>
References: <h58ftm$ndc$1@optima5.xanadu-bbs.net> <80ocqwqgiy.fsf@banana.shacknet.nu> <h58lfi$oq5$1@optima5.xanadu-bbs.net> <80d47cxdyr.fsf@banana.shacknet.nu>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.20141118.mbox.gz!border1.nntp.ams.giganews.com!nntp.giganews.com!news-out2.kabelfoon.nl!newsfeed.kabelfoon.nl!xindi.nntp.kabelfoon.nl!news.glorb.com!news2.glorb.com!optima2.xanadu-bbs.net!optima5.xanadu-bbs.net!not-for-mail
Newsgroups: news.software.nntp
Organization: Xanadu BBS
Lines: 211
Reply-To: dont.bother
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-Trace: optima5.xanadu-bbs.net 1249418940 7382 192.168.89.210 (4 Aug 2009
X-Complaints-To: newsmaster@xanadu-bbs.net
NNTP-Posting-Date: Tue, 4 Aug 2009 20:49:00 +0000 (UTC)
User-Agent: Thunderbird 2.0.0.22 (X11/20090608)
In-Reply-To: <80d47cxdyr.fsf@banana.shacknet.nu>
X-Enigmail-Version: 0.96.0