fetchmail-friends
[Top] [All Lists]

[fetchmail]Re: multi-hop ssh

2005-11-16 08:23:12
Matthias Andree wrote:

Derek Broughton <auspex(_at_)pointerstop(_dot_)ca> writes:

Due to "issues" with the $%^*!(_at_)#  firewall at my client's site, I can't
get
out to my mailbox, directly.  So, I'm trying to use fetchmail via ssh in
two hops. This works from home:
  poll pointerstop.ca with proto imap
    plugin "ssh pointers(_at_)%h /usr/sbin/imapd" auth ssh
    user "pointers"

and this works (as user fetchmail)  from the client's site:
  ssh  derek(_at_)io(_dot_)acad(_dot_)athabascau(_dot_)ca \
    'ssh pointers(_at_)pointerstop(_dot_)ca /usr/sbin/imapd'
and seems to meet the criteria for a plugin: I can give it imap commands
on
stdin and get results on stdout.  The ssh keys are configured correctly
so that no passwords are requested.

But this  doesn't:
  poll pointerstop.ca with proto imap
    plugin "ssh derek(_at_)io(_dot_)acad(_dot_)athabascau(_dot_)ca \
      'ssh  pointers(_at_)pointerstop(_dot_)ca /usr/sbin/imapd'"
      auth ssh
    user "pointers"

Syslog shows:
  socket error while fetching from pointerstop.ca

What am I doing wrong?  Is there some really good reason why I can't
do it?

Yes. Line breaks within strings are evil, regardless of the backslash.

Damn.  I've been trying to get this post on the list for weeks.  One version 
clearly said that the line break was purely for the sanity of mail readers 
and really isn't there in the config file.  Unfortunately, that wasn't the 
version that I ended up sending...

For the nonce, write the plugin command on a single line and it should
work (I hope your mailer doesn't wrap this..., it's one line for poll,
one for plugin, one for auth, one for user, totalling four (4)).

It does, but it really is written the way you describe :-)

Attached is the output from both fetchmail (not working) and using ssh 
directly (working, at least as far as getting to IMAP "PREAUTH").  I've 
modified the imap program name - apparently the system has two imap servers, 
and both seemed to find _this_mailbox, but courier-imap was needed for  
others.  

Perhaps my problem is simply that I don't pay enough attention to bash (I have 
to grab a text to write simple scripts).  The "No such file or directory" 
error doesn't seem to point to any component of the command - fully 
qualifying both the ssh commands and the 'mail' directory name doesn't help - 
is it really telling me that bash on _my_ machine is treating all the spaces 
in the line as part of a single command name?

In case the list doesn't actually permit attachments, the same output is in 
clear text below my sig (with line-terminating \ indicating it was wrapped by 
KMail, and isn't wrapped in fact).
-- 
derek

derek(_at_)othello:~$ fetchmail -v
fetchmail: 6.2.5 querying pointerstop.ca (protocol IMAP) at Wed 16 Nov 2005 
10:34:42 AM AST: poll started
fetchmail: running ssh derek(_at_)io(_dot_)acad(_dot_)athabascau(_dot_)ca 'ssh \
 pointers(_at_)pointerstop(_dot_)ca /usr/lib/courier-imap/bin/imapd mail' \
 (host pointerstop.ca service 143)
bash: line 1: ssh pointers(_at_)pointerstop(_dot_)ca 
/usr/lib/courier-imap/bin/imapd \
 mail: No such file or directory
fetchmail: socket error while fetching from pointerstop.ca
fetchmail: 6.2.5 querying pointerstop.ca (protocol IMAP) at Wed 16 Nov 2005 \
 10:34:45 AM AST: poll completed
fetchmail: Query status=2 (SOCKET)
fetchmail: normal termination, status 2
derek(_at_)othello:~$ 


derek(_at_)othello:~$ ssh derek(_at_)io(_dot_)acad(_dot_)athabascau(_dot_)ca 
'ssh \
 pointers(_at_)pointerstop(_dot_)ca /usr/lib/courier-imap/bin/imapd mail'

* PREAUTH Ready.
INFO: LOGIN, user=pointers, ip=[127.0.0.1], protocol=IMAP
a logout
* BYE Courier-IMAP server shutting down
a OK LOGOUT completed


Attachment: dump
Description: Text document

<Prev in Thread] Current Thread [Next in Thread>