PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : Postfix.. Kann keine Mails verschicken



brave_snoopy
08.03.07, 21:27
Guten Abend,
ich habe einen Postfix Server auf einem Debian Sarge System nach dieser Anleitung installiert und eingerichtet : http://workaround.org/articles/ispmail-sarge/index.shtml.de#tabellen_anlegen

Wenn ich mich nun per telnet auf den port 25 des mailservers verbinde.

ein helo server schicke, wird mir dieses bestätigt.
sobald ich aber nun mail from:bla@gmx.de eintrage und enter drücke, passiert ncihts. es kommt weder ein sender ok noch das der sender nicht akzeptiert wird.

in meiner /var/log/mail.err steht folgendes:




Mar 6 07:23:10 localhost postfix/trivial-rewrite[25434]: fatal: /etc/postfix/mysql-virtual_domains.cf: bad string length 0 < 1: where_field =

Mar 6 07:24:11 localhost postfix/trivial-rewrite[25438]: fatal: mysql:/etc/postfix/mysql-virtual_domains.cf(0,100): table lookup problem



Meine mysql-virtual_domains.cf sieht so aus.



cat mysql-virtual_domains.cf
user = user
password = user
dbname = mail
table = domains
select_field = 'virtual'
where_field = domain
hosts = 127.0.0.1


eigentlich sollte dort doch kein Fehler sein?

In der Tabelle mail/domains hab ich eine Domain eingetragen: test.local eingetragen. sollte ja eigentlich auch recht egal sein.

Der MySQL Server läuft auch einwandfrei.

yops
08.03.07, 21:42
Seltsam - sieht eigentlich alles okay aus. Wenn ich die Fehlermeldung des maillog richtig interpretiere, kommt es gar nicht bis zur Datenbankabfrage, sondern er stößt sich an dem Eintrag in der mysql-virtual_domains.cf. Kannst du die Datei mal löschen und neu erstellen?

brave_snoopy
08.03.07, 21:58
hab die Datei gelöscht. neu angelegt und alles nochmal reingeschrieben. danach postfix neugestartet.

leider kein Erfolg.

Hatte vorher noch die /var/log/mail.err gelöscht, diese wurde bis jetzt aber noch nicht wieder angelegt.

yops
08.03.07, 22:48
Schade :( Vielleicht fällt mir ja noch was im Bettchen ein ;) Kannst du mal deine übrigen Konfigurationdateien posten? Ääääh - Postfix hast du nach dem Löschen und neu erstellen der Datei neu gestartet?

mail.err: Postfix neu starten?

brave_snoopy
09.03.07, 00:53
ja hatte ich neugestartet.. ich poste die dateien mal heute nachmittag :)

brave_snoopy
09.03.07, 12:49
also die mail.err ist wieder da und es taucht nur noch nen tablelookup Problem auf.

meine main.cf sieht so aus:



cat main.cf
# See /usr/share/postfix/main.cf.dist for a commented, more complete version

smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
biff = no

# appending .domain is the MUA's job.
append_dot_mydomain = no

# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h

myhostname = web201.oftecs.de
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination =

virtual_mailbox_domains = mysql:/etc/postfix/mysql-virtual_domains.cf
virtual_mailbox_maps = mysql:/etc/postfix/mysql-virtual_mailboxes.cf
virtual_mailbox_base = /home/vmail
virtual_uid_maps = static:5000
virtual_gid_maps = static:5000

smtpd_auth_enable = yes
smtpd_recipient_restrictions = permit_authenticated, reject_unauth_destination


mynetworks = 127.0.0.0/8
mailbox_command = procmail -a "$EXTENSION"
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all



meine my.cnf sieht soaus:



cat my.cnf
# Example MySQL config file for medium systems.
#
# This is for a system with little memory (32M - 64M) where MySQL plays
# an important part, or systems up to 128M where MySQL is used together with
# other programs (such as a web server)
#
# You can copy this file to
# /etc/my.cnf to set global options,
# mysql-data-dir/my.cnf to set server-specific options (in this
# installation this directory is /opt/lampp/var/mysql) or
# ~/.my.cnf to set user-specific options.
#
# In this file, you can use all long options that a program supports.
# If you want to know which options a program supports, run the program
# with the "--help" option.

