23. januar 2006 - 19:08Der er
33 kommentarer og 1 løsning
Postfix - hjælp med Open Relay
Hej,
Jeg har lige sat min egen mail server op(postfix), og den virker også, men jeg tro den kører med Open Relay. Jeg har nu set på mange howto, andre med samme problem osv. Dog uden held, her er min main.cf og master.cf
# Specify "mynetworks_style = class" when Postfix should "trust" SMTP # clients in the same IP class A/B/C networks as the local machine. # Don't do this with a dialup site - it would cause Postfix to "trust" # your entire provider's network. Instead, specify an explicit # mynetworks list by hand, as described below. # # Specify "mynetworks_style = host" when Postfix should "trust" # only the local machine.
38236:/etc/postfix# /etc/init.d/postfix restart Stopping mail transport agent: Postfix. Starting mail transport agent: Postfix. 38236:/etc/postfix# postfix reload postfix/postfix-script: refreshing the Postfix mail system 38236:/etc/postfix# postfix check
By now the reader may wonder why we need smtpd client, helo or sender restrictions, when their evaluation is postponed until the RCPT TO or ETRN command. Some people recommend placing ALL the access restrictions in the smtpd_recipient_restrictions list. Unfortunately, this can result in too permissive access. How is this possible?
The purpose of the smtpd_recipient_restrictions feature is to control how Postfix replies to the RCPT TO command. If the restriction list evaluates to REJECT or DEFER, the recipient address is rejected; no surprises here. If the result is PERMIT, then the recipient address is accepted. And this is where surprises can happen.
Here is an example that shows when a PERMIT result can result in too much access permission:
Line 5 rejects mail from hosts that don't specify a proper hostname in the HELO command (with Postfix < 2.3, specify reject_unknown_hostname). Lines 4 and 9 make an exception to allow mail from some machine that announces itself with "HELO localhost.localdomain".
The problem with this configuration is that smtpd_recipient_restrictions evaluates to PERMIT for EVERY host that announces itself as "localhost.localdomain", making Postfix an open relay for all such hosts.
In order to avoid surprises like these with smtpd_recipient_restrictions, you should place non-recipient restrictions AFTER the reject_unauth_destination restriction, not before. In the above example, the HELO based restrictions should be placed AFTER reject_unauth_destination, or better, the HELO based restrictions should be placed under smtpd_helo_restrictions where they can do no harm.
du skal nok gøre det sidste med at flytte rundt på dine restriktioner som der står med at det skal stå efter: reject_unauth_destination
når du tester at du kan sende mail - hvor prøver du så at sende dem hen ? til en mailadresse på din server eller til en ude i byen (hotmail eller lign) ?
Jan 23 22:26:05 38236 postfix/postfix-script: stopping the Postfix mail system Jan 23 22:26:05 38236 postfix/master[2264]: terminating on signal 15 Jan 23 22:26:09 38236 postfix/postfix-script: starting the Postfix mail system Jan 23 22:26:09 38236 postfix/master[8125]: daemon started -- version 2.1.5 Jan 23 22:26:13 38236 postfix/postfix-script: refreshing the Postfix mail system Jan 23 22:26:13 38236 postfix/master[8125]: reload configuration Jan 23 22:26:47 38236 postfix/smtpd[8421]: warning: dict_nis_init: NIS domain name not set - NIS lookups disabled Jan 23 22:26:47 38236 postfix/smtpd[8421]: connect from unknown[83.90.242.79] Jan 23 22:26:47 38236 postfix/smtpd[8421]: 674569702372: client=unknown[83.90.242.79] Jan 23 22:26:47 38236 postfix/smtpd[8421]: disconnect from unknown[83.90.242.79] Jan 23 22:26:47 38236 postfix/pickup[8135]: 9CA3B9612781: uid=0 from=<fsef@sfr.dk> Jan 23 22:26:47 38236 postfix/cleanup[8425]: 9CA3B9612781: message-id=<002701c62062$80f520b0$4ff25a53@speed> Jan 23 22:26:47 38236 postfix/qmgr[8136]: 9CA3B9612781: from=<fsef@sfr.dk>, size=1467, nrcpt=1 (queue active) Jan 23 22:26:48 38236 postfix/smtpd[8434]: connect from 38236.vs.webtropia.com[127.0.0.1] Jan 23 22:26:48 38236 postfix/smtpd[8434]: C49909612783: client=38236.vs.webtropia.com[127.0.0.1] Jan 23 22:26:48 38236 postfix/cleanup[8425]: C49909612783: message-id=<002701c62062$80f520b0$4ff25a53@speed> Jan 23 22:26:48 38236 postfix/qmgr[8136]: C49909612783: from=<fsef@sfr.dk>, size=1952, nrcpt=1 (queue active) Jan 23 22:26:48 38236 postfix/smtpd[8434]: disconnect from 38236.vs.webtropia.com[127.0.0.1] Jan 23 22:26:48 38236 amavis[17712]: (17712-06) Passed, <fsef@sfr.dk> -> <markrskou@ofir.dk>, Message-ID: <002701c62062$80f520b0$4ff25a53@speed>, Hits: 0.347 Jan 23 22:26:48 38236 postfix/smtp[8428]: 9CA3B9612781: to=<markrskou@ofir.dk>, relay=127.0.0.1[127.0.0.1], delay=1, status=sent (250 2.6.0 Ok, id=17712-06, from MTA: 250 Ok: queued as C49909612783) Jan 23 22:26:48 38236 postfix/qmgr[8136]: 9CA3B9612781: removed Jan 23 22:26:49 38236 postfix/smtp[8438]: C49909612783: to=<markrskou@ofir.dk>, relay=postfixprim.ofir.com[193.0.243.241], delay=1, status=sent (250 message sent ok) Jan 23 22:26:49 38236 postfix/qmgr[8136]: C49909612783: removed
aaah - jeg har en mistanke om at det er muligvis amavis som måske spiller en rolle her - den griber jo mailen inden og derfor ser det ud som om for postfix at det kommer fra sig selv - hvis du forstår ?
Ja jeg har også læst det der forumindlæg, men den slutte bare med tommy.dk poster main.cf og master.cf. Jeg teste på ordb.org for et par dage siden, nu har jeg lavet en del om i main.cf og master.cf. Nu kommer der en fejl på smtp-amavis.
------------------------------- Jan 25 10:11:35 38236 postfix/qmgr[25242]: warning: connect to transport smtp-amavis: No such file or directory
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.