config smtp-cli & postfix to send CLI mail to internet

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

config smtp-cli & postfix to send CLI mail to internet

Owen Townsend
subject: newbie config smtp-cli & postfix
date: Oct 9/2009

I want to  mail from Linux logged in user accounts to the internet
and more importantly from Korn shell scripts to the internet.
so scripts running by cron could email error situations to people at home.
I do not want to receive any email from the internet to linux logged on
users
via postfix. (postfix mail between users logged on to the RH linux works OK)
I use Thunderbird for my email from internet.

Previously I installed postfix (postfix-2.3.3-2.x86_64.rpm),
changed config file /etc/postfix/main.cf to 'relayhost =
smtp.webfaction.com'
and tried to send using 'mail' (got errs you can see on website as below)

I was told that smtp-cli is a simpler way for what I want to do
so I installed smtp-cli 2.6 & ran following tests
& got following messages in /var/log/postfix

test1--> smtp-cli --from uvsoft4 --to [hidden email] --subject "test1" \
                  --body-plain "test1 oct 9 11:24"

Oct  9 11:30:31 uvsoft4 postfix/smtp[7230]:
connect to mx7.webfaction.com[174.133.156.178]:
No route to host (port 25)

Oct  9 11:30:31 uvsoft4 postfix/smtp[7230]: C3B9C46962:
to=<[hidden email]>, relay=none, delay=6.2,
delays=0.07/0.01/6.1/0, dsn=4.4.1, status=deferred
(connect to mx7.webfaction.com[174.133.156.178]:
No route to host)

Note - I am only showing 2 most significant lines of /var/log/maillog
       (broken on multiple lines for ease of reading)
     - see all lines at the URLs listed further below

Since I saw 'no route to host port 25', I changed /etc/postfix/main.cf to:
relayhost = [smtp.webfaction.com]:587, reran & got following:
 
test2--> smtp-cli --from uvsoft4 --to [hidden email] --subject "test2" \
                  --body-plain "test2 oct 9 12:40"

Oct  9 12:42:05 uvsoft4 postfix/smtp[10496]: ECF0546964:
to=<[hidden email]>, relay=smtp.webfaction.com[74.55.86.74]:587,
delay=0.62, delays=0.07/0.01/0.4/0.14, dsn=5.7.1,
status=bounced (host smtp.webfaction.com[74.55.86.74] said: 554 5.7.1
<65-38-39-25.dhcp465.dsl.ucc-net.ca[65.38.39.25]>: Client host rejected:
Access denied (in reply to RCPT TO command))

Oct  9 12:42:05 uvsoft4 postfix/local[10504]: A63F046967:
to=<[hidden email]>, relay=local, delay=0.06,
delays=0.02/0.01/0/0.02, dsn=5.1.1, status=bounced
(unknown user: "uvsoft4")

See complete maillog's (test1=maillog5_smtpcli & test2=maillog6_smtpcli)
on my website as follows:

www.uvsoftware.ca/postfix/smtpcli_test1    <-- command line for smtp-cli
www.uvsoftware.ca/postfix/maillog5_smtpcli <-- /var/log/maillog Oct 9 test1
www.uvsoftware.ca/postfix/maillog6_smtpcli <-- /var/log/maillog Oct 9 test2
www.uvsoftware.ca/postfix/main.cf          <-- my postfix config file
www.uvsoftware.ca/postfix/maillog1,2,3,4   <-- old tests using mail vs
smtp-cli

I am using a router to get to the internet & my ISP
- router gateway adress to the internet is 192.168.0.1
- my linux Red Hat computer is 192.168.0.4

For each test I did following:
1. service postfix stop
2. > /var/log/maillog
3. service postfix start
4. smtp-cli ...           <-- see complete command above
5. service postfix stop
6. capture /var/log/maillog & assign test# (maillog1,2,3,4,5,etc)

Note - somebody on postfix user list said I might need SASL library
- BUT I can't find a recent rpm for my RHEL 5 x86_64 ?
I found cyrus-sasl-2.1.1.19-14.x86_64.rpm but hesitant to try it ?

Hope you can help me with this problem

Thanks, Owen

Reply | Threaded
Open this post in threaded view
|

Re: config smtp-cli & postfix to send CLI mail to internet

Bjørn Ruberg
Owen Townsend wrote:

[...]

> Oct  9 12:42:05 uvsoft4 postfix/smtp[10496]: ECF0546964:
> to=<[hidden email]>, relay=smtp.webfaction.com[74.55.86.74]:587,
> delay=0.62, delays=0.07/0.01/0.4/0.14, dsn=5.7.1,
> status=bounced (host smtp.webfaction.com[74.55.86.74] said: 554 5.7.1
> <65-38-39-25.dhcp465.dsl.ucc-net.ca[65.38.39.25]>: Client host rejected:
> Access denied (in reply to RCPT TO command))

As you are obviously able to send e-mail using your regular e-mail
client, you should already know which configuration settings are
required for sending e-mail through your ISP. The log below shows your
posting's first step on its way to the mailing list, seems like
"smtp.webfaction.com" is indeed the correct SMTP server.

Received: from [192.168.0.4] (65-38-39-25.dhcp465.dsl.ucc-net.ca [65.38.39.25])
        by smtp.webfaction.com (Postfix) with ESMTP id 12F381C73BBD
        for <[hidden email]>; Fri,  9 Oct 2009 16:12:36 -0500 (CDT)


You write that you use Thunderbird for regular e-mail. Find out how your
Thunderbird client is configured. If your ISP requires a username and
password, you will need to configure Postfix similarly. Google for
"postfix relayhost auth" for instructions.

For further assistance after having done that, please include the output
from "postconf -n" in your next posting to the list. Please also consult
http://www.postfix.org/DEBUG_README.html

--
Bjørn

Reply | Threaded
Open this post in threaded view
|

config smtp-cli & postfix to send CLI mail to internet

Stan Hoeppner
Bjørn Ruberg put forth on 10/9/2009 4:44 PM:

> Owen Townsend wrote:
>
> [...]
>
>> Oct  9 12:42:05 uvsoft4 postfix/smtp[10496]: ECF0546964:
>> to=<[hidden email]>, relay=smtp.webfaction.com[74.55.86.74]:587,
>> delay=0.62, delays=0.07/0.01/0.4/0.14, dsn=5.7.1,
>> status=bounced (host smtp.webfaction.com[74.55.86.74] said: 554 5.7.1
>> <65-38-39-25.dhcp465.dsl.ucc-net.ca[65.38.39.25]>: Client host rejected:
>> Access denied (in reply to RCPT TO command))
>
> As you are obviously able to send e-mail using your regular e-mail
> client, you should already know which configuration settings are
> required for sending e-mail through your ISP. The log below shows your
> posting's first step on its way to the mailing list, seems like
> "smtp.webfaction.com" is indeed the correct SMTP server.

I spoon fed him the complete answer a few days ago.  He adopted the :587
but then ignored my SASL instructions:

Stan Hoeppner put forth on 10/7/2009 2:50 PM:

> What he's going to need to do is one (or more) of the following:
>
> 1.  Request ISP remove TCP 25 block from his account
> 2.  Install/configure SASL red hat libraries -- sry no help here, Google
> for "rad hat SASL library"
> 3.  Configure Postfix to send via SASL over either TCP 25 or 587
>
> Create /etc/postfix/sasl_passwd
> smtp.webfaction.com [hidden email]:password
>
> Then execute:
> postmap /etc/postfix/sasl_passwd
>
> Add the following to /etc/postfix/main.cf
>
> relayhost = [smtp.webfaction.com]:587
> smtp_sasl_auth_enable = yes
> smtp_sasl_security_options = noanonymous
> smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd

Reply | Threaded
Open this post in threaded view
|

config smtp-cli & postfix to send CLI mail to internet

Stan Hoeppner
In reply to this post by Owen Townsend
Owen Townsend put forth on 10/9/2009 4:14 PM:

