Category: disk usage

How to clear eximstatus database entries

How to clear eximstatus database entries

Hello,

This post is about truncating eximstats database. The scenario is considered when the database size increase to large size. This can occur due to high mail queue or spam issues. If your eximstats database has gotten pretty large, chances are you have a spam issue and may want to check your /var/log/exim_mainlog log to see if you have any kind of spam activity going on.

So what is eximstats database?

Eximstats parses the exim log to produce text and graphical data, i.e. number of successful and unsuccessful delivery etc . From WHM we can analyze the email queue by from “Home » Email » Mail Queue Manager“. The eximstats normally analyze the exim mainlog and syslog files to generate a statistical output.

Here I’m explaining the way to remove contents from the database Eximstats.

1, SSH to server as ‘root’ user.

2, Enter to MySQL command prompt.

root@myserver [~]# mysql
Welcome to the MariaDB monitor.  Commands end with ; or g.
Your MariaDB connection id is 14851610
Server version: 10.0.20-MariaDB-cll-lve MariaDB Server
Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.
MariaDB [(none)]>

3, Use the database eximstat.

MariaDB [(none)]> use eximstats;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
MariaDB [eximstats]>

4, The DB eximstat mainly contains 4 tables:

MariaDB [eximstats]> show tables;
+---------------------+
| Tables_in_eximstats |
+---------------------+
| defers              |
| failures            |
| sends               |
| smtp                |
+---------------------+
4 rows in set (0.00 sec)
MariaDB [eximstats]>

5, Truncate all tables.

MariaDB [eximstats]> truncate table smtp; 
MariaDB [eximstats]> truncate table sends;
MariaDB [eximstats]> truncate table failures; 
MariaDB [eximstats]> truncate table defers;

6, Quit from MySQL prompt.

MariaDB [eximstats]> quit
Bye

7, Check the DB.

root@sng006 [~]# mysqlcheck -c eximstats
eximstats.defers                                   OK
eximstats.failures                                 OK
eximstats.sends                                    OK
eximstats.smtp

6, Restart Exim daemon.

Do check the exim main log and confirm that everything is normal. That’s all 🙂

Get 24/7 expert server management

The post How to clear eximstatus database entries appeared first on SupportSages – Your IT Infrastructure partner !!.

Steps to enable TLSv1.2 for PayPal /Stripe connections

Steps to enable TLSv1.2 for PayPal /Stripe connections

Recently, the following error was thrown whenever I try to process a payment in PayPal.

“Stripe / PayPal no longer supports API requests made with TLS 1.0. Please initiate HTTPS connections with TLS 1.2 or later”

on further investigation it is found that common payment gateways such as  PayPal are updating their API servers to only accept requests made using the new TLS 1.2 protocol for encryption. This is intended to secure all external connections made to the payment gateways. Interestingly the same issue happened during Stripe checkout as well, ruling out any issues specific to PayPal alone.

Even though the server is enabled with TLS 1.2, the default connections uses  TLS 1.0 for establishing connections with payment gateways and it creates the compatibility issue.

This issue was a good one. Took me 1+ hour to figure out. Google helped by lighting the path 🙂

Here is what I did.

1.Checked in the Qualys SSLLabs using the link https://www.ssllabs.com/ssltest  and confirmed that TLS 1.2 is enabled.

2.Worked in the SSL settings of web server / virtual host to enable only TLS1.2 by using the following entry in my virtual host entry


SSLProtocol -all +TLSv1.2

You need to tweak it in accordance with your webserver settings. I also tried adjusting the priorities of TLS v1 TLS v 1.2 etc.

3. Checked for the latest version of OpenSSL and Curl

4. Tried matching the libcurl version in CLI and the phpinfo page and they turned out to be the same.

5. OpenSSL versions also matched in phpinfo and CLI

6. Tried running curl in the CLI with –tlsv2 option enabled. It worked there, but still not on the website.

I tried running the php script and it was returning me TLS 1.0 . So that was the turning point. For some reason system is taking TLS 1.0 and not trying to negotiate TLS 1.2


