Installation Sendmail / Cyrus IMAP

Installation Cyrus IMAP

cd /usr/ports/mail/cyrus-imapd23
make install clean

   lqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk
   x Options for cyrus-imapd 2.3.18_1                                   x
   x lqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk x
   x x      [*] BDB            Use Berkeley DB                        x x
   x x      [*] IDLED          Enable IMAP idled support              x x
   x mqqqqqqqqqqv(+)qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq93%qqqqqj x
   tqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqu
   x                   <  OK  >          <Cancel>                       x
   mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj

Optionen für Cyrus-SASL

   lqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk
   x Options for cyrus-sasl 2.1.25_1                                    x
   x lqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk x
   x x[*] BDB                 Use Berkeley DB                         x x
   x x[*] MYSQL               Use MySQL                               x x
   x x[ ] PGSQL               Use PostgreSQL                          x x
   x x[ ] SQLITE              Use SQLite                              x x
   x x[ ] SQLITE3             Use SQLite3                             x x
   x x[ ] DEV_URANDOM         Use /dev/urandom                        x x
   x x[ ] ALWAYSTRUE          Enable the alwaystrue password verifier x x
   x x[ ] KEEP_DB_OPEN        Keep handle to Berkeley DB open         x x
   x x[*] OBSOLETE_CRAM_ATTR  Enable cmusaslsecretCRAM-MD5 property   x x
   x x[*] AUTHDAEMOND         Enable use of authdaemon                x x
   x x[*] LOGIN               Enable LOGIN authentication             x x
   x x[*] PLAIN               Enable PLAIN authentication             x x
   x x[*] CRAM                Enable CRAM-MD5 authentication          x x
   x x[*] DIGEST              Enable DIGEST-MD5 authentication        x x
   x x[*] NTLM                Enable NTLM authentication              x x
   x x[*] OTP                 Enable OTP authentication               x x
   x x[*] SCRAM               Enable SCRAM authentication             x x
   x mqqqqv(+)qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq82%qqqqqj x
   tqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqu
   x                   <  OK  >          <Cancel>                       x
   mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj

Konfiguration

/etc/services

Datei /etc/services editieren und folgenden Eintrag hinzufügen (falls nicht bereits vorhanden):

sieve           4190/tcp   #ManageSieve Protocol
sieve           4190/udp   #ManageSieve Protocol

ACHTUNG! Früher war Sieve auf Port 2000.  Der Port hat im Jahr 2009 gewechselt:

7 Dec 2009.... sieve service moves from 2000/tcp to 4190/tcp

/etc/rc.conf

#-----------------------------------------------#
#       Mail Server                             #
#-----------------------------------------------#
# Cyrus
cyrus_imapd_enable="YES"
# Sendmail
sendmail_enable="YES"           # Run the sendmail inbound daemon (YES/NO).
sendmail_submit_enable="YES"    # Start a localhost-only MTA for mail submission

MySQL Anbindung

Cyrus Table erstellen:

CREATE TABLE `cyrus_email` (
  `id` int(11) NOT NULL auto_increment,
  `username` varchar(50) NOT NULL default '',
  `password` varchar(50) NOT NULL default '',
  `real_name` varchar(150) NOT NULL default '',
  `active` tinyint(4) NOT NULL default '1',
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 PACK_KEYS=1;

Eventuell bestehende cyrus_email einträge Importieren (falls der Server neu aufgesetzt wird)

In der mysql DB noch Berechtigungen geben:

MySQL User erstellen:

 INSERT INTO `user` ( `Host` , `User` , `Password` , `Select_priv` , `Insert_priv` , `Update_priv` , 
 `Delete_priv` , `Create_priv` , `Drop_priv` , `Reload_priv` , `Shutdown_priv` , `Process_priv` , `File_priv` , 
 `Grant_priv` , `References_priv` , `Index_priv` , `Alter_priv` , `Show_db_priv` , `Super_priv` , 
 `Create_tmp_table_priv` , `Lock_tables_priv` , `Execute_priv` , `Repl_slave_priv` , `Repl_client_priv` , 
 `ssl_type` , `ssl_cipher` , `x509_issuer` , `x509_subject` , `max_questions` , `max_updates` , `max_connections`
 )
 VALUES (
 'localhost', 'cyrus', PASSWORD( 'yourpass' ) , 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N',
 'N', 'N', 'N', 'N', 'N', 'N', 'N', '', '', '', '', '0', '0', '0'
 );

Berechtigung:

 INSERT INTO `db` VALUES('%', 'Corky_admin', 'cyrus', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y');

Nach Anpassungen an den den Berechtigungen sollte man entweder die Datenbank neu starten oder die forcieren, die Privilegien-Datenbank neu zu laden:

mysqladmin -u root -p flush-privileges 
Enter password:

imapd.conf

Um weiterzufahren, muss man das File /usr/local/etc/imapd.conf anpassen. Welche Änderungen man alle machen kann, erfährt man, indem man man imapd.conf eingibt. Leider fehlen die sasl_sql_* Direktiven.

cp /usr/local/etc/imapd.conf /usr/local/etc/imapd.conf-dist
vi /usr/local/etc/imapd.conf
configdirectory: /var/imap
partition-default: /var/spool/imap
allowplaintext: yes
timeout: 30
poptimeout: 10
admins: admin
autocreatequota: 0
duplicatesuppression: yes
reject8bit: no
sieveusehomedir: false
sievedir: /var/imap/sieve
postmaster: postmaster
sieve_maxscriptsize: 64
sieve_maxscripts: 5
sasl_pwcheck_method: auxprop
sasl_auxprop_plugin: sql
sasl_sql_engine: mysql sasl_sql_hostnames: localhost sasl_sql_user: dbuser sasl_sql_passwd: dbpass sasl_sql_database: Corky_admin sasl_sql_verbose: no sasl_sql_select: SELECT password FROM cyrus_email WHERE username = '%u' AND active='1' sasl_sql_usessl: 0
sasl_mech_list: login plain cram-md5 digest-md5
tls_cert_file: /var/imap/server.pem
tls_key_file: /var/imap/server.pem
tls_ca_file: /var/imap/server.pem
log_level: 1

Damit sich er admin auch im cyradm einloggen kann, muss man in der MySQL Table Corky_admin.cyrus_email noch den user „admin“ erstellen.

cyrus.conf

Das File /usr/local/etc/cyrus.conf muss in der Regel nicht modifziert werden. Es beschreibt, welche Daemons gestartet werden sollen (z.B. imap, imaps, pop3s, etc.) Sollten SQUAT Fehlermeldungen auftauchen im /var/log/messages:

Sep 13 16:35:11 corky imap[32602]: SQUAT failed
Sep 13 16:35:11 corky imap[32602]: SQUAT failed to open index file

kann man das im EVENTS Bereich korrigieren:

EVENTS {
 # this is required
 checkpoint    cmd="ctl_cyrusdb -c" period=30

 # this is only necessary if using duplicate delivery suppression,
 # Sieve or NNTP
 delprune      cmd="cyr_expire -E 3" at=0400

 # this is only necessary if caching TLS sessions
 tlsprune      cmd="tls_prune" at=0400
# for index searches
# get rid of "SQUAT failed to open index file" error uncomment this
# or change to higher debug level in /etc/syslog.conf
#squatter cmd="squatter -r user" period=1440
#squatter        cmd="/opt/cyrus/bin/squatter -r" at=0401
}

Verzeichnisstrukturen erstellen

Anschliessend fürt man als root folgenden befehl aus:

/usr/local/cyrus/bin/mkimap
reading configure file...
i will configure directory /var/imap.
i saw partition /var/spool/imap.
done
configuring /var/imap...
creating /var/spool/imap...
done

Somit wäre mal das Grundgerüst von Cyrus erstellt.

SSL Zertifikat installieren

# rm /var/imap/server.pem 
# openssl req -new -x509 -nodes -out /var/imap/server.pem -keyout /var/imap/server.pem -days 365
Generating a 1024 bit RSA private key
.++++++
.......++++++
writing new private key to '/var/imap/server.pem'
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:CH
State or Province Name (full name) [Some-State]:ZH
Locality Name (eg, city) []:Zürich
Organization Name (eg, company) [Internet Widgits Pty Ltd]:Deine Firma
 Organizational Unit Name (eg, section) []:
Common Name (eg, YOUR name) []:server.example.com <--Wichtig: muss gleich Servername sein!
Email Address []:meine@emailadresse.com
#
chmod 600 /var/imap/server.pem
chown cyrus:cyrus /var/imap/server.pem

Syslog Anpassung

Ich will, dass er nicht die ganzen Logs im /var/log/messages abspeichert, sondern in ein separtes File /var/log/imapd.log Dazu packe ich folgende Zeile ins /etc/syslog.conf rein:

# alles wird geloggt
# local6.debug                                    /var/log/imapd.log
#Damit Loggst Du alles was local6 ist und nicht debug oder info ist nach /var/
#log/cyrus:
local6.*;local6.!=debug;local6.!=info           -/var/log/imapd.log

Erstelle die Datei:

true > /var/log/imapd.log

Und restarte anschliessend syslog:

/etc/rc.d/syslogd restart

Bestehende Mailboxen Importieren

1) Self Scripts kopieren:

cd /usr/local/cyrus/
mkdir self
cd self
scp <username>@oldserver.com:/usr/local/cyrus/self/* .
chown cyrus:cyrus *

2) User vom bestehenden System kopieren:

Alter Server:

/etc/rc.d/sendmail stop
/usr/local/etc/rc.d/imapd stop

tar cvfzpP /var_spool_imap.tar.gz /var/spool/imap
tar cvfzpP /var_imap.tar.gz /var/imap

Neuer Server (Ich speichere meine Mailboxen auf einer Separaten (/data) Partition:

cd /data
scp <username>@oldserver.com:/var_spool_imap.tar.gz .
scp <username>@oldserver.com:/var_imap.tar.gz .
tar xzfv var_spool_imap.tar.gz
tar xzfv var_imap.tar.gz
mv /var/spool/imap/user /var/spool/imap/user_bak
cd /var/spool/imap/
ln -s /data/var/spool/imap .

mv /var/imap/mailboxes.db /var/imap/mailboxes.db.backup cp /data/var/imap/mailboxes.db /var/imap/mailboxes.db chown cyrus:cyrus /var/imap/mailboxes.db

Testen, ob auch alles da ist:

cyradm localhost -u admin
Password: 
localhost.myserver.ch> lm
INBOX (\HasNoChildren)                                                  
user.abfab (\HasNoChildren)                                             
user.cruiser (\HasChildren)                                             
user.cruiser.Registrations (\HasChildren)                               
user.cruiser.Registrations.SearchEngines (\HasNoChildren)               
user.cruiser.Registrations.eurogay (\HasNoChildren)                     
user.cruiser.Registrations.hddialer (\HasNoChildren)                    
user.cruiser.TopLists (\HasNoChildren)                                  
user.cruiser.werbung_von_uns (\H
[..]

4) Sieve Scripts kopieren

cd /var/imap/
cp -r /data/var/imap/sieve/* /var/imap/sieve/
chown cyrus:cyrus /var/imap/sieve/

5) Nun alles testen auf dem neuen Server:

/usr/local/etc/rc.d/imapd start

6) Wenn es keine Fehlermeldungen gibt, die DNS Einträge auf den neuen Mailserver ändern. Auf dem alten Mailserver IMAP nicht mehr starten, damit nicht aus versehen noch Mails angenommen werden.

Installation Sendmail

Vorbereitungen

Pfade für eigene Konfigurationen etc. erstellen:

mkdir /etc/mail/bin
mkdir /etc/mail/my_prefs
mkdir /etc/mail/header  
mkdir /etc/mail/certs 

true > /etc/mail/certs/revocation.list
chmod 600 /etc/mail/certs/revocation.list

Nun die Header Files hinzufügen

access

vi /etc/mail/header/access.header

->paste

#
# With this file you can control the access
# to your mailserver, example:
#
#    cyberspammer.com        550 We don't accept mail from spammers
#    okay.cyberspammer.com   OK
#    sendmail.org            OK
#    128.32                  RELAY
#
# Take a look at /usr/share/sendmail/README for a full description
127.0           RELAY
# Eigenes Relaying für MX
myserver.com        RELAY
# autogenerated entries below

aliases

vi /etc/mail/header/aliases.header

-> paste

# $FreeBSD: src/etc/mail/aliases,v 1.20 2004/06/30 16:47:08 maxim Exp $
#       @(#)aliases     5.3 (Berkeley) 5/24/90
#
#  Aliases in this file will NOT be expanded in the header from
#  Mail, but WILL be visible over networks.
#
#       >>>>>>>>>>      The program "newaliases" must be run after
#       >> NOTE >>      this file is updated for any changes to
#       >>>>>>>>>>      show through to sendmail.
#
#
# See also RFC 2142, `MAILBOX NAMES FOR COMMON SERVICES, ROLES
# AND FUNCTIONS', May 1997

# Pretty much everything else in this file points to "root", so
# you would do well in either reading root's mailbox or forwarding
# root's email from here.

# root: me@my.domain

# Basic system aliases -- these MUST be present
MAILER-DAEMON: postmaster
postmaster: root
root: /dev/null
www:            root

# General redirections for pseudo accounts
_pflogd: root
bin:    root
bind:   root
daemon: root
games:  root
kmem:   root
mailnull: postmaster
man:    root
news:   root
nobody: root
operator: root
pop:    root
proxy:  root
smmsp:  postmaster
sshd:   root
system: root
toor:   root
tty:    root
usenet: news
uucp:   root

# Well-known aliases -- these should be filled in!
# manager:
# dumper:

# BUSINESS-RELATED MAILBOX NAMES
# info:
# marketing:
# sales:
# support:

# NETWORK OPERATIONS MAILBOX NAMES
abuse:  root
# noc:          root
security:       root

# SUPPORT MAILBOX NAMES FOR SPECIFIC INTERNET SERVICES
ftp:            root
ftp-bugs:       ftp
# hostmaster:   root
# webmaster:    root
# www:          webmaster

# NOTE: /var/msgs and /var/msgs/bounds must be owned by sendmail's
#       DefaultUser (defaults to mailnull) for the msgs alias to work.
#
# msgs: "| /usr/bin/msgs -s"

# bit-bucket: /dev/null
# dev-null: bit-bucket
# ---------- BEGIN OF AUTOGENERATED STUFF --------------

sendmail.cw

vi /etc/mail/header/sendmail.cw.header

-> paste

# Lokale Hostnamen, für die Mail angenommen und an einen User auf diesem System gesandt wird
# (kann über /etc/aliases) weitergeleitet werden. Die Datei wird bei neueren Versionen auch
# als /etc/mail/local-host-names gespeichert.
mail.myserver.com
localhost
127.0.0.1
localhost.myserver.com

virtusertable

vi /etc/mail/header/virtusertable.header

-> paste

@mail.myserver.com         root

Installation

Anschliessend im

vi /etc/make.conf

folgendes hinzufügen:

#-----------------------------------------------#
# Sendmail                                      #
#-----------------------------------------------#
SENDMAIL_WITHOUT_IPV6=yes
SENDMAIL_WITHOUT_MILTER=no
SENDMAIL_WITH_TLS=yes
SENDMAIL_WITH_SMTPS=yes
SENDMAIL_WITH_SASL2=yes
SENDMAIL_WITH_CYRUSLOOKUP=yes
SENDMAIL_MC=/etc/mail/my_prefs/corky.mc
SENDMAIL_SUBMIT_MC=/etc/mail/my_prefs/corky.submit.mc
SENDMAIL_CFLAGS+= -DMILTER -DSASL=2
SENDMAIL_LDADD+= -lsasl2

Nun Sendmail aus den Ports installieren:

cd /usr/ports/mail/sendmail-sasl
make install clean

   lqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk
   x Options for cyrus-sasl-saslauthd 2.1.25                            x
   x lqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk x
   x x         [*] BDB       Use Berkeley DB                          x x
   x x         [ ] OPENLDAP  Use OpenLDAP                             x x
   x x         [ ] HTTPFORM  Enable HTTP form authentication          x x
   x mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj x
   tqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqu
   x                   <  OK  >          <Cancel>                       x
   mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj

mailer.conf generieren

FreeBSD benutzt eine Datei namens /etc/mail/mailer.conf um rauszusuchen, welchen Mailer er nehmen soll. Nach der obigen Installation müssen wir daher das entsprechende File anpassen, damit er unser Sendmail aus den Ports nehmen soll, und nicht mehr jene aus der Base installation:

cd /usr/ports/mail/sendmail
make mailer.conf

Output:

/bin/mv /etc/mail/mailer.conf.new  /etc/mail/mailer.conf

Prüfen der Kompilation

Wir möchten nachtürlich wissen, ob Cyrus, SSL, wie auch Milter aktiv ist im Sendmail, denn das sind die wichtigsten drei Sachen, die wir unbedingt haben wollen.

sendmail -d0.1 < /dev/null 
Version 8.14.5
Compiled with: DNSMAP LOG MAP_REGEX MATCHGECOS MILTER MIME7TO8 MIME8TO7
              NAMED_BIND NETINET NETUNIX NEWDB NIS PIPELINING SASLv2 SCANF
              SOCKETMAP STARTTLS TCPWRAPPERS USERDB XDEBUG

Konfiguration

Cyrus SASL / MySQL für Benutzer Authentisierung benutzen

Analog zum /usr/local/etc/imapd.conf richten wir SASL dazu ein, dass man den Benutzernamen ebenfalls mit der gleichen Datenbank authentisieren kann. Dazu erstellen resp. ändern wir das File:

vi /usr/local/lib/sasl2/Sendmail.conf
pwcheck_method: auxprop
auxprop_plugin: sql
sql_engine: mysql
sql_hostnames: localhost
sql_user: cyrus
sql_passwd: <sqlpass>
sql_database: Corky_admin
sql_verbose: no
sql_select: SELECT password FROM cyrus_email WHERE username = '%u' AND active='1'
sql_usessl: 0
mech_list: login plain cram-md5 digest-md5
log_level: 1

Sendmail

Die Konfiguration bei Sendmail geschieht am besten über sogenannte m4 Macros. Man kann, wenn man Lust hat, auch das ganze sendmail.cf von Hand editieren – ist jedoch nicht empfehlenswert, da ein Space und ein Tabulator zuviel oder an der falschen Stelle das ganze Sendmail schon abschalten kann…

Am einfachsten kopiert man /etc/mail/freebsd.submit.mc nach /etc/mail/my_prefs/default.submit.mc und /etc/mail/hostname.mc nach /etc/mail/default.mc (gemäss den Pfaden im /etc/make.conf) und linkt die .cf Dateien schön zurück:

mv /etc/mail/sendmail.cf /etc/mail/sendmail.cf.ORIGINAL
mv /etc/mail/submit.cf /etc/mail/submit.cf.ORIGINAL

mv /etc/mail/freebsd.submit.mc /etc/mail/my_prefs/default.submit.mc
mv /etc/mail/freebsd.mc /etc/mail/my_prefs/default.mc
touch /etc/mail/my_prefs/default.cf
touch /etc/mail/my_prefs/default.submit.cf
ln -s /etc/mail/my_prefs/default.cf /etc/mail/sendmail.cf
ln -s /etc/mail/my_prefs/default.submit.cf /etc/mail/submit.cf 

Anschliessend heisst es, vorallem das default.mc zu editieren. Bei Cyrus gibt es einige Sachen, die man speziell anpassen muss. Hier ist mein default.mc für einen Überblick der Funktionen.

Und wenn alles gut geklappt hat, kann man so schnell das ganze .cf File erstellen/editeren und anschliessend installieren lassen:

cd /etc/mail/
make cf install

Output:

/usr/bin/m4 -D_CF_DIR_=/usr/share/sendmail/cf/   /usr/share/sendmail/cf/m4/cf.m4 /etc/mail/my_prefs/corky.mc > /etc/mail/my_prefs/corky.cf
/usr/bin/m4 -D_CF_DIR_=/usr/share/sendmail/cf/   /usr/share/sendmail/cf/m4/cf.m4 /etc/mail/my_prefs/corky.submit.mc > /etc/mail/my_prefs/corky.submit.cf
install -m 444 /etc/mail/my_prefs/corky.cf /etc/mail/sendmail.cf
install: /etc/mail/my_prefs/corky.cf and /etc/mail/sendmail.cf are the same file
*** Error code 64

Stop in /etc/mail.

–> Fehler ignorieren, wenn die .cf files erstellt worden sind.  Sind die Files nicht erstellt worden, einfach eine kleine Modifikation (z.B. dnl## ) in den *.mc hinzufügen, dann nochmals make cf install ausführen. Dann sollten die CF Files generiert werden.

SSL Zertifikat

openssl req -newkey rsa:1024 -keyout /etc/mail/certs/mycert.pem -nodes -x509 -days 365 -out  /etc/mail/certs/cacert.pem


Generating a 1024 bit RSA private key ................................................++++++ ...................++++++ writing new private key to '/etc/mail/certs/mycert.pem' ----- You are about to be asked to enter information that will be incorporated into your certificate request. What you are about to enter is what is called a Distinguished Name or a DN. There are quite a few fields but you can leave some blank For some fields there will be a default value, If you enter '.', the field will be left blank. ----- Country Name (2 letter code) [AU]:CH State or Province Name (full name) [Some-State]:ZH Locality Name (eg, city) []:Zürich Organization Name (eg, company) [Internet Widgits Pty Ltd]:Meine Firma GmbH Organizational Unit Name (eg, section) []: Common Name (eg, YOUR name) []:name.myserver.com <-- Wichtig: muss gleich Servername sein! Email Address []:meine@emailadresse.com echo "" >> /etc/mail/certs/mycert.pem cat /etc/mail/certs/cacert.pem >> /etc/mail/certs/mycert.pem

Anschliessend nur noch die Berechtigungen richtig anpassen:

chmod 400 /etc/mail/certs/*

sendmailmake

Dieses kleine hilfreiche Tool hab ich von Steven. Es generiert alle nötigen Sendmail Files aus der MySQL Datenbank heraus.

Mysql Tables erstellen:
# --------------------------------------------------------
#
# Table structure for table `mail_add_cyrus_sasl`
#

CREATE TABLE `mail_add_cyrus_sasl` (
  `id` int(11) NOT NULL auto_increment,
  `username` varchar(250) NOT NULL default '',
  `password` varchar(250) NOT NULL default '',
  `active` tinyint(4) NOT NULL default '0',
  PRIMARY KEY  (`id`),
  UNIQUE KEY `id_2` (`id`),
  UNIQUE KEY `username` (`username`),
  KEY `id` (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 PACK_KEYS=1;

# --------------------------------------------------------

#
# Table structure for table `mail_alias_entries`
#

CREATE TABLE `mail_alias_entries` (
  `id` int(4) NOT NULL auto_increment,
  `username` varchar(50) NOT NULL default '',
  `alias` text NOT NULL,
  `domain` varchar(50) NOT NULL default '',
  PRIMARY KEY  (`id`),
  UNIQUE KEY `username` (`username`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 PACK_KEYS=1;

# --------------------------------------------------------

#
# Table structure for table `mail_auto_replys`
#

CREATE TABLE `mail_auto_replys` (
  `id` int(11) NOT NULL auto_increment,
  `user` varchar(50) NOT NULL default '',
  `message` text NOT NULL,
  `active` tinyint(4) NOT NULL default '0',
  PRIMARY KEY  (`id`),
  UNIQUE KEY `id_2` (`id`),
  KEY `id` (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 PACK_KEYS=1;

# --------------------------------------------------------

#
# Table structure for table `mail_domain_forwarding`
#

CREATE TABLE `mail_domain_forwarding` (
  `id` int(11) NOT NULL auto_increment,
  `source_domain` varchar(50) NOT NULL default '',
  `destination_domain` varchar(50) NOT NULL default '',
  PRIMARY KEY  (`id`),
  UNIQUE KEY `id_2` (`id`),
  KEY `id` (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 PACK_KEYS=1;

# --------------------------------------------------------

#
# Table structure for table `mail_entries`
#

CREATE TABLE `mail_entries` (
  `id` int(11) NOT NULL auto_increment,
  `comment` text NOT NULL,
  `username` varchar(50) NOT NULL default '',
  `password` varchar(50) NOT NULL default '',
  `domain` varchar(50) NOT NULL default '',
  `alias` varchar(50) NOT NULL default '',
  `is_active` tinyint(4) NOT NULL default '1',
  `is_admin` tinyint(4) NOT NULL default '0',
  PRIMARY KEY  (`id`),
  UNIQUE KEY `id_2` (`id`),
  KEY `id` (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 PACK_KEYS=1;

# --------------------------------------------------------

#
# Table structure for table `mail_mx_entries`
#

CREATE TABLE `mail_mx_entries` (
  `id` int(11) NOT NULL auto_increment,
  `domain` varchar(150) NOT NULL default '',
  UNIQUE KEY `domain` (`domain`),
  UNIQUE KEY `id` (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='MX Eintr?ge';

# --------------------------------------------------------

#
# Table structure for table `nonexisting_email`
#

CREATE TABLE `nonexisting_email` (
  `id` int(11) NOT NULL auto_increment,
  `nonexist` varchar(250) NOT NULL default '',
  `message` varchar(250) NOT NULL default 'error:nouser No such User here!',
  UNIQUE KEY `id` (`id`),
  KEY `nonexist` (`nonexist`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
Installation

sendmail-build-autoresponder.tar.gz downloaden und installieren:

cd /usr/local/software
fetch http://www.teslina.com/wp-content/uploads/2012/03/sendmail-build-autoresponder.tar.gz
tar xzfv sendmail-build-autoresponder.tar.gz
Konfiguration

DB username/passwd etc. anpassen:

cd sendmail-build-autoresponder-new
vi header.h

nun das Sendmailmake generieren und ins /etc/mail/bin Verzeichnis kopieren:

make # <- warnings einfach ignorieren
cp sendmailmake /etc/mail/bin/

jetzt noch das sendmailmake ausführen

/etc/mail/bin/sendmailmake

Starten/Testen

Alias im .bashrc hinzufügen:

cd
vi .bashrc 
alias rcsendmail='/etc/rc.d/sendmail'

Starte Cyrus

/usr/local/etc/rc.d/imapd start

Starte Sendmail

rcsendmail start

Testen

# telnet localhost imap

Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
* OK [CAPABILITY IMAP4 IMAP4rev1 LITERAL+ ID STARTTLS AUTH=LOGIN AUTH=PLAIN AUTH=CRAM-MD5 AUTH=DIGEST-MD5 SASL-IR COMPRESS=DEFLATE]
my.testserver.ch Cyrus IMAP v2.3.16 server ready . login <mail username> <mail password> . OK [CAPABILITY IMAP4 IMAP4rev1 LITERAL+ ID LOGINDISABLED COMPRESS=DEFLATE ACL RIGHTS=kxte QUOTA MAILBOX-REFERRALS NAMESPACE UIDPLUS NO_ATOMIC_RENAME UNSELECT CHILDREN MULTIAPPEND BINARY SORT SORT=MODSEQ THREAD=ORDEREDSUBJECT THREAD=REFERENCES ANNOTATEMORE CATENATE CONDSTORE SCAN IDLE URLAUTH] User logged in

um telnet zu verlassen:

. logout
# telnet localhost 110

Trying 127.0.0.1...
Connected to localhost. Escape character is '^]'. +OK my.testserver.ch Cyrus POP3 v2.3.16 server ready <4056458412.1126900089@my.testserver.ch> user <mail username> +OK Name is a valid mailbox pass <mail pass> +OK Mailbox locked and ready stat +OK 47 2630366 quit +OK Connection closed by foreign host.

x

Flattr this!

  • Hallo
    #1 geschrieben von Hallo vor 3 Jahren

    Manche Deiner Anleitungen sind ja ganz nett. Aber diese hier kann man echt überhaupt nicht gebrauchen. Einige Sachen fehlen, andere Sachen sind falsch und wieder andere Sachen sind vollkommen unnötig.

  • *

    Du kannst diese HTML tags verwenden: <a> <abbr> <acronym> <b> <blockquote> <cite> <code> <del> <em> <i> <q> <s> <strike> <strong>

  • Kommentar-Feed für diesen Beitrag
nach oben