|
|||||||||||
|
Re: using a remote IMAP server and smarthost
From: Florian Kulzer <florian.kulzer+debian(at)icfo.es>
Date: Sat Aug 25 2007 - 18:27:32 EDT
OK, I will outline the two methods I know, then you can decide which one you like better. (Don't hesitate to ask for more details if necessary.) In the following I will assume that your ~/.ssh/config is set up such that you can use "ssh myvm" to log in on the vm. (This allows me to keep the command syntax simple and in any case I think it is a good approach in practice.) I would also recommend to set up public key authentication and to use ssh-agent, to avoid having to type your password whenever you send mail. Method 1: You can forward a local port via ssh like this: ssh -N -L 2525:smtp.smarthost.tld:25 myvm This command establishes an ssh connection to myvm. Everything that is sent to port 2525 on your local computer will be forwarded to myvm and then myvm will pass it on to smtp.smarthost.tld, port 25. This is like a mini-VPN for only one port; you have to run this command before you send mail(s) and you can cancel it (CTRL-C) when you are done. Mutt (or any other MUA) on the local computer can now simply be configured to use localhost, port 2525 as its smtp server. To smtp.smarthost.tld, on the other hand, it will seem as if the smtp-connection originates from myvm and it should accept it. The connection works in both directions and all reactions of the smarthost will be sent back to your local computer, port 2525. If the smarthost requires smtps connections from myvm then you have to use port 465 instead of port 25: ssh -N -L 2525:smtp.smarthost.tld:465 myvm and you have to configure mutt or your local MTA accordingly. Method 2: You can set up mutt's sendmail command to use a short script which invokes ssh to run sendmail on myvm directly. This requires that sendmail works on myvm, though. The advantage is that you don't have to do anything else before you send mail (unlike with method 1). It seems that you do not have sendmail fully operational on myvm at the moment, so maybe you will want to stick with method 1 right now. In any case, here is the necessary wrapper script for method 2:
cat - | ssh myvm "/usr/sbin/sendmail -oem -oi $@" ---------- ENDS ABOVE (this line is not part of the script) ---------- -- Regards, | http://users.icfo.es/Florian.Kulzer Florian | -- To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.orgReceived on Sat Aug 25 18:44:36 2007 This archive was generated by hypermail 2.1.8 : Sun Oct 07 2007 - 02:56:25 EDT |
||||||||||
|
|||||||||||