Posts

Showing posts from 2019

Plesk - Decrypt FTP Passwords

I was working on a project where Plesk user details were being imported into a database and it would help to know the password. Since Plesk 11 the Plesk Client account is hashed which makes it unrecoverable, but other passwords are encrypted with 128 bit AES encryption and a salt. If the FTP login name is the same as the client login there is a chance the customer was lazy and used the same details. To decrypt the passwords you will need the server secret key and the password string from the plesk database. The server secret key can be retrieved with the following command on a linux server: cat /etc/psa/private/secret_key | base64 Matching FTP logins (and their encrypted password) can be retrieved from the Plesk database with: SELECT REPLACE(s.home, '/var/www/vhosts/', '') AS domain, c.login, a.password FROM clients c LEFT JOIN sys_users s ON s.login = c.login LEFT JOIN accounts a on s.account_id = a.id; The results will look like: +-------------------

MySQL - Sort by IP Address

If you have a column containing ip addresses, sort the ip addresses numerically with: ORDER BY  INET_ATON(ip_address_column)

systemctl: Show running services

systemctl list-units --type service --state running

Google Maps API: Allow local files from your desktop computer

Assuming that you have already created the key... Go to https://console.developers.google.com/apis/credentials Make sure you have the right project selected from the dropdown at the top Click the API Key Under "Application restrictions" select "HTTP referrers (websites)" Under "Website restrictions" click "ADD AN ITEM" Put __file_url__//*  into the box that appears Click "SAVE"

IPTables: Clear all rules

When you need to clear all rules and set the default police to ACCEPT. iptables-save | sed "/-/d;/^#/d;s/DROP/ACCEPT/" | iptables-restore This is not permanent. The default rules will be reloaded if IPTables, your firewall or the server is restarted.

MySQL/Percona: Show the order of configuration files

Show which files the database server uses and the order they are read. Get the server binary location # which mysqld /usr/sbin/mysqld Get the configuration file locations and order # /usr/sbin/mysqld --verbose --help | grep -A 1 "Default options" Default options are read from the following files in the given order: /etc/my.cnf /etc/mysql/my.cnf /usr/etc/my.cnf ~/.my.cnf