Snappy

Helpdesk Support

Official Supportmonk Company Blog!

Syncing your mailbox folders using ImapSync

February 22, 2018 , 9:24 pm


The imapsync  is a handy tool we can use to sync our inbox folders.
The uniqueness of this tool is that it can sync folders between two imap servers directly without any backup/restore or intermediate mail clients.

Installing ImapSync

For Fedora & Centos distros,

sudo yum install epel-release
sudo yum install imapsync

For Ubuntu

For ubuntu unfortunately the repository is not available and you have to type the following commands

sudo apt-get install makepasswd rcs perl-doc libio-tee-perl git libmail-imapclient-perl libdigest-md5-file-perl libterm-readkey-perl libfile-copy-recursive-perl build-essential make automake libunicode-string-perl libauthen-ntlm-perl libcrypt-ssleay-perl libdigest-hmac-perl libfile-copy-recursive-perl libio-compress-perl libio-socket-inet6-perl libio-socket-ssl-perl libio-tee-perl libmodule-scandeps-perl libnet-ssleay-perl libpar-packer-perl libreadonly-perl libterm-readkey-perl libtest-pod-perl libtest-simple-perl libunicode-string-perl liburi-perl cpanminus

#Install modules from CPAN

sudo cpanm JSON::WebToken Test::MockObject Unicode::String Data::Uniqid

#Get the imapsync from  git repository

git clone git://github.com/imapsync/imapsync.git

 

#Build and install

cd imapsync
mkdir dist
sudo make install

Transfer emails wih ImapSync

You have to ensure that both imap servers are up and running.

After that you can ensure the following command syntax

imapsync --host1 hostname1 --port1 port# --user1 #1 --domain1 fully.qualified.domain #1 --ssl1 --host2 hostname2 --port2 port# --user2 userid#2 --domain2 fully.qualified.domain #2 --ssl2

 

e.g.;

For syncing mails from imap.imapserver.net to localhost,

imapsync --host1 imap.imapserver.net --user1 username1@supportmonk.com --password1 4HrJazz1! --host2 localhost --user2 username1@supportmonk.com --password2 4DrJazz1!

 

If you don’t want to give passwords directly in terminal which will be shown in the ps command,
it’s better to create two files (/etc/secret1 and /etc/secret2 in this example) that contain the passwords , do a chmod 600 on these files, and use the –passfile1 and –passfile2 switches.

echo “4HrJazz1!” > /etc/secret1
echo “4HrJazz1!” > /etc/secret2
chmod 600 /etc/secret1
chmod 600 /etc/secret2

Now we can do the migration with this simple command:

imapsync --host1 imap.imapserver.net --user1 username1@supportmonk.com --passfile1 /etc/secret2 --host2 localhost --user2 username1@supportmonk.com --passfile2 /etc/secret2

 

How to Disable Network Manager

February 20, 2018 , 5:31 pm


The Network Manager service automates the network’s settings and disrupts connections to the IP addresses that reside in the ipaliases module.

 

Disable the Network Manager service

To disable the Network Manager service, perform the following steps:

1.) Disable Network Manager with the following commands:

Disable NetworkManager on CentOS 6, CloudLinux 6, Red Hat Enterprise Linux 6 (RHEL),

    service NetworkManager stop
    chkconfig NetworkManager off
Disable NetworkManager on CentOS 7, CloudLinux 7,
systemctl stop NetworkManager.service
systemctl disable NetworkManager.service
2.) Change to the /etc/sysconfig/network-scripts directory.
     Open each configuration file with your preferred text editor and set the following keys’ values:

    NM_CONTROLLED=no

    ONBOOT=yes
3.) Run the following commands to restart the network:
      Restart the network on CentOS 6, CloudLinux 6, RHEL 6
  chkconfig network on
  service network start
Restart the network on CentOS 7, CloudLinux 7, or RHEL 7
  systemctl enable network.service
  systemctl start network.service

ToubleShoot High Disk I/O

February 20, 2018 , 5:13 pm


Disk I/O describes how long the read and write operations require on a hard disk. The speed at which your server can read and write information to disk directly affects your server’s performance and the performance of cPanel & WHM.  Your server’s load will increase if the system experiences high disk I/O wait time.

 

Symptoms of high disk I/O

Problem
Description
High server load The average system load exceeds 1.
chkservd notifications You receive notifications about an offline service or that the system cannot restart a service.
Slow hosted websites Hosted websites may require more than a minute to load.
Slow delivery of email The Exim service performs slowly or does not respond. Exim contains a large outbound mail queue.
Slow connection for email The POP or IMAP services perform slowly or do not respond.
Slow Webmail interfaces The Webmail interfaces perform slowly or do not respond (for example, Roundcube, Horde, or SquirrelMail).
Slow WHM or cPanel interfaces The WHM or cPanel interfaces perform slowly when you add email accounts, databases, or other items.

How to determine the disk I/O wait on your server

Use the top command to find the average wait time on your server

The %wa statistic at the top of the output indicates your server’s average disk wait.

If the I/O wait percentage is greater than one divided by the number of your CPU cores, the CPU cores must wait to process data on hard disk. For example, if the system possesses four CPU cores and the server %wa statistic is 8.0, then the actual %wa is 2.0. Because the actual %wa is larger than 1.0, the CPU cores must wait before they can process data on hard disk.

Use the sar command to determine the history of your server’s disk I/O wait

The sar command provides you with the history of the server’s load averages. Use this command to determine the times when your server experiences high disk I/O.

How to resolve a problem with high disk I/O

Problem
Recommendation
Hard disk specifications with low RPM speed or slow interface technology Upgrade the hard disk on your server or split the application load between separate hard disks.
No bandwidth available on the hard disk Upgrade the hard disk on your server or split the application load between separate hard disks.
Write caching is disabled Enable write caching on the disk.
Degraded RAID array Check the Raid array for a hardware malfunction. You should test and verify the hardware.
Software RAID array on the server reports busy; CPU uses slow parity calculation Check the Raid array for a hardware malfunction. You should test and verify the hardware.
Software processes slowly Upgrade the hard disk on your server or split the application load between separate hard disks.

Changing container ID in Openvz servers

June 9, 2017 , 11:51 am


I was migrating one container from machine to another and accidentally i found that there are two similar container ID on the two machines e.g. 101 on both machines. Migration does not allow migrating a container if the same ID on the other machine exists.

I followed the steps below to change CTID from 101 to 102:


root@host# vzctl chkpnt 101 –dumpfile /tmp/Dump.101
root@host# mv /etc/vz/conf/101.conf /etc/vz/conf/102.conf
root@host# mv /vz/private/101 /vz/private/102
root@host# mv /vz/root/101 /vz/root/102
root@host# vzctl restore 102 –dumpfile /tmp/Dump.101

 

That’s all, now I’ve changed the container ID of VM from 101 to 102.

Paper Lantern showing set but showing x3 style in cPanel

June 9, 2017 , 11:50 am


As you know cPanel has stopped x3 theme and made paper lantern the default style, they have introduced “Retro Style” for Paper Lantern.  The Retro style makes Paper Lantern look like X3 so that if you prefer the old and trusted appearance of X3, you can feel at home even when using Paper Lantern.  It’s not a perfect implementation of X3, but with the silver chrome borders, blue-teal gradients, electro-blue world map page headers, and bubbly application icons, Paper Lantern can have the same familiarity that so many of our customers crave. Some might get confused as why cpanel shows X3 look even with Paper lantern enabled.

You can  switch to Default Style of Paper lantern for those accounts which have Retro Style enabled by following method :

#cd /home/$user/var/cpanel/styled    (replace $user with cPanel username)
In the Styled directory if you list the files you will see a link as blow:

# ls -l 

lrwxrwxrwx 1 $user $user 58 Apr 27  2016 current_style -> /usr/local/cpanel/base/frontend/paper_lantern/styled/retro/

Just unlink current_style and it rolls back to default style of paper lantern.

# unlink current_style
Now re-login to your cPanel account and you will see the default sPaper lantern Style.

ezchimp: WHMCS – Mailchimp integration

February 10, 2017 , 4:30 pm