tls_version;
?>;

As anyone can guess, the issue is with the default version.

By default it is taking TLS 1.0. Issue would be solved if I can somehow get TLS v 1.2 to load. I tried setting CURLOPT_SSLVERSION, but unfortunately (or fortunately) it didn’t work 🙁

Finally an interesting discussion came as Bug 1272504 in https://bugzilla.redhat.com/show_bug.cgi?id=1272504 .

Luckily, the server was a VPS and hence we could update the package. yum update nss.i686 and the issue got resolved. The above code displayed TLS 1.2 and I knew the problem solved. It did!!

Steps to enable TLSv1.2 for PayPal /Stripe connections 1

Get 24/7 expert server management

The post Steps to enable TLSv1.2 for PayPal /Stripe connections appeared first on SupportSages – Your IT Infrastructure partner !!.

Add a command/binary to CageFS

Add a command/binary to CageFS

Hello Pals,

My new blog is about adding a command or binary in the CageFS. For those who doesn’t know what CageFS is, I will start with a small brief on that.

CageFS

CageFS is a term related to CloudLinux and it is a virtualized file system and a set of tools to contain each user in its own ‘cage’ (can relate to chroot in Linux). Each customer will have its own fully functional CageFS, with all the system files, tools, etc.

So coming back to the topic, I will be adding FTP command to the CageFS.

First, we can check the binary ‘FTP’ and see if it’s present in the server.

root@myserver [~]# ftp
ftp>

Now that command is available on the server let’s see after switching to a normal user.

root@myserver [~]# su - manu
 
 
manu@myserver [~]# ftp
-bash: ftp: command not found

So its confirmed that the command “ftp” is not available to the users. Now we are going to add this to CageFS so that the command becomes available to users.

You can add any RPM’s if they’re installed on the server. First, find the full path of the command using the ‘which’ command:

root@myserver [~]# which ftp
/usr/bin/ftp

Once you have the full path, find out its package.

root@myserver [~]# rpm -qf /usr/bin/ftp
ftp-0.17-54.el6.x86_64

Now let’s add the package/rpm to CageFS

root@myserver [~]# cagefsctl --addrpm ftp-0.17-54.el6.x86_64

You need to update CageFS so that its added to every user’s cage.

root@myserver [~]# cagefsctl --force-update

Once the command is executed, switch to a user’s account and verify that command is available.


root@myserver [~]# su - manu
 
manu@myserver [~]# ftp
ftp>

That’s all and the command ftp will be available for the user now.

Hope this blog was helpful. 🙂

Get 24/7 expert server management

The post Add a command/binary to CageFS appeared first on SupportSages – Your IT Infrastructure partner !!.

Legacy File Manager : File Listing Issue Resolution

Legacy File Manager : File Listing Issue Resolution

Hello folks,

Today I am going to solve an issue with cPanel Legacy File Manager. I think you already know what a Legacy File Manager is. For those who don’t, Legacy file manager gives the look and feel of old cPanel File Manager. This is done for those who are finding it difficult with new cPanel file manager.

Please note that with newer cPanel updates, they have discontinued the “X3” theme and “Paper Lantern” has now become the default. So for those who have latest cPanel, this blog will be irrelevant as Legacy File Manager is only available in old X3 theme.

So coming to the issue, at times when you access Legacy File Manager nothing shows up. Below is an example of how it will look.

Legacy File Manager : File Listing Issue Resolution 2

Steps for solving the issue

Checking cPanel Error Logs

First, we will be checking cPanel error logs to see if anything shows up there. Following command is run on commandline while accessing the Legacy File Manager.

root@s1 [/home/manu]# tail -f /usr/local/apache/logs/error_log | grep manu

Unfortunately, there was no error. So we will move on to next step.

Checking cPanel Version

This step is to confirm whether the issue is a cPanel bug. cPanel version can be checked by using the following command

root@s1 [/home/manu]# tail -f /usr/local/apache/logs/error_log | grep manu

Take a Backup of the Account

This is a precautionary step. You won’t know if the user’s cPanel gets corrupted or not on proceeding with clearing the cPanel cache etc. For the purpose, I used the following command.

nice -n 19 /scripts/pkgacct manu

As I have mentioned earlier manu is the username of the account and nice -n 19 is used to reduce the priority of the process.

Clearing cPanel Cache

For clearing cPanel cache, you can move the ‘cache’ file from the cPanel folder in a user’s home directory. The command I used is given below.

#mv /home/user/.cpanel/cache /home/user/.cpanel/cache.bak 

After this step, I tried logging in again to the cPanel of the user. the issue was not resolved. 🙁

Renaming .cPanel Directory

For the purpose, I used the simple ‘mv’ command.

#mv /home/user/.cpanel /home/user/.cpanel.bak

On logging in again, a new .cpanel directory was created and everything seemed to be working fine. 🙂

Hope this post was helpful for you today.

Get 24/7 expert server management

The post Legacy File Manager : File Listing Issue Resolution appeared first on SupportSages – Your IT Infrastructure partner !!.

Some useful switches for “du – disk usage”

As we know, du command is used to check the disk usage of files and folders under Linux system. There are a lot of switches available for du among which here I am trying to explain the most common switches used.

As you know, one can easily checks the switches available for du by looking at the man page for du or by executing the command du –help .

Here I am trying to provide some basic guidelines about commonly used switches so that you can use them whenever in need.

Most commonly used form

# du -sch

h -> human readable format.
c -> display a total size usage at the end of result.
s -> display total size of a file or total size of all files in a directory.

Usage:

root@server [/home/abl]# du -s /home/abl
213932 /home/abl
root@server [/home/abl]# du -sh /home/abl
209M /home/abl
root@server [/home/abl]# du -sch /home/abl
209M /home/abl
209M total

Listing all files and directories, switch “a”

# du -ah

a -> this switch displays disk usage of all individual files and directories.

Usage:

root@server [/home/abl/etc]# du -ah /home/abl/etc | tail
0 /home/abl/etc/wis.com/quota
4.0K /home/abl/etc/wis.com
0 /home/abl/etc/ftpquota
0 /home/abl/etc/quota
4.0K /home/abl/etc/cacheid
0 /home/abl/etc/ablo.com/passwd
0 /home/abl/etc/ablo.com/shadow
0 /home/abl/etc/ablo.com/quota
4.0K /home/abl/etc/ablo.com
28K /home/abl/etc

Exclude something from the command output, using –exclude

# du –exclude

-–exclude -> This switch will avoid the particular file name that we have mentioned.
In the below example du -ah avoid files ending with .txt (–exclude=”*.txt”)

 root@server [/home/abl/etc]# du -ah –exclude=”quota” /home/abl/etc | tail
4.0K /home/abl/etc/wis.abl.com
0 /home/abl/etc/wis.com/passwd
0 /home/abl/etc/wis.com/shadow
4.0K /home/abl/etc/wis.com
0 /home/abl/etc/ftpquota
4.0K /home/abl/etc/cacheid
0 /home/abl/etc/abl.com/passwd
0 /home/abl/etc/ablogsite.com/shadow
4.0K /home/abl/etc/ablogsite.com
28K /home/abl/etc

Display modification time of files/folders, using –time

# du –time

–time ->This option shows the modification date and time of the file/directories.

root@server [/home/user/folder]# du -sch –time *
1.8M    2017-05-19 00:32    Folder 1
248M    2017-05-06 07:35   Folder 2
40K       2016-12-15 15:05   Folder 3
32K       2017-04-27 15:46   File.pdf
250M    2017-05-19 00:32    total

This switches should help you get the disk usage of the files in any directory.

There are few other options for du which are worth trying. You can view its details checking the man page of du.

Get 24/7 expert server management

The post Some useful switches for “du – disk usage” appeared first on SupportSages – Your IT Infrastructure partner !!.