LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices

Reply
 
Search this Thread
Old 09-30-2006, 08:36 AM   #1
Sleen
Member
 
Registered: Sep 2005
Location: Kampala,Uganda
Distribution: RHEL,FC,SUSE,UBUNTU
Posts: 41

Rep: Reputation: 15
Lightbulb getting mails from remote mail server is slow,so need an intermediate server


Hi all,
I need a solution to a problem one of my client is having.They have a remote mail server in another country,and getting mails from this server is really slow.So they want an intermediary mail server at their office so that,they can be getting their mails from this second mail server,but then,a copy of the mails should be left on the remote server.Any ideas?Please
 
Old 09-30-2006, 10:07 AM   #2
chadl
Member
 
Registered: Sep 2005
Location: US
Distribution: Gentoo AMD64 Testing
Posts: 129

Rep: Reputation: 16
On my system I have a cron job copy the mail spool file from one server over SCP (Secure copy), and then append it to the mail spool file on my local system. You could just as easily make "local system" a mail server running a POP3 server.

The only thing that is needed for this to work is to have SSH authentication set up using public/private key's (SCP uses the same authentication as SSH), as the background job won't be able to ask for a password. There are a number of tutorials on setting up keyed authentication.
 
Old 09-30-2006, 10:25 AM   #3
Sleen
Member
 
Registered: Sep 2005
Location: Kampala,Uganda
Distribution: RHEL,FC,SUSE,UBUNTU
Posts: 41

Original Poster
Rep: Reputation: 15
Hi Chadl,thanx.I was thinking,can't fetchmail do what you said could be done here above?
 
Old 09-30-2006, 11:28 AM   #4
chadl
Member
 
Registered: Sep 2005
Location: US
Distribution: Gentoo AMD64 Testing
Posts: 129

Rep: Reputation: 16
Quote:
Originally Posted by Sleen
Hi Chadl,thanx.I was thinking,can't fetchmail do what you said could be done here above?
Yes, fetchmail can do exactly the same thing. The only reason that I use SCP in my setup is because my computer is behind a firewall that prevents inbound connections, so I have my computer make an outgoing SCP connection instead.

I also think that the fewer services that I run that are open to the internet, the fewer security holes that my system's could have.

Last edited by chadl; 09-30-2006 at 11:29 AM.
 
Old 09-30-2006, 12:27 PM   #5
Sleen
Member
 
Registered: Sep 2005
Location: Kampala,Uganda
Distribution: RHEL,FC,SUSE,UBUNTU
Posts: 41

Original Poster
Rep: Reputation: 15
Yeah,thats true.I have never used SCP before.Is there suppose to be some configurations at the remote server end,if one was to use SCP?
 
Old 09-30-2006, 03:09 PM   #6
chadl
Member
 
Registered: Sep 2005
Location: US
Distribution: Gentoo AMD64 Testing
Posts: 129

Rep: Reputation: 16
Quote:
Originally Posted by Sleen
Yeah,thats true.I have never used SCP before.Is there suppose to be some configurations at the remote server end,if one was to use SCP?
SCP works over the SSH protocol, so if SSH works, then SCP will also work.

The only requirement that this script adds is that you will need to have public/private key's setup for login, because the script will run in the background and can not accept passwords.
Here is a tutorial covering how to set-up authentication over SSH using keys: http://www.linuxquestions.org/linux/..._Keys_with_SSH

Here is the script that I have running on my computer to get the mail from the remote server:
Code:
#!/bin/bash
scp example.com:/var/spool/mail/chadl /tmp/mail_$$
if [ $? -eq 0 ]&&[ -s /tmp/mail_$$ ]; then
        cat /tmp/mail_$$ >> /usr/spool/mail/chadl
        ssh chadl@example.com "echo -n '' > /var/spool/mail/chadl"
fi
rm /tmp/mail_$$
Note that this script removes the mail from the remote server. In order to change that you can remove line 5 that tells the server to empty the remote mail file.
Just removing this line will cause problems without doing something else, however, as it will result in the same mail being downloaded from the server and thus duplicated on the local mail spool.
I can not think of an easy way to fix this off the top of my head, but I will post if an idea comes to me.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Setting up a mail server to scan mails nightfall_sg Linux - Software 1 10-20-2005 01:11 AM
sending old e-mails into new mail server inbox mush Linux - Newbie 2 10-02-2005 08:58 PM
mail server: just send mails out, but not receive hamish Linux - Software 4 02-27-2005 11:06 AM
can we configure a Linux server with mail server,file server and web server kumarx Linux - Newbie 5 09-09-2004 06:21 AM
Mail Server not accepting mails!! RKris Linux - Networking 5 08-27-2002 06:35 AM


All times are GMT -5. The time now is 03:15 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration