Showing posts with label Linux Solutions. Show all posts
Showing posts with label Linux Solutions. Show all posts

Wednesday, May 18, 2011

To view current Exim queue details using Perl script

To get the detailed results of Exim mail queue using a simple perl script.



____________________________________________________________________________________

root@sysadmin [~]# ./exim_queue_report.pl



                   EXIM MAIL QUEUE REPORT                  

============================================================



-> Total mails in Queue: 3

-> No of frozen emails : 2



-> Emails per CPanel User:



 COUNT   USER

----------------------------------

    2   mailnull

    1   marcm





-> Mails to following email addresses got bounced:



 COUNT   EMAIL

----------------------------------

    1   helensss@123new.com

    1   jerry1@nopytruction.com





-> Subject of emails in the mail queue:



 COUNT   SUBJECT

----------------------------------

    5   Mail delivery failed: returning message to sender

   12   Seminar topics





-> From address of mails in the mail queue:



 COUNT   FROM

----------------------------------

    2   Mailer-Daemon@server1.tchmachines.com

    1   jblac@aol.com





============================================================



-> What do you want to do?



 [1] Remove all mails of a Cpanel user

 [2] Remove all mails with specific subject

 [3] Remove all mails originated from a script source

 [4] Remove all bounced emails

 [5] Remove all frozen emails

 [6] Remove all mails From: specific email address

 [7] Chmod a script source to 000

 [8] I'm done! Exit..



Your choice ( 1 to 8 ) >;

________________________________________________________________________________



You can download the above script Download Exim Queue Report

[technomance]



Tags:-Exim mail queue,cpanel, exim mail queue scripts







Tuesday, September 21, 2010

Wordpress for BlackBerry version1.3-



Depending on your region or country, you might not see the latest version in the BlackBerry App World, but on your device you should now already see the latest version 1.3.



These features have been added in version 1.3:



    * Option to load more comments, not just the latest 100

    * Ability to load comments by status (all/spam/pendings)

    * You can now edit the comment details (Author Name/E-mail/URL)

    * Option to manually set the video-size when using VideoPress service

    * A much requested formatting toolbar that allows you to bold text for example

    * A new word count feature is shown on the post/page write screen

    * You can now submit bug reports and feedback from within the app

    * Multiple improvement to how Stats are handled

    * Improvements on the photo resizing options and a new jpeg encoder is now being used

 

For more information click on the link - Wordpress for BlackBerry version1.3







Use Postie plug-in for Post blog using black berry phone as email



To download Postie,click on the link - Download Posties Plugin


Tags:-wordpress,blackberry,wordpress help, wordpress 

Monday, July 12, 2010

Steps to disable website pages download using wget ?






Wget is a network utility to retrieve files from the World Wide Web using HTTP and FTP.It works non-interactively, so it can work in the background, after having logged off. The program supports recursive retrieval of web-authoring pages as well as FTP sites—you can use Wget to make mirrors of archives and home pages or to travel the Web like a WWW robot, checking for broken links.

For disabling wget to grab your site pages then simply add the code below in the .htaccess file under public_html directory [for which you wish to disable the wget grabbing].

===================================
SetEnvIfNoCase User-Agent “^Wget” bad_bot

Order Allow,Deny
Allow from all
Deny from env=bad_bot

===================================

Now, if anybody tries to grab info from your website using wget, he will receive a 403 error.

Please check this link to know more information about wget

http://wget.addictivecode.org/FrequentlyAskedQuestions

Tags:-wget,cpanel,webadmin,serveradmin,apachae,linux,commands,wget,cpanel,whm

Tuesday, July 6, 2010

Steps to disable Telnet in a Server


Telnet is a network protocol used as "bidirectional interactive text-oriented communications" underlying TCP/IP protocol for accessing remote computers.Telnet is unencrypted and sends clear text passwords and usernames through logins and should be disabled on all web servers and replaced with SSH.Some hosting providers are not disabling telnet by default but you should ensure that it has been turned off as it's a great security risk to your servers. TELNET server listens for incoming messages on port 23, and sends outgoing messages to port 23.

1. Login to your server through SSH and su to root.

