# yum install postfix mutt
# service postfix start
# adduser student
# su - student
$ mutt
1. Press m to create a new message.
2. In To write student@server1.example.com
3. In Subject write something
4. In Body write something. The default editor is vi, so:
4.1 enter i for insert
4.2 now write
4.3 when finished writing, press ESC
4.4 to save, press :wq
5. Now send, press y.
Print mail queue
# postqueue -p
Mail queue is empty
Flush mail queue
# postqueue -f
less /var/log/maillog
# netstat -tulpn | grep 25
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 17389/master
# grep inet_interfaces /etc/postfix/main.cf
# The inet_interfaces parameter specifies the network interface
#inet_interfaces = all
#inet_interfaces = $myhostname
#inet_interfaces = $myhostname, localhost
inet_interfaces = localhost
# the address list specified with the inet_interfaces parameter.
# receives mail on (see the inet_interfaces parameter).
# to $mydestination, $inet_interfaces or $proxy_interfaces.
# - destinations that match $inet_interfaces or $proxy_interfaces,
# unknown@[$inet_interfaces] or unknown@[$proxy_interfaces] is returned
# vi /etc/postfix/main.cf
...
inet_interfaces = all
...
# service postfix restart
# netstat -tulpn | grep 25
tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN 17558/master
--------------------
Step 1: Install Packages
--------------------
# yum install sendmail sendmail-cf dovecot m4
--------------------
Step 2: Configure sendmail to receive external mails
--------------------
Edit /etc/mail/sendmail.mc
2.1 Comment out sendmail to listen to all network adresses. To comment out in sendmail, put
'dnl' at the beginning of the line.
dnl DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl
2.2 We will use our local hostname as mail domain, so change 'localhost.localdomain' to your
hostname, mine is server1.example.com.
LOCAL_DOMAIN(`localhost.localdomain')dnl
--------------------
Step 3. Recompile Sendmail using m4
--------------------
# m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf
--------------------
Step 4: Configure Dovecot to fetch emails
--------------------
4.1 Edit /etc/dovecot/dovecot.conf
#Protocols we want to be serving.
protocols = pop3
# A comma separated list of IPs or hosts where to listen in for connections.
listen = *, ::
4.2 Edit /etc/dovecot/conf.d/10-auth.conf
disable_plaintext_auth = no
#!include auth-system.conf.ext
!include auth-passwdfile.conf.ext
4.3 Add User
# echo "$USER:{PLAIN}password:$UID:$GROUPS::$HOME" > /etc/dovecot/users
Example:
magkar:{PLAIN}password:500:500::/home/magkar
Here I use an existing account on mail server, if you need to create a new user, use command
useradd to create a new user and passwd to set password:
# useradd student1
# passwd student1
4.4 Last step. Verify installation by running 'dovecot -n'
# dovecot -n
# 2.0.9: /etc/dovecot/dovecot.conf
# OS: Linux 2.6.32-358.14.1.el6.x86_64 x86_64 Red Hat Enterprise Linux Server release 6.4 (Santiago)
disable_plaintext_auth = no
mbox_write_locks = fcntl
passdb {
args = scheme=CRYPT username_format=%u /etc/dovecot/users
driver = passwd-file
}
protocols = pop3
ssl_cert = </etc/pki/dovecot/certs/dovecot.pem
ssl_key = </etc/pki/dovecot/private/dovecot.pem
userdb {
args = username_format=%u /etc/dovecot/users
driver = passwd-file
}
--------------------
Step 5: Restart sendmail and dovecot service
--------------------
# service dovecot restart
# service sendmail restart
If this is a fresh installation, either of the services are started, so stopping them will fail.
Verify this by restarting the services again.
--------------------
Step 6: Testing the installation
--------------------
Thunderbird
email: magkar@server1.example.com
POP3
Host: server1.example.com
Port: 110
No SSL
username: magkar
password: password
Send password cleartext
SMTP
Host: server1.example.com
Port: 25
NO AUTHENTICATION
Add static dns to /etc/hosts
server1.example.com 192.168.1.10
--------------------
Reference
--------------------
http://wiki2.dovecot.org/BasicConfiguration
http://wiki2.dovecot.org/FindMailLocation
http://www.telnetport25.com/2012/02/configuring-e-mail-notifications-in-nagios-core/
I'm dedicated agile security architect/system architect/developer with specialty of open source framework.
December 8, 2017
Install and Configure Postfix
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment