Web development

CNERIS.COM

CNERIS.COM

The PassivePorts directive is used in the file /etc/proftpd.conf to specify a passive ports range.

  1. Connect to the Plesk server via SSH.

  2. Create /etc/proftpd.d/55-passive-ports.conf file using the following command:

    # touch /etc/proftpd.d/55-passive-ports.conf

  3. Edit file /etc/proftpd.d/55-passive-ports.conf in any text editor and place the content below as follows:

    <Global>
    PassivePorts 49152 65535 
    </Global>

    Note: Remove PassivePorts directive from /etc/proftpd.conf file if the directive is defined inside.

  4. Specify ports in /etc/proftpd.d/* files as well, if needed. See the ProFTPd documentation for more information regarding the PassivePorts directive.

  5. Next, the nf_conntrack_ftp module should be loaded into the system:

    # /sbin/modprobe nf_conntrack_ftp

    # lsmod | grep conntrack_ftp 
    nf_conntrack_ftp 13696 0 
    nf_conntrack 61684 1 nf_conntrack_ftp

  6. If Plesk Firewall is installed and enabled, specify the port range according to the KB article Unable to connect to FTP in passive mode.

    If another firewall is used to manage iptables rules, use it to allow the passive ports range.

    Otherwise, make sure that the following line exists in the iptables settings:

    # iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT

  7. If a server is behind the NAT, the nf_nat_ftp module should be loaded:

    # /sbin/modprobe nf_nat_ftp

    In case if FirewallD on CentOS 7 is installed, NAT modules should be added into /etc/modules-load.d/iptables.conf

    # echo nf_nat_ftp >> /etc/modules-load.d/iptables.conf
    # echo nf_conntrack_ftp >> /etc/modules-load.d/iptables.conf

    Note: the action which involves kenel modules configuration should be performed on the barebone hardware or in the virtual machine with full hardware emuation.
    It the container is used, the same actions should be performed on a hardware node side.

  8. To keep the changes after a system reboot, the modules should be added to the IPTABLES_MODULES line in the file /etc/sysconfig/iptables-config as follows:

    # cat /etc/sysconfig/iptables-config | grep IPTABLES_MODULES
    IPTABLES_MODULES="nf_conntrack_ftp nf_conntrack ip_nat_ftp"

    Note: Because the FTP helper modules must read and modify commands being sent over the command channel, they will not work when the command channel is encrypted through use of TLS/SSL.

  9. If it is required to use TLS/SSL for FTP, the only way is to open required ports. Use Plesk Firewall extension for this, or add the rules using iptables:

    # iptables -I INPUT 2 -p tcp --match multiport --dports 49152:65535 -j ACCEPT
    # service iptables save

    Note: Ports should be opened on all firewalls in the network.

  10. Restart the xinetd service to apply changes:

    # service xinetd restart

From: https://support.plesk.com/hc/en-us/articles/213902285

 

WordPress is the most popular Content Management System. This popularity makes WordPress a perfect target for hackers. The most common attack faced by a WordPress site is XML-RPC attack.

 

Recognizing an XML-RPC Attack

1) Randomly “Error establishing database connection” error is displaying on the WordPress site.

2) “Out of memory” error in the web console.

3) “Cannot open the file no such file/directory” error in web server error log.

4) “POST /xmlrpc.php HTTP/1.0” error in webserver access log.

 

By default, Plesk allows only active FTP connections. This may result in customers being unable to connect to the server via FTP. To avoid this, we recommend enabling passive FTP. This topic explains how to enable passive FTP mode in Plesk for Linux.

To enable passive FTP mode in Plesk for Linux:

  1. Log in to your server via SSH as the root user.
  2. Create the /etc/proftpd.d/55-passive-ports.conf file, add the following lines to it, and then save the changes:

    <Global>

    PassivePorts 49152 65535

    </Global>

  3. Run the following command:

    systemctl restart xinetd

Now your Plesk server accepts passive FTP connections. If you have installed the Plesk Firewall and switched on its default configuration, you need to add a firewall rule allowing passive FTP:

  • Direction: Incoming
  • Action: Allow
  • Ports: TCP 49152-65535
  • Sources: (any host)

 

Thursday, 14 February 2019 21:40

Unknown collation: ‘utf8mb4_unicode_520_ci'

The following error is found when trying to migrate the MySQL database from one server to another: 

Unknown collation: ‘utf8mb4_unicode_520_ci’

-----------------------------

User can solve this by finding

ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;

in the .sql file, and swapping it with

ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;

This method of pasword recovery will require that you be able to access both the files and the database of your PrestaShop login. The instructions will be using the cPanel File editor and phpMyAdmin in order to obtain the necessary information to reset the password that is stored in the database table.

Step 1) Login to your cPanel, then go to the FILES section and click on File Manager.

Step 2) We will need to edit the SETTINGS.INC.PHP file in order to obtain the COOKIE_KEY before we can change the password in the database. Find your PrestaShop installation files using the File Manager. When you are in the files, look for the CONFIG folder and click on it to see the list of files.

Step 3) In the file list you should see a file labeled settings.inc.php. Right-click then select EDIT or CODE EDITOR to open this file.

Step 4) When you are in the editor look for the line that begins like this: define('_COOKIE_KEY_'

. Copy the string of numbers and letters that is between the single quotation marks. Don't copy the quotation marks! In order to copy it, simply place your mouse pointer at the beginning of the text, left-click, hold the button down and drag to the end of the code. This will highlight the key. Once all of the text is highlighted, release the left button and right-click (control click on a Mac touchpad or one-button mouse) on the highlit text. Select COPY. This will store the text. You can close the file once you have the key copied.

Step 5) Go back into the cPanel and then select the phpMyAdmin icon in the DATABASES section.

Step 6) Once you have phpMyAdmin open, select your PrestaShop database name from the menu on the left side of the page. If you are unfamiliar with your PrestaShop database name then please read this article in order to find it.

Step 7) When your database opens you will see a long list of tables listed on the lefthand side of the screen. Scroll down the list of table names until you find ps_employee table> Note that this prefix may vary if it was named differently during the installation. The suffix of "_employee" should still remain though. Left-click on the table to open it.

Step 8) Select EDIT for admin employee IDOnce you have the table opened in the phpMyAdmin editor, you will need to click on EDIT for the Administrator login that you're trying to reset. Please refer to the screenshot at right to see where to find EDIT (it's to the left of the admin login that you're trying to find under Options)

Step 9) Select the passwd field and clear existing password When you are in the EDIT screen look for the line that starts with the label passwd. This is where the password is stored. You will see the existing value in the field to the right under VALUE. Click in the field, highlight all of the text and clear it with your backspace or delete key.

Step 10) Next, right click (or control-click on a Mac) in the same field and select PASTE to insert the COOKIE_KEY from the SETTINGS_INC.PHP file from earlier. If you do not see the code that you obtained earlier, please return to steps 1-4 to get the code.

Step 11) When you have finished placing the code in there, the next step is to type in your new password. There should be NO SPACE in between your password and the COOKIE_KEY. Practice good security by making sure that your password is not something easily determined. For guidelines on creating a good password, please read An Introduction to Password Security.

Step 12) Click on the drop down menu and select MD5When you have your password typed in, click on the drop-down menu to the left of the value field where you inserted the COOKIE_KEY and typed your password. It will be under the columned labeled FUNCTION. Scroll down the list and look for and select md5.

Step 13) Select MD5, double-check password and then click on GO to save password changeWhen you have selected md5, double-check to make sure your password is correct in the value field and then click on GO in the bottom left corner of the screen in order to commit the change.

After an update to Joomla 3.8.10 some users are getting errors and they can not use the menu.

 

Screen pops up the following error message

Cannot Use Object Of Type StdClass As Array

 

The solution is quite simple:

Edit the file "helix3.php" (plugins/system/helix3/helix3.php)

 

And add the following code on 50 line:

if (is_object($data)) {

           $data = (array)$data;

}

After the line: JForm::addFormPath(JPATH PLUGINS.'...)

And before the line: if ($form->getName()=='com_menus.item')

Tuesday, 19 June 2018 21:42

MySQL Service wont start (FIX!!!)

I gave up on 5.0 and installed 4.1 and I am up and running but I stumbled across this post deep in the forum. I bet this works but I dont want to mess with my installation anymore so I am not 100% sure: 

"Then I found the answer: one has to delete three files, all located in the mysql/data directory: 

*ib_logfile0 

*ib_logfile1 

*ibdata1 

Deleting these files means that the Windows config wizard recreates them and the server starts without a hitch. 

I also then restarted Windows after I reconfigured MySql just to make sure. 

Then run "MySQL Server Instance Config Wizard" again and enjoy!!!!!!!!!!!"

Dump of the MySQL database hosted on the Plesk server fails:

mysqldump: Got error: 1146: Table '<TABLENAME>' doesn't exist when using LOCK TABLES

Backups have the following warning related to the database:

WARNING: mysql 'exampleDB'

Unable to execute SQL: Table 'exampleDB.<TABLENAME>' doesn't exist in engine. SQL query: SHOW FULL COLUMNS IN `<TABLENAME>`

Migration fails with the following error:

Failed to copy content of database 'exampleDB'

This section describes how to rebuild or repair tables or indexes, which may be necessitated by:

Changes to how MySQL handles data types or character sets. For example, an error in a collation might have been corrected, necessitating a table rebuild to update the indexes for character columns that use the collation.

Required table repairs or upgrades reported by CHECK TABLE, mysqlcheck, or mysql_upgrade.

Methods for rebuilding a table include:

  1. Dump and Reload Method
  2. ALTER TABLE Method
  3. REPAIR TABLE Method

Dump and Reload Method

If you are rebuilding tables because a different version of MySQL will not handle them after a binary (in-place) upgrade or downgrade, you must use the dump-and-reload method. Dump the tables before upgrading or downgrading using your original version of MySQL. Then reload the tables after upgrading or downgrading.

I did change the datadir of a MySQL installation and following some steps it worked fine. Every base I had was moved correctly but one.

I can connect and USE the database, even SHOW TABLES returns me all the tables correctly and the files of each table exists on the mysql data directory. But when I try to SELECT something there, it says the table doesn't exists. But the table does exists, it even shows at SHOW TABLES statement!

My guess is that the SHOW TABLES lists the files existence somehow that the files are corrupt or something like that but it doesn't check it. So I can list them but not access them.

But that's just a guess, I've never seen this before. Can't restart the database now for testing, every other application which uses it is running fine.

Does anyone knows what is it?

Page 8 of 9