Konfiguracja Postfix-a w Debianie
Postfix jest powszechnie stosowanym serwerem poczty, dokładnie mówiąc MTA (Mail Transfer Agent). W tym artykule opisujemy jak zainstalować Postfiks w Debianie Lenny 5.0. W przykładzie wykorzystujemy serwer testowy (lists.wefi.net).
Instalacja pakietów
Instalacja Postfix-a z wiersza poleceń może zostać rozpoczęta następująco:
apt-get install postfix
Debian wyświetla następująco informację, że usunięty zostanie Exim i pyta czy chcesz kontynuować instalację:
lists:~# apt-get install postfix Reading package lists... Done Building dependency tree Reading state information... Done Suggested packages: procmail postfix-mysql postfix-pgsql postfix-ldap postfix-pcre sasl2-bin libsasl2-modules resolvconf postfix-cdb ufw The following packages will be REMOVED: exim4 exim4-base exim4-config exim4-daemon-light The following NEW packages will be installed: postfix 0 upgraded, 1 newly installed, 4 to remove and 0 not upgraded. Need to get 1224kB of archives. After this operation, 1008kB disk space will be freed. Do you want to continue [Y/n]? y Get:1 http://http.at.debian.org lenny/main postfix 2.5.5-1.1 [1224kB] Fetched 1224kB in 0s (6060kB/s) Preconfiguring packages ...
Konfiguracja pakietu
W pierwszym etapie konfiguracji wybieramy w tym przykładzie Internet Site. Zależnie od indywidualnych potrzeb należy tutaj wybrać odpowiednią pozycję.
Package configuration ┌───────────────────────────┤ Postfix Configuration ├───────────────────────────┐ │ Please select the mail server configuration type that best meets your needs. │ │ │ │ No configuration: │ │ Should be chosen to leave the current configuration unchanged. │ │ Internet site: │ │ Mail is sent and received directly using SMTP. │ │ Internet with smarthost: │ │ Mail is received directly using SMTP or by running a utility such │ │ as fetchmail. Outgoing mail is sent using a smarthost. │ │ Satellite system: │ │ All mail is sent to another machine, called a 'smarthost', for delivery. │ │ Local only: │ │ The only delivered mail is the mail for local users. There is no network. │ │ │ │ General type of mail configuration: │ │ │ │ No configuration │ │ Internet Site │ │ Internet with smarthost │ │ Satellite system │ │ Local only │ │ │ │ │ │ <Ok> <Cancel> │ │ │ └───────────────────────────────────────────────────────────────────────────────┘
W drugim etapie podajemy nazwę serwera pocztowego. Nazwa serwera w przykładzie to lists.wefi.net (adres mailowy to np. mailingliste@lists.wefi.net):
Package configuration ┌──────────────────────────────────┤ Postfix Configuration ├───────────────────────────────────┐ │ The "mail name" is the domain name used to "qualify" _ALL_ mail addresses without a domain │ │ name. This includes mail to and from <root>: please do not make your machine send out mail │ │ from root@example.org unless root@example.org has told you to. │ │ │ │ This name will also be used by other programs. It should be the single, fully qualified │ │ domain name (FQDN). │ │ │ │ Thus, if a mail address on the local host is foo@example.org, the correct value for this │ │ option would be example.org. │ │ │ │ System mail name: │ │ │ │ lists.wefi.net______________________________________________________________________________ │ │ │ │ <Ok> <Cancel> │ │ │ └──────────────────────────────────────────────────────────────────────────────────────────────┘
Zakończenie instalacji
(Reading database ... 21540 files and directories currently installed.) Removing exim4 ... dpkg: exim4-config: dependency problems, but removing anyway as you request: exim4-base depends on exim4-config (>= 4.30) | exim4-config-2; however: Package exim4-config is to be removed. Package exim4-config-2 is not installed. Package exim4-config which provides exim4-config-2 is to be removed. exim4-base depends on exim4-config (>= 4.30) | exim4-config-2; however: Package exim4-config is to be removed. Package exim4-config-2 is not installed. Package exim4-config which provides exim4-config-2 is to be removed. Removing exim4-config ... dpkg: exim4-daemon-light: dependency problems, but removing anyway as you request: bsd-mailx depends on exim4 | mail-transport-agent; however: Package exim4 is not installed. Package mail-transport-agent is not installed. Package exim4-daemon-light which provides mail-transport-agent is to be removed. Removing exim4-daemon-light ... Stopping MTA: exim4_listener. Removing exim4-base ... Processing triggers for man-db ... Selecting previously deselected package postfix. (Reading database ... 21404 files and directories currently installed.) Unpacking postfix (from .../postfix_2.5.5-1.1_i386.deb) ... Processing triggers for man-db ... Setting up postfix (2.5.5-1.1) ... Adding group `postfix' (GID 108) ... Done. Adding system user `postfix' (UID 104) ... Adding new user `postfix' (UID 104) with group `postfix' ... Not creating home directory `/var/spool/postfix'. Creating /etc/postfix/dynamicmaps.cf Adding tcp map entry to /etc/postfix/dynamicmaps.cf Adding group `postdrop' (GID 109) ... Done. setting myhostname: lists.wefi.net setting alias maps setting alias database changing /etc/mailname to lists.wefi.net setting myorigin setting destinations: lists.wefi.net, localhost.wefi.net, , localhost setting relayhost: setting mynetworks: 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 setting mailbox_size_limit: 0 setting recipient_delimiter: + setting inet_interfaces: all WARNING: /etc/aliases exists, but does not have a root alias. Postfix is now set up with a default configuration. If you need to make changes, edit /etc/postfix/main.cf (and others) as needed. To view Postfix configuration values, see postconf(1). After modifying main.cf, be sure to run '/etc/init.d/postfix reload'. Running newaliases Stopping Postfix Mail Transport Agent: postfix. Starting Postfix Mail Transport Agent: postfix. lists:~#
Kontrola odbioru maili
Kontrolujemy telnetem czy odbiór funkcjonuje (jak jest to opisane w artykule Kontrola dostępu do portu TCP 25 (SMTP) przy pomocy telnetu):
ubuntu@ubuntu:~$ telnet lists.wefi.net 25 Trying 80.66.32.103... Connected to lists.wefi.net. Escape character is '^]'. 220 lists.wefi.net ESMTP Postfix (Debian/GNU) EHLO test.example.com 250-lists.wefi.net 250-PIPELINING 250-SIZE 10240000 250-VRFY 250-ETRN 250-STARTTLS 250-ENHANCEDSTATUSCODES 250-8BITMIME 250 DSN MAIL FROM: test@example.com 250 2.1.0 Ok RCPT TO: postmaster@lists.wefi.net 250 2.1.5 Ok DATA 354 End data with <CR><LF>.<CR><LF> Subject: Testnachricht Das ist ein Test. . 250 2.0.0 Ok: queued as 87D2CDE40A2 QUIT 221 2.0.0 Bye Connection closed by foreign host. user@ubuntu:~$
Została dostarczona następująca wiadomość:
lists:~# mail Mail version 8.1.2 01/15/2001. Type ? for help. "/var/mail/root": 1 message 1 new >N 1 test@example.com Tue Jun 1 10:00 16/545 Testnachricht & 1 Message 1: From test@example.com Tue Jun 1 10:00:49 2010 X-Original-To: postmaster@lists.wefi.net Subject: Testnachricht Date: Tue, 1 Jun 2010 10:00:08 +0200 (CEST) From: test@example.com To: undisclosed-recipients:; Das ist ein Test. & q Saved 1 message in /root/mbox lists:~#
Dalsze informacje
- Postfix (Wikipedia)
- Postfix Home Page