Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Unix - SMTP relay

Posted on 2013-06-07
4
Medium Priority
?
561 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 501 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 27

Assisted Solution

by:skullnobrains
skullnobrains earned 498 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 501 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

Fill in the form and get your FREE NFR key NOW!

Veeam is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

Question has a verified solution.

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

SSH (Secure Shell) - Tips and Tricks As you all know SSH(Secure Shell) is a network protocol, which we use to access/transfer files securely between two networked devices. SSH was actually designed as a replacement for insecure protocols that sen…
Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Suggested Courses
Course of the Month10 days, 20 hours left to enroll

885 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