[plug] Fetchmail Config

Russell russellsteicke at gmail.com
Fri Apr 13 13:48:56 WST 2007


On 4/12/07, Chris Watt <something.rotten at gmail.com> wrote:
> Hi Guys,
>
> I'm at a bit of a loss to how Fetchmail works with configuration
> (Probably just not reading the man pages and internet properly!)
>
> What I have is the following:
> An OTRS install that uses fetchmail to retrieve IMAPS e-mail from a
> server in Germany and pipe it into OTRS for processing.
>
> I can't seem to work out where I should be storing the .fetchmailrc
> files and how to run a cron job on it ever 3 to 5 minutes.

(I should point out that I don't know what OTRS means here, and that
may afect my answer.)

You could put a .fetchmailrc in each user's home directory.  Each one
would contain something like:

set daemon 300
poll mail.foo.bar
    proto imap
    user "itsme"
    password "secret"
    fetchall
    ssl
    forcecr
    set syslog

IMAP will negotiate SSL encryption after the initial connection is
made.  The ssl line makes fetchmail look for this.  "set daemon 300"
puts fetchmail in daemon mode, where it will run continuously and
sleep for 300 seconds between each poll.  Look at the fetchmail man
page for the other stuff.

To start the daemons, you could put this into each user's crontab:

  @reboot   fetchmail
  1 * * * * fetchmail

which will start a per-user fetchmail daemon at reboot and then once
per hour make sure it's running.  (If you run fetchmail when there's
already a daemon running, it will merely wake up the existing daemon.
Also, @reboot is a vixie cron extension, but I _think_ vixie cron is
fairly common on Linux distributions.  It seems to be the default on
debian.)

Watch that you don't create a large load at the far end by starting
all the daemons at once.  Assuming your cron jobs run with bash, you
could do this:

  @reboot   sleep $((RANDOM \% 300)) && fetchmail
  1 * * * * sleep $((RANDOM \% 300)) && fetchmail

Alternatively, put each user's information into /etc/fetchmailrc, and
run one daemon with that configuration file.  I don't run fetchmail
this way, and I'm not sure how to configure it like that.

> The server in Germany also has an SSL certificate that is signed
> internally (thereofre browsers and mail clients always throw up a
> screen asking to accept the certificate).  Withh fetchmail stop at
> this point, or is there a way that I can force accept it?

The self-signed certificate will make fetchmail put a line in the log like:

Apr 13 13:30:39 maggie fetchmail[407]: Server certificate verification
error: self signed certificate

each time it connects.  There is no other effect.






-- 
Virus found in this message.



More information about the plug mailing list