ezchimp is a WHMCS addon module which integrates with Mailchimp for newsletters and mailing lists for your clients in WHMCS. Clients can subscribe/unsubscribe to your newsletters or mailing lists and interest groups in Mailchimp during signup or via their client area. Auto updates Mailchimp subscription when clients change their email address or add contact / sub-account. Auto-subscribe customers purchasing products in specific product groups to corresponding mailing list and interest group. Supports subscribe/unsubscribe, multiple mailing lists and interest groups, multi-language.

Download ezchimp for only $30 including 1 year free support and updates! And it is open source, licensed under GPLv3.

NOTE: For WHMCS versions less than 7, use version 1.

When clients sign up, they will get the options like this:

Mailing list registration options

Mailing list registration options

Clients will also get the mailing list and interest group options in their client area:

Client area mailing list options

Client area mailing list options

Follow on twitter for updates: ezchimp

Get it here for only $30 including 1 year free support and updates!

Steps to setup:

  1. Download and extract the ezchimp.tar.gz file into your modules/addons/ folder within your WHMCS directory.
  2. Move the ezchimp_webhook.php file to your WHMCS root directory (eg: /home/username/public_html/whmcs). Test and make sure http://yourdomain.com/whmcs/ezchimp_webhook.php is giving a blank page instead of any errors such as internal server error (500). If it does, check and fix the ownership (should be owned by the domain’s username on a cpanel server for example), permission (try 555) etc so that it works.
  3. Go to WHMCS admin -> Setup -> Addon Modules and “activate” the module listed as “MailChimp newsletter”
  4. Set the WHMCS base URL (eg: http://yourdomain.com/whmcs, since version 1.6 only, not displayed in screenshot below).
  5. After successful activation enter you MailChimp API key and set access control below in the same page:
    ezchimp addon configuration

    ezchimp addon configuration

  6. Go to “Addons” -> “MailChimp newsletter” and configure the settings as necessary:
    ezchimp settings

    ezchimp settings

  7. Click on “Lists & Groups” in right menu to display all mailing lists and interest groups in your Mailchimp account:
    ezchimp lists config

    ezchimp lists config

  8. Enable those you need to make available for your clients in WHMCS. Give an alias as you wish. If you do not specify an alias, the name of the interest group (or the name of the list if there are no interest groups in it) will be used.
  9. The “Status” link in side menu will display the subscription status of your clients and their sub-contacts to mailing lists and interest groups:
    echimp subscription status

    echimp subscription status

  10. Use the “Tools” link to initially subscribe existing clients after a fresh activation of ezchimp module:
    ezchimp tools

    ezchimp tools

    All text can be modified by editing the file english.php in the ezchimp/lang/ folder. You may also add support for other languages by creating a new file for the language in ezchimp/lang/ folder.

How to upgrade Mysql 5.1 to 5.4 and phpmyadmin on Zpanel?

August 9, 2016 , 6:27 pm


Here is the steps to upgrade Mysql.

   1. Login to your server as root
2. cd /etc/yum.repos.d
3. wget http://rpms.famillecollet.com/enterprise/remi.repo
4. yum –enablerepo=remi update mysql-server
5. mysql_update -u root -p
6. cd /etc/zpanel/panel/etc/apps
7. Rename the existing phpmyadmin folder and create a new folder.
mv phpmyadmin phpmyadmin_old
mkdir phpmyadmin
8. Download the phpmyadmin to your desktop
9. Login to WinSCP and access /etc/zpanel/panel/etc/apps/phpmyadmin then upload all files
10. Copy the config.inc file from phpmyadmin_old to phpmyadmin folder and delete the old folder.

Critical glibc buffer overflow vulnerability in getaddrinfo() on Linux

February 17, 2016 , 3:58 pm


It’s time for a new DNS-based remote code execution vulnerability after “Ghost” vulnerability (CVE-2015-0235).  This was discovered by the Google Security Team and Red Hat.

We can divide this “Critical glibc buffer overflow vulnerability” into two.

 

1. CVE-2015-7547                           2. CVE-2015-5229

 

It’s noticed that all the versions of glibc since 2.9 are affected by this attack. You can get rid of this vulnerability by updating glibc version.

Vulnerability in detail

 

A stack-based buffer overflow was found in libresolv in the code which performs dual A/AAAA DNS queries. A remote attacker could create specially crafted DNS responses which could cause libresolv to crash or potentially execute code with the permissions of the user running the library. The buffer overflow occurs in the function send_dg (for UDP queries) and send_vc (for TCP queries) in libresolv. The issue is only exposed when libresolv is called from the nss_dns NSS service module. CVE-2015-7547)

