How to configure Auth LDAP plugin for Dokuwiki - php

Every time I'm trying to login into dokuwiki with my LDAP credentials I'm getting the error below:
However once when I tried to log in with Internet Explorer rather than with Chrome I logged in successfully, but that never happened again.
Would someone please help me with configuring dokuwiki to authenticate users with LDAP credentials using AuthLDAP plugin.
Please see the content of conf/local.php file:
$conf['title'] = 'SomeNameOfDokuWiki';
$conf['license'] = '0';
$conf['useacl'] = 1;
$conf['authtype'] = 'authldap';
$conf['passcrypt'] = 'md5';
$conf['superuser'] = 'xander';
$conf['disableactions'] = 'register';
$conf['proxy']['user'] = 'SomeUserName';
$conf['proxy']['pass'] = 'SomeEncryptedPassword';
$conf['plugin']['authldap']['server'] = 'ldap://some.local.ip.address.129:389';
$conf['plugin']['authldap']['usertree'] = 'ou=Users,dc=example,dc=max,dc=net';
$conf['plugin']['authldap']['grouptree'] = 'ou=Groups,dc=xander,dc=max,dc=net';
$conf['plugin']['authldap']['userfilter'] = '(&(cn=%{user})(objectClass=inetOrgPerson))';
$conf['plugin']['authldap']['groupfilter'] = '(&(objectClass=posixGroup)(|(gidNumber=%{gid})(memberUID=%{user})))';
$conf['plugin']['authldap']['version'] = 3;
$conf['plugin']['authldap']['bindpw'] = 'SomeBindPassword';
$conf['plugin']['authldap']['userkey'] = 'cn';
$conf['plugin']['authldap']['debug'] = 1;
$conf['plugin']['authldap']['modPass'] = 0;
I'm sure that following queries are correct (I checked them through phpldapadmin):
(&(cn=%{user})(objectClass=inetOrgPerson))
(&(objectClass=posixGroup)(|(gidNumber=%{gid})(memberUID=%{user})))
Thanks.

I think perhaps you are missing this.
$conf['plugin']['authldap']['binddn'] = 'CN=ad user with enough rights to see other accounts,CN=Users,DC=yourdomain,DC=com';

Related

Cannot get ldap_modify to work

