I'm a beginner and want to setup Postfix on CentOS.

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

I'm a beginner and want to setup Postfix on CentOS.

Jason Long
Hello,
I installed Postfix on CentOS and my "main.cf" file is as below:

myhostname = mail.my-example.com
mydomain = my-example.com
myorigin = $mydomain
## Uncomment and Set inet_interfaces to all ##
inet_interfaces = all
## Change to all ##
inet_protocols = all
## Comment ##
##- Uncomment ##
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
## Uncomment and add IP range ##
mynetworks = 127.0.0.0/8, My Public IP
## Uncomment ##
home_mailbox = Maildir/
smtpd_use_tls = yes
smtpd_tls_cert_file = /etc/postfix/mail.crt
smtpd_tls_key_file = /etc/postfix/mail.key
smtpd_tls_security_level = may
mynetworks_style = subnet
queue_directory = /var/spool/postfix



When I want to send an email to Yahoo! then it show me below error:

# telnet localhost 25
Trying ::1...
Connected to localhost.
Escape character is '^]'.
ehlo localhost
220 mail.my-example.net.com ESMTP Postfix
250-mail.my-example.net.com
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-STARTTLS
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
mail from:<info>
250 2.1.0 Ok
rcpt to:<[hidden email]>
554 5.7.1 <[hidden email]>: Relay access denied


I searched and find a solution as below:

"smtpd_recipient_restrictions = permit_sasl_authenticated"
  
But when I added it to main.cf then I can't do anything:

# telnet localhost 25
Trying ::1...
Connected to localhost.
Escape character is '^]'.
ehlo localhost


How can I solve it?

Thank you.
Reply | Threaded
Open this post in threaded view
|

Re: I'm a beginner and want to setup Postfix on CentOS.

ilyak
> mynetworks = 127.0.0.0/8, My Public IP
> Trying ::1...
It could be that you are using IPv6 to connect while "mynetworks" is IPv4 address.
Try "telnet 127.0.0.1 25"

On Mon, Oct 12, 2020 at 3:25 PM Jason Long <[hidden email]> wrote:
Hello,
I installed Postfix on CentOS and my "main.cf" file is as below:

myhostname = mail.my-example.com
mydomain = my-example.com
myorigin = $mydomain
## Uncomment and Set inet_interfaces to all ##
inet_interfaces = all
## Change to all ##
inet_protocols = all
## Comment ##
##- Uncomment ##
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
## Uncomment and add IP range ##
mynetworks = 127.0.0.0/8, My Public IP
## Uncomment ##
home_mailbox = Maildir/
smtpd_use_tls = yes
smtpd_tls_cert_file = /etc/postfix/mail.crt
smtpd_tls_key_file = /etc/postfix/mail.key
smtpd_tls_security_level = may
mynetworks_style = subnet
queue_directory = /var/spool/postfix



When I want to send an email to Yahoo! then it show me below error:

# telnet localhost 25
Trying ::1...
Connected to localhost.
Escape character is '^]'.
ehlo localhost
220 mail.my-example.net.com ESMTP Postfix
250-mail.my-example.net.com
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-STARTTLS
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
mail from:<info>
250 2.1.0 Ok
rcpt to:<[hidden email]>
554 5.7.1 <[hidden email]>: Relay access denied


I searched and find a solution as below:

"smtpd_recipient_restrictions = permit_sasl_authenticated"
  
But when I added it to main.cf then I can't do anything:

# telnet localhost 25
Trying ::1...
Connected to localhost.
Escape character is '^]'.
ehlo localhost


How can I solve it?

Thank you.
Reply | Threaded
Open this post in threaded view
|

Re: I'm a beginner and want to setup Postfix on CentOS.

Jason Long
Thank you for your reply.
How can I sure I'm using IPv4 or IPv6?






On Monday, October 12, 2020, 06:18:10 PM GMT+3:30, IL Ka <[hidden email]> wrote:





> mynetworks = 127.0.0.0/8, My Public IP
> Trying ::1...
It could be that you are using IPv6 to connect while "mynetworks" is IPv4 address.
Try "telnet 127.0.0.1 25"


On Mon, Oct 12, 2020 at 3:25 PM Jason Long <[hidden email]> wrote:

> Hello,
> I installed Postfix on CentOS and my "main.cf" file is as below:
>
> myhostname = mail.my-example.com
> mydomain = my-example.com
> myorigin = $mydomain
> ## Uncomment and Set inet_interfaces to all ##
> inet_interfaces = all
> ## Change to all ##
> inet_protocols = all
> ## Comment ##
> ##- Uncomment ##
> mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
> ## Uncomment and add IP range ##
> mynetworks = 127.0.0.0/8, My Public IP
> ## Uncomment ##
> home_mailbox = Maildir/
> smtpd_use_tls = yes
> smtpd_tls_cert_file = /etc/postfix/mail.crt
> smtpd_tls_key_file = /etc/postfix/mail.key
> smtpd_tls_security_level = may
> mynetworks_style = subnet
> queue_directory = /var/spool/postfix
>
>
>
> When I want to send an email to Yahoo! then it show me below error:
>
> # telnet localhost 25
> Trying ::1...
> Connected to localhost.
> Escape character is '^]'.
> ehlo localhost
> 220 mail.my-example.net.com ESMTP Postfix
> 250-mail.my-example.net.com
> 250-PIPELINING
> 250-SIZE 10240000
> 250-VRFY
> 250-ETRN
> 250-STARTTLS
> 250-ENHANCEDSTATUSCODES
> 250-8BITMIME
> 250 DSN
> mail from:<info>
> 250 2.1.0 Ok
> rcpt to:<[hidden email]>
> 554 5.7.1 <[hidden email]>: Relay access denied
>
>
> I searched and find a solution as below:
>
> "smtpd_recipient_restrictions = permit_sasl_authenticated"
>   
> But when I added it to main.cf then I can't do anything:
>
> # telnet localhost 25
> Trying ::1...
> Connected to localhost.
> Escape character is '^]'.
> ehlo localhost
>
>
> How can I solve it?
>
> Thank you.
>
Reply | Threaded
Open this post in threaded view
|

Re: I'm a beginner and want to setup Postfix on CentOS.

Remco Rijnders
On Mon, Oct 12, 2020 at 02:54:55PM +0000, Jason wrote in
<[hidden email]>:
>Thank you for your reply.
>How can I sure I'm using IPv4 or IPv6?

You have both on your system. When you telnetted to localhost, it used ipv6 (see
the "Trying ::1..." part). You do not have that listed in your mynetworks
section. Try adding "[::1]/128" to your mynetworks setting and try again.
Reply | Threaded
Open this post in threaded view
|

Re: I'm a beginner and want to setup Postfix on CentOS.

ilyak
In reply to this post by Jason Long
" ::1"  is a local address for IPv6
"127.[something]" is a local address of IPv4.

My guess is that you didn't include IPv6 address to the list of "mynetworks", so Postfix can't "trust" it, because
"smtpd_relay_restrictions" is default to: "permit_mynetworks, permit_sasl_authenticated, defer_unauth_destination", which means it only relays emails either from "mynetworks" or authenticated users.

"localhost" is resolved to the IPv6 address on CentOS. You can explicitly disable IPv6:

Or use IPv4 address explicitly: "telnet 127.0.0.1 25".

I'd stay with the latter case.



On Mon, Oct 12, 2020 at 5:55 PM Jason Long <[hidden email]> wrote:
Thank you for your reply.
How can I sure I'm using IPv4 or IPv6?


On Monday, October 12, 2020, 06:18:10 PM GMT+3:30, IL Ka <[hidden email]> wrote:

> mynetworks = 127.0.0.0/8, My Public IP
> Trying ::1...
It could be that you are using IPv6 to connect while "mynetworks" is IPv4 address.
Try "telnet 127.0.0.1 25"
Reply | Threaded
Open this post in threaded view
|

Re: I'm a beginner and want to setup Postfix on CentOS.

Jason Long
# ifconfig

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:80230 errors:0 dropped:0 overruns:0 frame:0
          TX packets:80230 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:13792298 (13.1 MiB)  TX bytes:13792298 (13.1 MiB)



You right. 

# telnet 127.0.0.1 25
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
220 mail.example.net ESMTP Postfix
ehlo 127.0.0.1
250-mail.example.net
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-STARTTLS
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN


Which lines of configuration must be change?