> Note - somebody on postfix user list said I might need SASL library
> - BUT I can't find a recent rpm for my RHEL 5 x86_64 ?
> I found cyrus-sasl-2.1.1.19-14.x86_64.rpm but hesitant to try it ?
>
> Hope you can help me with this problem

Dangit, I'm sorry Owen.  I didn't read your entire email.  So, please
accept my apology for my crass tone in my last response.  Indeed, you
will need the sasl libraries to accomplish your goals.  I'm a Debian
guy, not Red Hat.

Go ahead and give that RPM a go, see if it works.  If not we'll search
for another version of libsasl that will work.  You might need libsasl2
instead.

--
Stan
Reply | Threaded
Open this post in threaded view
|

Re: config smtp-cli & postfix to send CLI mail to internet

Victoriano Giralt-2
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Stan Hoeppner wrote:
| Go ahead and give that RPM a go, see if it works.  If not we'll search
| for another version of libsasl that will work.  You might need libsasl2
| instead.
If the OP needs SASL just for SMTP-auth in Postfix, I'd suggest to give
Docecot a go. It has excellent SASL capabilities, is quite easy to
configure and integrate with Postfix and has a lot of powerful and useful
features for authenticating users.

- --
Victoriano Giralt
Systems Manager
Central ICT Services
University of Malaga
SPAIN
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)
Comment: Using GnuPG with CentOS - http://enigmail.mozdev.org

iD8DBQFK0DxNV6+mDjj1PTgRAmxtAKCfTNirl/3bnxu2ckC4LDQit5CfBwCeI9pr
tcPQx/hSznQMmWwiGt9gpsQ=
=wzaL
-----END PGP SIGNATURE-----
Reply | Threaded
Open this post in threaded view
|

config smtp-cli & postfix to send CLI mail to internet

Stan Hoeppner
Victoriano Giralt put forth on 10/10/2009 2:48 AM:
> Stan Hoeppner wrote:
> | Go ahead and give that RPM a go, see if it works.  If not we'll search
> | for another version of libsasl that will work.  You might need libsasl2
> | instead.
> If the OP needs SASL just for SMTP-auth in Postfix, I'd suggest to give
> Docecot a go. It has excellent SASL capabilities, is quite easy to
> configure and integrate with Postfix and has a lot of powerful and useful
> features for authenticating users.

He just needs to authenticate an outbound connection to an ISP relay.
All he needs is the SASL library, which requires no configuration.
Dovecote would be overkill, assuming it's even applicable to outbound
SMTP connections.

--
Stan
Reply | Threaded
Open this post in threaded view
|

Re: config smtp-cli & postfix to send CLI mail to internet

mouss-4
In reply to this post by Victoriano Giralt-2
Victoriano Giralt a écrit :
> Stan Hoeppner wrote:
> | Go ahead and give that RPM a go, see if it works.  If not we'll search
> | for another version of libsasl that will work.  You might need libsasl2
> | instead.
> If the OP needs SASL just for SMTP-auth in Postfix, I'd suggest to give
> Docecot a go.

OP needs "client side SASL" (he needs to authenticate to his
ISP/whatever relay). dovecot auth only applies to "server side SASL"



> It has excellent SASL capabilities, is quite easy to
> configure and integrate with Postfix and has a lot of powerful and useful
> features for authenticating users.
>
Reply | Threaded
Open this post in threaded view
|

Re: config smtp-cli & postfix to send CLI mail to internet

Victoriano Giralt-2
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

mouss wrote:
| OP needs "client side SASL" (he needs to authenticate to his
| ISP/whatever relay). dovecot auth only applies to "server side SASL"
I apologise for the noise. I could not find the original post, and I was
too fast on the send button.

- --
Victoriano Giralt
Systems Manager
Central ICT Services
University of Malaga
SPAIN
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)
Comment: Using GnuPG with CentOS - http://enigmail.mozdev.org

iD8DBQFK0K+FV6+mDjj1PTgRAhmsAKCW4mPn/KgtADnTwitEAh9W0noUFQCeLwH8
JZSV/88Wa9hYGLpppZQYBEQ=
=WSwG
-----END PGP SIGNATURE-----