How to change Postfix hostname and SMTP banner on Plesk server

Connect to a Plesk server via SSH.

Create a copy “postfix” configuration file:

# cp -a /etc/postfix/main.cf /root/backup_main.cf

Open “postfix” configuration file in a text editor, for example, “vi” editor:

# vi /etc/postfix/main.cf

Add the lines specified below to the configuration file main.cf and make sure that these lines are present only once in the file:

Note: replace example.com with required mail server name.

myhostname = example.com
smtpd_banner = $myhostname ESMTP $mail_name

Using command line tool. check “postfix” configuration syntax and restart postfix:

postfix check
(empty output - means syntax is OK)
# service postfix restart

Freeing disk space on your Linux server

To find out where disk space is being used:

Get to the root of your machine by running

# cd /

Run

# sudo du -h --max-depth=1

Note which directories are using a lot of disk space.
cd into one of the big directories.
Run

# ls -l

to see which files are using a lot of space. Delete any you don’t need.
Repeat steps to run once you cd into the directory with the largest size

sudo du -h --max-depth=1

FTP Error for Plesk Server – 421 Service not available, remote server has closed connection

FTP is not working and has the following error:
421 Service not available, remote server has closed connection

Also, in the message logs:
Plesk Unable to FTP – missing scoreboard file (Linux)

On CentOS 6 and 7 if you experience issues logging on to FTP server please check the logs for the following:

# tail -f /var/log/messages

Look for this error:

proftpd[11951]: fatal: ScoreboardFile: : unable to use '/var/run/proftpd/scoreboard': No such file or directory on line 74 of '/etc/proftpd.conf'

Check in /var/run for a proftpd folder, if it’s missing you have a bug in your ProFTPd version usually caused by using the Atomic repo to update ProFTPd.

Check for atomic:


# ls -la /etc/yum.repos.d/ | grep atomic
-rw-r--r--.   1 root root   827 May 18  2016 atomic.repo

The solution is to remove the package and reinstall from Plesk repo:


rpm -e --nodeps psa-proftpd
plesk installer --select-release-current --install-component=proftpd
service xinetd restart

Then you should be able to connect again. Please note that any changes to proftpd.conf such as enabling custom PassivePorts will be lost and need to be recreated.

Source: https://community.webcore.cloud/tutorials/plesk_articles/plesk_unable_to_ftp_missing_scoreboard_file_linux/

Change Windows RDP SSL Cert from Default to Comodo Free SSL

This article describes how to change the SSL cert for you Windows server to match a hostname so that when you remote desktop to a windows server, you don’t get a warning for the identity and the SSL cert.

Go to Sectigo (Comodo) and sign up for a free ssl.

https://ssl.comodo.com/free-ssl-certificate.php

First, generate a CSR.

One: https://knowledge.digicert.com/solution/SO21586.html

https://support.comodo.com/index.php?/Knowledgebase/Article/View/739/19/csr-generation-and-ssl-installation-for-ms-terminal-services-rdp

Set up the CSR

Godaddy – https://hk.godaddy.com/en/help/windows-generate-csr-for-code-or-driver-signing-certificate-7282

CSR Generation: Using certreq (Windows)
This article is for administrators who prefer the command shell!

Save the following file as request.inf on your server editing the subject according to the comment:

;----------------- request.inf -----------------

[Version]
Signature="$Windows NT$"

[NewRequest]
Subject = "C=US, CN=something.example.com" 

KeySpec = 1
KeyLength = 2048
Exportable = TRUE
MachineKeySet = TRUE
SMIME = False
PrivateKeyArchive = FALSE
UserProtected = FALSE
UseExistingKeySet = FALSE
ProviderName = "Microsoft RSA SChannel Cryptographic Provider"
ProviderType = 12
RequestType = PKCS10
KeyUsage = 0xa0
HashAlgorithm = SHA256 

