dapurhosting.com Blog for Tech

December 11, 2009

Rebuild cPanel’s PHP

Filed under: cPanel/WHM,Server — dh @ 2:54 am

To rebuild cPanel’s php so cPanel use difference PHP, you can use this syntax

/scripts/makecpphp

November 13, 2009

Detect DDOS Attack in Linux

Filed under: Uncategorized — dh @ 2:23 am

This is a simply command in Linux to check the no. of connection opened per IP.

/bin/netstat -ntu | awk ‘{print $5}’ | cut -d: -f1 | sort | uniq -c | sort -nr |more

Detect size of transfer

iftop -i interface

Auto block DDOS IP ((D)DoS-Deflate)

http://deflate.medialayer.com/

mod_evasive

http://www.eth0.us/mod_evasive

September 24, 2009

Upgrade Linux kernel howto

Filed under: Uncategorized — dh @ 10:37 am

Q. How do I upgrade Linux kernel? I would like to upgrade kernel w/o compiling from source code i.e. binary upgrade. How do I perform the actual upgrade of the kernel in Linux?
A. You need to compile kernel only if
=> You need custom made kernel for specific task such as embedded kernel

=> You need to apply specific patch to Linux

Upgrade of the kernel in Red Hat enterprise Linux version <= 4.x

If your system is registered with Red Hat Network (RHN), then you can use the up2date command as follows:
# up2date -f kernel
For SMP kernel (multi core or multiple CPU) use command:
# up2date -f kernel-smp

Upgrade of the kernel in Fedora Linux / CentOS / RHEL 5

Use yum command to upgrade kernel:
# yum update kernel

If you have downloaded RPM file use rpm command:
# rpm -ivh kernel*

Upgrade of the kernel in Debian or Ubuntu Linux

Use apt-get command. First find your kernel version:
$ uname -r
Next find available kernel images:
$ apt-cache search kernel-image
Now install kernel by explicitly specifying version number:
# apt-get install kernel-image-x.x.x-xx
OR
$ sudo apt-get install kernel-image-x.x.x-xx

http://www.cyberciti.biz/faq/linux-kernel-upgrade-howto/

August 16, 2009

R=lookuphost defer (-1): lowest numbered MX record points to local host

Filed under: Uncategorized — dh @ 7:02 pm

If you are testing an email problem and see this error:

R=lookuphost defer (-1): lowest numbered MX record points to local host

This means the domain name is not listed in /etc/localdomains

You generally can fix this by running /scripts/mailperm

If not, you should check /var/cpanel/users/USERNAME and make sure there is a DNS line in for this domain name and it is not along the lines of XDNS

Example

root@server8 [~]# mail -v test@server.com
Subject: test
test
.
Cc:
LOG: MAIN
  <= root@server.server8.com U=root P=local S=391
root@server8 [~]# delivering 1K2CMu-0004PY-F4
LOG: MAIN
  lowest numbered MX record points to local host: server.com
LOG: MAIN
  == test@server.com R=lookuphost defer (-1): lowest numbered MX record points to local host
LOG: MAIN
  Frozen

source: http://wiki.cpaneldirect.net/wiki/index.php/R%3Dlookuphost_defer_%28-1%29:_lowest_numbered_MX_record_points_to_local_host

June 12, 2009

Backup MX Servers

Filed under: Uncategorized — dh @ 8:20 am

A Backup MX Server is a mail server that will store (spool) your incoming email if your primary mail server becomes unavailable. A mail server can become unavailable to receive incoming mail for a number of reasons. A few examples are:

  • Hardware or software failure
  • Very busy and unable to receive new incoming connections, or emails
  • Network connection is down or saturated
  • Network routing issues can also cause your mail server to become unavailable

Case 1 – No Backup MX

If you do not have a Backup MX Server, the following conditions may occur:

  • Email will be bounced (Returned to Sender)
  • Your (inbound) email will cause a backup in the originating mail server’s spool
  • Service Timeout; Depending on the Retry attempts by the originating mail server, your mailboxes may never receive their incoming email
  • Users do not understand bounce messages; To most users, bounce messages are unreadable, so when they can’t send an email, they do not try to resend.

Case 2 – With a Backup MX

How Email works when a Backup MX Server is involved:

  1. User sends an email to ‘user@example.com’ (a mailbox hosted by your Server)
  2. Their mail server looks up the MX Records for ‘example.com’ and finds two:
    • IP: x.x.x.x Weight: 10
    • IP: y.y.y.y Weight: 20
  3. Their mail server first attempts to connect to: x.x.x.x
  4. Connection fails, which could be caused by any of the above conditions)
  5. They try to connect to the secondary MX record: y.y.y.y
  6. They successfully connect to this server.
  7. Email transmission begins, and the Backup MX Server receives the email into its spool.
  8. Since there are no existing local domains on this server, this backup server will stores this email in its spool.
  9. Based off of the Retry Attempts, backup server will continue to try and make connections to your Primary Mail Server.
    • Backup server will only make 4 retry attempts. It is recommended that you set the last attempt to a longer timeframe, i.e., 24 hours (1440 minutes)
    • This way backup server does not send a Bounce Message to the originator saying that it could not deliver the message, before your Primary Server is back online.
  10. If your Primary Mail Server comes back online before the final Retry Attempt, you can reset the Retry Counts on all messages in the spool. This will force the Backup MX Server to try forwarding all existing mail in the spool back to your Primary Mail Server.

Configuring a Backup MX Server

  1. Add a placeholder domain (called “example.com”) to open up the port to listen on.
  2. Configure backup server by adding the IP addresses to which delivery should be allowed.
  3. In general settings, change the delivery retry times to 10, 10, 10, and 1440.
  4. In DNS, add secondary MX records pointing to the new server’s IP. Set the preference value higher than the main MX record.

June 8, 2009

Mass Change Permission

Filed under: Securtiy,Server — dh @ 5:42 pm

Go to your directory

to change permission from one to other

find -perm 777 -exec chmod 755 {} \; -print

To change all directory permission

find -type d -perm 777 -exec chmod 755 {} \; -print

To change all public_html permission

cd /home; find -name "public_html" -exec chmod 711 {} \;

May 14, 2009

Mass Change Nameservers in DNS Zone

Filed under: Server — dh @ 5:13 pm


cd /var/named
replace 'ns1.olddomain.com' 'ns1.newdomain.com' -- *.db
replace 'ns2.olddomain.com' 'ns2.newdomain.com' -- *.db

You have to replace ns1/ns2.olddomain.com and ns1/ns2.newdomain.com with the correct nameservers.

Restart named using the command


service named restart
named -u named
ls /scripts/ | grep named
/scripts/rebuilddnsconfig

Also remember to change your nameserver too


vi /etc/nameserverips

May 1, 2009

Show User Process

Filed under: Uncategorized — dh @ 9:14 am

ps -aux | grep user| cut -c 9-14

eval ps ax|grep "user"|grep -iv "grep"| awk '{print $1}'

April 24, 2009

Find User’s Files

Filed under: Server — dh @ 7:05 am

find / -user username | more

find /home/david -name ‘index*’
find /home/david -iname ‘index*’

http://www.codecoffee.com/tipsforlinux/articles/21.html

Find String On File

grep -H -r “text-to-find” /directory

cari file hari ini

find . -mtime -1 \! -type d -exec ls -l {} \;

April 19, 2009

Closing Open DNS Servers

Filed under: Securtiy — Tags: , — dh @ 4:31 am

Allowing DNS Recursion is like running an Open SMTP Relay. You allow anyone to query your DNS server and this can easily lead to abuse.
You can fix this by disabling recursive lookups for not authorized IP’s.
This article will teach you step by step how to do this.

  1. Login to your server as root
  2. Edit /etc/named.confpico /etc/named.conf

    Add before options {} the fallowing:

    acl “trusted” {
    MAIN_IP;
    SECONDARY_IP;
    127.0.0.1;
    };

    Where MAIN_IP and SECONDARY_IP are the IP’s of your nameservers on that server.

    Now you have to add in the same file /etc/named.conf in the options {} part of the file the fallowing:

    allow-recursion { trusted; };
    allow-notify { trusted; };
    allow-transfer { trusted; };

  3. Now save and restart namedservice named restart

Source:

http://www.cpanelconfig.com/cpanel-security-related-articles/closing-open-dns-servers/

« Newer PostsOlder Posts »

Powered by WordPress