Solved

Unix - SMTP relay

Posted on 2013-06-07
4
525 Views
Last Modified: 2013-06-24
I need to write script to look at the Linux Servers in question to see if SMTP relay is on for port 25.

I have a list of servers need to run this script. Can some one please assist.
0
Comment
Question by:ittechlab
4 Comments
 

Author Comment

by:ittechlab
ID: 39228997
where do i check if i have SMTP relay configured in any linux server.

I am using all redhat 4/5/6
0
 
LVL 20

Assisted Solution

by:carlmd
carlmd earned 167 total points
ID: 39229600
Go to www.mxtoolbox.com, enter your domain, and use "mx lookup", then use SMTP Test on the result.

That should tell you everything you need to know.
0
 
LVL 26

Assisted Solution

by:skullnobrains
skullnobrains earned 166 total points
ID: 39231199
this should get you started with

cat <<EOF | nc -w 10 HOST 25 | grep "550.*access.*denied"
mail from: <>
rcpt to: toto@example.com
EOF

this will return true if you end up with a "relay access denied" while sending a mail from the empty user to a remote domain and false in all other cases including the server being down or failure of the script

you can easily stick this in a loop if you have many machines to check

beware that relay access will differ depending on the location of the machine on which you run the script
0
 
LVL 13

Accepted Solution

by:
Sandy earned 167 total points
ID: 39234719
create a for loop which accepts input(servername) listed in separate file and then put below commands and redirect all the stdin and stderr in a file

#netstat -lnp | grep 25
#alternatives --display mta

Cheers
SA
0

Featured Post

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Attention: This article will no longer be maintained. If you have any questions, please feel free to mail me. jgh@FreeBSD.org Please see http://www.freebsd.org/doc/en_US.ISO8859-1/articles/freebsd-update-server/ for the updated article. It is avail…
Fine Tune your automatic Updates for Ubuntu / Debian
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now