mail server on rental server ,cannot send mail

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

mail server on rental server ,cannot send mail

Tuyosi Takesima
few days ago i rented renal server for coninience .
and i made mail server.

but i cannot send mail although i receive mail.

i think problems is in postfix setting .
please point out problems .


 /etc/postfix/main.cf
---------------------
myhostname = abc.vs.sakura.ne.jp
mydomain = vs.sakura.ne.jp
myorigin = $myhostname
inet_interfaces = all
mydestination = $myhostname localhost.$mydomain
home_mailbox = Maildir/
relayhost =
mynetworks = 127.0.0.0/8 160.16.123.123
queue_directory = /var/spool/postfix
command_directory = /usr/local/sbin
daemon_directory = /usr/local/libexec/postfix
data_directory = /var/postfix
mail_owner = _postfix
inet_protocols = all
unknown_local_recipient_reject_code = 550
debug_peer_level = 2
debugger_command =
         PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
         ddd $daemon_directory/$process_name $process_id & sleep 5
sendmail_path = /usr/local/sbin/sendmail
newaliases_path = /usr/local/sbin/newaliases
mailq_path = /usr/local/sbin/mailq
setgid_group = _postdrop
html_directory = /usr/local/share/doc/postfix/html
manpage_directory = /usr/local/man
sample_directory = /etc/postfix
readme_directory = /usr/local/share/doc/postfix/readme
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/isp_auth
smtp_sasl_security_options = noanonymous
disable_dns_lookups = yes


/etc/postfix/master.cf
-----------------------
smtp      inet  n       -       -       -       -       smtpd
submission inet n       -       -       -       -       smtpd  #<-
pickup    unix  n       -       -       60      1       pickup
cleanup   unix  n       -       -       -       0       cleanup
qmgr      unix  n       -       -       300     1       qmgr
tlsmgr    unix  -       -       -       1000?   1       tlsmgr
rewrite   unix  -       -       -       -       -       trivial-rewrite
bounce    unix  -       -       -       -       0       bounce
defer     unix  -       -       -       -       0       bounce
trace     unix  -       -       -       -       0       bounce
verify    unix  -       -       -       -       1       verify
flush     unix  n       -       -       1000?   0       flush
proxymap  unix  -       -       n       -       -       proxymap
proxywrite unix -       -       n       -       1       proxymap
smtp      unix  -       -       -       -       -       smtp
relay     unix  -       -       -       -       -       smtp
showq     unix  n       -       -       -       -       showq
error     unix  -       -       -       -       -       error
retry     unix  -       -       -       -       -       error
discard   unix  -       -       -       -       -       discard
local     unix  -       n       n       -       -       local
virtual   unix  -       n       n       -       -       virtual
lmtp      unix  -       -       -       -       -       lmtp
anvil     unix  -       -       -       -       1       anvil
scache    unix  -       -       -       -       1       scache


/etc/pf.conf
--------------------
ext_if="vio0"
tcp_services="{ 22, 25, 80, 143, 587, 993 }"  # <-submisson port
icmp_types="echoreq"
set block-policy return
set loginterface $ext_if
set skip on lo
match out on $ext_if inet from !($ext_if:network) to any
nat-to($ext_if:0)
set reassemble yes no-df
block in log
pass out quick
antispoof quick for { lo  }
pass in  on  $ext_if   inet proto tcp from any to  ( $ext_if:0 ) port
$tcp_services
pass in inet proto icmp all icmp-type $icmp_types


/etc/hosts
------------
127.0.0.1       localhost
::1             localhost
160.16.114.201  abc.vs.sakura.ne.jp abc
vs.sakura.ne.jp abc. 300  MX     10 abc.vs.sakura.ne.jp tk2-233-26197.
abc                    300  A      160.16.114.201


/etc/resolv.conf
------------------
lookup file bind
nameserver 8.8.8.8


in mailer ,sylpheed
----------------------
smtp port ;587
imap4 port:993
erro is 'cannot connect SMTP server: abc.vs.sakura.ne.jp:587'

tail /var/log/mail
---------------------
Jun 23 13:09:41 abc postfix/smtpd[5923]: connect from p123.akita.ocn.ne.jp
[210.789.321.123]


------
regards

Reply | Threaded
Open this post in threaded view
|

Re: mail server on rental server ,cannot send mail

Matthew Martin-2
On 6/22/15, Tuyosi Takesima <[hidden email]> wrote:
> few days ago i rented renal server for coninience .
> and i made mail server.
>
> but i cannot send mail although i receive mail.
>
> i think problems is in postfix setting .

If only there were an alternative. Something relatively simple with an
easily understood configuration and a suitable license... I guess a
guy can dream.

> please point out problems .

You have

> mynetworks = 127.0.0.0/8 160.16.123.123

And then...

> Jun 23 13:09:41 abc postfix/smtpd[5923]: connect from p123.akita.ocn.ne.jp
> [210.789.321.123]

As far as I can tell you're only allowing localhost or 160.16.123.123
to talk to postfix, and that isn't the address trying to talk to it. I
don't see how 210.789.321.123 could even exist.

Reply | Threaded
Open this post in threaded view
|

Re: mail server on rental server ,cannot send mail

Tuyosi Takesima
In reply to this post by Tuyosi Takesima
thanks  Matthew Martin.
you give me important hints .

i rewrite main.cf
--------------------
/etc/postfix/main.cf
myhostname = abc.vs.sakura.ne.jp
mydomain = vs.sakura.ne.jp
myorigin = $myhostname
inet_interfaces = all
home_mailbox = Maildir/
relay_domains = $mydestination #<-
relayhost =                 #<-
mynetworks = 127.0.0.0/8    #<-
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain #<-
queue_directory = /var/spool/postfix
command_directory = /usr/local/sbin
daemon_directory = /usr/local/libexec/postfix
data_directory = /var/postfix
mail_owner = _postfix
inet_protocols = all
unknown_local_recipient_reject_code = 550
debug_peer_level = 2
debugger_command =
         PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
         ddd $daemon_directory/$process_name $process_id & sleep 5
sendmail_path = /usr/local/sbin/sendmail
newaliases_path = /usr/local/sbin/newaliases
mailq_path = /usr/local/sbin/mailq
setgid_group = _postdrop
html_directory = /usr/local/share/doc/postfix/html
manpage_directory = /usr/local/man
sample_directory = /etc/postfix
readme_directory = /usr/local/share/doc/postfix/readme
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/isp_auth
smtp_sasl_security_options = noanonymous
disable_dns_lookups = yes

then i can send the srver via KEITAI(pocket phone ?)
but i cannot send mail by PC .

i guess the cause of not sending  mail is company's router

beause
/var/log/maillog says
-----------------
Jun 23 15:15:47 abc postfix/smtpd[20788]: lost connection
after UNKNOWN from p123.akita.ocn.ne.jp[123.189.32.456]

Jun 23 15:15:47 abc postfix/smtpd[20788]: disconnect from
p123.akita.ocn.ne.jp[123.189.32.456] unknown=0/1
commands=0/1

Jun 23 15:16:32 abc dovecot: imap-login: Login:
user=<tuyosi>,
method=PLAIN, rip=123.189.32.456, lip=160.16.114.201, mpid=16847, TLS,
session=<UkDnVCkZQwDdvSB/>

---
regards

Reply | Threaded
Open this post in threaded view
|

Re: mail server on rental server ,cannot send mail

Matthew Martin-2
On 6/23/15, Tuyosi Takesima <[hidden email]> wrote:

> thanks  Matthew Martin.
> you give me important hints .
>
> i rewrite main.cf
> --------------------
> /etc/postfix/main.cf
> myhostname = abc.vs.sakura.ne.jp
> mydomain = vs.sakura.ne.jp
> myorigin = $myhostname
> inet_interfaces = all
> home_mailbox = Maildir/
> relay_domains = $mydestination #<-
> relayhost =                 #<-
> mynetworks = 127.0.0.0/8    #<-
> mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain #<-
> queue_directory = /var/spool/postfix
> command_directory = /usr/local/sbin
> daemon_directory = /usr/local/libexec/postfix
> data_directory = /var/postfix
> mail_owner = _postfix
> inet_protocols = all
> unknown_local_recipient_reject_code = 550
> debug_peer_level = 2
> debugger_command =
>          PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
>          ddd $daemon_directory/$process_name $process_id & sleep 5
> sendmail_path = /usr/local/sbin/sendmail
> newaliases_path = /usr/local/sbin/newaliases
> mailq_path = /usr/local/sbin/mailq
> setgid_group = _postdrop
> html_directory = /usr/local/share/doc/postfix/html
> manpage_directory = /usr/local/man
> sample_directory = /etc/postfix
> readme_directory = /usr/local/share/doc/postfix/readme
> smtp_sasl_auth_enable = yes
> smtp_sasl_password_maps = hash:/etc/postfix/isp_auth
> smtp_sasl_security_options = noanonymous
> disable_dns_lookups = yes
>
> then i can send the srver via KEITAI(pocket phone ?)
> but i cannot send mail by PC .
>
> i guess the cause of not sending  mail is company's router
>
> beause
> /var/log/maillog says
> -----------------
> Jun 23 15:15:47 abc postfix/smtpd[20788]: lost connection
> after UNKNOWN from p123.akita.ocn.ne.jp[123.189.32.456]
>
> Jun 23 15:15:47 abc postfix/smtpd[20788]: disconnect from
> p123.akita.ocn.ne.jp[123.189.32.456] unknown=0/1
> commands=0/1
>
> Jun 23 15:16:32 abc dovecot: imap-login: Login:
> user=<tuyosi>,
> method=PLAIN, rip=123.189.32.456, lip=160.16.114.201, mpid=16847, TLS,
> session=<UkDnVCkZQwDdvSB/>
>
> ---
> regards
>
>

