정보 보안을 향한 항해

PostFix mail 서버 구축 설정 본문

서버/서버 구축 실습

PostFix mail 서버 구축 설정

금홍자 2021. 10. 6. 10:33

postfix mail server 와 sendmail server 는 유명한 mail server 이다.

 

iredmail server 는 유명하지 않지만 굉장히 좋다

fail2ban 과 

 

회사에서 mail  server 구축시 강력하게 권할 만한 mail server 이다

fail2ban
clamAV
MySQL/MariaDB

 

1 방화벽을 disable 

# setenforce 0

 

 

# nano /etc/sysconfig/network

파일 확인

 

# nano etc/hosts

# yum -y install postfix

postfix 다운받는다

 

iredmail 독립적 mail 이고

postfix 는 squarrel mail 을 사용한다

sendmail 은 앞에서 mailx mute 

 

백업파일

# cp -arp /etc/postfix/main.cf /etc/postfix/main.cf.bak

 

# nano -c /etc/pastfix/m

75 줄 m

 

 

 

yhostname 주석 제거

 

83줄 주석 제거

98줄 주석제거

 

113, 116 localhost 로 되어있다

116 주석으로 무시한다

 

 

113 all 에 주석 제거

ipv4 6 둘다 하는 것

119 주석제거

 

264줄

주석제거

419 home mail box

주석제거

 

# service postfix start

# chkconfig 해주고

telnet 설치한다

 

 

ehlo localhost

 

다음줄에 점 찍으면

idml 스타일이다

data가 대기열에 있는 것이다

 

quit 로 나간다

 

아까 보낸게 와있다

cat 으로 읽어본다

잘 와있다ㅓ

 

postfix 는 mail server 로서는 허술하지만

심플하기 때문에 잘 보내진다.

 

 

 

 

 

 

 

정리

[root@centos1 centos]# setenforce 0
[root@centos1 centos]# nano /etc/sysconfig/network
[root@centos1 centos]# nano /etc/hosts
[root@centos1 centos]# yum -y install postfix
Loaded plugins: fastestmirror, refresh-packagekit, security
Setting up Install Process
Loading mirror speeds from cached hostfile
YumRepo Error: All mirror URLs are not using ftp, http[s] or file.
 Eg. Invalid release/repo/arch combination/
epel/metalink                                            | 3.8 kB     00:00     
YumRepo Error: All mirror URLs are not using ftp, http[s] or file.
 Eg. Invalid release/repo/arch combination/
 * epel: d2lzkl7pfhq30w.cloudfront.net
base                                                     | 3.7 kB     00:00     
extras                                                   | 3.4 kB     00:00     
updates                                                  | 3.4 kB     00:00     
Package 2:postfix-2.6.6-8.el6.x86_64 already installed and latest version
Nothing to do
[root@centos1 centos]# cp -arp /etc/postfix/main.cf /etc/postfix/main.cf.bak
[root@centos1 centos]# nano -c /etc/postfix/main.cf
[root@centos1 centos]# nano -c /etc/postfix/main.cf
[root@centos1 centos]# nano -c /etc/postfix/main.cf
[root@centos1 centos]# service postfix start
[root@centos1 centos]# chkconfig --level 35 postfix on 
[root@centos1 centos]# chkconfig --list | grep postfix
postfix        	0:off	1:off	2:on	3:on	4:on	5:on	6:off
[root@centos1 centos]# yum -y install telnet
Loaded plugins: fastestmirror, refresh-packagekit, security
Setting up Install Process
Loading mirror speeds from cached hostfile
YumRepo Error: All mirror URLs are not using ftp, http[s] or file.
 Eg. Invalid release/repo/arch combination/
YumRepo Error: All mirror URLs are not using ftp, http[s] or file.
 Eg. Invalid release/repo/arch combination/
 * epel: d2lzkl7pfhq30w.cloudfront.net
Resolving Dependencies
--> Running transaction check
---> Package telnet.x86_64 1:0.17-49.el6_10 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package        Arch           Version                    Repository       Size
================================================================================
Installing:
 telnet         x86_64         1:0.17-49.el6_10           updates          58 k

Transaction Summary
================================================================================
Install       1 Package(s)

Total download size: 58 k
Installed size: 109 k
Downloading Packages:
telnet-0.17-49.el6_10.x86_64.rpm                         |  58 kB     00:00     
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : 1:telnet-0.17-49.el6_10.x86_64                               1/1 
  Verifying  : 1:telnet-0.17-49.el6_10.x86_64                               1/1 

Installed:
  telnet.x86_64 1:0.17-49.el6_10                                                

Complete!
[root@centos1 centos]# telnet localhost smtp
Trying ::1...
Connected to localhost.
Escape character is '^]'.
220 centos1.kahn.edu ESMTP Postfix
ehlo localhost
250-centos1.kahn.edu
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
mail from:root
250 2.1.0 Ok
rcpt to:centos
250 2.1.5 Ok
data
354 End data with <CR><LF>.<CR><LF>
This is a Test Mail from Postfix Mailer
.
250 2.0.0 Ok: queued as BE0AEBFB9F
auit
502 5.5.2 Error: command not recognized
quit
221 2.0.0 Bye
Connection closed by foreign host.
[root@centos1 centos]# cd /home/centos/Maildir/new ; ls
1633483792.V802Idfa3eM501006.centos1
[root@centos1 new]# cat 1633483792.V802Idfa3eM501006.centos1
Return-Path: <root@centos1.kahn.edu>
X-Original-To: centos
Delivered-To: centos@centos1.kahn.edu
Received: from localhost (localhost [IPv6:::1])
	by centos1.kahn.edu (Postfix) with ESMTP id BE0AEBFB9F
	for <centos>; Wed,  6 Oct 2021 10:29:19 +0900 (KST)
Message-Id: <20211006012934.BE0AEBFB9F@centos1.kahn.edu>
Date: Wed,  6 Oct 2021 10:29:19 +0900 (KST)
From: root@centos1.kahn.edu
To: undisclosed-recipients:;

This is a Test Mail from Postfix Mailer