# The following options will be passed to all MySQL clients
[client]
#password = your_password
port = 3306
socket = /opt/lampp/var/mysql/mysql.sock

# Here follows entries for some specific programs

# The MySQL server
[mysqld]
port = 3306
socket = /opt/lampp/var/mysql/mysql.sock
skip-locking
key_buffer = 16M
max_allowed_packet = 1M
table_cache = 64
sort_buffer_size = 512K
net_buffer_length = 8K
read_buffer_size = 256K
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 8M

# Don't listen on a TCP/IP port at all. This can be a security enhancement,
# if all processes that need to connect to mysqld run on the same host.
# All interaction with mysqld must be made via Unix sockets or named pipes.
# Note that using this option without enabling named pipes on Windows
# (via the "enable-named-pipe" option) will render mysqld useless!
#
#skip-networking

# Replication Master Server (default)
# binary logging is required for replication
# log-bin deactivated by default since XAMPP 1.4.11
#log-bin=mysql-bin

# required unique id between 1 and 2^32 - 1
# defaults to 1 if master-host is not set
# but will not function as a master if omitted
server-id = 1

# Replication Slave (comment out master section to use this)
#
# To configure this host as a replication slave, you can choose between
# two methods :
#
# 1) Use the CHANGE MASTER TO command (fully described in our manual) -
# the syntax is:
#
# CHANGE MASTER TO MASTER_HOST=<host>, MASTER_PORT=<port>,
# MASTER_USER=<user>, MASTER_PASSWORD=<password> ;
#
# where you replace <host>, <user>, <password> by quoted strings and
# <port> by the master's port number (3306 by default).
#
# Example:
#
# CHANGE MASTER TO MASTER_HOST='125.564.12.1', MASTER_PORT=3306,
# MASTER_USER='joe', MASTER_PASSWORD='secret';
#
# OR
#
# 2) Set the variables below. However, in case you choose this method, then
# start replication for the first time (even unsuccessfully, for example
# if you mistyped the password in master-password and the slave fails to
# connect), the slave will create a master.info file, and any later
# change in this file to the variables' values below will be ignored and
# overridden by the content of the master.info file, unless you shutdown
# the slave server, delete master.info and restart the slaver server.
# For that reason, you may want to leave the lines below untouched
# (commented) and instead use CHANGE MASTER TO (see above)
#
# required unique id between 2 and 2^32 - 1
# (and different from the master)
# defaults to 2 if master-host is set
# but will not function as a slave if omitted
#server-id = 2
#
# The replication master for this slave - required
#master-host = <hostname>
#
# The username the slave will use for authentication when connecting
# to the master - required
#master-user = <username>
#
# The password the slave will authenticate with when connecting to
# the master - required
#master-password = <password>
#
# The port the master is listening on.
# optional - defaults to 3306
#master-port = <port>
#
# binary logging - not required for slaves, but recommended
#log-bin=mysql-bin


# Point the following paths to different dedicated disks
#tmpdir = /tmp/
#log-update = /path-to-dedicated-directory/hostname

# Uncomment the following if you are using BDB tables
#bdb_cache_size = 4M
#bdb_max_lock = 10000

# Comment the following if you are using InnoDB tables
skip-innodb
innodb_data_home_dir = /opt/lampp/var/mysql/
innodb_data_file_path = ibdata1:10M:autoextend
innodb_log_group_home_dir = /opt/lampp/var/mysql/
innodb_log_arch_dir = /opt/lampp/var/mysql/
# You can set .._buffer_pool_size up to 50 - 80 %
# of RAM but beware of setting memory usage too high
innodb_buffer_pool_size = 16M
innodb_additional_mem_pool_size = 2M
# Set .._log_file_size to 25 % of buffer pool size
innodb_log_file_size = 5M
innodb_log_buffer_size = 8M
innodb_flush_log_at_trx_commit = 1
innodb_lock_wait_timeout = 50

