Category Archives: Plesk 11

postfix-delete.pl scipt

#!/usr/bin/perl

$REGEXP = shift || die “no email-adress given (regexp-style, e.g. bl.*@yahoo.com)!”;

@data = qx</usr/sbin/postqueue -p>;
for (@data) {
if (/^(w+)(*|!)?s/) {
$queue_id = $1;
}
if($queue_id) {
if (/$REGEXP/i) {
$Q{$queue_id} = 1;
$queue_id = “”;
}
}
}

#open(POSTSUPER,”|cat”) || die “couldn’t open postsuper” ;
open(POSTSUPER,”|/usr/sbin/postsuper -d -“) || die “couldn’t open postsuper” ;

foreach (keys %Q) {
print POSTSUPER “$_n”;
};
close(POSTSUPER);

How to troubleshoot spamming activities on postfix mail server.

1. To see the mail queue:

mailq

2. To flush the mail queue:

postfix flush

or

postfix -f

3. To remove all mails from the queue:

postsuper -d ALL

4. To remove all mails in the deferred queue:

postsuper -d ALL deferred

5. To delete all queued messages from or to the domain called webserverpage.com:

./postfix-delete.pl webserverpage.com

Note: You may download the script on the link below.

http://blog.webserverpage.com/?p=541

6. To delete all queued messages that contain the word “virus” in the email.

./postfix-delete.pl virus

7. To know the number of messages sitting in the deferred queue:

find /var/spool/postfix/deferred -type f | wc -l

8. Sort user email accounts with corresponding number(s) of email.

mailq|grep ^[A-F0-9]|cut -c 42-80|sort |uniq -c|sort -n|tail

Plesk 12.0 Installation in Centos 6.5

1. Download the plesk installer from their website.

wget http://autoinstall.plesk.com/plesk-installer

2. Change the permission to executable.

chmod +x plesk-installer

3. Run the script.

./plesk-installer

To start the installation or upgrade, press N and then press Enter.
To quit the installer, press Q and then press Enter.

—— IMPORTANT ——

* Before installing or upgrading Parallels products, be sure to back up your data.

* New installation of product(s) should be performed on clean servers only.
  Only the operating system with the networking option should be
  installed for new installations.
  Parallels will not be held liable for damages resulting from installation
  of products on a server with anything other than a fresh installation of the
  operating system for which the product installation was intended.

By using this Wizard you agree to the terms and conditions described at
http://www.parallels.com/en/company/terms/ and those of the Parallels Panel End User
License Agreement.

N) Next page;  Q) Cancel installing
Select an action [N]:N

Select product software source
===============================================================================

You can install products by using any of the following sources:

 * Local media
 * Official Parallels server
 * Other network site

Current settings:
 Install products from Parallels server
 Install required system packages from Parallels server
Store downloaded files in: /root/parallels

N) Next page; P) Go back;  Q) Cancel installing
S) Change source; T) Change target directory;
Select an action and press ENTER [N]:N

HTTP Proxy Setup
===============================================================================

If you are behind a firewall and use an HTTP proxy, you should specify the proxy server below.
If your proxy requires authentication, select “Use authentication”
and specify the username and password

Current settings:
 Do not use proxy.

N) Next page; P) Go back;  Q) Cancel installing;
S) Select proxy server; A) Use authentication;
Select the required action [N]:N

Select the desired products and their versions
===============================================================================

The following product versions are available:

1. [ ] Parallels Plesk Panel

N) Go to the next page; P) Go to the previous page; Q) Cancel installing
To select a version, type the respective number;
Select an action [N]:1

Select the desired products and their versions
===============================================================================

The following product versions are available:

1. [*] Parallels Plesk Panel
  2. (*) Parallels Plesk Panel 12.0.18
  3. ( ) Parallels Plesk Panel 11.5.30

N) Go to the next page; P) Go to the previous page; Q) Cancel installing
To select a version, type the respective number;
Select an action [N]:2

Would you like to help Parallels make better products by sending information
about installation, upgrade, and other problems? [Yes]: Yes

Select the installation type for Parallels Plesk Panel
===============================================================================

