telnetでsmtp(postfix) (telnet xxx.xxx.xxx.xxx 25) まずは基本中の基本から メモ

わすれちゃうんで、メモ

一番最初はDNS MXの確認

[hirasawa@ubunt1004-32-2 ~]$ nslookup
> set type=mx
> hirasawa.local
Server:		192.168.1.28
Address:	192.168.1.28#53

hirasawa.local	mail exchanger = 10 mail.hirasawa.local.
> mail
Server:		192.168.1.28
Address:	192.168.1.28#53

mail.hirasawa.local	canonical name = cent5-64b-40.hirasawa.local.
> quit
Server:		192.168.1.28
Address:	192.168.1.28#53

** server can't find quit: NXDOMAIN
> exit

[hirasawa@ubunt1004-32-2 ~]$ 

んで続いて、nmapでポートが開いていることを確認。

[hirasawa@ubunt1004-32-2 ~]$ nmap 192.168.1.40 | grep 25
25/tcp   open  smtp
[hirasawa@ubunt1004-32-2 ~]$ 
[hirasawa@ubunt1004-32-2 ~]$ nmap localhost | grep 25
Warning: Hostname localhost resolves to 2 IPs. Using 127.0.0.1.
[hirasawa@ubunt1004-32-2 ~]$ 

telnetsmtpクライアントってことですね

[hirasawa@ubunt1004-32-2 ~]$ telnet 192.168.1.40 25
Trying 192.168.1.40...
Connected to 192.168.1.40.
Escape character is '^]'.
220 cent5-64b-40.localdomain ESMTP Postfix
HELO hirasawa.local
250 cent5-64b-40.localdomain
MAIL from hiraawa@hirasawa.local
501 5.5.4 Syntax: MAIL FROM:<address>
MAIL FROM: hirasawa@hirasawa.local
250 2.1.0 Ok
RCPT TO: hirasawa@hirasawa.local
250 2.1.5 Ok
DATA
354 End data with <CR><LF>.<CR><LF>
From: hirasawa@hirasawa.local
Subject 0753
Hello from ubu
.
250 2.0.0 Ok: queued as 5CC721F0070F
QUIT
221 2.0.0 Bye
Connection closed by foreign host.
[hirasawa@ubunt1004-32-2 ~]$ 

順番が逆になっちまうけど、
mail-server(192.168.1.40)で走ってるsmtppostfix

[root@cent5-64b-40 ~]# ps -ef | grep postfix
root     22560     1  0 19:21 ?        00:00:00 /usr/libexec/postfix/master
postfix  22561 22560  0 19:21 ?        00:00:00 pickup -l -t fifo -u
postfix  22562 22560  0 19:21 ?        00:00:00 qmgr -l -t fifo -u
root     23620 23584  0 20:09 pts/4    00:00:00 grep postfix
[root@cent5-64b-40 ~]# ps -ef | grep sendmail
root     23623 23584  0 20:09 pts/4    00:00:00 grep sendmail
[root@cent5-64b-40 ~]# 
[root@cent5-64b-40 ~]# 
[root@cent5-64b-40 ~]# cd /etc/postfix/
[root@cent5-64b-40 postfix]# ls -l
合計 328
-rw-r--r-- 1 root root 11942  6月  1 01:29 LICENSE
-rw-r--r-- 1 root root  1629  6月  1 01:29 TLS_LICENSE
-rw-r--r-- 1 root root 17832  6月  1 01:29 access
-rw-r--r-- 1 root root  3550  6月  1 01:29 bounce.cf.default
-rw-r--r-- 1 root root 11175  6月  1 01:29 canonical
-rw-r--r-- 1 root root  9920  6月  1 01:29 generic
-rw-r--r-- 1 root root 16838  6月  1 01:29 header_checks
-rw-r--r-- 1 root root 26810 11月 24 19:21 main.cf
-rw-r--r-- 1 root root 17981  6月  1 01:29 main.cf.default
-rw-r--r-- 1 root root 26737 11月 24 15:54 main.cf.orig
-rw-r--r-- 1 root root   970  6月  1 01:29 makedefs.out
-rw-r--r-- 1 root root  4137  6月  1 01:29 master.cf
-rwxr-xr-x 1 root root 22564  6月  1 01:29 post-install
-rw-r--r-- 1 root root 17639  6月  1 01:29 postfix-files
-rwxr-xr-x 1 root root  6366  6月  1 01:29 postfix-script
-rw-r--r-- 1 root root  6805  6月  1 01:29 relocated
-rw-r--r-- 1 root root 12081  6月  1 01:29 transport
-rw-r--r-- 1 root root 11984  6月  1 01:29 virtual
[root@cent5-64b-40 postfix]# 
[root@cent5-64b-40 postfix]# 
[root@cent5-64b-40 postfix]# diff main.cf.orig main.cf
107c107
< #inet_interfaces = all
---
> inet_interfaces = all
110c110
< inet_interfaces = localhost
---
> #inet_interfaces = localhost
155c155
< mydestination = $myhostname, localhost.$mydomain, localhost
---
> mydestination = $myhostname, localhost.$mydomain, localhost hirasawa.local
255a256
> mynetworks = 168.100.189.0/28, 127.0.0.0/8 192.168.1.0/24
[root@cent5-64b-40 postfix]#

一応、参考にしたサイト
http://www.searchman.info/fedoracore4_apply/sev1040.html