Issues with Amazon Elastic Load Balance or ELB and fixes

I was using Amazon cloud services for past some time. Amazon is one of the amazing service provider and mean time many restrictions and limitations when you are looking for flexible cloud infra and services. On my experience on Amazon EC2, and ELBs; I have noticed some issues which may be very difficult to identify.

AWS ELB

ELBs behave very strange some time when servers go offline. As Expected Health checks in ELBs, will manage EC2 downtime as explained. But I have noticed, once all servers in ELB goes down for maintenance or for any rezone it will be marked as Out of service in ELB page.

Yes, this looks normal. The issue comes when these servers come up; at this moment ELB behaves very strange. ELB will show servers are in service after health checks, and even you can see health checks are hitting all servers. But if you try to access ELB URL it will respond like unavailable or it will say service is down.

So surprised rite! Yes this what issue I have noticed. The solution for this was remove the server from ELB and add it back. When I checked with some AWS experts, they said it will come up and will be live but if it’s not coming up remove servers and add it back.

So the conclusion is keep sharp eye on it using monitoring tools. Hop this will be helpful for some one who will be facing similar king of issues with ELBs. Thank you, will come with new topic soon.

Posted in AWS, Cloud, Internet | Leave a comment

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.

Posted in Computer, Linux, Other | Tagged , , , , , , , , , , , | 4 Comments