I really don't know anything about Postfix. And right now their
webserver seems down and I can't see their documentation. Have you
tried OpenSMTPD? :)

p123.akita.ocn.ne.jp's IP is different now, and still seems
impossible. .456? I'm not familiar enough with postfix/sasl/etc... to
help with anything else, but that IP can't be correct. Octets only go
up to 255. I'd see what's going on with that before looking at
anything else.

Reply | Threaded
Open this post in threaded view
|

Re: mail server on rental server ,cannot send mail

Tuyosi Takesima
In reply to this post by Tuyosi Takesima
sorry , i hide real adress and name for my privacy .

Vice versa at my home , i can    sent    mail
                      but cannot recieve mail .

i  first doubt  dovecot setting  .

 /etc/dovecot/dovecot.conf

--------------------------
protocols = imap
listen = *
!include conf.d/*.conf


 /etc/dovecot/conf.d/10-mail.conf

--------------------------------
mail_location = maildir:~/Maildir
namespace inbox {
  inbox = yes
}
mmap_disable = yes
first_valid_uid = 1000
mail_plugin_dir = /usr/local/lib/dovecot
mbox_write_locks = fcntl


 /etc/dovecot/conf.d/10-ssl.conf
--------------------------------
ssl = no       # <-------- Correction
ssl_cert = </etc/ssl/dovecotcert.pem
ssl_key = </etc/ssl/private/dovecot.pem


in mailer ,sylpheed
----------------------
smtp port ;587
imap4 port:143 # <-Correction


but in my  company i can recieve mail by sylpheed
with ( {protocols = imap in dovecot.conf}  +  { imap4 port 993 in sylpheed
} ) .
                    143=imap                               993=imaps


/var/log/maillog does not show nothing when i recieve mail .


to test relaying , i use http://www.rbl.jp/svcheck.php .
it says only 'Error: Can't connect to abc.vs.sakura.ne.jp'

it shows that the problem may be port closing .

so i nmap my home address.

result is
PORT   STATE    SERVICE
22/tcp open     ssh
25/tcp filtered smtp
80/tcp open     http

namely ports 143 doesnot open. (so cannot revieve)
ports 587 also doesnot open.      (but can send  ?????   )


i set wifi router at home
1) port forwarding
1       192.168.100.101         22 - 22         TCP&UDP  effective
2       192.168.100.101         80 - 80         TCP&UDP  effective
3       192.168.100.101         143 - 143       TCP&UDP  effective
4       192.168.100.101         587 - 587       TCP&UDP  effective
5       192.168.100.101         993 - 993       TCP&UDP  effective

2)pfctl
-sr
pass in on run0 inet proto tcp from any to (run0:0) port = 22 flags S/SA
pass in on run0 inet proto tcp from any to (run0:0) port = 80 flags S/SA
pass in on run0 inet proto tcp from any to (run0:0) port = 143 flags S/SA
pass in on run0 inet proto tcp from any to (run0:0) port = 587 flags S/SA
pass in on run0 inet proto tcp from any to (run0:0) port = 993 flags S/SA

are there another point  about opening ports ?

i  think opensmtpd and postfix and sendmail have the power of sending mail .

--------------
regards

Reply | Threaded
Open this post in threaded view
|

Re: mail server on rental server ,cannot send mail

polken
In reply to this post by Matthew Martin-2
Log when sending and receiving to see what is happening i have postfix,
dovecot, amavisd and works ok!

> Date: Tue, 23 Jun 2015 05:22:36 -0500
> Subject: Re: mail server on rental server ,cannot send mail
> From: [hidden email]
> To: [hidden email]
> CC: [hidden email]
>
> On 6/23/15, Tuyosi Takesima <[hidden email]> wrote:
> > thanks  Matthew Martin.
> > you give me important hints .
> >
> > i rewrite main.cf
> > --------------------
> > /etc/postfix/main.cf
> > myhostname = abc.vs.sakura.ne.jp
> > mydomain = vs.sakura.ne.jp
> > myorigin = $myhostname
> > inet_interfaces = all
> > home_mailbox = Maildir/
> > relay_domains = $mydestination #<-
> > relayhost =                 #<-
> > mynetworks = 127.0.0.0/8    #<-
> > mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
#<-

> > queue_directory = /var/spool/postfix
> > command_directory = /usr/local/sbin
> > daemon_directory = /usr/local/libexec/postfix
> > data_directory = /var/postfix
> > mail_owner = _postfix
> > inet_protocols = all
> > unknown_local_recipient_reject_code = 550
> > debug_peer_level = 2
> > debugger_command =
> >          PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
> >          ddd $daemon_directory/$process_name $process_id & sleep 5
> > sendmail_path = /usr/local/sbin/sendmail
> > newaliases_path = /usr/local/sbin/newaliases
> > mailq_path = /usr/local/sbin/mailq
> > setgid_group = _postdrop
> > html_directory = /usr/local/share/doc/postfix/html
> > manpage_directory = /usr/local/man
> > sample_directory = /etc/postfix
> > readme_directory = /usr/local/share/doc/postfix/readme
> > smtp_sasl_auth_enable = yes
> > smtp_sasl_password_maps = hash:/etc/postfix/isp_auth
> > smtp_sasl_security_options = noanonymous
> > disable_dns_lookups = yes
> >
> > then i can send the srver via KEITAI(pocket phone ?)
> > but i cannot send mail by PC .
> >
> > i guess the cause of not sending  mail is company's router
> >
> > beause
> > /var/log/maillog says
> > -----------------
> > Jun 23 15:15:47 abc postfix/smtpd[20788]: lost connection
> > after UNKNOWN from p123.akita.ocn.ne.jp[123.189.32.456]
> >
> > Jun 23 15:15:47 abc postfix/smtpd[20788]: disconnect from
> > p123.akita.ocn.ne.jp[123.189.32.456] unknown=0/1
> > commands=0/1
> >
> > Jun 23 15:16:32 abc dovecot: imap-login: Login:
> > user=<tuyosi>,
> > method=PLAIN, rip=123.189.32.456, lip=160.16.114.201, mpid=16847, TLS,
> > session=<UkDnVCkZQwDdvSB/>
> >
> > ---
> > regards
> >
> >
>
> I really don't know anything about Postfix. And right now their
> webserver seems down and I can't see their documentation. Have you
> tried OpenSMTPD? :)
>
> p123.akita.ocn.ne.jp's IP is different now, and still seems
> impossible. .456? I'm not familiar enough with postfix/sasl/etc... to
> help with anything else, but that IP can't be correct. Octets only go
> up to 255. I'd see what's going on with that before looking at
> anything else.

Reply | Threaded
Open this post in threaded view
|

Re: mail server on rental server ,cannot send mail

Edgar Pettijohn III-2
In reply to this post by Tuyosi Takesima
On 06/22/15 23:15, Tuyosi Takesima wrote:

> few days ago i rented renal server for coninience .
> and i made mail server.
>
> but i cannot send mail although i receive mail.
>
> i think problems is in postfix setting .
> please point out problems .
>
>
>   /etc/postfix/main.cf
> ---------------------
> myhostname = abc.vs.sakura.ne.jp
> mydomain = vs.sakura.ne.jp
> myorigin = $myhostname
> inet_interfaces = all
> mydestination = $myhostname localhost.$mydomain
> home_mailbox = Maildir/
> relayhost =
> mynetworks = 127.0.0.0/8 160.16.123.123
> queue_directory = /var/spool/postfix
> command_directory = /usr/local/sbin
> daemon_directory = /usr/local/libexec/postfix
> data_directory = /var/postfix
> mail_owner = _postfix
> inet_protocols = all
> unknown_local_recipient_reject_code = 550
> debug_peer_level = 2
> debugger_command =
>           PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
>           ddd $daemon_directory/$process_name $process_id & sleep 5
> sendmail_path = /usr/local/sbin/sendmail
> newaliases_path = /usr/local/sbin/newaliases
> mailq_path = /usr/local/sbin/mailq
> setgid_group = _postdrop
> html_directory = /usr/local/share/doc/postfix/html
> manpage_directory = /usr/local/man
> sample_directory = /etc/postfix
> readme_directory = /usr/local/share/doc/postfix/readme
> smtp_sasl_auth_enable = yes
> smtp_sasl_password_maps = hash:/etc/postfix/isp_auth
> smtp_sasl_security_options = noanonymous
> disable_dns_lookups = yes

The first thing the postfix guys will tell you is to try without chroot.

>
> /etc/postfix/master.cf
> -----------------------
> smtp      inet  n       -       -       -       -       smtpd
> submission inet n       -       -       -       -       smtpd  #<-
> pickup    unix  n       -       -       60      1       pickup
> cleanup   unix  n       -       -       -       0       cleanup
> qmgr      unix  n       -       -       300     1       qmgr
> tlsmgr    unix  -       -       -       1000?   1       tlsmgr
> rewrite   unix  -       -       -       -       -       trivial-rewrite
> bounce    unix  -       -       -       -       0       bounce
> defer     unix  -       -       -       -       0       bounce
> trace     unix  -       -       -       -       0       bounce
> verify    unix  -       -       -       -       1       verify
> flush     unix  n       -       -       1000?   0       flush
> proxymap  unix  -       -       n       -       -       proxymap
> proxywrite unix -       -       n       -       1       proxymap
> smtp      unix  -       -       -       -       -       smtp
> relay     unix  -       -       -       -       -       smtp
> showq     unix  n       -       -       -       -       showq
> error     unix  -       -       -       -       -       error
> retry     unix  -       -       -       -       -       error
> discard   unix  -       -       -       -       -       discard
> local     unix  -       n       n       -       -       local
> virtual   unix  -       n       n       -       -       virtual
> lmtp      unix  -       -       -       -       -       lmtp
> anvil     unix  -       -       -       -       1       anvil
> scache    unix  -       -       -       -       1       scache
>
>
> /etc/pf.conf
> --------------------
> ext_if="vio0"
> tcp_services="{ 22, 25, 80, 143, 587, 993 }"  # <-submisson port
> icmp_types="echoreq"
> set block-policy return
> set loginterface $ext_if
> set skip on lo
> match out on $ext_if inet from !($ext_if:network) to any
> nat-to($ext_if:0)
> set reassemble yes no-df
> block in log
> pass out quick
> antispoof quick for { lo  }
> pass in  on  $ext_if   inet proto tcp from any to  ( $ext_if:0 ) port
> $tcp_services
> pass in inet proto icmp all icmp-type $icmp_types
>
>
> /etc/hosts
> ------------
> 127.0.0.1       localhost
> ::1             localhost
> 160.16.114.201  abc.vs.sakura.ne.jp abc
> vs.sakura.ne.jp abc. 300  MX     10 abc.vs.sakura.ne.jp tk2-233-26197.
> abc                    300  A      160.16.114.201
>
>
> /etc/resolv.conf
> ------------------
> lookup file bind
> nameserver 8.8.8.8
>
>
> in mailer ,sylpheed
> ----------------------
> smtp port ;587
> imap4 port:993
> erro is 'cannot connect SMTP server: abc.vs.sakura.ne.jp:587'
>
> tail /var/log/mail
> ---------------------
> Jun 23 13:09:41 abc postfix/smtpd[5923]: connect from p123.akita.ocn.ne.jp
> [210.789.321.123]
>
>
> ------
> regards

Reply | Threaded
Open this post in threaded view
|

Re: mail server on rental server ,cannot send mail

Craig Skinner-3
On 2015-06-23 Tue 20:04 PM |, Edgar Pettijohn wrote:
>
> The first thing the postfix guys will tell you is to try without chroot.
>

Well before that....,
they'll ask for log extracts
& output from 'postconf -n' + 'postconf -Mf'.

http://www.postfix.org/DEBUG_README.html#mail