I'm trying to use LDAP user password change code but I have stuck on a step where ldap_modify throwing LDAP error:
1 - Operations error
First I thought that password encryption method is not correct but even code
$rootdn = "cn=ldap_manager,dc=mycompany,dc=local";
$rootpwd = "mysecretkeys";
$r = ldap_bind($con,$rootdn,$rootpwd);
$entry = array();
$entry["givenName"] = "BabaGanush";
if ($r = ldap_modify($con,$user_dn,$entry) === false){
$error = ldap_error($con);
$errno = ldap_errno($con);
$message[] = "E201 - Please contact the administrator.";
$message[] = "$errno - $error";
} else {
$message[] = "Name was changed";
}
is not working (getting the same Error #1).
I have tried all possible combinations for rootDN but cannot get bind when used ldap_manager
$rootdn = "CN=users,DC=mycompany,DC=local";
$username = 'ldap_mamanger';
$domain = 'mycompany';
$rootdn = $username;
$rootdn = $username.'#'.$domain;
$rootdn = $domain.'\\'.$username;
$rootdn = "uid=$username,cn=users,dc=$domain,dc=local";
$rootdn = "uid=$username,dc=$domain,dc=local";
$rootdn = "uid=$username,dc=local";
$rootdn = "uid=$username,dc=$domain";
when $ldaprdn = $domain.'\\'.$username; works fine for regular AD user (can bind)
dsquery user -name ldap* returns
"CN=ldap_manager,CN=Users,DC=mycompany,DC=local"
"CN=ldap_user,CN=Users,DC=mycompany,DC=local"
Any clue what can be wrong?
As far as I see it, you are trying to modify a complete entry. That means, ldap_modify replaces the current content located under the given DN with the new content. And I'm sure there are some fields that are left empty shich are required when you replace the current entry with one that contains only a givenName.
So either fetch the current entry and replace the value in question within that result or you might want to have a look at ldap_mod_replace.

Web service running time is slow and causing slow running web page

I"m using below third party code to send SMS for customers who are making orders in my web store, it seems this code is loading slowly and it's causing my order confirmation page (which has this code inside) to load slow.
is there any solution that I can use this code but it's slowness don't affect my page ?
Thanks
// Send SMS
/*
ini_set("soap.wsdl_cache_enabled", "0");
$sms_client = new SoapClient('http://87.107.121.54:2620/post/send.asmx', array('encoding'=>'UTF-8'));
$parameters['username'] = "xxxxxxxxxxx";
$parameters['password'] = "xxxx";
$parameters['to'] = "$phone";
$parameters['from'] = "1000947320";
$parameters['text'] ="test";
$parameters['isflash'] =false;
$sms_client->SendSimpleSMS2($parameters)->SendSimpleSMS2Result;
*/
Make the confirmation page add the values into database and create a script which processes the values from the database, meaning:
when user enters the page, your code will do something like this:
INSERT INTO sms SET to='$to', text='$text', sent=0;
and then you make a script which does the following:
ini_set("soap.wsdl_cache_enabled", "0");
$parameters['username'] = "xxxxxxxxxxx";
$parameters['password'] = "xxxx";
$parameters['from'] = "1000947320";
$parameters['isflash'] =false;
$sms_client = new SoapClient('http://87.107.121.54:2620/post/send.asmx', array('encoding'=>'UTF-8'));
$query = mysql_query("SELECT * FROM sms WHERE sent=0");
while( $message = mysql_fetch_assoc($query) ) {
$thisMessage = $parameters;
$thisMessage['to'] = $message['to'];
$thisMessage['text'] = $message['text'];
$sms_client->SendSimpleSMS2($thisMessage)->SendSimpleSMS2Result;
mysql_query('UPDATE sms SET sent=1 WHERE id='.$message['id']);
}
and you run this script in cron, lets say every minute or how often do you want to.

Yii::app()->lang doesn't work sometimes with LimeSurvey

I am working on a custom script to automatically send out invites and reminders. I have everything working fine up until a point. My function to send invites looks like this:
function sendInvites($iSurveyID) {
$oSurvey = Survey::model()->findByPk($iSurveyID);
if (!isset($oSurvey)) {
die("could not load survey");
}
if(!tableExists("{{tokens_$iSurveyID}}")) {
die("survey has no tokens or something");
}
$SQLemailstatuscondition = "emailstatus = 'OK'";
$SQLremindercountcondition = '';
$SQLreminderdelaycondition = '';
$iMaxEmails = (int)Yii::app()->getConfig("maxemails");
$iMaxReminders = 1;
if(!is_null($iMaxReminders)) {
$SQLremindercountcondition = "remindercount < " . $iMaxReminders;
}
$oTokens = Tokens_dynamic::model($iSurveyID);
$aResultTokens = $oTokens->findUninvited(false, $iMaxEmails, true, $SQLemailstatuscondition, $SQLremindercountcondition, $SQLreminderdelaycondition);
if (empty($aResultTokens)) {
die("No tokens to send invites to");
}
$aResult = emailTokens($iSurveyID, $aResultTokens, 'invite');
}
I also have a simple little file that starts up Yii:
Yii::createApplication('LSYii_Application', APPPATH . 'config/config' . EXT);
Yii::app()->loadHelper('admin/token');
Yii::app()->loadHelper('common');
Everything works as expected up until I actually try to send emails to the tokens. I've tracked the problem down to the following, on of the functions called by emailTokens has this in it:
$clang = Yii::app()->lang;
$aBasicTokenFields=array('firstname'=>array(
'description'=>$clang->gT('First name'),
'mandatory'=>'N',
'showregister'=>'Y'
),
The Yii::app()->lang part seems to be causing issues because then php is unable to call the gT method. However, when LimeSurvey is running "properly" this never happens. I can't even seem to find where "lang" is in the LimeSurvey source.
What can I do to make it work?
Why do you make it so hard on yourself and not use the RemoteControl2 API ?
See http://manual.limesurvey.org/wiki/RemoteControl_2_API#invite_participants
On that page you will also find a PHP example script.
maybe
Yii::import('application.libraries.Limesurvey_lang');
$clang = new Limesurvey_lang($oTokens->language);

Single Sign On : Stuck on progressing image in jsconnect

what i want to achieve is, user login in my wordpress website and also login on vanilla forum, i have installed jsconnect plugin in vanilla forum, and using the php's jsconnect library from following location jsConnectPHP
Here is my code:
require_once('functions.jsconnect.php');
$clientID = "1501569466";
$secret = "xxxxxxxxxxxxxxxxxxxxxx";
$userD = array();
if( isset($_POST['log']) ){
$data = array();
$data['user_login'] = $_POST['u_user'];
$data['user_password'] = $_POST['u_pass'];
$data['remember'] = TRUE;
$user = wp_signon($data, FALSE);
if(!is_wp_error($user)){
$userD['uniqueid'] = $user->ID;
$userD['name'] = $user->user_login;
$userD['email'] = $user->user_email;
$userD['photourl'] = '';
$secure = true;
WriteJsConnect($user, $_GET, $clientID, $secret, $secure);
$redirect = "http://localhost/vanilla/entry/jsconnect?client_id={$clientID}";
echo "<script>document.location.href='".$redirect."';</script>";
}
}
when the user login on wordpress i redirect it to jsconnect url in vanilla where i just found only a progress image, and can't figure out where is the problem..
jsconnect authentication url expects jsonp array like the following:
test({"email":"test#test.com",
"name":"testuser",
"photourl":"",
"uniqueid":1234,
"client_id":"12345678",
"signature":"XXXX"})
You authorization url you specify inside jsconnect should see this output to process further. In fact I am stuck at that point. I could see vanilla forum when loaded gets this input but no login happens.

Wialon remote API login

My code:
<?php
if(isset($_GET['login']) && isset($_GET['login']) && isset($_GET['password'])){
$_login_url = "http://testing.wialon.com/wialon/ajax.html?svc=core/login&params={user:%s,password:%s}";
$login = $_GET['login'];
$password = $_GET['password'];
$handle = fopen(sprintf($_login_url, $login, $password), "r");
$line = fgets($handle);
fclose($handle);
$responce = explode(",",$line);
if(count($responce) < 2) {
echo "Invalid user or password";
} else {
$sessid = explode(":",$responce[1]);
$lastid = str_replace("\"","",$sessid[1]);
echo "http://testing.wialon.com/index.html?sid=".$lastid."";
}
}
?>
when I access this script with the server hosting the script everything works perfectly, The sessions are generated with my IP address.
But when I access it with another computer any user trying to login the script generates session using the servers IP address. can I send the request with the users IP address?
No, you cannot send the request with the users IP address.
However, you might be able to indicate that the request is being performed on behalf of another IP by using the HTTP_X_FORWARDED_FOR request header or similar, but without looking at their documentations (which doesn't seem to be publicly available) I can't be sure of it. You'll need to ask 'em.
This is an old thread but, let me put in my two cents. There are two new wialon athentication methods Token login and by passing the athorization hash . the second method is best suited for maintaining session across servers.
http://sdk.wialon.com/wiki/en/kit/remoteapi/apiref/core/create_auth_hash
http://sdk.wialon.com/wiki/en/kit/remoteapi/apiref/token/token
//get the Token from here http://hosting.wialon.com/login.html?client_id=wialon&access_type=-1&activation_time=0&duration=0&flags=1
// You should have your existing username from wialon with SDK access
$params = "{'token':'$token','operateAs','$username'}";
$baseurl = "http://hst-api.wialon.com/wialon/ajax.html";
$url = "$baseurl?params=".urlencode($params)."&svc=token/login";
$o = json_decode(file_get_contents($url),true);
$sid = $o['eid'];

Categories