On Monday, October 12, 2020, 06:38:42 PM GMT+3:30, IL Ka <[hidden email]> wrote:





" ::1"  is a local address for IPv6
"127.[something]" is a local address of IPv4.
https://en.wikipedia.org/wiki/Localhost

My guess is that you didn't include IPv6 address to the list of "mynetworks", so Postfix can't "trust" it, because
"smtpd_relay_restrictions" is default to: "permit_mynetworks, permit_sasl_authenticated, defer_unauth_destination", which means it only relays emails either from "mynetworks" or authenticated users.

"localhost" is resolved to the IPv6 address on CentOS. You can explicitly disable IPv6:
https://www.tecmint.com/disable-ipv6-in-centos-8/

Or use IPv4 address explicitly: "telnet 127.0.0.1 25".

I'd stay with the latter case.



On Mon, Oct 12, 2020 at 5:55 PM Jason Long <[hidden email]> wrote:

> Thank you for your reply.
> How can I sure I'm using IPv4 or IPv6?
>
>
> On Monday, October 12, 2020, 06:18:10 PM GMT+3:30, IL Ka <[hidden email]> wrote:
>
>> mynetworks = 127.0.0.0/8, My Public IP
>> Trying ::1...
> It could be that you are using IPv6 to connect while "mynetworks" is IPv4 address.
> Try "telnet 127.0.0.1 25"
>
Reply | Threaded
Open this post in threaded view
|

Re: I'm a beginner and want to setup Postfix on CentOS.

Jason Long
I disabled IPv6 in CentOS but connect with localhost not affected.


On Mon, Oct 12, 2020 at 6:48 PM, Jason Long
# ifconfig

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:80230 errors:0 dropped:0 overruns:0 frame:0
          TX packets:80230 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:13792298 (13.1 MiB)  TX bytes:13792298 (13.1 MiB)



You right. 

# telnet 127.0.0.1 25
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
220 mail.example.net ESMTP Postfix
ehlo 127.0.0.1
250-mail.example.net
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-STARTTLS
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN


Which lines of configuration must be change?





On Monday, October 12, 2020, 06:38:42 PM GMT+3:30, IL Ka <[hidden email]> wrote:





" ::1"  is a local address for IPv6
"127.[something]" is a local address of IPv4.
https://en.wikipedia.org/wiki/Localhost

My guess is that you didn't include IPv6 address to the list of "mynetworks", so Postfix can't "trust" it, because
"smtpd_relay_restrictions" is default to: "permit_mynetworks, permit_sasl_authenticated, defer_unauth_destination", which means it only relays emails either from "mynetworks" or authenticated users.

"localhost" is resolved to the IPv6 address on CentOS. You can explicitly disable IPv6:
https://www.tecmint.com/disable-ipv6-in-centos-8/

Or use IPv4 address explicitly: "telnet 127.0.0.1 25".

I'd stay with the latter case.



On Mon, Oct 12, 2020 at 5:55 PM Jason Long <[hidden email]> wrote:

> Thank you for your reply.
> How can I sure I'm using IPv4 or IPv6?
>
>
> On Monday, October 12, 2020, 06:18:10 PM GMT+3:30, IL Ka <[hidden email]> wrote:
>
>> mynetworks = 127.0.0.0/8, My Public IP
>> Trying ::1...
> It could be that you are using IPv6 to connect while "mynetworks" is IPv4 address.
> Try "telnet 127.0.0.1 25"
>
Reply | Threaded
Open this post in threaded view
|

Re: I'm a beginner and want to setup Postfix on CentOS.

Ron Wheeler
localhost is a name that Centos resolves.

https://www.liquidweb.com/kb/what-is-localhost

https://forums.centos.org/viewtopic.php?t=47101 discusses how it gets interpreted/set.

lo and ifconfig does not enter into the discussion.



On 2020-10-12 12:44 p.m., Jason Long wrote:
I disabled IPv6 in CentOS but connect with localhost not affected.


On Mon, Oct 12, 2020 at 6:48 PM, Jason Long
# ifconfig

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:80230 errors:0 dropped:0 overruns:0 frame:0
          TX packets:80230 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:13792298 (13.1 MiB)  TX bytes:13792298 (13.1 MiB)



You right. 

