Jan 05

Re: Yandex IP range, Yandex subnets, Block Yandex Robots

Across our server range we are finding that Yandex continues to ignore robots.txt files and crawls some sites constantly, so how do you stop such an abuse of your network resources?

If you use IPTABLES or APF (you should!) then you can block all Yandex spiders using the following IP ranges:

77.88.0.0/18 # yandex.ru
77.88.22.0/23 # yandex.ru
77.88.24.0/21 # yandex.ru
77.88.24.0/22 # yandex.ru
77.88.28.0/22 # yandex.ru
77.88.36.0/23 # yandex.ru
77.88.42.0/23 # yandex.ru
77.88.44.0/24 # yandex.ru
77.88.50.0/23 # yandex.ru
87.250.224.0/19 # yandex.ru
87.250.230.0/23 # yandex.ru
87.250.252.0/22 # yandex.ru
93.158.128.0/18 # yandex.ru
93.158.137.0/24 # yandex.ru
93.158.144.0/21 # yandex.ru
93.158.144.0/23 # yandex.ru
93.158.146.0/23 # yandex.ru
93.158.148.0/22 # yandex.ru
95.108.128.0/17 # yandex.ru
95.108.128.0/24 # yandex.ru
95.108.152.0/22 # yandex.ru
95.108.216.0/23 # yandex.ru
95.108.240.0/21 # yandex.ru
95.108.248.0/23  # yandex.ru
178.154.128.0/17 # yandex.ru
178.154.160.0/22 # yandex.ru
178.154.164.0/23 # yandex.ru
199.36.240.0/22 # yandex.ru
213.180.192.0/19 # yandex.ru
213.180.204.0/24 # yandex.ru
213.180.206.0/23 # yandex.ru
213.180.209.0/24 # yandex.ru
213.180.218.0/23 # yandex.ru
213.180.220.0/23 # yandex.ru

Simply restart APF and Yandex will no longer be a problem (until they extend their network!).

Dec 09

Re: Is PHP SOAP installed? Which version of PHP SOAP do I have?

For dedicated servers, you can tell if PHP SOAP is installed by the running the following command on the console:

# php -i phpinfo | grep soap

The following outpout will confirm you have PHP SOAP installed:

soap
soap.wsdl_cache => 1 => 1
soap.wsdl_cache_dir => /tmp => /tmp
soap.wsdl_cache_enabled => 1 => 1
soap.wsdl_cache_limit => 5 => 5
soap.wsdl_cache_ttl => 86400 => 86400

If you have a shared hosting account and need PHP SOAP, simply contact the Helpdesk to arrange a transfer of your account to a suitable server.

Dec 07

Re: Where can I find the mail log in Plesk?

The mail logs in Plesk qmail are stored here:

/usr/local/psa/var/log/maillog

You can view the entire maillog like this:

# cat /usr/local/psa/var/log/maillog

Or you can look at the last 150 lines like this:

# tail -150 /usr/local/psa/var/log/maillog

You can watch the maillog devlop in real time like this:

# tail -f /usr/local/psa/var/log/maillog

You can search for specific entries like this:

# tail -500 /usr/local/psa/var/log/maillog | grep test@domain.co.uk

The Plesk maillog is your friend when it comes to finding spammers and email problems on your server.

Dec 07

Re: Finding spammers in Plesk, find source of spam on Plesk server

If you are hosting a Plesk server wilth multiple sites then eventually you will find that spam will appear from one of those sites and it will be difficult to determine where the spam is coming from. This will put your server IP at risk of being suspended by your server provider.

First things first, let’s check to see if the spam is being sent by a mailbox user, this would indicate deliberate spamming from a client or a compromised password on a mailbox account.

Out of the ordinary authentications

A large number of authentications to a particular mailbox, ie. thousands, can indicate massive email activity, you can check this quickly as follows:

# cat /usr/local/psa/var/log/maillog |grep -I "LOGIN"|awk {'print $12'}|sort|uniq -c|sort -n

If you cannot see anything out of the ordinary, the search continues.

The Maillog is your friend

Let’s take a look at the plesk qmail maillog:

# tail -500 /usr/local/psa/var/log/maillog

Entries like the following indicate the domain and mailbox that the email is being sent from:

Dec  7 10:51:01 server qmail-local-handlers[29265]: from=info@spammerdomain.com

This leaves you no further work to do, possibly suspend the account and contact the client in question. You might want to clear the mail queue in the Plesk panel also.

Difficult to locate spammers

A more difficult situation is where the email is being sent using the Apache user or as anonymous. This type of email spam cannot so easily be traced to a sender as it is not being sent from a mailbox.

These entries look something like this:

Dec  7 10:50:17 server qmail-queue-handlers[29080]: from=anonymous@server.hostname.com

Or like this:

Dec  7 10:50:17 server qmail: 1323255017.404624 info msg 47220220: bytes 501 from <anonymous@server.hostname.com> qp 29081 uid 48

It is not possible to determine the spammer from the maillog in this situation. These emails are being sent using a form processor or other PHP mailer / PERL mailer script.

Track, Trace and Remove

To solve this problem you need to

  • Login to the Plesk Control Panel > Home > Mail Settings > Mail Queue
  • Click on one of the many SPAM emails you will see listed

Look for this at the top of the mail header:

Received: (qmail 2583 invoked by uid 10211)

Once you have the UID (which in this case in 10211) you can now trace the client like this:

# grep 10211 /etc/passwd

Which will show something like this:

dom74628:x:10211:2523::/var/www/vhosts/thespammerdomain.com:/bin/false

You can now proceed suspend the spam account and remove all the mails from the mail queue.

Dec 06

You can use iptables pre-routing to route from one port to another.

For example, the following command will enable mail users to use port 26 or port 25 for SMTP request. All port 26 requests will be routed to port 25.

# iptables -t nat -A PREROUTING -p tcp -d 192.168.167.2 --dport 26 -j DNAT --to 192.168.167.2:25

Now your clients can use port 26 or port 25 without any problems.

Nov 15

Re: Mail being bounced even though Mailbox exists, bounce message

Hi. This is the qmail-send program at server.mailserver.com.
I’m afraid I wasn’t able to deliver your message to the following addresses.
This is a permanent error; I’ve given up. Sorry it didn’t work out.”

Take a look in the mail log file:

tail -1500 /usr/local/psa/var/log/maillog

You see errors such as this:

Unable to stat entry '/usr/local/psa/handlers/info'

To resolve you need to remove and rebuil all mail handlers as follows:

1. Stop the mail service

    # /usr/local/psa/admin/sbin/mailmng --stop-service

    OR

    # service qmail stop

2. Backup old handlers in a temporary directory

    # mkdir /usr/local/temp

    # cp -a /usr/local/psa/handlers/before-* /usr/local/temp/

    # cp -a /usr/local/psa/handlers/info /usr/local/temp/

3. Remove the handlers

    # rm -rf /usr/local/psa/handlers/before-*/*

    # rm -rf /usr/local/psa/handlers/info/*

4. Recreate handlers using mchk utility

    # /usr/local/psa/admin/sbin/mchk --with-spam

5. Start mail service:

    # /usr/local/psa/admin/sbin/mailmng --start-service

    OR 

    service qmail start

This may take a little time however it will resolve all errors.

Nov 09

Re: Can’t start Apache, getting error (28) No space left on device

First, don’t panic, this problem is easily fixed. Take a deep breath and now get ready to clear up some semaphores:

1) First let’s kill all httpd process:

# killall -9 httpd

2) Now let’s delete the semaphores:

# ipcs -s | grep apache | perl -e 'while (<STDIN>) {@a=split(/\s+/); print `ipcrm sem $a[1]`}'

3) Now let’s start up Apache

# service httpd start

Problem solved, panic over. One for the toolbox!

Nov 08

Re: How to enable PHP Pear for a domain in Plesk

1) edit vhost.conf as such:

<Directory /var/www/vhosts/domain.com/httpdocs>
        php_admin_value include_path "/var/www/vhosts/domain.com/httpdocs/:/usr/share/pear/"
        php_admin_value open_basedir "none"
</Directory>

2) /usr/local/psa/admin/sbin/websrvmng – -reconfigure-vhost –vhost-name=domain.com

3) service httpd restart

To test pear, create a php file, eg check_pear.php

<?php
require_once 'System.php';
var_dump(class_exists('System', false));
?>

4) open check_pear.php in a browser, a ‘true’ result confirms pear is working:

bool(true)

That’s all there is to getting PEAR working on Plesk 9 Linux.

Oct 29

Re: Where are emails and email files stored in Plesk?

Even though emails account for part of your web space usage, they are actually stored outside of your vhost document root.

You can find all email files here:

# ls -l /var/qmail/mailnames

Each directory relates to a specific POP box, the mailboxes are not grouped by domain or client account.

Oct 19

If you get the error “The domain is still suspended for the following reason: Domain is temporarily suspended for backing up or restoring.” this means that the domain is locked and you will not be able to unsuspend the domain name from the Plesk 9.x control panel.

Some solution show you editing the plesk databases directly, but there is no need for such a risk.

The solution for Plesk 9.x for Linux is as follows:

  1. Open up a command shell with the server
  2. Type the following command to directly unsuspend the domain
  3. # /usr/local/psa/bin/domain –on domain.com

Now you should see “SUCCESS: Changing status of domain ‘domain.com’ complete.”

Oct 18

One of the first things we do to a Plesk server is remove Dr Web and all of it’s components which is not as easy as it may first appear as there are a number of modules that need removing.

Here we will show you how to remove all parts of Dr Web from your Plesk server.

Open an SSH session with your server and do the following:

# yum remove drweb-base drweb-bases drweb-common drweb-daemon drweb-updater psa-drweb-configurator

You will now find no trace of Dr Web in your logs or in your system.

Oct 18

Re: Error: Incorrect key file for table ‘jos_session’; try to repair it

The fact that you’ve got this error means that you are running Joomla 1.5x, under mysql4.x and have just upgraded to mysql 5.x probably without backing up your database – am I right?

Ok, don’t worry, there is a fix. First, the problem is that mysql 4.x and Joomla 1.5 use incompatible indexing with mysql 5.x, so the upgrade would have probably updated all of your tables except for these specific Joomla files. We need to delete the old Joomla table and rebuild it.

You need to login to Plesk and find the client account with the problem, log in to phpMyAdmin and apply the fix below by running the SQL as follows:

===========

DROP TABLE `jos_components`;
CREATE TABLE `jos_components` (
`id` int(11) NOT NULL auto_increment,
`name` varchar(50) NOT NULL default '',
`link` varchar(255) NOT NULL default '',
`menuid` int(11) unsigned NOT NULL default '0',
`parent` int(11) unsigned NOT NULL default '0',
`admin_menu_link` varchar(255) NOT NULL default '',
`admin_menu_alt` varchar(255) NOT NULL default '',
`option` varchar(50) NOT NULL default '',
`ordering` int(11) NOT NULL default '0',
`admin_menu_img` varchar(255) NOT NULL default '',
`iscore` tinyint(4) NOT NULL default '0',
`params` text NOT NULL,
`enabled` tinyint(4) NOT NULL default '1',
PRIMARY KEY  (`id`),
KEY `parent_option` (`parent`, `option`(32))
) TYPE=MyISAM CHARACTER SET `utf8`;

