Saturday, March 11, 2017

Copy all Incoming Outgoing Emails - Employee monitor

How can we monitor employee's email conversations ?

If we are running company, It's too impotent to monitoring employee's email conversations which is traveled by company domain name. If you are using WHM with Exim mail server, it's too easy.

Let's consider "domain.com" is your company domain, you have 50's of mail IDs. You are having a mail ID "[email protected]" and you need to archive / monitor all your mails incoming and outgoing mails to "[email protected]".

To do this, you must have access to server with ssh (root access) and WHM (root access).

1. "/usr/local/cpanel/etc/exim/sysfilter/options" is path where you can store all custom filters.

#cd /usr/local/cpanel/etc/exim/sysfilter/options

2. Create a empty file for store your filter rules. You can create as much of filter as you want, so create a file with understandable name with domain name, replace domain_com to your company domain name.

#vim incoming_outgoing_domain_com

3. Copy paste bellow code to this file and replace "domain.com" to your company domain name and "[email protected]" to your mail that you created for archive all mails,

For incoming mails only,

if ("$h_to:, $h_cc:, $h_bcc" contains "domain.com")
then
     unseen deliver "[email protected]"
endif

For outgoing mails only,

if $sender_address: contains "domain.com"
then
     unseen deliver "[email protected]"
endif

For incoming and outgoing mails,

if ("$h_to:, $h_cc:, $h_bcc" contains "domain.com")
   or ("$sender_address:" contains "domain.com")
then
   unseen deliver "[email protected]"
endif


Note: Forwarding to other domains, outside server won't work.

Wednesday, March 8, 2017

Device eth0 does not seem to be present, delaying initialization - Virtual Box Error - CentOS 6.6

Hello everyone,

Today I've faced an error on Virtual Box with CentOS 6.6 today, If you are frequently use virtual machines, you'll see these kind of errors. Let's explain my situation.

I've installed and used CentOS 6.6 for python before 2 months, later I've deleted it's account (not files) from Virtual Box because of no frequent use. Today I need to test something on that server. So I've created account and pointed this virtual machine to newly created account.

Once server up, logged to server and tried to ping for check the network. Network not succeeded, when I check IP with ifconfig, I can see only loopback network. "service network restart" says "Device eth0 does not seem to be present, delaying initialization".

Okay, What is solution now ?

Reason for this issue: When we install guest OS with virtual box, It'll assign mac address to it's guest OS's device. But in our case, we have installed guest OS already and it already assigned some mac address. When we create account again and merge guest OS with it, we will get conflict with 2 different mac address. One was created during original installation of guest OS, another one is created during recreate of virtualbox guest OS account.

To fix this,

Login to OS, remove the file as mentioned bellow, which have old mac address.

# rm /etc/udev/rules.d/70-persistent-net.rules

Reboot server, so that new fill will be generated again,

# reboot

Now open the file,
# cat /etc/udev/rules.d/70-persistent-net.rules

It'll look as mentioned bellow,

# This file was automatically generated by the /lib/udev/write_net_rules
# program, run by the persistent-net-generator.rules rules file.
#
# You can modify it, as long as you keep each rule on a single
# line, and change only the value of the NAME= key.

# PCI device 0x8086:0x100e (e1000)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="08:00:17:ef:c5:08", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

Note down the ATTR{address}

open following file

# vim /etc/sysconfig/network-scripts/ifcfg-eth0

Replace mac address which you copied to HWADDR
Remove line with UUID

Now restart the network service,

# service network restart

That's It. Now you can able access network on guest OS.

Thursday, February 23, 2017

Increase WordPress URL Length

Hello Guys,

I'm back here after a long period. Today I would like to share the simple trick for WordPress Blogging. If you need to increase URL length in wordpress sites, do following things.

1. On page "wp-includes/formatting.php" find the following line and change the value that mention as Bold

function sanitize_title_with_dashes

$title = utf8_uri_encode($title, 300);

2. In database, find the table and change the value of table field.
wp_post => post_name => varchar 300

Friday, March 25, 2016

Installing PHP 5.6 on Ubuntu Server 14.04.4 LTS

Hello Beginners,

Hopefully most of the Sys Admin kids won't consider about LTS (Long Term Support) or EOL (End Of Life) on product.

Every product have it's version and its end of life, you can see about EOL of php by following link.

http://php.net/supported-versions.php
http://php.net/eol.php

As same Ubuntu have

https://wiki.ubuntu.com/LTS

Okay now, why we discuss about it,
Ubuntu 14.04.4 LTS is latest product of Ubuntu which have Long Term Support, PHP 5.5 is php version support by Ubuntu 14.04.4 LTS, that means php in it's EOL. So it's good to install Ubuntu 14.04.4 with PHP 5.6