# telnet 127.0.0.1 25
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
220 mail.example.net ESMTP Postfix
ehlo 127.0.0.1
250-mail.example.net
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-STARTTLS
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN


Which lines of configuration must be change?





On Monday, October 12, 2020, 06:38:42 PM GMT+3:30, IL Ka <[hidden email]> wrote:





" ::1"  is a local address for IPv6
"127.[something]" is a local address of IPv4.
https://en.wikipedia.org/wiki/Localhost

My guess is that you didn't include IPv6 address to the list of "mynetworks", so Postfix can't "trust" it, because
"smtpd_relay_restrictions" is default to: "permit_mynetworks, permit_sasl_authenticated, defer_unauth_destination", which means it only relays emails either from "mynetworks" or authenticated users.

"localhost" is resolved to the IPv6 address on CentOS. You can explicitly disable IPv6:
https://www.tecmint.com/disable-ipv6-in-centos-8/

Or use IPv4 address explicitly: "telnet 127.0.0.1 25".

I'd stay with the latter case.



On Mon, Oct 12, 2020 at 5:55 PM Jason Long <[hidden email]> wrote:
> Thank you for your reply.
> How can I sure I'm using IPv4 or IPv6?
>
>
> On Monday, October 12, 2020, 06:18:10 PM GMT+3:30, IL Ka <[hidden email]> wrote:
>
>> mynetworks = 127.0.0.0/8, My Public IP
>> Trying ::1...
> It could be that you are using IPv6 to connect while "mynetworks" is IPv4 address.
> Try "telnet 127.0.0.1 25"
>

-- 
Ron Wheeler
Artifact Software
438-345-3369
[hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: I'm a beginner and want to setup Postfix on CentOS.

Jason Long
Thank you.
I edited both "/etc/hosts" and "/etc/sysconfig/network" files and put my domain name there.
What is my server problem?


On Mon, Oct 12, 2020 at 8:24 PM, Ron Wheeler
localhost is a name that Centos resolves.

https://www.liquidweb.com/kb/what-is-localhost

https://forums.centos.org/viewtopic.php?t=47101 discusses how it gets interpreted/set.

lo and ifconfig does not enter into the discussion.



On 2020-10-12 12:44 p.m., Jason Long wrote:
I disabled IPv6 in CentOS but connect with localhost not affected.


On Mon, Oct 12, 2020 at 6:48 PM, Jason Long
# ifconfig

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:80230 errors:0 dropped:0 overruns:0 frame:0
          TX packets:80230 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:13792298 (13.1 MiB)  TX bytes:13792298 (13.1 MiB)



You right. 

# telnet 127.0.0.1 25
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
220 mail.example.net ESMTP Postfix
ehlo 127.0.0.1
250-mail.example.net
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-STARTTLS
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN


Which lines of configuration must be change?





On Monday, October 12, 2020, 06:38:42 PM GMT+3:30, IL Ka <[hidden email]> wrote:





" ::1"  is a local address for IPv6
"127.[something]" is a local address of IPv4.
https://en.wikipedia.org/wiki/Localhost

My guess is that you didn't include IPv6 address to the list of "mynetworks", so Postfix can't "trust" it, because
"smtpd_relay_restrictions" is default to: "permit_mynetworks, permit_sasl_authenticated, defer_unauth_destination", which means it only relays emails either from "mynetworks" or authenticated users.

"localhost" is resolved to the IPv6 address on CentOS. You can explicitly disable IPv6:
https://www.tecmint.com/disable-ipv6-in-centos-8/

Or use IPv4 address explicitly: "telnet 127.0.0.1 25".

I'd stay with the latter case.



On Mon, Oct 12, 2020 at 5:55 PM Jason Long <[hidden email]> wrote:
> Thank you for your reply.
> How can I sure I'm using IPv4 or IPv6?
>
>
> On Monday, October 12, 2020, 06:18:10 PM GMT+3:30, IL Ka <[hidden email]> wrote:
>
>> mynetworks = 127.0.0.0/8, My Public IP
>> Trying ::1...
> It could be that you are using IPv6 to connect while "mynetworks" is IPv4 address.
> Try "telnet 127.0.0.1 25"

>

-- 
Ron Wheeler
Artifact Software
438-345-3369
[hidden email]