How to Use Wrapper to Get Root Privilege for Scripts in Plesk Module

When you try to build a Plesk module you will come across number of doubts in that some of them are

How to Run a Shell Script or Binary as Root in Plesk Module?
How to use plesk wrapper to get root privilege for scripts?
How to use plesk wrapper from sbin?
What to do with “failed to open stream: Permission denied” in plesk module?

Plesk-modules
Its very difficult to get help on plesk module development. The tutorial provided by Parallels is really insufficient and incomplete. When I was trying to build a plesk module package, I faced many problems and googling never gave any solution too. After doing so much research I was able to develop a plesk module for my Client. I hope this post will be helpful for many who are trying to build plesk module and wanted root privilege to run a script in it.

Following is one of the methods which I used successfully in plesk 10.4. I hope it will work for all plesk versions.

Imagine you want to build a plesk module and that should have functionality to set ownership of  configuration file to root:root or any other ownership. Also need to write in to /etc/passwd or any file which can be edited only with root permission. This functionality is not possible with simple php script like chown, or system functions. It is because, plesk modules runs under psaadm user privilege so it can’t change files which is under root privilege. But there is one solution for this which is provided in plesk i.e. plesk module wrappers. This can be used to get root privilege for some scripts. To achieve this, you can follow below procedure or steps.

Imagine you have a shell script [setperm.sh] which is used to set permission for all files related to your module. To execute this script with root privilege use following steps.

1) Place setperm.sh under “/usr/local/psa/admin/sbin”  [don’t forget this path is very important]
2) Create a symbolic link in “/usr/local/psa/admin/bin/modules/<ur-module-foldername>”. By executing
“ln -s /usr/local/psa/admin/sbin/wrapper /usr/local/psa/admin/bin/modules/<ur-module-foldername>/ setperm.sh”
3) You are done with wrapper; now you can use this script in any php file inside your module script and it will execute as root.
4) For example you can call this script like this
<?php
system(/usr/local/psa/admin/bin/modules/<ur-module-foldername>/ setperm.sh, $varout);
?>
5) You can create this symbolic link while building RPM itself.

So this is all about plesk wrapper usage to get root privilege for scripts under plesk module.

How to Uninstall Windows KDE from Windows XP or Vista