[mysqldump]
quick
max_allowed_packet = 16M

[mysql]
no-auto-rehash
# Remove the next comment character if you are not familiar with SQL
#safe-updates

[isamchk]
key_buffer = 20M
sort_buffer_size = 20M
read_buffer = 2M
write_buffer = 2M

[myisamchk]
key_buffer = 20M
sort_buffer_size = 20M
read_buffer = 2M
write_buffer = 2M

[mysqlhotcopy]
interactive-timeout



sollte aber hier kein problem liegen oder?

yops
09.03.07, 13:15
Mir fehlt bei dir diese Zeile in der main.cf


virtual_alias_maps = mysql:/etc/postfix/mysql-virtual_forwardings.cf mysql:/etc/postfix/mysql-virtual_email2email.cf
wobei die eigentlich für einfache Testzwecke nicht nötig sein sollte.

Ansonsten hast du dich wahrscheinlich gegen SSL entschieden, da deine main.cf dafür nicht konfiguriert ist?

Kannst du den Tablelookup-Error nochmal posten oder ist er mit dem oben identisch?

brave_snoopy
09.03.07, 13:46
ja ich habe mich erstmal gegen ssl entschieden, ich wollte das system erstmal so zum laufen bekommen.

habe jetzt festgestellt, wenn ich



virtual_mailbox_domains = mysql:/etc/postfix/mysql-virtual_domains.cf
virtual_mailbox_maps = mysql:/etc/postfix/mysql-virtual_mailboxes.cf
virtual_mailbox_base = /home/vmail



auskommentiere, klappt es einwandfrei.

Also scheint irgendwas mit der kommunikation zu dem sql server nicht zu stimmen.

Kann es evtl sein, das der versucht zu überprüfen, ob der Sender zu den eigenen Domains gehört und dann da hängen bleibt?



Das Tablelookup ist die gleiche Meldung wie oben schon genannt.

Kann es sein, das der mysql Server aufem Socket läuft und nicht auf TCP/IP und so postfix keine kommunikation aufbauen kann?


Nachtrag:

Ja es liegt am mysql server.

wenn ich versuche per telnet 127.0.0.1 3306 auf den mysql zu connecten klappt dies nicht.

Also horcht der sql server nicht auf tcp/ip anfragen.

Wo muss ich das einstellen ?

yops
10.03.07, 00:01
Beachten Sie, dass, wenn Sie localhost als Hostnamen angeben, mysqladmin standardmäßig statt TCP/IP eine Verbindung über eine Unix-Socketdatei verwendet. Ab MySQL 4.1 können Sie das zu verwendende Verbindungsprotokoll mit der Option --protocol={TCP|SOCKET|PIPE|MEMORY} explizit angeben.

http://dev.mysql.com/doc/refman/5.1/de/multiple-unix-servers.html

bla!zilla
10.03.07, 11:17
Gib mal den FQDN deiner Maschine an. Dann sollte er versuchen über TCP/IP eine Verbindung zum MySQL Daemon herzustellen.

Imagine
10.03.07, 11:24
Sag mal Snoopy,

kannst Du jetzt gar nicht raus senden? Willst Du über einen SMPT-Relayserver senden oder hat Dein Mailserver einen MX-Eintrag?

Und

mail from:bla@gmx.de
bringt solange nichts, wie Postfix nicht für diese Domain zuständig ist. Also in Deiner main.cf fehlt der Eintrag:

mydestination = hostname.deine_domain.de localhost.deine_domain.de localhost gmx.de

Dann fehlt auf alle Fälle

mynetworks = 127.0.0.0/8, 192.168.0.0/24

Ansonsten können Deine Clients nicht aus dem Netzwerk 192.168.0.0, sondern jeder User lokal vom Server z.B. via telenet mailen.

Zuletzt mache mal lieber
postconf -n, um Deine main.cf auszugeben; liefert die eingetragenen Werte OHNE Kommentare.
postconf -d liefert die Standardwerte.

Apropos, lasse zunächstmal die MySQL-Funktionalität weg, solange die Basis nicht funktioniert. Du wirst Dich nur verzetteln, weil Du nicht weisst, wo Du suchen musst.

Grüsse

Imagine

brave_snoopy
10.03.07, 11:29
ich hab nun den mysql auf Port 3306 laufen.

wenn ich nun

telnet 127.0.0.1 3306 eingebe, wird eine verbindung zum mysqld aufgebaut.


mein postfix funktioniert leider immernoch nicht, es bleibt weiterhin nach dem mail from:... stehen.I

ch erhalte in der /var/log/mail.err immernoch folgende fehlermeldungen:




Mar 6 16:55:43 localhost postfix/trivial-rewrite[6221]: fatal: mysql:/etc/postfix/mysql-virtual_domains.cf(0,100): table lookup problem
Mar 6 17:03:33 localhost postfix/trivial-rewrite[6439]: fatal: mysql:/etc/postfix/mysql-virtual_domains.cf(0,100): table lookup problem
Mar 6 17:03:35 localhost postfix/trivial-rewrite[6440]: fatal: mysql:/etc/postfix/mysql-virtual_domains.cf(0,100): table lookup problem
Mar 7 05:50:57 localhost postfix/trivial-rewrite[10479]: fatal: mysql:/etc/postfix/mysql-virtual_domains.cf(0,100): table lookup problem
Mar 7 05:50:59 localhost postfix/trivial-rewrite[10481]: fatal: mysql:/etc/postfix/mysql-virtual_domains.cf(0,100): table lookup problem




meine mysql-virtual_domains.cf sieht so aus.





cat mysql-virtual_domains.cf

user = oftecs
password = password
dbname = mail
table = domains
select_field = 'virtual'
where_field = domain
hosts = 127.0.0.1


Wozu ist die Zeile select_field da? Es gibt keine Tabelle oder ähnliches in meiner mysql Datenbank "mail" . Die Spalte domain ist allerdings in der Tabelle domains enthalten.

Noch ne Idee?

bla!zilla
10.03.07, 13:06
Statt der 127.0.0.1 mal die IP vom eth0 verwenden.

Imagine
10.03.07, 13:46
mein postfix funktioniert leider immernoch nicht, es bleibt weiterhin nach dem mail from:... stehen.I

Noch ne Idee?

Die habe ich Dir doch vor zwei Stunden gegeben:

Konfiguriere Deinen Postfix erstmal ohne Datenbank-basierte Benutzerkonten. Dein Postfix läuft nicht richtig, nicht weil Deine DB Probleme hätte, sondern weil Du Postfix noch nicht ohne DB zum Laufen gebracht hast.

Ob die DB funktioniert kannst Du manuel checken, indem Du dasselbe machst , was Postfix machen würde. Aber schaue ersteinmal, dass Postfix mit den lokalen Benutzeraccounts funktioniert.

Gute HowTo's findest Du hier:

http://wiki.debianforum.de/Serverbetrieb

Imagine

yops
10.03.07, 15:09
Und

mail from:bla@gmx.de
bringt solange nichts, wie Postfix nicht für diese Domain zuständig ist. Also in Deiner main.cf fehlt der Eintrag:

mydestination = hostname.deine_domain.de localhost.deine_domain.de localhost gmx.de
Das stimmt so nicht. Er holt sich die Domains aus der Datenbank



Dann fehlt auf alle Fälle

mynetworks = 127.0.0.0/8, 192.168.0.0/24
Da sich die User lokal anmelden, reicht die 127.0.0.1

yops
10.03.07, 15:24
Wozu ist die Zeile select_field da? Es gibt keine Tabelle oder ähnliches in meiner mysql Datenbank "mail" . Die Spalte domain ist allerdings in der Tabelle domains enthalten.

Noch ne Idee?
Ist ein hart codierter Parameter

SELECT virtual from domains where domain = 'virtual.test';

Kannst du mal auf der Konsole folgendes eingeben und den Output dann hier posten:

$ mysql -u mailuser -pmailuserpasswort
use maildatenbank;
select * from domains;