It was discovered that the calloc implementation in glibc could return memory areas which contain non-zero bytes. This could result in unexpected application behavior such as hangs or crashes. (CVE-2015-5229)

 

Affected Products

 

All versions of the glibc package included with Red Hat Enterprise Linux 6 and 7 were affected by this flaw.

          Red Hat Enterprise Linux 6 & CentOS 6       : RHSA-2016:0175-1

Red Hat Enterprise Linux 7 & CentOS 7       : RHSA-2016:0176-1

Debian Squeeze, Wheezy, Jessy & Stretch    : CVE-2015-7547

Ubuntu 12.04 & 14.04                                       : CVE-2015-7547

 

How this Vulnerability occur / Possible way of Attack?

 

DNS requests are the root cause of this problem. ie, If the DNS server responds with a maliciously crafted response, each of this DNS request could trigger the exploit.

               >>> SSH logins           :   On each SSH login,  reverse DNS lookups are performed

>>> Mail servers           : For every incoming connections are checked for reverse DNS, DNS blacklists, SPF records are checked, …

>>> Curl requests on a server  : If an application allows user-input that triggers HTTP(s) fetches, this could trigger the exploit.

How to patch server?

 

If you are using a Red Hat Enterprise Linux, then you can update glibc via yum using the readily available packages.

If the package is available, run the following:

                     $ yum clean all

$ yum update glibc

After the update, you should reboot the system or restart all the public facing services.

ie, In case you are unable to restart the entire system after applying the update, execute the following command to list all running processes still using the old [in-memory] version of glibc on your system.

                  lsof +c0 -d DEL | awk ‘NR==1 || /libc-/ {print $2,$1,$4,$NF}’ | column -t

From the resulting list, identify the public-facing services and restart them.

For Red Hat Enterprise Linux 7 and CentOS 7 —  You can patch the server by reloading systemd after glibc update.

              $ systemctl daemon-reexec

Open SSH client bug CVE-2016-0777 – Security Update Issued

January 15, 2016 , 5:25 pm


A critical flaw has been identified in the OpenSSH CLIENT that could lead to serious security implications.

How to fix?
Add the option ‘UseRoaming no’ to your /etc/ssh/ssh_config file or start your ssh client with -oUseRoaming=no included on the ssh command line.

                           ie, echo ‘UseRoaming no’ >> /etc/ssh/ssh_config
or
sudo sh -c ‘echo UseRoaming \”no\” >> /etc/ssh/ssh_config’

It’s being reported that it effects only on Centos 7 servers and they can update OpenSSH using yum.

           #yum update openssh

Flash megaraid firmware

November 18, 2015 , 10:47 pm


In this article, I would like to discuss how to  flash megaraid firmware in this article. Here we need to upgrade megaraid-sas-9271-4i.

You can download the firmware from their website at

http://www.avagotech.com/products/server-storage/raid-controllers/megaraid-sas-9271-4i

http://www.avagotech.com/products/server-storage/raid-controllers/megaraid-sas-9271-4i#downloads

Download the exact firmware depends on your product version and unzip it. You can find the .rom files and readme files for that version.

[root@server ~]# wget http://docs.avagotech.com/docs-and-downloads/raid-controllers/raid-controllers-common-files/23-34-0-0005_SAS_2208_FW_IMAGE_APP_3-460-05-4565.zip

[root@server ~]# unzip 23-34-0-0005_SAS_2208_FW_IMAGE_APP_3-460-05-4565.zip

 

Using the followig command, you can flash firmware on your machine.

[root@server ~]# MegaCli -adpfwflash -f mr2208fw.rom -a0

To verify the firware version, you can run the command given below.
[root@server ~]# MegaCli64 -AdpAllinfo -aAll
Envelope Icon

Get Updates Your Email!

Subscribe to Supportmonk and receive blog posts to your email!

Subscribe Via Email

SupportMonk on Facebook


Outsourced Customer Support