2. Type pico /etc/xinetd.d/telnet

3. Look for the line: disable = no and replace with disable = yes

4. Now restart the inetd service: /etc/rc.d/init.d/xinetd restart

5. Turn off it through chkconfig as well because it can still start through that.
/sbin/chkconfig telnet off

6. Scan your server to ensure port 23 is closed.
nmap -sT -O localhost

Also run ps -aux | grep telnet and if you find anything other than "grep telnet" as result kill the process.

Tags:-Linux,telnet,disable telnet,differnece between telnet and ssh,ssh,telnet command,defenition,define telnet,ports

Wednesday, June 30, 2010

Mod_Security [Defenition and Installation Steps


Mod security is an open source web application firewall for intrusion detection and prevention engine for web applications and is most widely deployed in web applications.Mod Security v2.5.12 (change log) has been released. This release fixes several important issues to help prevent a detection bypass and denial of service attacks against Mod Security. Mode security provides protection from a range of attacks against web applications and allows for HTTP traffic monitoring, logging and real-time analysis.

Requirements:
  • Apache Web Server 1.3x or 2.x
Note: We have confirmed this security addon works with Cpanel based servers.

How to install?
1. Login to your server through SSH and su to the root user.

2. First your going to start out by grabbing the latest version of mod_security
wget http://www.modsecurity.org/download/mod_security-1.7.4.tar.gz

3. Next we untar the archive and cd into the directory:
tar zxvf mod_security-1.7.4.tar.gz
cd mod_security-1.7.4/

4. Now you need to determine which version of apache you use:
APACHE 1.3.x users
cd apache1/
APACHE 2.x users
cd apache2/

5. Lets Compile the module now:
/usr/local/apache/bin/apxs -cia mod_security.c

6. Ok, now its time to edit the httpd conf file. First we will make a backup just incase something goes wrong:

cp /usr/local/apache/conf/httpd.conf /usr/local/apache/conf/httpd.conf.backup

7. Now that we have backed it all up, we can edit the httpd.conf. Replace pico with nano depending on what you have

pico /usr/local/apache/conf/httpd.conf
8. Lets look for something in the config, do this by holding control and pressing W and you are going to search for

(altho any of the IfModules would work fine)

9. Now add this


SecFilterEngine On

SecServerSignature "Apache"
SecFilterCheckUnicodeEncoding Off
SecAuditEngine RelevantOnly
SecAuditLog logs/audit_log
SecFilterScanPOST On

SecFilterDefaultAction "deny,log,status:403"

SecFilterSelective REQUEST_METHOD "^POST$" chain
SecFilterSelective HTTP_Content-Length "^$"

SecFilterSelective HTTP_Transfer-Encoding "!^$"

SecFilterSelective ARG_PHPSESSID "!^[0-9a-z]*$"
SecFilterSelective COOKIE_PHPSESSID "!^[0-9a-z]*$"
SecFilter "../"

SecFilter "viewtopic\.php\?" chain
SecFilter "chr\(([0-9]{1,3})\)" "deny,log"

SecFilterSelective THE_REQUEST "wget "
SecFilterSelective THE_REQUEST "lynx "
SecFilterSelective THE_REQUEST "scp "
SecFilterSelective THE_REQUEST "ftp "
SecFilterSelective THE_REQUEST "cvs "
SecFilterSelective THE_REQUEST "rcp "
SecFilterSelective THE_REQUEST "curl "
SecFilterSelective THE_REQUEST "telnet "
SecFilterSelective THE_REQUEST "ssh "
SecFilterSelective THE_REQUEST "echo "
SecFilterSelective THE_REQUEST "links -dump "
SecFilterSelective THE_REQUEST "links -dump-charset "
SecFilterSelective THE_REQUEST "links -dump-width "
SecFilterSelective THE_REQUEST "links http:// "
SecFilterSelective THE_REQUEST "links ftp:// "
SecFilterSelective THE_REQUEST "links -source "
SecFilterSelective THE_REQUEST "mkdir "
SecFilterSelective THE_REQUEST "cd /tmp "
SecFilterSelective THE_REQUEST "cd /var/tmp "
SecFilterSelective THE_REQUEST "cd /etc/httpd/proxy "
SecFilterSelective THE_REQUEST "/config.php?v=1&DIR "
SecFilterSelective THE_REQUEST "/../../ "
SecFilterSelective THE_REQUEST "&highlight=%2527%252E "
SecFilterSelective THE_REQUEST "changedir=%2Ftmp%2F.php "

# Very crude filters to prevent SQL injection attacks
SecFilter "delete[[:space:]]+from"
SecFilter "insert[[:space:]]+into"
SecFilter "select.+from"

# Weaker XSS protection but allows common HTML tags
SecFilter "<[[:space:]]*script" # Prevent XSS atacks (HTML/Javascript injection) SecFilter "<(.|n)+>"


10. Save the file Ctrl + X then Y

11. Restart Apache

/etc/rc.d/init.d/httpd stop
/etc/rc.d/init.d/httpd start

Tags:-Mod_Security,mode_security,mode_security installation,mode_security configuration,define,linux,linux admin,linux webhosting


Tuesday, June 29, 2010

Exim Commands and Configuration Files


Configuration Files of Exim :

  • /etc/exim.conf – exim main configuration file
  • /etc/localdomains – list of domains allowed to relay mail
  • Log : /var/log/exim_mainlog – incoming/outgoing mails are logged here
  • /var/log/exim_rejectlog – exim rejected mails are reported here
  • /exim errors are logged here
  • Mail queue: /var/spool/exim/input
  • Cpanel script to restart exim – /scripts/restartsrv_exim
  • Email forwarders and catchall address file – /etc/valiases/domainname.com
  • Email filters file – /etc/vfilters/domainname.com
  • POP user authentication file – /home/username/etc/domainname/passwd
  • catchall inbox – /home/username/mail/inbox
  • POP user inbox – /home/username/mail/domainname/popusername/inbox
  • POP user spambox – /home/username/mail/domainname/popusername/spam
  • Program : /usr/sbin/exim (suid – -rwsr-xr-x 1 root root )
  • Init Script: /etc/rc.d/init.d/exim
Trouble shooting and checking exim mail logs

1) Count the no of messages in the queue