INSERT INTO `jos_components` VALUES (1, 'Banners', '', 0, 0, '', 'Banner Management', 'com_banners', 0, 'js/ThemeOffice/component.png', 0, 'track_impressions=0\ntrack_clicks=0\ntag_prefix=\n\n', 1);
INSERT INTO `jos_components` VALUES (2, 'Banners', '', 0, 1, 'option=com_banners', 'Active Banners', 'com_banners', 1, 'js/ThemeOffice/edit.png', 0, '', 1);
INSERT INTO `jos_components` VALUES (3, 'Clients', '', 0, 1, 'option=com_banners&c=client', 'Manage Clients', 'com_banners', 2, 'js/ThemeOffice/categories.png', 0, '', 1);
INSERT INTO `jos_components` VALUES (4, 'Web Links', 'option=com_weblinks', 0, 0, '', 'Manage Weblinks', 'com_weblinks', 0, 'js/ThemeOffice/component.png', 0, 'show_comp_description=1\ncomp_description=\nshow_link_hits=1\nshow_link_description=1\nshow_other_cats=1\nshow_headings=1\nshow_page_title=1\nlink_target=0\nlink_icons=\n\n', 1);
INSERT INTO `jos_components` VALUES (5, 'Links', '', 0, 4, 'option=com_weblinks', 'View existing weblinks', 'com_weblinks', 1, 'js/ThemeOffice/edit.png', 0, '', 1);
INSERT INTO `jos_components` VALUES (6, 'Categories', '', 0, 4, 'option=com_categories&section=com_weblinks', 'Manage weblink categories', '', 2, 'js/ThemeOffice/categories.png', 0, '', 1);
INSERT INTO `jos_components` VALUES (7, 'Contacts', 'option=com_contact', 0, 0, '', 'Edit contact details', 'com_contact', 0, 'js/ThemeOffice/component.png', 1, 'contact_icons=0\nicon_address=\nicon_email=\nicon_telephone=\nicon_fax=\nicon_misc=\nshow_headings=1\nshow_position=1\nshow_email=0\nshow_telephone=1\nshow_mobile=1\nshow_fax=1\nbannedEmail=\nbannedSubject=\nbannedText=\nsession=1\ncustomReply=0\n\n', 1);
INSERT INTO `jos_components` VALUES (8, 'Contacts', '', 0, 7, 'option=com_contact', 'Edit contact details', 'com_contact', 0, 'js/ThemeOffice/edit.png', 1, '', 1);
INSERT INTO `jos_components` VALUES (9, 'Categories', '', 0, 7, 'option=com_categories&section=com_contact_details', 'Manage contact categories', '', 2, 'js/ThemeOffice/categories.png', 1, 'contact_icons=0\nicon_address=\nicon_email=\nicon_telephone=\nicon_fax=\nicon_misc=\nshow_headings=1\nshow_position=1\nshow_email=0\nshow_telephone=1\nshow_mobile=1\nshow_fax=1\nbannedEmail=\nbannedSubject=\nbannedText=\nsession=1\ncustomReply=0\n\n', 1);
INSERT INTO `jos_components` VALUES (10, 'Polls', 'option=com_poll', 0, 0, 'option=com_poll', 'Manage Polls', 'com_poll', 0, 'js/ThemeOffice/component.png', 0, '', 1);
INSERT INTO `jos_components` VALUES (11, 'News Feeds', 'option=com_newsfeeds', 0, 0, '', 'News Feeds Management', 'com_newsfeeds', 0, 'js/ThemeOffice/component.png', 0, '', 1);
INSERT INTO `jos_components` VALUES (12, 'Feeds', '', 0, 11, 'option=com_newsfeeds', 'Manage News Feeds', 'com_newsfeeds', 1, 'js/ThemeOffice/edit.png', 0, 'show_headings=1\nshow_name=1\nshow_articles=1\nshow_link=1\nshow_cat_description=1\nshow_cat_items=1\nshow_feed_image=1\nshow_feed_description=1\nshow_item_description=1\nfeed_word_count=0\n\n', 1);
INSERT INTO `jos_components` VALUES (13, 'Categories', '', 0, 11, 'option=com_categories&section=com_newsfeeds', 'Manage Categories', '', 2, 'js/ThemeOffice/categories.png', 0, '', 1);
INSERT INTO `jos_components` VALUES (14, 'User', 'option=com_user', 0, 0, '', '', 'com_user', 0, '', 1, '', 1);
INSERT INTO `jos_components` VALUES (15, 'Search', 'option=com_search', 0, 0, 'option=com_search', 'Search Statistics', 'com_search', 0, 'js/ThemeOffice/component.png', 1, 'enabled=0\n\n', 1);
INSERT INTO `jos_components` VALUES (16, 'Categories', '', 0, 1, 'option=com_categories&section=com_banner', 'Categories', '', 3, '', 1, '', 1);
INSERT INTO `jos_components` VALUES (17, 'Wrapper', 'option=com_wrapper', 0, 0, '', 'Wrapper', 'com_wrapper', 0, '', 1, '', 1);
INSERT INTO `jos_components` VALUES (18, 'Mail To', '', 0, 0, '', '', 'com_mailto', 0, '', 1, '', 1);
INSERT INTO `jos_components` VALUES (19, 'Media Manager', '', 0, 0, 'option=com_media', 'Media Manager', 'com_media', 0, '', 1, 'upload_extensions=bmp,csv,doc,epg,gif,ico,jpg,odg,odp,ods,odt,pdf,png,ppt,swf,txt,xcf,xls,BMP,CSV,DOC,EPG,GIF,ICO,JPG,ODG,ODP,ODS,ODT,PDF,PNG,PPT,SWF,TXT,XCF,XLS\nupload_maxsize=10000000\nfile_path=images\nimage_path=images/stories\nrestrict_uploads=1\ncheck_mime=1\nimage_extensions=bmp,gif,jpg,png\nignore_extensions=\nupload_mime=image/jpeg,image/gif,image/png,image/bmp,application/x-shockwave-flash,application/msword,application/excel,application/pdf,application/powerpoint,text/plain,application/x-zip\nupload_mime_illegal=text/html', 1);
INSERT INTO `jos_components` VALUES (20, 'Articles', 'option=com_content', 0, 0, '', '', 'com_content', 0, '', 1, 'show_noauth=0\nshow_title=1\nlink_titles=0\nshow_intro=1\nshow_section=0\nlink_section=0\nshow_category=0\nlink_category=0\nshow_author=1\nshow_create_date=1\nshow_modify_date=1\nshow_item_navigation=0\nshow_readmore=1\nshow_vote=0\nshow_icons=1\nshow_pdf_icon=1\nshow_print_icon=1\nshow_email_icon=1\nshow_hits=1\nfeed_summary=0\n\n', 1);
INSERT INTO `jos_components` VALUES (21, 'Configuration Manager', '', 0, 0, '', 'Configuration', 'com_config', 0, '', 1, '', 1);
INSERT INTO `jos_components` VALUES (22, 'Installation Manager', '', 0, 0, '', 'Installer', 'com_installer', 0, '', 1, '', 1);
INSERT INTO `jos_components` VALUES (23, 'Language Manager', '', 0, 0, '', 'Languages', 'com_languages', 0, '', 1, '', 1);
INSERT INTO `jos_components` VALUES (24, 'Mass mail', '', 0, 0, '', 'Mass Mail', 'com_massmail', 0, '', 1, 'mailSubjectPrefix=\nmailBodySuffix=\n\n', 1);
INSERT INTO `jos_components` VALUES (25, 'Menu Editor', '', 0, 0, '', 'Menu Editor', 'com_menus', 0, '', 1, '', 1);
INSERT INTO `jos_components` VALUES (27, 'Messaging', '', 0, 0, '', 'Messages', 'com_messages', 0, '', 1, '', 1);
INSERT INTO `jos_components` VALUES (28, 'Modules Manager', '', 0, 0, '', 'Modules', 'com_modules', 0, '', 1, '', 1);
INSERT INTO `jos_components` VALUES (29, 'Plugin Manager', '', 0, 0, '', 'Plugins', 'com_plugins', 0, '', 1, '', 1);
INSERT INTO `jos_components` VALUES (30, 'Template Manager', '', 0, 0, '', 'Templates', 'com_templates', 0, '', 1, '', 1);
INSERT INTO `jos_components` VALUES (31, 'User Manager', '', 0, 0, '', 'Users', 'com_users', 0, '', 1, 'allowUserRegistration=1\nnew_usertype=Registered\nuseractivation=1\nfrontend_userparams=1\n\n', 1);
INSERT INTO `jos_components` VALUES (32, 'Cache Manager', '', 0, 0, '', 'Cache', 'com_cache', 0, '', 1, '', 1);
INSERT INTO `jos_components` VALUES (33, 'Control Panel', '', 0, 0, '', 'Control Panel', 'com_cpanel', 0, '', 1, '', 1);

DROP table `jos_core_acl_aro`;
CREATE TABLE `jos_core_acl_aro` (
`id` int(11) NOT NULL auto_increment,
`section_value` varchar(240) NOT NULL default '0',
`value` varchar(240) NOT NULL default '',
`order_value` int(11) NOT NULL default '0',
`name` varchar(255) NOT NULL default '',
`hidden` int(11) NOT NULL default '0',
PRIMARY KEY  (`id`),
UNIQUE KEY `#__section_value_value_aro` (`section_value`(100),`value`(100)),
KEY `#__gacl_hidden_aro` (`hidden`)
) TYPE=MyISAM CHARACTER SET `utf8`;

DROP table `jos_session`;
CREATE TABLE `jos_session` (
`username` varchar(150) default '',
`time` varchar(14) default '',
`session_id` varchar(200) NOT NULL default '0',
`guest` tinyint(4) default '1',
`userid` int(11) default '0',
`usertype` varchar(50) default '',
`gid` tinyint(3) unsigned NOT NULL default '0',
`client_id` tinyint(3) unsigned NOT NULL default '0',
`data` longtext,
PRIMARY KEY  (`session_id`(64)),
KEY `whosonline` (`guest`,`usertype`),
KEY `userid` (`userid`),
KEY `time` (`time`)
) TYPE=MyISAM CHARACTER SET `utf8`;