These are the simple steps to uninstall KDE from windows XP
Many are installing KDE in windows but they are unaware; how to un-install windows KDE application, so here is the simple step to uninstall KDE from windows XP.
[ad#add-top-in]

  • In TaskMgr processes, shut down kded4, dbus-daemon, klauncher, etc.
  • Run kdewin-installer, click each installed package until it shows a garbage can, and then complete the installer
  • Remove lib directory from %PATH% and the KDEDIRS environment variable which is created at the time of installation. In [ Start > Control Panel > System > Advanced > Environment Variables], click on KDEDIRS in User variable and delete Variable name KDEDIRS with Variable value; the directory where you installed KDE4, e.g. C:\KDE4.
  • Clean up your Download Path of all the downloaded packages, and delete your install directory too

Done now KDE is uninstalled from your system.

How to Install Windows KDE

There Is Nothing Which Can Stop Spam Mails Coming or Going Out Of Your Mil Address!!!

Email spam [Junk mail or Unwanted email] really annoys all. There’s something hideous about craftily and repeatedly forcing worthless products onto millions of people who really couldn’t care less about viagra logo enhancements or anything else on offer. Spam is a big problem for everyone from the individual home Internet user to the multi-national corporation that depends on email communications to conduct business.

There are different kinds of spamming around this electronic web world.
– Repeatedly forcing useless products onto millions.
– Hidden text and links
– Blog and Wiki spamming
– Email Bombing
– Porno spam [Mailing of “adult” advertisements or pornographic pictures]
– Virus spam [Mass mailing that contain viruses, Trojans, malicious scripts, etc.]
– Spam scams [Mass mailing of fraudulent messages]
Etc…..

There are more and more spam categories do you ever think about
– What the reason behind it?
– Why this spam’s are not blocked all the time?
– How this spamming happening?
– What action you can take against spamming?
– Can’t we stop this spamming?

Yes it’s true there are many questing regarding this but truly the problem is; “the worst mailing protocol itself”. The founder of mail protocol never thought of this kind of un-presidential use of this discovery. Yes that’s true! Now no one can change this protocol because this protocol is spread like spider web all over the world. One craziest thing in mailing is; any one can send mail to any one with others mail address also if that mail address exists or not! That meant I can send mail from your mail id with out using your mail account, is this craziest!!!

There are many tools and companies in the world to stop and prohibit this spamming but all are failed in it. Till now there is no product or agency which can stop spam mails coming or going out of your mail address. So this is all about mail security. We can only hop a good system will come to stop this nonsense in future.
[ad#add-top-in]
But still there are some tips to Identify this spam mails your self but its little technical I hop all can understand this. By seeing mail you cant identify how is sending mail and from ware it came from. The only way to check that is by looking in to header of the mail. All mail clients have the option to see the header of the mail the header of mail will looks like this it may differ in appearance depends up on providers

Return-Path: [spamers@address.com]
Received: from server.anydomai.com (mail.anymaildomain.com [126.43.75.123])
by spam01.d2.dfd.com (8.10.2/8.10.2) with ESMTP id NAA23597;
Fri, 12 Dec 2008 16:11:20 -0400 (EDT)
Received: from aol.com (127-34-56-98.dsl.mybigisp.com [127.34.56.98])
by server.mymailhost.com; Fri, 12 Jul 2002 13:09:38 -0700 (PDT)
Date: Fri, 12 Jul 2002 13:09:38 -0700 (PDT)
From: Hot Summer Deals <faike@aol.com>
To: your@mailaddress.com
Subject: You won the price of 10$Bln!!

In this you need to check the initial 6 lines which give exact picture of reply address and mail from server. This should mach the last 3 lines. Some time it also dot work; so this is not the 100% best solution for spam mail identification. I hop you can understand the complexity in mail identification.

NOTE:- Better solution is stop opening mails from unknown person. Never click any link in mails and also never download attached file which you are not sure about.

How to Migrate a Live Virtual Machine Without Interrupting Services!


Industry interest in live migration has grown as virtualization technology has become more widely adopted. Live Migration of VMs across physical servers is a vital component of data center management that enables IT managers to move VMs as necessary in order to perform tasks such as upgrading or conducting maintenance of a server, balancing the server load and proactively managing the server availability to avoid downtime or lost data. The demonstration illustrates AMD’s approach to an open and collaborative relationship with its partners to meet customer demands.

Red Hat and AMD were able to achieve this feat through the combination of Red Hat’s innovative, high-performing virtualization technology and the consistent and reliable architecture of the AMD Opteron processor.
[ad#add-top-in]
Live migration enables the movement of running virtual machines from one physical server to another without disrupting service to the end user, something that, till now, has only been demonstrated across systems based on one vendor’s platforms. Live migration demonstration moves a live VM from a dual socket Intel Xeon DP Quad Core E5420-based system to a system based on the forthcoming 45nm Quad-Core AMD Opteron processor, utilizing Red Hat’s high-performance open source virtualization software.

See the demonstration
httpv://www.youtube.com/watch?v=EuhU6jJjpAQ

Ubuntu 7.04 Support Period is now Nearing its End of life by Oct 19-2008

Since its launch in October 2004 Ubuntu has become one of the most highly regarded Linux distributions with millions of users in homes, schools, businesses and governments around the world. Ubuntu is Open Source software, costs nothing to download.

Ubuntu says the release of 7.04 almost 18 months old, that is on April 19, 2007. As with the earlier releases, Ubuntu committed to ongoing security and critical fixes for a period of 18 months. The support period is now nearing its end and Ubuntu 7.04 will reach end of life on Sunday, October 19th, 2008. At that time, Ubuntu Security Notices will no longer include information or updated packages for Ubuntu 7.04.

The supported upgrade path from Ubuntu 7.04 is via Ubuntu 7.10. Instructions and caveats for the upgrade may be found here…

[ad#add-top-in]
Note that upgrades to version 8.04 LTS and beyond are only supported in multiple steps, via an upgrade first to 7.10, then to 8.04 LTS. Both Ubuntu 7.10 and Ubuntu 8.04 LTS continue to be actively supported with security updates and select high-impact bug fixes.

Easy Steps to set up NFS in your Computer or Server Network

Network File System [NFS] is a very effective way of sharing files and data across your Unix/Linux network. NFS offers a neat functionality that fits perfectly into the Unix/Linux filesystem. Simply mount a directory off another machine on your network and read from or write to it; even run applications from it, that’s completely transparent!

Following are the steps to achieve NFS facility in your network.

You need to set up two kinds of services of NFS that is NFS Server at file sharing server and NFS Clint at Clint or user side servers.
[ad#add-top-in]
Setting Up an NFS Server:

-Install NFS-Server application in servers which ever you want to share. Using following commands.

apt-get install nfs-kernel-server
or
yum install nfslock portmap nfs

-Place an entry in /etc/exports

/usr/local   192.168.0.1(ro) 192.168.0.2(ro)
/home      192.168.0.0/255.255.255.0(rw)

Here we are sharing ‘/usr/local’ with read-only and ‘/home’ with write permission. We can also specify network mask for allowing a group of network computers  or each IP as shown above to allow specified IP to access this folders.

-If you come back and change your /etc/exports file, the changes you make may not take effect immediately. You should run the command ‘exportfs –ra’ to force
nfsd to re-read the /etc/exports file.

-You may need to set /etc/hosts.allow and /etc/hosts.deny
These two files specify which computers on the network can use services on your machine. Each line of the file contains a single entry listing a service and a set of machines. When the server gets a request from a machine, Its not compulsory if your are not using it.

-The NFS server is configured and we can start it running.

/etc/init.d/nfs-kernel-server stop
/etc/init.d/nfs-kernel-server start

Now we have setup NFS Server to share or get the shared NFS files. We need to set up following steps in Clint servers or PC

Setting up an NFS Client:

-Install NFS-Clint application in servers. Using following commands for this.

apt-get install nfs-common
or
yum install nfslock portmap nfs

-Mount the remote directory from your server just the way you mount a local hard drive, with the mount command.

mount 192.168.0.10:/home /mnt/home

Make sure you have created ‘/mnt/home’ directory before mounting it.

-To un-mount you need to run following command

umount /mnt/home

-NFS file systems can be added to your /etc/fstab file, same way as local file systems, so that nfs mounts when your system starts up. For this you need to enter following entry in fstab.

192.168.0.10:/home  /mnt/home    nfs          rw            0    0

These are the simple steps to set up NFS mount; there are lots of options and steps and configurations to set NFS in little more effective manner, also can set fstab and export file configurations for more flexible NFS functionality.

Linux File Sharing in Windows as normal File Sharing

Yes that’s true you can share files of Linux and windows machines like normal windows file sharing.
By Running SAMBA on a Linux machine you can achieve this.
Following are the simple steps to set this.

Install Samba using ‘apt-get’ or ‘yum’, like running following command in Linux box or servers.

apt-get install samba
or
yum install samba

So installation is done. Okay now you need to set up a folder to sharing, user name and password by editing ‘/etc/samba/smb.conf‘ file.
[ad#add-top-in]

  • Setting network

interfaces = 192.168.0.1/24 127.0.0.1/24
bind interfaces only = Yes

By setting this SAMBA will run only on the internal interface.

  • Setting Password

File access permissions for the shares to work, you have to set up the SAMBA username/password by running smbpasswd on the linux box.

smbpasswd <your linux username>

You should use username/password created above in Windows machine to file sharing.

  • Setting up shared folders

[myfile]
comment = My shared files and folders
path = /home/jithonline
read only = no

Then, on the windows machine access it as \\10.0.3.10\ where 10.0.3.10 is the IP address of the linux machine use the password you set using smbpasswd to login.

If you want to share CD/DVD drive

[dvd]
comment = dvd drive on Linux Box
writable = No
locking = No
path = /mnt/cdrom2

Now restart the samba using

/etc/init.d/samba stop
/etc/init.d/samba start

That’s it, all about Linux file sharing in Windows with SAMBA.

Install OpenOffice 2.4 on Windows Vista

OpenOffice provides everything most people need in an office productivity suite for free. It is stable, reliable, and robust. Unlike its major competitor, it was designed from the start as a single piece of software, which makes for higher quality software and a more consistent user experience. OpenOffice is available on all major computing platforms and is supported in over seventy languages.

The main components of the OpenOffice.org Suite are

– Writer  wordprocessor
– Calc  spreadsheet
– Impress  for presentations
– Draw for graphics
– Base  database
[ad#add-top-in]
It has a familiar user interface, and is able to read and write the vast majority of legacy file formats (including common Microsoft Office formats). It is supported in over seventy languages, with active support both Communities based (free) and from commercial organizations (paid-for).

Installation:-

Download the OpenOffice 2.4 here…

Run the installer file; the installer extracts the files in an OpenOffice.org 2.x (en-US) Installation Files folder on your desktop, then the installer is launched automatically once the extract is complete. Then the real thing begins and it does install indeed in “\Program files\OpenOffice.org2.x” directory. Note that, it doesn’t create any desktop shortcut to launch the applications. They are in your Start menu once installed. And once it’s ok, just delete the folder on your desktop.

So now done with installation!! Enjoy the power of OpenOffice, Compare to Microsoft Office, Open office is bit faster and also it supports all Microsoft office related stuffs and especially for frees of cost, that’s interesting isn’t it?

How to Monitor Websites and Web Services Live for Free from PC

NagiosYes you can Monitor Websites and Web Services Live for Free from PC Using Nagios. Nagios is a host and service monitoring tool  designed to inform network problems. When problems are encountered, the Nagios daemon can send notifications out to you in a variety of different ways (email, instant message,  etc.). Current status information, historical logs, and reports can all be accessed via a web browser too.

Features of Nagios include Monitoring of network services like SMTP, POP3, HTTP, IMAP, PING, FTP, etc. This features also can be used to monitor your websites which are hosted in third party hosting servers, that’s especially from home/office PC itself!!

Setting up Nagios for your domains:

1) Installation process

You can use following commands to install components needed.

  • Installing Apache/httpd and Nagios under Fedroa Core/Cent OS Linux

# yum install httpd
# chkconfig httpd on
# /etc/init.d/httpd start
# yum install nagios nagios-plugins nagios-plugins-all

  • Debian, Ubuntu Linux httpd/Apache and Nagios installation

# apt-get install apache2
# /etc/init.d/apache2 start
# apt-get install nagios-text nagios-plugins nagios-images
or
# apt-get install nagios2 nagios-plugins nagios-images

  • If you don’t have yum/apt. Install stable apache/nagios by downloading from following sites

Apache:- http://httpd.apache.org/
Nagios:- http://www.nagios.org/download/#stable

Now we done with Installation next….
[ad#add-top-in]
2) Configuring Nagios:

  • Add a custom directory for your *.cfg files

# mkdir /etc/nagios2/mysite

  • Edit /etc/nagios2/nagios.cfg and edit the following path

Default path cfg_dir=/etc/nagios2/conf.d to
cfg_dir=/etc/nagios2/mysite

  • Create your own configuration files inside the defined directory that is In /etc/nagios2/mysite; add the following files.

contacts.cfg: Defines the people who will receive the alerts in case of a problem.
Here you need to change e-mail ID and Pager ID.

define contact{
contact_name                    Admin
alias                           Administrator Name
service_notification_period     24×7
host_notification_period        24×7
service_notification_options    w,u,c,r
host_notification_options       d,u,r
service_notification_commands   notify-by-email,notify-by-pager
host_notification_commands      host-notify-by-email,host-notify-by-epager
email                           admin@yourdomain.com
pager                           11111111@pager.yourdomain.com
}

define contactgroup{
contactgroup_name       admins
alias                   Nagios Administrators
members                 Admin # contact_name should be added here
}

host.cfg: Defines the url’s that will be monitored.

##You can add as many as url’s need like bellow
define host{
host_name  jithesh.com
alias      Jithesh
address    www.jithesh.com
use        generic-host
}

define host{
host_name  blog.jithonline.com
alias      JithOnline
address    blog.jithonline.com
use        generic-host
}

#### Hostgroup_name ###
define hostgroup {
hostgroup_name  all
alias           All Servers
members         *
}

# A list of your servers
define hostgroup {
hostgroup_name    servers
alias           Servers
members         jithesh.com, blog.jithonline.com  #Add all host_name here
}

services.cfg: Defines the services that will be monitored for each URL.

## Hostgroups services ##
define service {
hostgroup_name                 servers
service_description             HTTP
check_command                 check_http
use                             generic-service
notification_interval           0
}

define service {
hostgroup_name                 servers
service_description             PING
check_command                 check_ping!100.0,20%!500.0,60%
use                             generic-service
notification_interval           0
}

define service {
hostgroup_name                 servers
service_description             FTP
check_command                 check_ftp
use                             generic-service
notification_interval           0
}

define service {
hostgroup_name                 servers
service_description             POP
check_command                 check_pop
use                             generic-service
notification_interval           0
}

define service {
hostgroup_name                 servers
service_description             IMAP
check_command                 check_imap
use                             generic-service
notification_interval           0
}

define service {
hostgroup_name                 servers
service_description             SMTP
check_command                 check_smtp
use                             generic-service
notification_interval           0
}

templates.cfg: Defines some templates like the generic url, generic service and a lot of others custom templates.

In the default installation you will find files named generic-host_nagios2.cfg, generic-service_nagios2.cfg and there might be others. Just with copy and paste them into /etc/nagios2/mysite directory it will work OK. Anyway, I prefer to put the definitions on each of them into a single file called templates.cfg, but that’s a personal preference.

timeperiods.cfg: Defines time periods which are valid for checks, notifications, etc.

The default configuration file is OK, so just copy and paste it from /etc/nagios2/conf.d/timeperiods_nagios2.cfg to /etc/nagios2/mysite/timeperiods.cfg.

So we have done with all configuration stuffs.

3)  Restart the Nagios service:

# /etc/init.d/nagios2 restart
If there is any configuration error Nagios will tell you where it is when you attempt to restart the service.

4) Monitor your URLs

By opening Nagios in browser
http://<nagios_server_host>/nagios2
user name:-nagiosadmin
passwd:-<set passwd> Most of the case root passwd itself

If you still having problems, don’t hesitate to post comment.