#root@leo [~]# exim -bpc
3506
Here 3506 mails are in the queue.

2) Command To List All The Messages In The Queue.(Time, Size,Message ID,Sender,Receipient):-

#root@localhost# exim -bp
Other Options:- root@localhost#exim -bpru
If you want to list for the message for a particular domain issue the
following command:-
root@localhost# exim -bpru | grep openhelp.info

3) Command To Find The Details Of Messages In The Queue( Count, Volume,Oldest,Newest And Total):-

#root@localhost# exim -bp | exiqsumm
===========================
The result of the comand will be like this:-
1 3686 18h 18h ziro.net
1 1638 4d 4d znormativa.com
1 2662 11m 11m zoominternet.net
1 3174 24m 24m zpub.com
1 2048 2h 2h zufall.de
===========================
3583 18MB 9d 0m TOTAL

4) Command To Create And Display Exim Stats From The Log File:-

#root@localhost# eximstats /var/log/exim_mainlog
===========================================
The result of the command will be like this:-
sree @ openhelp.info = lookuphostT=remote_smtp:SMTP error from remote mail
server after end of data:mail.tripseinc.com [65.106.35.202]: 550 5.7.1
rquested action not taken: message refusedhost smtp.where.xeonerver.net
[18.19.80.14]:553 sorry, mail to that recipient is not accepted
Errors encountered: 9617
===========================================

5) Generate And Display Exim Stats For A Particular Date:-

#root@localhost# fgrep YYYY-MM-DD /var/log/exim_mainlog | eximstats
==============================================
The result of the command will be like this:-
Top 50 host destinations by message count
-----------------------------------------
Messages Bytes Average Host destination
Top 50 host destinations by volume
-----------------------------------------
Messages Bytes Average Host destination
Top 50 rejected ips by message count
-----------------------------------------
Messages Rejected ip
2 [65.98.14.123]
1 [65.98.35.126]
Top 50 temporarily rejected ips by message count
------------------------------------------------
Messages Temporarily rejected ip
8 [69.65.55.100]
============================================