[EnhancedKeyUsageExtension]
OID=1.3.6.1.5.5.7.3.1 ; this is for Server Authentication / Token Signing
;-----------------------------------------------


then run

certreq -new request.inf request.csr

This add the key as well – https://blogs.technet.microsoft.com/rmilne/2014/06/17/how-to-request-certificate-without-using-iis-or-exchange/

re: https://support.comodo.com/index.php?/comodo/Knowledgebase/Article/View/813/102/

Finish install:

How to Change the IP for Webmail on Plesk Domain

Symptoms

Webmail webmail.example.com shows the blank page or the default plesk page.

DNS records for webmail.example.com is managed by external DNS server:


# dig +short webmail.example.com @8.8.8.8
203.0.113.2

There is another IP 203.0.113.3 is set in web server configuration file for webmail.example.com:

RHEL-like systems


grep VirtualHost /etc/httpd/conf/plesk.conf.d/webmails/example.com_webmail.conf | grep -v "/VirtualHost"
<VirtualHost 203.0.113.3:7080 127.0.0.1:7080>
<VirtualHost 203.0.113.3:7081 127.0.0.1:7081>

Debian-like systems


grep VirtualHost /etc/apache2/plesk.conf.d/webmails/example.com_webmail.conf | grep -v "/VirtualHost"
<VirtualHost 203.0.113.3:7080 127.0.0.1:7080>
<VirtualHost 203.0.113.3:7081 127.0.0.1:7081>

Both IP addresses belongs to the server
Cause

IP address that is set for domain does not match the one specified on registrar’s side.
Resolution

Log into Plesk
Browse to Home > Domains > example.com > Web Hosting Access and change IP address to the correct one 203.0.113.2

If the domain has no hosting and used only to serve mail, Web Hosting Access link is not present in Plesk. However, to update IP for webmail’s configuration file is possible via command line:

Connect to the server using SSH
Update the IP address to correct one:


# plesk bin subscription -u example.com -ip 203.0.113.2

Source: https://support.plesk.com/hc/en-us/articles/115005104213-Webmail-shows-the-blank-page

DDos Analysis

DDos Detection Articles:

https://www.hivelocity.net/kb/how-to-check-if-your-linux-server-is-under-ddos-attack/

http://linuxaria.com/howto/how-to-verify-ddos-attack-with-netstat-command-on-linux-terminal

https://support.plesk.com/hc/en-us/articles/360000345633-How-to-diagnose-possible-DoS-or-DDoS-attack-on-Apache

Import a large sql dump file to a MySQL database from command line

How to import a very large SQL dump file (6 Gb) to a MySQL database using windows command line. If you are using linux it is the same. The process is the following:

Open a command prompt (or shell in Linux) with administrative privilleges

Connect to a mysql instance using command line


# mysql -h 192.168.1.1 --port=3306 -u root -p

if you are in localhost you do not need host and port


# mysql -u root -p

Or if plesk,

# mysql -uadmin -p`cat /etc/psa/.psa.shadow`

You are now in mysql shell. Set network buffer length to a large byte number. The default value may throw errors for such large data files


mysql> set global net_buffer_length=1000000;

Set maximum allowed packet size to a large byte number.The default value may throw errors for such large data files.

mysql> set global max_allowed_packet=1000000000;

Disable foreign key checking to avoid delays,errors and unwanted behaviour

mysql> SET foreign_key_checks = 0;
mysql> SET UNIQUE_CHECKS = 0;
mysql> SET AUTOCOMMIT = 0;

Import your sql dump file

mysql> use db_name;
mysql> source backup-file.sql;

Remember to enable foreign key checks when procedure is complete!


 mysql> SET foreign_key_checks = 1;
 mysql> SET UNIQUE_CHECKS = 1;
 mysql> SET AUTOCOMMIT = 1;

If you are in Linux you can create a Bash script which will do the dirty job and write to stdout start and end time of import:


  #!/bin/sh 

  # store start date to a variable
  imeron=`date`

  echo "Import started: OK"
  dumpfile="/home/bob/bobiras.sql"

  ddl="set names utf8; "
  ddl="$ddl set global net_buffer_length=1000000;"
  ddl="$ddl set global max_allowed_packet=1000000000; "
  ddl="$ddl SET foreign_key_checks = 0; "
  ddl="$ddl SET UNIQUE_CHECKS = 0; "
  ddl="$ddl SET AUTOCOMMIT = 0; "
  # if your dump file does not create a database, select one
  ddl="$ddl USE jetdb; "
  ddl="$ddl source $dumpfile; "
  ddl="$ddl SET foreign_key_checks = 1; "
  ddl="$ddl SET UNIQUE_CHECKS = 1; "
  ddl="$ddl SET AUTOCOMMIT = 1; "
  ddl="$ddl COMMIT ; "

  echo "Import started: OK"

  time mysql -h 127.0.0.1 -u root -proot -e "$ddl"

  # store end date to a variable
  imeron2=`date`

  echo "Start import:$imeron"
  echo "End import:$imeron2"

Other solutions:
Big Dump
http://www.ozerov.de/bigdump/ seems good

Split Files
http://www.rusiczki.net/2007/01/24/sql-dump-file-splitter/

Using the MutiPHP Editor changes are overwritten for fopen and exec

Recently there was an issue where the fopen and curl function and shell_exec functions were reverting back to original values. Using the MutiPHP Editor was not working.

the resolution was that the php-fmp handler was being used on a cpanel server. So the php-fpm config file needed to be changed.

The line that needs to be edited is:in /opt/cpanel/ea-php56/root/etc/php-fpm.d/$DOMAIN

Remove the disable_functions which includes shell_exec

php_admin_value[disable_functions] =

Then restart the following services.

systemctl restart httpd.service
/scripts/restartsrv_apache_php_fpm
/scripts/restartsrv_cpanel_php_fpm

UPDATE; Seems the yaml files need to be updated:
https://forums.cpanel.net/threads/stop-cpanel-from-overwriting-php-fpm-settings-file.596527/

This information is for editing the yaml file which should result in permanent changes.

More information here on php-fpm configurations:
https://documentation.cpanel.net/display/64Docs/Configurations+Values+of+PHP-FPM#ConfigurationsValuesofPHP-FPM-Howtoremovedefaultvaluesfromaconfiguration

UPDATE 2:

Also, there was an issue with fopen where the changes in the MultiPHP Editor were being overwritten.

If  PHP handler is LSAPI, you can adjustment to your Apache configuration. Please ensure the setting is enabled for the site(s) in question under MultiPHP Ini Editor. If this still does not work, in whm from   Home »Software »MultiPHP Manager there is a System PHP-FPM Configuration tab and from it you can change the user override ability for allow_url_fopen and other options.

 

How do I manage databases in the Plesk control panel?

The Plesk Control Panel has the ability to create multiple MySQL and PostgreSQL databases as well as multiple users within each database. Also, directly accessible via Plesk, are the links to phpMyAdmin and PhpPGAdmin, the PHP interface applications that abstract mysql or postgresql into a web-based administration tool, allowing you to sort, edit, and create tables within a given database.

Before creating your databases within the Plesk Control Panel, please ensure that you have already added a hosted domain name to your dedicated server.

Here is how you can create MySQL (or PostgreSQL) databases using Plesk:
Login to your Plesk Control Panel. The login URL is in the following format (https://ipaddress:8443).
Click on Websites and Domains from the navigation bar on the left.

Select the domain name that you’d like to associate your database with.
Click the Databases icon on the top right menu.

Click the Add Database icon.

Add the Database Name
Select the related site for the data base.
Click the “Create a Database User” box in order to setup database administrator’s credentials.
Enter a username and a password which will be used for accessing the contents of the database.
Select if the User has access to all databases.
Select Access Control for the database.
Click OK.
Now, you can use the phpMyAdmin and other tools where you can manage your database.