Archive

Archive for the ‘Plesk’ Category

How to easily encrypt/decrypt a file in Linux with gpg

June 29th, 2022 Comments off

No matter what you’re doing on your computer, you need to do so with an eye to security — that means using strong passwords, storing files in safe locations, and in some cases encrypting files. Fortunately, for nearly every usage, there are tools to enable you to encrypt your data…from transferring data online to storing data on a locally attached storage, even encrypting your entire drive.

Since gpg is built into almost every Linux system, you won’t have to install anything to get this working from the command line. I’ll also show how to gain this functionality within the Nautilus (GNOME Files) file manager tool.

From the command line

Let’s say you have a file, /home/user/test.txt, that you want to password protect. Using gpg, you would do the following.

  1. Open a terminal window.
  2. Change to the /home/user/ directory with the command cd /home/user/
  3. Encrypt the file with the command gpg -c test.txt.
  4. Enter a unique password for the file and hit Enter.
  5. Verify the newly typed password by typing it again and hitting Enter.

You should now see the file test.txt.gpg in the /home/user folder. To decrypt that file, do the following.

  1. Open a terminal window.
  2. Change to the /home/user directory with the command cd /home/user.
  3. Decrypt the file with the command gpg important.dox.gpg.
  4. When prompted, enter the decryption password you created when encrypting the file.

You could send that file to a recipient and, as long as they have gpg installed, they can decrypt the file with the password you used for encryption. If they are a Windows user, they can always install Gpg4win.

The GUI way

If you happen to be a GNOME 3 user (or any Linux desktop that makes use of either Nautilus or GNOME Files), you can add a contextual menu entry to the file manager for encryption. Here’s how (I’ll demonstrate it on Ubuntu GNOME 16.04).

  1. Open a terminal window.
  2. Issue the command sudo apt-get install seahorse-nautilus.
  3. Type your sudo password and hit Enter.
  4. If prompted, type y and hit Enter.
  5. Allow the installation to complete.

Open the file manager and navigate to the /home/user directory. Right-click the test.text file and then click the Encrypt… entry. You will be prompted to enter and then verify an encryption password. Once you’ve verified the password, the test.txt.gpg file will appear in

The decryption process is the same.

  1. Open the file manager.
  2. Navigate to the encrypted file.
  3. Right-click the encrypted file.
  4. Click Open with Decrypt File.
  5. When prompted, give the new file a name and click Enter.
  6. When prompted, enter the decryption password and click Enter.

The encrypted file will now be decrypted and ready to use.

How to Install memcached on CentOS Plesk Server

April 9th, 2022 Comments off

Install memcached daemon with command

yum install Memcached

Enable memcached to start on boot

systemctl enable memcached

Start memcached

systemctl start memcached

You can verify if memcached is running with the command “netstat -lntp”

[root@server ~]# netstat -lntp |grep memcachetcp        0      0 0.0.0.0:11211           0.0.0.0:*               LISTEN      129472/memcached    tcp6       0      0 :::11211                :::*                    LISTEN      129472/memcached [root@server ~]#

By default Memcached listen on all interfaces (0.0.0.0:11211). You need to make it bind to 127.0.0.1 only, so no one will be able to access your Memcached installation from the public. For securing Memcached installation, refer How to secure Memcached on CentOS 7. After Memcached is secured, you will see it listen on 127.0.0.1 only like the following

[root@server etc]# netstat -lntp | grep mem
tcp        0      0 127.0.0.1:11211         0.0.0.0:*              LISTEN      81636/memcached     
[root@server etc]#

Install memcached PHP Module

Install the requirements

yum install -y libmemcached-devel zlib-devel

Replace default system PHP with PHP version on which you need memcache PHP module installed. In this case, I will be installing the PHP module for PHP version 7.4

cd /usr/binmv php php.oldmv phpize phpize.oldln -s /opt/plesk/php/7.4/bin/phpln -s /opt/plesk/php/7.4/bin/phpize

Now run the command

/opt/plesk/php/7.4/bin/pecl install memcached

If you get error related to phpize missing, you need to install PHP devel package.

yum install plesk-php74-devel

After install finished, you need to edit php.ini

vi /opt/plesk/php/7.4/etc/php.ini

At end of the file, add

extension=memcached.so

Restart php-fpm

systemctl restart plesk-php74-fpm.service

Install memcache module

the latest version of memcache won’t work with PHP 7.4, so we need to use an older version.

To install version 4.0.5.2 of memcache, run

/opt/plesk/php/7.4/bin/pecl install memcache-4.0.5.2

After installing, edit php.ini file

vi /opt/plesk/php/7.4/etc/php.ini

At end of the file, add

extension=memcache.so