Jeweils mit deinen für Postfix angelegten Daten?

brave_snoopy
11.03.07, 21:19
guten Abend
das ist die Ausgabe.




web201:~# mysql -u oftecs -p
Enter password:
ERROR 2002: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)



Also es scheint ja nun wirklich nen mysql Problem zu sein.

Wo genau muss ich in der Konfigurationsdatei denn Angeben, das der aufem TCP Port lauschen soll und nicht nur aufem Socket? Aus der Anleitung aufer mysql Homepage werd ich nicht schlau.

brave_snoopy
11.03.07, 23:13
nach einigem hin und her bekomm ich nun endlich mein 250 ok wenn ich mail from:irgendwas@irgendwas.de eintrage.

nur beim rcpt to:stefan@virtual.test bekomm ich nun die fehlermeldung:

451 Server configuration error.


Was ist das nun?

hier nochmal die aktuelle main.cf von postfix



cat main.cf
# See /usr/share/postfix/main.cf.dist for a commented, more complete version

smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
biff = no

# appending .domain is the MUA's job.
append_dot_mydomain = no

# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h

myhostname = web201.oftecs.de
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination =

virtual_mailbox_domains = mysql:/etc/postfix/mysql-virtual_domains.cf
virtual_mailbox_maps = mysql:/etc/postfix/mysql-virtual_mailboxes.cf
virtual_mailbox_base = /home/vmail
virtual_uid_maps = static:5000
virtual_gid_maps = static:5000

smtpd_auth_enable = yes
smtpd_recipient_restrictions = permit_authenticated, reject_unauth_destination


mynetworks = 127.0.0.0/8
inet_interfaces = all



also wenn ich an lokal ne mail schicke ging dies früher auch einwandfrei, nur jetzt mit der mysql geschichte nicht mehr.

die mysql-virtual_mailboxes.cf




cat mysql-virtual_mailboxes.cf
user = oftecs
password = password
dbname = mail
table = users
select_field = CONCAT(SUBSTRING_INDEX(email,'@',-1),'/',SUBSTRING_INDEX(email,'@',1),'/')
where_field = email
hosts = 127.0.0.1



was kann das nun noch sein? Sollte ja nur noch was kleines sein oder?




Wo genau muss ich in der Konfigurationsdatei denn Angeben, das der aufem TCP Port lauschen soll und nicht nur aufem Socket? Aus der Anleitung aufer mysql Homepage werd ich nicht schlau.

ich habe es zur Zeit mit ner umgebungsvariabel gelöst, aber es sollte ja auch in der konfig gehen nur wo?

Imagine
12.03.07, 07:11
Das steht in der my.cnf unter "port = 3306"


Wo genau muss ich in der Konfigurationsdatei denn Angeben, das der aufem TCP Port lauschen soll und nicht nur aufem Socket? Aus der Anleitung aufer mysql Homepage werd ich nicht schlau.
Und die findest Du bei Debian unter /etc/mysql/

Das Einrichten von Postfix für MySQL mit Beispiel und dem Warum und Wieso so und nicht anders, findest Du in zwei sehr guten Büchern beschrieben:
"Postfix" (Ralf Hildebrandt, Patrick Ben Koetter) und "Das Postfix-Buch (Peer Heinlein). Die Jungs kannst Du unter http://ilpostino.jpberlin.de/pipermail/postfixbuch-users/
auch persönlich fragen.

yops
12.03.07, 09:05
nur beim rcpt to:stefan@virtual.test bekomm ich nun die fehlermeldung:

451 Server configuration error.


Was steht in den Logs (maillog, maiillerr)?

brave_snoopy
12.03.07, 16:50
steht leider nichts drin, nachdem die Fehlermeldung erscheint.

Vom 8. März ist der letzte Eintrag:



Mar 8 13:22:58 web201 postfix/smtp[3837]: 3853D5F17B: to=<postmaster@web201.oftecs.de>, orig_to=<postmaster>, relay=none, delay=0, status=deferred (connect to web201.domain[213.23.146.]: server dropped connection without sending the initial SMTP greeting)


