Kayako Login Share for H-Sphere

Here is how you can setup Kayako Login Share to work with your H-Sphere user accounts.

First log in to your H-Sphere database and run the following SQL - this is just to be more secure as you really don't want the loginshare php script accessing your hsphere DB with a high privilege user account. So we create a view that only feeds back username and md5hash of password - and setup a new user to access this view.

CREATE VIEW public.kayakologinshare (username, pass, email, name, lastname )
AS
select distinct users.username,
md5(users.password) as pass,
email,
name,
last_name as lastname
from contact_info,
accounts,
user_account,
users
where contact_info.id = accounts.ci_id
and accounts.id = user_account.account_id
and user_account.user_id = users.id
and users.reseller_id = 1;

CREATE USER "kayakologinshare" PASSWORD 'STRONGPASSWORDHERE';

GRANT SELECT ON "public"."kayakologinshare" TO "kayakologinshare";

If you have the full version with source code

I personaly know this way works as I have implemented it - Next you need to edit your /includes/LoginShare/loginshare.config.php and add the following lines...

define("LOGINAPI_HS",108);
$_LOGINAPI[LOGINAPI_HS] = array("title" => "H-Sphere login", "include" =>"hs.login.php");

NOTE : where 108 is in the first line above, this needs to be an usused number in the loginshare.config.php file, so make sure 108 is not already used otherwise change it.

Now download the zip file below and place the unzipped hs.login.php file in the /includes/LoginShare/ folder.

If you have the leased version without access to source code

This way will work as well, but I have not personally tried it, although I know others have with success. Unzip the file below and rename the file to hsphere.login.php and upload it to your /includes/LoginShare/ folder overwriting the existing file that is already there.

Finally...

When you have done this you can login to your Kayako admin screen and enter the DB details for kayakologinshare as above and then assign that login share to your template group.

You do also need to make sure that your the CP Postgre Server will accept connections from the server running Kayako
NOTE:Replace 10.11.12.13 with your server IP that is running Kayako

echo 'host all all 10.11.12.13 255.255.255.255 password' >> /var/lib/pgsql/data/pg_hba.conf

You also need to make sure that your firewall will allow access, eg if you are running iptables this should work.
NOTE:Replace 10.11.12.13 with your server IP that is running Kayako

iptables -I INPUT -s 10.11.12.13 -p tcp --dport 5432 -j ACCEPT

Post a comment