Restart php-fpm

systemctl restart plesk-php74-fpm.service

How to get mail statistics from your postfix mail logs

January 21st, 2018 Comments off

How to get mail statistics from your postfix mail logs

Its an amazing tool and will provide you the following details

  • Total number of:
    • Messages received, delivered, forwarded, deferred, bounced and rejected
    • Bytes in messages received and delivered
    • Sending and Recipient Hosts/Domains
    • Senders and Recipients
    • Optional SMTPD totals for number of connections, number of hosts/domains connecting, average connect time and total connect time
  • Per-Day Traffic Summary (for multi-day logs)
  • Per-Hour Traffic (daily average for multi-day logs)
  • Optional Per-Hour and Per-Day SMTPD connection summaries
  • Sorted in descending order:
    • Recipient Hosts/Domains by message count, including:
      • Number of messages sent to recipient host/domain
      • Number of bytes in messages
      • Number of defers
      • Average delivery delay
      • Maximum delivery delay
    • Sending Hosts/Domains by message and byte count
    • Optional Hosts/Domains SMTPD connection summary
    • Senders by message count
    • Recipients by message count
    • Senders by message size
    • Recipients by message size

    with an option to limit these reports to the top nn.

  • A Semi-Detailed Summary of:
    • Messages deferred
    • Messages bounced
    • Messages rejected
  • Summaries of warnings, fatal errors, and panics
  • Summary of master daemon messages

Installation :-

Installation is very simple , just download the package and unzip

  •  wget http://jimsun.linxnet.com/downloads/pflogsumm-1.1.5.tar.gz
  •  tar -zxf pflogsumm-1.1.5.tar.gz
  • chown root:root pflogsumm-1.1.5

Generate the statistics  :-

cat /var/log/maillog | ./pflogsumm.pl
( The above command will generate a detailed statistics as follows )

Grand Totals
————
messages

118 received
319 delivered
1 forwarded
6 deferred (1597 deferrals)
18 bounced
20 rejected (5%)
0 reject warnings
0 held
0 discarded (0%)

5452k bytes received
277987k bytes delivered
76 senders
49 sending hosts/domains
128 recipients
37 recipient hosts/domains

Per-Day Traffic Summary
date received delivered deferred bounced rejected
——————————————————————–
Jan 13 2018 51 251 476 14 9
Jan 14 2018 17 16 522 2 5
Jan 15 2018 43 45 527 2 6
Jan 16 2018 7 7 72

Per-Hour Traffic Daily Average
time received delivered deferred bounced rejected
——————————————————————–
0000-0100 0 1 19 0 0
0100-0200 1 1 13 0 0
0200-0300 1 1 13 0 0
0300-0400 1 1 19 0 0
0400-0500 1 1 14 0 0
0500-0600 0 0 7 0 0
0600-0700 1 1 13 0 0
0700-0800 1 1 13 0 0
0800-0900 0 0 7 0 0
0900-1000 2 2 14 0 1
1000-1100 5 51 32 3 0
1100-1200 1 1 33 0 0
1200-1300 1 4 14 0 0
1300-1400 2 2 20 0 0
1400-1500 2 2 20 0 0
1500-1600 4 4 14 0 0
1600-1700 1 1 20 0 0
1700-1800 2 2 20 0 1
1800-1900 1 2 14 1 0
1900-2000 1 1 13 0 2
2000-2100 1 1 19 0 0
2100-2200 1 1 19 0 0
2200-2300 1 1 13 0 0
2300-2400 1 1 19 0 1

Categories: Plesk, Uncategorized Tags:

Upgrading MySQL Governor on CPanel, Plesk and DirectAdmin server

November 29th, 2012 Comments off

Upgrading MySQL Governor on CPanel, Plesk and DirectAdmin server

 

Run the below command to update MySQL Governor

yum update db-governor db-governor-mysql –enablerepo=cloudlinux-updates-testing

Run the below command to restart the service

service db_governor restart

 

How to install MySQL Governor on CPanel, Plesk and DirectAdmin

November 29th, 2012 Comments off

How to install MySQL Governor on CPanel, Plesk and DirectAdmin

MySQL governor is set of utilities to monitor and restrict MySQL usage in shared hosting environment. The monitoring is done via USER_STATISTICS table that is available in CloudLinux version of MySQL as well as via tracking of slow queries.

To install MySQL governor on cPanel server

yum install db-governor –enablerepo=cloudlinux-updates-testing
/usr/share/lve/dbgovernor/install-mysql.py –install

Note :

MySQL on cPanel servers will be updated from CloudLinux RPMs.

MySQL Governor is compatible only with MySQL 5.x

 

%d bloggers like this: