Code Monkey home page Code Monkey logo

fetchmail-ldap's Introduction

fetchmail-ldap

OpenLDAP schema to dynamically generate a configuration file to poll mails via fetchmail .

Attributes

  • fetchmailEnabled >> TRUE or FALSE - used to deteced if the entry should be parsed or not
  • fetchmailServer >> DNS-Name of the Mailserver (but also works with IP-Addresses)
  • fetchmailProtocol >> e.g. pop3, imap or any other protocol supported by fetchmail
  • fetchmailUsername >> Username of the mailbox you're connecting to
  • fetchmailPassword >> same as above
  • fetchmailCustom >> add any additionial commands like nokeep fetchall
  • fetchmailSSL >> TRUE or FALSE - set this to enable SSL support

Expected DIT

Basically you should have two Trees:

  • one with the global settings used for each individual user, like fetchmailServer, fetchmailProtocol and fetchmailCustom
  • another tree with the actual users (should be inetOrgPerson). These must have at least added fetchmail to ObjectClass and a valid mail attribute. Usually you also add the attributes fetchmailUsername and fetchmailPassword

So the tree looks like:

dc=foo,dc=bar
|_ ou=Templates 
|  |_ cn=fetchmailDefaults
|     |_ fetchmailEnabled = true
|     |_ fetchmailServer = pop.myserver.com
|     |_ fetchmailProtocol = pop3
|     |_ fetchmailCustom = nokeep fetchall
|     |_ fetchmailSSL = false
|     |_ sn = Fetchmail Default Values
|     |_ objectClass = top, inetOrgPerson, fetchmail
|_ ou=Users
   |_ uid=testuser
      |_ mail = [email protected]
      |_ fetchmailEnabled = true
      |_ fetchmailUsername = testuser
      |_ fetchmailPassword = topSecret
      |_ fetchmailSSL = true <-- This would overwrite the Default-Settings

This will generate the following line that will be passed to fetchmail:

poll pop.myserver.com proto pop3 user testuser pass toSecret is [email protected] here nokeep fetchall ssl

Add Schema

Method 1:

add this line to /etc/ldap/slapd.conf: include /etc/ldap/schema/fetchmail.schema

Method 2:

ldapadd -Y EXTERNAL -H ldapi:/// -f /etc/ldap/schema/fetchmail.ldif

Edit Settings

fetchmail.sh

Change

  • BASE_DN
  • BASE_DEFAULTS
  • BASE_USERS

that it fits your LDAP configuration.

Test it!

Run fetchmail.sh and take a look at the output - it should be similiar to the poll ... line.

If everything is fine setup a Cronjob to invoke the script:

*/5 * * * * /usr/local/bin/fetchmail.sh | fetchmail -f -

Developers Homepage

Vist: http://leckerbeef.de/fetchmail-ldap-integration/

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.