6) To Print What Exim Is Doing Right Now:-

#root@localhost# exiwhat
======================================================
Result of this command will be like this:-
925 handling incoming connection from ([61.152.161.184]) [61.152.161.184]
1951 handling incoming connection from pc-206-216-44-190.cm.vtr.net [
190.44.216.206]
10714 daemon: no queue runs, listening for SMTP on port 26 (IPv4)
10720 daemon: -q1h, listening for SMTP on port 25 (IPv4)
10725 daemon: no queue runs, listening for SMTPS on port 465 (IPv4)
=====================================================

7)For Clearing All The Mails In The Queue:-

root@localhost#exim -bpru|awk {'print $3'}|xargs exim -Mrm

8)Search The Queue For Messages From A Specific Sender:-

root@localhost# exiqgrep -f [luser]@domain

9)Search The Queue For Messages From A Specific Receipient/Domain:-

root@localhost# exiqgrep -r [luser]@domain
Eg:-root@localhost# exiqgrep -r openhelp.info

10)Command To Print The Message ID’s In The Entire Queue:-

#root@localhost# exiqgrep -i
===========================
The Result of the command will be like this:-
1KZyz0-0004wH-6d
1KZzBW-0001sT-1j
===========================

11)Comand To Start A Queue Run:-

root@localhost# exim -q -v

12)Comand To Start A Queue Run For Just Local Deleveries:-

root@localhost# exim -ql -v

13)Counting The No Of Frozen Mails:-

#root@localhost#exim -bpru | grep frozen | wc -l

14)Deleting All The Frozen Mails In The Queue:-

#root@localhost#exiqgrep -z -i | xargs exim -Mrm

15)Deliver a specific Message:-

#root@localhost# exim -M

You need to give message Id After this.
Like :- root@localhost# exim -M 1KZyrO-0006Vy-R2

16)Remove A Message From The Queue:-

#root@localhost# exim -Mrm

17)Command To Freeze All Queued Mail From A Given Sender:-

root@localhost#exiqgrep -i -f l user @ domain.com | xargs exim -Mf

18)Command To View Message Header:-

#root@localhost# exim -Mvh
Eg:-root@localhost#exim -Mvh 1KZzeO-0005up-GW

19)Command To View MessageBody:-

#root@localhost# exim -Mvb
This Command will show the body of the message.
Eg:-root@localhost#exim -Mvb 2345fg-34

20)Command To View A Message’s Logs:-

#root@server1 [~]# exim -Mvl 1KZznJ-0003Wp-Vj

21)Deleting The Bounce Back Message s In The Queue:-

#root@leo [~]exiqgrep -if "<>" | xargs exim -Mrm
OR
#root@leo [~] exim -bp | grep '<>' | awk '{print $3}'| xargs exim -Mrm

Bounce Back Messages Will Be ending with "<>".

Eg:- 17m 3.1K 1KDDkk-0002YT-5G <>barry @ email.net

22)Deleting The Bounce Back Message’s for a particular Domain:-

root@xeon [~] exiqgrep -if openhelp.info | xargs exim -Mrm
root@xeon [~] exiqgrep -ir openhelp.info | xargs exim -Mrm

Tags:-exim,exim commands,exim issues,exim docs,exim troubleshooting,exim configuration files,exim server,exim logs,linux,linux exim,linux updates

Setup time zone in Linux


1. The command used to check the time zone is

[root@server123 ~]# date
MON Jan 14 14:04:01 IST 2010
Here we can see that time zone is set into Indian Standard time.

2.Take the backup of current timezone configuration.

[root@server123 ~]#mv /etc/localtime /etc/localtime-old

2. Change to the directory to /usr/share/zoneinfo. You can find all the time zone regions here. Choose the the appropriate region where you resides. If you live in India choose region kerala in the /usr/share/zoneinfo/Asia directory.

3)remove the file /etc/localtime

[root@server123 Asia]# rm /etc/localtime


4. Create a symbolic link from the appropiate timezone to /etc/localtime

[root@server123 Asia]# ln -s /usr/share/zoneinfo/Asia/Kerala /etc/localtime


5. Update the current system time by executingthe rdate command.

[root@server123 Asia]#rdate -s rdate.cpanel.net

6. Synchronize hardware clock with system clock .

[root@server123 Asia]# /sbin/hwclock – -systohc

Tags:-Time zone,linuz time zone,Linux commands,Linux time commands,linux time zone commands,Linux,cPanel,Time

Steps to change the character set of a MySQL database to utf8?


Please follow the steps as it is to change the character set to Mysql

1) Dump the data of the mysql database to data_dump.sql

root@server1 [~]# mysqldump -t -u -p >data_dump.sql;

2) Dump the schema of the mysql database to schema_dump.sql

root@server1 [~]# mysqldump -d -u -p >schema_dump.sql

3)Now edit the file schema_dump.sql and remove the entries “DEFAULT CHARSET=”from the table and column definitions.

4) Drop the existing database.
root@server1 [~]#mysqladmin drop

5) Create a new database with uft8 as the default character set:

root@server1 [~]# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1074337 to server version: 4.1.22-standard


Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the buffer.

mysql>CREATE DATABASE DEFAULT CHARACTER SET utf8;

Now quit the mysql.

6) Import schema_dump.sql into the new database:

root@server1 [~]# mysql -u -p

7. Import data_dump.sql into the new database:
root@server1 [~]# mysql -u -p


Tags: LAMP, Linux, mysql, techzinformaticha-support, phpmyadmin

Sunday, June 27, 2010

TO VIEW THE DETAILED HARDWARE CONFIGURATION OF LINUX MACHINE

lshw - (Hardware Lister) is a small tool to provide detailed information on the hardware configuration of the machine. It can report exact memory configuration, firmware version, mainboard configuration, CPU version and speed, cache configuration, bus speed, etc. on DMI-capable x86 or EFI (IA-64) systems and on some PowerPC machines

While running this command it says something like -bash: lshw: command not found ".. means the command is not installed.

[root@computer ~]# lshw
-bash: lshw: command not found

So we need to install that command before running command:

[root@computer ~]# yum -y install lshw*

[If yum is run with the -y option, yum will assume a ``yes'' answer to all interactive questions. This is typically used in a script or to process ``known safe'' installs or updates.]

Apachae and Mail logs and configurations files in Linux

Apache Logs
-----------

To view the logs of Apachae:/usr/local/apache

+ bin- apache binaries are stored here – httpd, apachectl, apxs
+ conf – configuration files – httpd.conf
+ cgi-bin
+ domlogs – domain log files are stored here
+ htdocs
+ include – header files
+ libexec – shared object (.so) files are stored here – libphp4.so,mod_rewrite.so
+ logs – apache logs – access_log, error_log, suexec_log
+ man – apache manual pages
+ proxy -
+ icons -

Init Script :/etc/rc.d/init.d/httpd – apache start script
Cpanel script to restart apache – /scripts/restartsrv_httpd

Mail Logs and Mail configuration files:
----------------------------------------------------
  • /etc/exim.conf – exim main configuration file
  • /etc/localdomains – list of domains allowed to relay mail
  • Log : /var/log/exim_mainlog – incoming/outgoing mails are logged here
  • /var/log/exim_rejectlog – exim rejected mails are reported here
  • /exim errors are logged here
  • Mail queue: /var/spool/exim/input
  • Cpanel script to restart exim – /scripts/restartsrv_exim
  • Email forwarders and catchall address file – /etc/valiases/domainname.com
  • Email filters file – /etc/vfilters/domainname.com
  • POP user authentication file – /home/username/etc/domainname/passwd
  • catchall inbox – /home/username/mail/inbox
  • POP user inbox – /home/username/mail/domainname/popusername/inbox
  • POP user spambox – /home/username/mail/domainname/popusername/spam
  • Program : /usr/sbin/exim (suid – -rwsr-xr-x 1 root root )
  • Init Script: /etc/rc.d/init.d/exim
Tags:-Linux,Linux admin interview questions,Linux apachae logs,Linux mail logs