Normal repo of Ubuntu don't have PHP 5.6, so we can do following steps to install PHP.

$sudo add-apt-repository ppa:ondrej/php5-5.6
$sudo apt-get update
$sudo apt-get install php5
$php5 -v

That's it.

Enabling Modules in PHP5 & Apache2 @ Ubuntu 14.04.4 LTS

Usually beginners of LAMP administrator having trouble to installing and enabling modules of PHP and Apache2

In older days we can do this by config page or by linking modules location to PHP or Apache module enable location, but we can do same with following comments easily, Please note this is advisable if you using Ubuntu repository to install packages.

Enabling module for Apache2

$sudo a2enmod module_name

Ex.

$sudo a2enmod rewrite

Enabling module for PHP5

$sudo php5enmod module_name

Ex.
$sudo php5enmod mcrypt


Saturday, September 26, 2015

Postfix mail log with Subject line - Parallel Plesk Panel

We need mail subject in our Logs when we manage several domains with lots of mail IDs for better mail troubleshooting,

For postfix, normally don't have setting for mail log with subject line. But we have do it with simple trick on postfix configuration. Just follow bellow steps, It wont affect any off your mail services, but your log storage will increase some amount.

1. Open your postfix config file with your favoret text editor, mine always vim
vim /etc/postfix/main.cf

2. Find bellow line and un comment it, if commented.
header_checks = regexp:/etc/postfix/header_checks

3. Open file /etc/postfix/header_checks with your editor
vim /etc/postfix/header_checks

4. Add bellow line and save,
/^Subject:/     INFO

5. Restart postfix
service postfix restart

Send mail from your webmail and verify log by following comment. 
tail -f /var/log/maillog | grep Subject

For Plesk,

tail -f /usr/local/psa/var/log/maillog | grep Subject

Note " | grep Subject" used to filter only subject line, you can remove it as per your needs

Monday, September 7, 2015

Import Plesk mails to WHM cPanel mails - vice versa

Before start to the solution, I'll explain my situation,

I've 2 servers with Parallels Plesk - 11.5.30 and WHM - 11.50. Plesk have Postfix mail server and WHM have exim mail server.

My task is to migrate a domain example.com from Plesk installed server to WHM installed server.

Now I've moved files to new server, But how can I move mails from Plesk to WHM. It's really hard thing to do, because both have different mail server.

After lot of reference, I can see that horde will help on this.

Okay, Let's see what is Horde, It is a webmail client, slimier to squirrelmail, roundcube mail etc. It is used to check our mails on server with web interface.

So how it help us to import mails that located in server with Plesk control panel to server with WHM control panel.

Trick

1. How to Enable Horde web-mail on plesk.

Login in to your Plesk control panel, click "Tools & Settings" on left menu, click "Updates and Upgrades" under Panel, new window will open, click Add/Remove Components, on list under "Plesk webmails support" select "Horde web-mail support", if not selected and click remove another one. It'll take few min to install.

2. In WHM control panel, we don't have to do much work because by default there is option to choose our web-mail client.

3. Login in to Horde Web-mail client on plesk server, Right click Inbox, click Export. It'll ask to download file, use default option and click ok.

4. MBOX file will be downloaded.

5. Login to web-mail on WHM server, as same Right click and choose Import. It'll ask for mbox file, choose downloaded file.

6. It'll take few some time based on your mails count and size.

That's it.

Advantages:
It's very quick method to import, no need any configuration changes.

Disadvantages:
It's too hard if we have large amount of mail boxes.

Monday, August 10, 2015

How to overcome from CM Security lock

Hello guys,

It's really crazy thing that my friend faced.

He is having android smartphone with Kit-Kat version. For security, he have installed CM Security, while he play with it, he locked his screen. Forget pattern option also didn't work for him.

He called me and said about his problem, there are some solutions in this case. Most of them ask to do Hard reset. It's good option, if you don't have any important files in phone. Because this option will do factory reset.

Suddenly remembered about a great option on Android OS, Safe-Mode. It will disable all 3rd party applications and login to you phone.

So he just reboot his phone with safemode, removed that application. After that his mobile was work fine. Same trick will work for all 3rd party security applications.

Note these things,

1. This application should installed by you. That means 3rd party.
2. You are unable to overcome from encrypted files, you'll face serious damage on this.
3. This wont work if you locked with Android default security option.

How to do safemode booting on Android,

Just 3 seconds login press power button, you'll "PowerOff menu". Now long touch "PowerOff". It'll ask you to reboot with Safemode.

That's it, enjoy the trick.

Do not hack others phone with this, it's illegal, more than that, you'll loose their trust on you.