===========

Do this for each corrupt database. Your Joomla application will start running straight away!

Oct 18

Ok, so you are running PHP 5.1x / 5.2x and need to upgrade to PHP 5.3x in order to support the lastest WordPress 3.x incarnations, but you have a problem – you also have Zend Optimizer (module php-zend-optimizer) installed, there is no support for the standard Zend Optimizer in PHP 5.3x (or later).

Never fear, you can resolve the problem like this in Plesk:

# yum remove php-zend-optimizer

Now you can upgrade php (using the atomic repository), as such:

#yum upgrade php

Now you should install the replacement for Zend Optimizer as follows:

yum install php-zend-guard-loader

Restart apache:

# service httpd graceful

Job done!

Oct 17

Re: unable to connect to ssl://smtp.gmail.com:587 (Connection timed out)

This is the error you get if your server firewall is blocking port 587. This error message is usally given by a CMS or other PHP scripts that is unable to send messages to the Google SMTP server.

To resolve simply allow incoming and outgoing traffic through port 587 and restart your server firewall.

Nov 25

Messages in error_log: Please use the date.timezone setting, PHP Strict Standards:  strtotime() [<a href='function.strtotime'>function.strtotime</a>]: It is not safe to rely on the system’s timezone settings. Please use the date.timezone setting

The default timezone setting in your PHP.INI is not set.

Edit you PHP.INI using your favourite editor eg.

# vi /etc/php.ini

Change this:

[Date]
; Defines the default timezone used by the date functions
; date.timezone =

To this:

[Date]
; Defines the default timezone used by the date functions
date.timezone = Europe/London

This will resolve the problem.