kann doch nich so schwer sein, oder?

yops
12.03.07, 18:27
steht leider nichts drin, nachdem die Fehlermeldung erscheint.

Vom 8. März ist der letzte Eintrag:



kann doch nich so schwer sein, oder?
Doch, weil 451 Server configuration error nicht gerade sehr aussagekräftig ist...es ist wirklich kein Logeintrag vorhanden? Das kann nicht sein, dass dein letzter Eintrag vom 08.03 ist! Lösche die mail.log bitte und starte Postfix neu.

brave_snoopy
12.03.07, 21:06
Lösche die mail.log bitte und starte Postfix neu.


Habe ich gemacht, es tauchen keine neuen Log Dateien auf.
Es ist wie glaub ich schonmal erwähnt, nen Debian Sarge System.

Kann man das LogLevel von postfix vielleicht irgendwie erhöhen?

Selbst in /var/log/syslog steht nichts anderes drin.

brave_snoopy
13.03.07, 20:56
mh niemand mehr eine idee?

yops
13.03.07, 21:10
Probier mal


postfix stop
/etc/init.d/syslog stop
/etc/init.d/syslog start
postfix start

brave_snoopy
14.03.07, 16:56
es steht nix anderes drin als:




Mar 9 17:22:38 web201 postfix/smtp[14401]: C0B205F122: to=<postmaster@web201.oftecs.de>, orig_to=<postmaster>, relay=none, delay=51484, status=deferred (connect to web201.oftecs.de[213.23.146.157]: server dropped connection without sending the initial SMTP greeting)



und auch in der mail.err steht nichts anderes drin.

kann ich dir evtl. zugang zu dem server geben?

brave_snoopy
14.03.07, 22:10
es geht nun zur hälfte, also er nimmt für die Benutzer die in der mysql Datenbank eingetragen sind die Mails an. nur legt er sie nicht ins /home/vmail Verzeichniss auch nicht ins /var/mail Verzeichniss, sonder.. ich hab keine Ahnung wohin.

Aber er nimmt sie schonmal an, das ist doch mal was, ich habe die main.cf nun etwas schlanker gemacht und erstmal alles rausgeworfen was nicht wirklich wichtig ist.

sie sieht nun so aus:



cat main.cf
# See /usr/share/postfix/main.cf.dist for a commented, more complete version

smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
biff = no

# appending .domain is the MUA's job.
append_dot_mydomain = no

# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h

myhostname = web201.oftecs.de
#alias_maps = hash:/etc/aliases
#alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination =

virtual_mailbox_domains = mysql:/etc/postfix/mysql-virtual_domains.cf
virtual_mailbox_maps = mysql:/etc/postfix/mysql-virtual_mailboxes.cf
virtual_mailbox_base = /home/vmail
virtual_uid_maps = static:5000
virtual_gid_maps = static:5000


#smtpd_recipient_restrictions = permit_authenticated, reject_unauth_destination


mynetworks = 127.0.0.0/8

inet_interfaces = all



auf /home/vmail sind folgende Berechtigungen




drwxrwxrwx 2 vmail vmail 4096 2007-02-05 04:52 vmail


in der mail.err steht nichts drin.

allerdings händen die mails in der mailquere von postfix fest. ein mailq gibt folgendes aus:



mailq
-Queue ID- --Size-- ----Arrival Time---- -Sender/Recipient-------
A0DAF5F0CB* 360 Wed Mar 14 22:47:49 stefan@gmx.de
stefan@virtual.test

A396C5F0CE* 358 Wed Mar 14 22:53:47 test@gmx.de
stefan@virtual.test

-- 1 Kbytes in 2 Requests.
web201:/home#



nu isses nichmehr weit, bis es funktioniert :)

brave_snoopy
14.03.07, 22:36
autsch bin ich blöd.

In der master.cf stand virtual auf chroot.

Damit kann natürlich virtual nicht auf /home/vmail zugreifen.

Nun funktioniert es einwandfrei. Danke für eure Hilfe.