Installation types for the product:

 1. (*) Typical
       Install typically used components. Recommended for general use.

 2. ( ) Without DNS server
       Install typically used components without DNS server (BIND).

 3. ( ) Full
       Install all available components.

 4. ( ) Custom
       Custom components selection. Recommended only for experienced users.

N) Continue installation with selected type; P) Go the previous page; Q) Cancel installing;
L) View or change components marked for installation;
To select an installation type or choose another product, type the respective number;
Select an action [N]: N

Determining the amount of free disk space
===============================================================================

Following amount of diskpace required in directories:
/usr/local: 1200.00 Mb.
Total required: 1200.00 Mb, available 867684.00 Mb.

N) Next page; P) Go back; Q) Cancel installing
Select an action [N]: N

4. Once the installation is finish, you can now browse your new plesk server by typing your server IP to the browser.

https://<YourServerIP>:8443

Horde is not showing inbox messages

1) Backup horde database (/hordebackup.sql).

mysqldump -uadmin -p`cat /etc/psa/.psa.shadow` horde > horde_backup.sql

2) Run the below mysql queries for horde database.

mysql> select * from horde_prefs where pref_uid=’test@domain.com’ and pref_name=’sortpref’;

mysql> delete from horde_prefs where pref_uid=’test@domain.com’ and pref_name=’sortpref’;

How to enable port 587 (submission) in postfix

To enable port 587, edit the file /etc/postfix/master.cf

vi /etc/postfix/master.cf

and remove the # in front of the line:

#submission inet n – n – – smtpd

so that it looks like this:

submission inet n – n – – smtpd

and restart postfix:

/etc/init.d/postfix restart

How to find which domain spamming via PHP script?

PLESK

1) Create a /var/qmail/bin/sendmail-wrapper script with the following content:

#!/bin/sh
(echo X-Additional-Header: $PWD ;cat) | tee -a /var/tmp/mail.send|/var/qmail/bin/sendmail-qmail "$@"

Note, it should be two lines including ‘#!/bin/sh’.

2) Create a log file /var/tmp/mail.send and grant it “a+rw” rights; make the wrapper executable; rename old sendmail; and link it to the new wrapper:

~# touch /var/tmp/mail.send
~# chmod a+rw /var/tmp/mail.send
~# chmod a+x /var/qmail/bin/sendmail-wrapper
~# mv /var/qmail/bin/sendmail /var/qmail/bin/sendmail-qmail
~# ln -s /var/qmail/bin/sendmail-wrapper /var/qmail/bin/sendmail

3) Wait for an hour and change back sendmail:

~# rm -f /var/qmail/bin/sendmail
~# mv /var/qmail/bin/sendmail-qmail /var/qmail/bin/sendmail

Examine the /var/tmp/mail.send file. There should be lines starting with “X-Additional-Header:” pointing to domain folders where the scripts which sent the mail are located.
You can see all the folders from where mail PHP scripts were run with the following command:

~# grep X-Additional /var/tmp/mail.send | grep `cat /etc/psa/psa.conf | grep HTTPD_VHOSTS_D | sed -e 's/HTTPD_VHOSTS_D//' `

Reference: http://kb.parallels.com/en/1711

How to repair mail server configuration in Plesk?

Use mchk utility to repair/rebuild mail server configuration and restore settings for all mailboxes created in Parallels Plesk Panel.

Plesk for Linux:

~# /usr/local/psa/admin/sbin/mchk –help
Restore settings for all mailboxes.
Usage: /usr/local/psa/admin/sbin/mchk [OPTION]

OPTIONS:
–without-spam restore all settings except for SpamAssassin configuration
–with-spam restore all settings
–spam-only restore only SpamAssassin settings

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


Plesk for Windows:

Warning! Only settings that were applied to mailboxes through Parallels Plesk Panel interface or command-line utilities will be restored by mchk. Any custom configuration options, applied by other means (e.g. through mail server’s configuration console), will be lost.

C:>“%plesk_bin%mchk” –help
usage: mchk [options] …

–help
–all [–fix=all|local]
–domain –domain-name= [–fix=local]
–domains –domain-names=| [–via-file] [–fix=local]
–all-domains [–fix=local]
–global-settings

Usage example:

C:>”%plesk_bin%mchk” –all