Showing posts with label linux tutorial. Show all posts
Showing posts with label linux tutorial. Show all posts

How To Set SSH Login Message?

To set ssh login message, its very easy and interesting.
# vi /etc/motd
write the message of your own

######### Welcome to the SSH World #########
### This is the Email Server, please exit properly ###
########################################

Save and Quit

// To check quit the ssh terminal and re-login...


######### Welcome to the SSH World #########
### This is the Email Server, please exit properly ###
########################################

Thats all, Enjoy!!!!!

nmap in details

nmap is a tool to check the status of ports in any machine

Example1 : To scan a particular system for open ports
#nmap hostname

Example2 : Scanning for a single port on a machine
#nmap –p 22 hostname
–p indicates port.

Example3 : For scanning only ports
#nmap –F hostname

-F is for fast scan and this will not do any other scanning like IP address, hostname, operating system, and uptime etc.

Example4 : Scanning only TCP ports
#nmap –sT hostname
-s is for scanning and T is for only scanning of TCP ports

Example5 : Scanning only UDP ports
#nmap –sU hostname
-U indicates UDP port scanning

Exmaple6 : Scan for ports and get the version of different services running on that machine
#nmap –sV hostname
-V indicates version of each network service running on that host

Example7 : Check which protocol is supported by the remote machine
#nmap –sO hostname

Example8 : Scan a system for operating system and uptime details
# nmap -O hostname
-O is for operating system scan along with default port scan

Example9 : Scan a network
#nmap networkID/subnetmask
For the above command you can try in this way
#nmap x.x.x.x/24

How to install SendMailAnalyser in linux, centOS?

SendmailAnalyzer can work in any platform where Sendmail and Perl could run. What you need is a modern Perl distribution 5.8.x or more is good but older version should also work.

Download sendmailanalyzer-x.x.tar.gz and perform the following opertaions

# tar -zxvf sendmailanalyzer-x.x.tar.gz
# cd sendmailanalyzer-x.x/
# perl Makefile.PL
# make && make install

Start SendmailAnalyzer daemon:

# /usr/local/sendmailanalyzer/sendmailanalyzer -f

Add httpd configuratiosn for SendmailAnalyzer

Alias /sareport /usr/local/sendmailanalyzer/www

<Directory /usr/local/sendmailanalyzer/www>
Options ExecCGI
AddHandler cgi-script .cgi
DirectoryIndex sa_report.cgi
Order deny,allow
Deny from all
Allow from 127.0.0.1
Allow from ::1
# Allow from .example.com
</Directory>

Test:

http://server_ip_address/sareport

Additional tasks to be added in crontab

# SendmailAnalyzer log reporting daily cache
0 1 * * * /usr/local/sendmailanalyzer/sa_cache > /dev/null 2>&1
# On huge MTA you may want to have five minutes caching
#*/5 * * * * /usr/local/sendmailanalyzer/sa_cache -a > /dev/null 2>&1

Logrotate:

/etc/logrotate.d/syslog to restart SendmailAnalyzer when maillog is rotated or create a cron job.

For example:

/var/log/cron /var/log/debug /var/log/maillog /var/log/messages /var/log/secure /var/log/spooler /var/log/syslog
{
   sharedscripts
   postrotate
        /bin/kill -HUP `cat /var/run/syslogd.pid 2>/dev/null` 2>/dev/null || true
/PATH_TO/rc.sendmailanalyzer restart >/dev/null 2>&1 || true
# or /etc/rc.d/init.d/sendmailanalyzer restart >/dev/null 2>&1 || true
   endscript
}