LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 07-08-2014, 09:20 AM   #1
Nefri
LQ Newbie
 
Registered: Jul 2014
Posts: 6

Rep: Reputation: Disabled
Sendmail configuration (Connection timed out with alt4.gmail-smtp-in.l.google.com.)


Hi guys!

Background: I have to connect my laptop, useing ssh to a server with centOS and configurate an openVAS system to create scanreports and automaticly send them to the selected email adresses, but openVAS's emailing function not working by default. After some research I find out I have to configure a program named sendmail correctly to make is work, but looks like configurateing sendmail is not an easy task for a beginer like me.

Problem: I tryed to install and configurate sendmail, but when I try to send an email to my gmail, I always got Connection timed out with "alt4.gmail-smtp-in.l.google.com." error. I also not able to connect by telnet to "alt4.gmail-smtp-in.l.google.com. 25".

Here is my settings: (sry for spaming it all)
vi sendmail.mc
Code:
divert(-1)dnl
dnl #
dnl # This is the sendmail macro config file for m4. If you make changes to
dnl # /etc/mail/sendmail.mc, you will need to regenerate the
dnl # /etc/mail/sendmail.cf file by confirming that the sendmail-cf package is
dnl # installed and then performing a
dnl #
dnl #     /etc/mail/make
dnl #
include(`/usr/share/sendmail-cf/m4/cf.m4')dnl
VERSIONID(`setup for linux')dnl
OSTYPE(`linux')dnl
dnl #
dnl # Do not advertize sendmail version.
dnl #
dnl define(`confSMTP_LOGIN_MSG', `$j Sendmail; $b')dnl
dnl #
dnl # default logging level is 9, you might want to set it higher to
dnl # debug the configuration
dnl #
dnl define(`confLOG_LEVEL', `9')dnl
dnl #
dnl # Uncomment and edit the following line if your outgoing mail needs to
dnl # be sent out through an external mail server:
dnl #
dnl # define(`SMART_HOST', `[smtp.datanet.hu]')dnl
dnl #
define(`confDEF_USER_ID', ``8:12'')dnl
dnl define(`confAUTO_REBUILD')dnl
define(`confTO_CONNECT', `1m')dnl
define(`confTRY_NULL_MX_LIST', `True')dnl
define(`confDONT_PROBE_INTERFACES', `True')dnl
define(`PROCMAIL_MAILER_PATH', `/usr/bin/procmail')dnl
define(`ALIAS_FILE', `/etc/aliases')dnl
define(`STATUS_FILE', `/var/log/mail/statistics')dnl
define(`UUCP_MAILER_MAX', `2000000')dnl
define(`confUSERDB_SPEC', `/etc/mail/userdb.db')dnl
define(`confPRIVACY_FLAGS', `authwarnings,novrfy,noexpn,restrictqrun')dnl
define(`confAUTH_OPTIONS', `A')dnl
dnl #
dnl # The following allows relaying if the user authenticates, and disallows
dnl # plaintext authentication (PLAIN/LOGIN) on non-TLS links
dnl #
dnl define(`confAUTH_OPTIONS', `A p')dnl
dnl #
dnl # PLAIN is the preferred plaintext authentication method and used by
dnl # Mozilla Mail and Evolution, though Outlook Express and other MUAs do
dnl # use LOGIN. Other mechanisms should be used if the connection is not
dnl # guaranteed secure.
dnl # Please remember that saslauthd needs to be running for AUTH.
dnl #
dnl TRUST_AUTH_MECH(`EXTERNAL DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
dnl define(`confAUTH_MECHANISMS', `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
dnl #
dnl # Rudimentary information on creating certificates for sendmail TLS:
dnl #     cd /etc/pki/tls/certs; make sendmail.pem
dnl # Complete usage:
dnl #     make -C /etc/pki/tls/certs usage
dnl #
dnl define(`confCACERT_PATH', `/etc/pki/tls/certs')dnl
dnl define(`confCACERT', `/etc/pki/tls/certs/ca-bundle.crt')dnl
dnl define(`confSERVER_CERT', `/etc/pki/tls/certs/sendmail.pem')dnl
dnl define(`confSERVER_KEY', `/etc/pki/tls/certs/sendmail.pem')dnl
dnl #
dnl # This allows sendmail to use a keyfile that is shared with OpenLDAP's
dnl # slapd, which requires the file to be readble by group ldap
dnl #
dnl define(`confDONT_BLAME_SENDMAIL', `groupreadablekeyfile')dnl
dnl #
dnl define(`confTO_QUEUEWARN', `4h')dnl
dnl define(`confTO_QUEUERETURN', `5d')dnl
dnl define(`confQUEUE_LA', `12')dnl
dnl define(`confREFUSE_LA', `18')dnl
define(`confTO_IDENT', `0')dnl
dnl FEATURE(delay_checks)dnl
FEATURE(`no_default_msa', `dnl')dnl
FEATURE(`smrsh', `/usr/sbin/smrsh')dnl
FEATURE(`mailertable', `hash -o /etc/mail/mailertable.db')dnl
FEATURE(`virtusertable', `hash -o /etc/mail/virtusertable.db')dnl
FEATURE(redirect)dnl
FEATURE(always_add_domain)dnl
FEATURE(use_cw_file)dnl
FEATURE(use_ct_file)dnl
dnl #
dnl # The following limits the number of processes sendmail can fork to accept
dnl # incoming messages or process its message queues to 20.) sendmail refuses
dnl # to accept connections once it has reached its quota of child processes.
dnl #
dnl define(`confMAX_DAEMON_CHILDREN', `20')dnl
dnl #
dnl # Limits the number of new connections per second. This caps the overhead
dnl # incurred due to forking new sendmail processes. May be useful against
dnl # DoS attacks or barrages of spam. (As mentioned below, a per-IP address
dnl # limit would be useful but is not available as an option at this writing.)
dnl #
dnl define(`confCONNECTION_RATE_THROTTLE', `3')dnl
dnl #
dnl # The -t option will retry delivery if e.g. the user runs over his quota.
dnl #
FEATURE(local_procmail, `', `procmail -t -Y -a $h -d $u')dnl
FEATURE(`access_db', `hash -T<TMPF> -o /etc/mail/access.db')dnl
FEATURE(`blacklist_recipients')dnl
EXPOSED_USER(`root')dnl
dnl #
dnl # For using Cyrus-IMAPd as POP3/IMAP server through LMTP delivery uncomment
dnl # the following 2 definitions and activate below in the MAILER section the
dnl # cyrusv2 mailer.
dnl #
dnl define(`confLOCAL_MAILER', `cyrusv2')dnl
dnl define(`CYRUSV2_MAILER_ARGS', `FILE /var/lib/imap/socket/lmtp')dnl
dnl #
dnl # The following causes sendmail to only listen on the IPv4 loopback address
dnl # 127.0.0.1 and not on any other network devices. Remove the loopback
dnl # address restriction to accept email from the internet or intranet.
dnl #
DAEMON_OPTIONS(`Port=smtp, Name=MTA')dnl
dnl #
dnl # The following causes sendmail to additionally listen to port 587 for
dnl # mail from MUAs that authenticate. Roaming users who can't reach their
dnl # preferred sendmail daemon due to port 25 being blocked or redirected find
dnl # this useful.
dnl #
DAEMON_OPTIONS(`Port=submission, Name=MSA, M=Ea')dnl
dnl #
dnl # The following causes sendmail to additionally listen to port 465, but
dnl # starting immediately in TLS mode upon connecting. Port 25 or 587 followed
dnl # by STARTTLS is preferred, but roaming clients using Outlook Express can't
dnl # do STARTTLS on ports other than 25. Mozilla Mail can ONLY use STARTTLS
dnl # and doesn't support the deprecated smtps; Evolution <1.1.1 uses smtps
dnl # when SSL is enabled-- STARTTLS support is available in version 1.1.1.
dnl #
dnl # For this to work your OpenSSL certificates must be configured.
dnl #
DAEMON_OPTIONS(`Port=smtps, Name=TLSMTA, M=s')dnl
dnl #
dnl # The following causes sendmail to additionally listen on the IPv6 loopback
dnl # device. Remove the loopback address restriction listen to the network.
dnl #
dnl DAEMON_OPTIONS(`port=smtp,Addr=::1, Name=MTA-v6, Family=inet6')dnl
dnl #
dnl # enable both ipv6 and ipv4 in sendmail:
dnl #
dnl DAEMON_OPTIONS(`Name=MTA-v4, Family=inet, Name=MTA-v6, Family=inet6')
dnl #
define(`RELAY_MAILER_ARGS', `TCP $h 587')dnl
define(`ESMTP_MAILER_ARGS', `TCP $h 465')dnl
dnl # We strongly recommend not accepting unresolvable domains if you want to
dnl # protect yourself from spam. However, the laptop and users on computers
dnl # that do not have 24x7 DNS do need this.
dnl #
FEATURE(`accept_unresolvable_domains')dnl
dnl #
dnl FEATURE(`relay_based_on_MX')dnl
dnl #
dnl # Also accept email sent to "localhost.localdomain" as local email.
dnl #
LOCAL_DOMAIN(`localhost.localdomain')dnl
dnl #
dnl # The following example makes mail from this host and any additional
dnl # specified domains appear to be sent from mydomain.com
dnl #
dnl MASQUERADE_AS(`mydomain.com')dnl
dnl #
dnl # masquerade not just the headers, but the envelope as well
dnl #
dnl FEATURE(masquerade_envelope)dnl
dnl #
dnl # masquerade not just @mydomainalias.com, but @*.mydomainalias.com as well
dnl #
dnl FEATURE(masquerade_entire_domain)dnl
dnl #
dnl MASQUERADE_DOMAIN(localhost)dnl
dnl MASQUERADE_DOMAIN(localhost.localdomain)dnl
dnl MASQUERADE_DOMAIN(mydomainalias.com)dnl
dnl MASQUERADE_DOMAIN(mydomain.lan)dnl
MAILER(smtp)dnl
MAILER(procmail)dnl
dnl MAILER(cyrusv2)dnl
vi /etc/mail/access (default)
Code:
# By default we allow relaying from localhost...
Connect:localhost.localdomain           RELAY
Connect:localhost                       RELAY
Connect:127.0.0.1                       RELAY
vi /etc/mail/aliases (default)
Code:
This is empty
vi /etc/mail/virtusertable (default)
Code:
# A domain-specific form of aliasing, allowing multiple virtual domains to be
# hosted on one machine.
#
# info@foo.com  foo-info
# info@bar.com  bar-info
# joe@bar.com   error:nouser 550 No such user here
# jax@bar.com   error:5.7.0:550 Address invalid
# @baz.org      jane@example.net
#
# then mail addressed to info@foo.com will be sent to the address foo-info,
# mail addressed to info@bar.com will be delivered to bar-info, and mail
# addressed to anyone at baz.org  will be sent to jane@example.net, mail to
# joe@bar.com will be rejected with the specified error message, and mail to
# jax@bar.com will also have a RFC 1893  compliant error code 5.7.0.
#
# The username from the original address is passed as %1 allowing:
#
# @foo.org      %1@example.com
#
# Additionally, if the local part consists of "user+detail" then "detail" is
# passed as %2 and "+detail" is passed as %3  when a match against user+* is
# attempted, so entries like
#
# old+*@foo.org new+%2@example.com
# gen+*@foo.org %2@example.com
# +*@foo.org    %1%3@example.com
# X++@foo.org   Z%3@example.com
# @bar.org      %1%3
#
# Note: to preserve "+detail" for a default case (@domain) %1%3 must be used
# as RHS. There are two wildcards after "+": "+" matches only a non-empty
# detail, "*" matches also empty details, e.g., user+@foo.org  matches#
# +*@foo.org but not ++@foo.org. This can be used to ensure that the
# parameters %2 and %3 are not empty.
#
# All the host names on the left hand side (foo.com, bar.com, and baz.org)
# must be in class {w} or class {VirtHost}. The latter can be defined by the
# macros VIRTUSER_DOMAIN or VIRTUSER_DOMAIN_FILE (analogously to
# MASQUERADE_DOMAIN and MASQUERADE_DOMAIN_FILE). If VIRTUSER_DOMAIN or
# VIRTUSER_DOMAIN_FILE is used, then the entries of class {VirtHost} are
# added to class {R}, i.e., relaying is allowed to (and from) those domains.
vi /etc/mail/relay-domains (default)
Code:
Empty
vi /etc/mail/local-host-names
Code:
Empty
vi /ect/hosts (default)
Code:
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
This happen if I try to send a mail to my gmail (Ofc not arrive[I checked spam too]):
mail -v -s 'teszt' neferien@gmail.com < /etc/passwd
Code:
neferien@gmail.com... Connecting to [127.0.0.1] via relay...
220 openvas.hbit.sztaki.hu ESMTP Sendmail 8.14.4/8.14.4; Tue, 8 Jul 2014 15:41:17 +0200
>>> EHLO openvas.hbit.sztaki.hu
250-openvas.hbit.sztaki.hu Hello localhost [127.0.0.1], pleased to meet you
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-8BITMIME
250-SIZE
250-DSN
250-ETRN
250-DELIVERBY
250 HELP
>>> MAIL From:<aron@openvas.hbit.sztaki.hu> SIZE=1449
250 2.1.0 <aron@openvas.hbit.sztaki.hu>... Sender ok
>>> RCPT To:<neferien@gmail.com>
>>> DATA
250 2.1.5 <neferien@gmail.com>... Recipient ok
354 Enter mail, end with "." on a line by itself
>>> .
250 2.0.0 s68DfHNC007385 Message accepted for delivery
neferien@gmail.com... Sent (s68DfHNC007385 Message accepted for delivery)
Closing connection to [127.0.0.1]
>>> QUIT
221 2.0.0 openvas.hbit.sztaki.hu closing connection
If i check the maillog:
tail -f /var/log/maillog
Code:
Jul  8 15:41:16 openvas sendmail[7384]: s68DfGnW007384: from=aron, size=1449, class=0, nrcpts=1, msgid=<201407081341.s68DfGnW007384@openvas.hbit.sztaki.hu>, relay=root@localhost
Jul  8 15:41:17 openvas sendmail[7385]: s68DfHNC007385: from=<aron@openvas.hbit.sztaki.hu>, size=1704, class=0, nrcpts=1, msgid=<201407081341.s68DfGnW007384@openvas.hbit.sztaki.hu>, proto=ESMTP, daemon=MTA, relay=localhost [127.0.0.1]
Jul  8 15:41:17 openvas sendmail[7384]: s68DfGnW007384: to=neferien@gmail.com, ctladdr=aron (502/502), delay=00:00:01, xdelay=00:00:00, mailer=relay, pri=31449, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (s68DfHNC007385 Message accepted for delivery)
Jul  8 15:46:17 openvas sendmail[7387]: s68DfHNC007385: to=<neferien@gmail.com>, ctladdr=<aron@openvas.hbit.sztaki.hu> (502/502), delay=00:05:00, xdelay=00:05:00, mailer=esmtp, pri=121704, relay=alt4.gmail-smtp-in.l.google.com. [74.125.137.26], dsn=4.0.0, stat=Deferred: Connection timed out with alt4.gmail-smtp-in.l.google.com.
I have ports open:
netstat -ntlp | grep sendmail
Code:
tcp        0      0 0.0.0.0:587                 0.0.0.0:*                   LISTEN      7310/sendmail
tcp        0      0 0.0.0.0:465                 0.0.0.0:*                   LISTEN      7310/sendmail
tcp        0      0 0.0.0.0:25                  0.0.0.0:*                   LISTEN      7310/sendmail
I belive firewall is not active:
sestatus
Code:
SELinux status:                 enabled
SELinuxfs mount:                /selinux
Current mode:                   permissive
Mode from config file:          enforcing
Policy version:                 24
Policy from config file:        targeted

If I try to telnet alt4.gmail-smtp-in.l.google.com. at port 25
telnet alt4.gmail-smtp-in.l.google.com. 25
Code:
Trying 74.125.196.27...
telnet: connect to address 74.125.196.27: Connection timed out
Trying 2607:f8b0:4002:c07::1b...
telnet: connect to address 2607:f8b0:4002:c07::1b: Network is unreachable
It is works like this with port 587:
telnet smtp.gmail.com 587
Code:
Trying 74.125.136.108...
Connected to smtp.gmail.com.


So what do you think? Or do you need any more information? I started with smtp and linux 3 days ago so I am a complitely noob, sry if the questions are to obvious. Thanks you very much for any support!
 
Old 07-09-2014, 02:24 PM   #2
kentyler
Member
 
Registered: Dec 2008
Location: Newark Ohio
Distribution: Fedora Core
Posts: 270

Rep: Reputation: 38
If you can't telnet to smtp.gmai.com 25 then your ISP is blocking the port 25 traffic. Even so if you could the email would be rejected unless you have the proper hostname that resolves to the IP address.
 
Old 07-10-2014, 09:00 AM   #3
Nefri
LQ Newbie
 
Registered: Jul 2014
Posts: 6

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by kentyler View Post
If you can't telnet to smtp.gmai.com 25 then your ISP is blocking the port 25 traffic. Even so if you could the email would be rejected unless you have the proper hostname that resolves to the IP address.
Thanks you very much for your respond!
I see. So I have to edit the "dnl # define(`SMART_HOST', `[smtp.datanet.hu]')dnl" and add authentication to use the port 587? Or how can I configure a proper hostname?
 
Old 07-11-2014, 08:39 AM   #4
kentyler
Member
 
Registered: Dec 2008
Location: Newark Ohio
Distribution: Fedora Core
Posts: 270

Rep: Reputation: 38
Yes if the providers mail server is smtp.datanet.hu and allows relay then define this:

define('SMART_HOST', '[smtp.datanet.hu]')dnl
 
Old 07-14-2014, 07:27 AM   #5
Nefri
LQ Newbie
 
Registered: Jul 2014
Posts: 6

Original Poster
Rep: Reputation: Disabled
It was not easy, but now it is works Thank you very much for your support, it was very helpful!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Sendmail Configuration for gmail smtp service hudai Linux - Enterprise 1 09-26-2012 08:23 AM
How to send gmail through IP authenticated sendmail SMTP? rsund Linux - Server 2 01-06-2012 08:25 AM
PHP SMTP connection to gmail SMTP protocol violation ratcateme Programming 9 02-23-2009 03:58 AM
sendmail - Connection timed out [dsn=4.0.0 stat=Deferred: Connection timed out] ananthak Linux - Software 0 04-24-2007 07:28 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 03:58 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration