x

Capitolele principale

  1. LimeSurvey Cloud vs LimeSurvey CE
  2. LimeSurvey Cloud - Ghid de inițiere rapidă
  3. LimeSurvey CE - Instalare
  4. Cum să proiectați un sondaj bun (Ghid)
  5. Noțiuni de bază
  6. Configurați LimeSurvey
  7. Sondaje - Introducere
  8. Setările sondajului
  9. Vizualizați meniul sondajului
  10. Vedeți structura sondajului
  11. Introducere - Întrebări
  12. Introducere - Grupuri de întrebări
  13. Introducere - Managementul Sondajelor
  14. Opțiunile barei de instrumente pentru sondaj
  15. Sondaj multilingv
  16. Ghid de inițiere rapidă - ExpressionScript
  17. Caracteristici avansate
  18. Întrebări generale frrecvente
  19. Depanare
  20. Soluții alternative
  21. Licență
  22. Jurnal de modificare a versiunii
  23. Pluginuri - Avansat
 Actions

LDAP settings/ro: Difference between revisions

From LimeSurvey Manual

Maren.fritz (talk | contribs)
Created page with "Apoi, trebuie să definiți ce autentificare este necesară pentru a obține acces la director. Dacă accesul „anonim” este permis, NU setați următorii doi parametri, al..."
Maren.fritz (talk | contribs)
Created page with "== Definirea interogărilor în config/ldap.php=="
Line 38: Line 38:
*'''$serverId++'''.
*'''$serverId++'''.


== Defining queries in config/ldap.php==
== Definirea interogărilor în config/ldap.php==


Caution: when an '''ldap attribute name''' is required in one of these parameters, '''only use lower case names''': for instance displayname and NOT displayName.
Caution: when an '''ldap attribute name''' is required in one of these parameters, '''only use lower case names''': for instance displayname and NOT displayName.

Revision as of 09:20, 3 November 2023

  Atenție : Această caracteristică permite administratorilor de sondaj LimeSurvey să importe jetoane prin LDAP. Dacă aveți nevoie de o autentificare LDAP, vă rugăm să consultați AuthLDAP plugin.


General

Trebuie să activați suportul LDAP în config.php și să configurați parametrii LDAP în config/ldap.php pentru a utiliza această funcție.

Template:Alerta

Activarea LDAP în config.php

  • $enableLdap: dacă doriți să utilizați funcțiile LDAP în LimeSurvey, trebuie să setați acest parametru la true (este setat implicit la false):
'config'=>array(
 'debug'=>0,
 'debugsql'=>0,
 'enableLdap'=>true,
 )

Definirea serverelor LDAP

Mai întâi definiți opțiunile de conexiune la serverul LDAP în „application/config/ldap.php”. Pentru fiecare server, sunt disponibile următoarele opțiuni:

  • $serverId: Un număr întreg care identifică acest server LDAP. Este folosit în definițiile de interogare pentru a lega un server la o anumită interogare;
  • $ldap_server [ $serverId] [ 'server']: Adresa IP sau numele DNS al serverului LDAP. Dacă utilizați conexiuni securizate SSL (LDAP-uri sau LDAP+Start-TLS), acest nume trebuie să corespundă certificatului CN al serverului (sau SubjectAlternativeName);
  • $ldap_server [ $serverId] [ 'protoversion']: Poate fi 'ldapv2' sau 'ldapv3', în funcţie de protocolul acceptat de serverul dumneavoastră. „ldapv3” este protocolul preferat. Cu toate acestea, dacă doriți să utilizați conexiuni criptate, rețineți că LDAP-urile sunt acceptate în modul „ldapv2”, în timp ce Start-TLS este metoda de criptare pentru „ldapv3”;
  • $ldap_server [ $serverId] [ 'encrypt']: Definește metoda de criptare utilizată. „ldaps” este acceptat pentru serverele „ldapv2”, „start-tls” pentru serverele „ldapv3”. Cuvântul cheie „none” este folosit pentru comunicațiile LDAP cu text clar;
    • Nu uitați că pentru criptarea „ldaps” sau „start-tls”, serverul web trebuie să poată verifica certificatul serverului LDAP. Astfel, trebuie să vă definiți autoritatea de certificare în biblioteca openldap (de obicei, acest lucru se face în fișierul /etc/openldap/ldap.conf sub Linux).
  • $ldap_server [ $serverId] [ 'referrals']: Este un parametru boolean care definește dacă recomandările trebuie urmate sau nu (utilizați false pentru ActiveDirectory);
  • $ldap_server [ $serverId] [ 'encoding']: Este un parametru opțional care oferă codificarea folosită de directorul LDAP pentru a stoca șiruri. De obicei, nu trebuie să configurați acest parametru deoarece codarea implicită presupusă, „utf-8”, este codarea standard pentru directoarele LDAP. Cu toate acestea, dacă utilizați Active Directory și aveți probleme la importarea șirurilor accentuate, atunci încercați să setați acest parametru la codificarea folosită în zona dvs. (de exemplu, „cp850” pentru Europa de Vest). Puteți consulta lista derulantă „Setul de caractere al fișierului” din GUI Import Token from CSV file pentru a avea lista completă de codificări acceptate.

Apoi, trebuie să definiți ce autentificare este necesară pentru a obține acces la director. Dacă accesul „anonim” este permis, NU setați următorii doi parametri, altfel setați-i corespunzător:

  • $ldap_server [ $serverId] [ 'binddn']: DN-ul utilizatorului 'LDAP' căruia îi este permis să citească directorul;
  • $ldap_server [ $serverId] [ 'bindpw']: Parola pentru utilizatorul LDAP de mai sus.

Dacă trebuie să definiți alte servere LDAP, adăugați următoarea linie pentru a incrementa serverID și a defini noi parametri:

  • $serverId++.

Definirea interogărilor în config/ldap.php

Caution: when an ldap attribute name is required in one of these parameters, only use lower case names: for instance displayname and NOT displayName.

Please refer to the config/ldap.php file as it contains samples configuration.

Simple Queries

Let's begin with simples queries. These queries only filter LDAP entries based on their own attributes and location. They are usually enough for querying ActiveDirectory.

  • $query_id: is the id of the LDAP query;
  • $ldap_queries[$query_id]['ldapServerId']: Binds the query to a specific server;
  • $ldap_queries[$query_id]['name']: String describing the query. It will be displayed in the GUI;
  • $ldap_queries[$query_id]['userbase']: Root DN to use for user searches;
  • $ldap_queries[$query_id]['userfilter']: It is a filter used to select potential users' entries. It must be enclosed in parentheses;
  • $ldap_queries[$query_id]['userscope']: scope of the LDAP search for users ('base', 'one' or 'sub');
  • $ldap_queries[$query_id]['firstname_attr']: Ldap attribute that will be mapped to the Firstname field of the token entry;
  • $ldap_queries[$query_id]['lastname_attr']: Ldap attribute that will be mapped to the Lastname field of the token entry;
  • $ldap_queries[$query_id]['email_attr']: Ldap attribute that will be mapped to the email address field of the token entry.

Optionally, you can retrieve more information from the directory:

  • $ldap_queries[$query_id]['token_attr']: Ldap attribute that will be mapped to the token code;
  • $ldap_queries[$query_id]['language']: Ldap attribute that will be mapped to the user language code;
  • $ldap_queries[$query_id]['attr1']: Ldap attribute that will be mapped to the attribute_1 field;
  • $ldap_queries[$query_id]['attr2']: Ldap attribute that will be mapped to the attribute_2 field.

Combined Group Queries with DN members

Let's now see how to define a more complicated query.

The following queries use a first LDAP search that looks into LDAP groups. An LDAP group is an LDAP entry containing references to users' entries in the form of:

  • user ids (for instance posixGroups do)    ==> See the next section
  • Or user DNs (for instance groupofnames and groupofuniquenames do) ==> see below

Here we deal with groups containing user DNs:

  • define $query_id, $ldap_queries[$query_id]['ldapServerId'], $ldap_queries[$query_id]['name'] as explained above.

Then define the group filter parameters:

  • $ldap_queries[$query_id]['groupbase']: The Root DN from which you want to start searching for group entries;
  • $ldap_queries[$query_id]['groupfilter']: The LDAP filter that will select potential group entries;
  • $ldap_queries[$query_id]['groupscope']: The scope of the LDAP search for groups ('on', 'base' or 'sub');
  • $ldap_queries[$query_id]['groupmemberattr']: The Name of the LDAP attribute in the group entry that will contain references to users' entries;
  • $ldap_queries[$query_id]['groupmemberisdn']: TRUE.

At this point, everything is set up to let the first LDAP search find users corresponding to the selected groups. However, you can restrict which of these "user candidates" will be selected by applying another filter on them. This is, of course, optional:

  • $ldap_queries[$query_id]['userbase']: Base DN for the user LDAP search (only user candidate matching this base) will be selected;
  • $ldap_queries[$query_id]['userscope']: Scope for the user LDAP search (only user candidate matching the userbase+scope) will be selected;
  • $ldap_queries[$query_id]['userfilter']: It is a filter that applies to each user candidate entry (on its attributes) to add another selection.

Combined Group Queries with UID members

Let's now see how to define a combined Group query when group members are user UIDs and not User DNs.

As for the Group queries with DNs members, these queries use a first LDAP search that looks for LDAP groups entries and get their members. These members values are then used in a user search filter to search for corresponding entries. Thus another parameter must be configured to define the user attribute in the user's entry that should match the member UID found in the groups.

Let's review the required parameters:

  • define $query_id, $ldap_queries[$query_id]['ldapServerId'], $ldap_queries[$query_id]['name'] as explained above

Then define the group filter parameters:

  • $ldap_queries[$query_id]['groupbase']: The Root DN from which you want to start searching for group entries;
  • $ldap_queries[$query_id]['groupfilter']: The LDAP filter that will select potential group entries;
  • $ldap_queries[$query_id]['groupscope']: The scope of the LDAP search for groups ('on', 'base' or 'sub');
  • $ldap_queries[$query_id]['groupmemberattr']: The name of the LDAP attribute in the group entry that will contain references to users' entries;
  • $ldap_queries[$query_id]['groupmemberisdn']: FALSE;
  • $ldap_queries[$query_id]['useridattr']: name of the user attribute that must match the UID found in the group members.

At this point everything is set up to let the first LDAP search find users UIDs corresponding to selected groups and a user search filter will be automatically filled.

However, you can restrict which of these 'user candidates' will be selected by completing the automatic user filter computed from member UIDs. This is, of course, optional:

  • $ldap_queries[$query_id]['userbase']: Base DN for the user LDAP search (only user candidate matching this base) will be selected;
  • $ldap_queries[$query_id]['userscope']: Scope for the user LDAP search (only user candidate matching the userbase+scope) will be selected;
  • $ldap_queries[$query_id]['userfilter']: It is a filter that applies to each user candidate entry (on its attributes) to add another selection.

What about Active Directory?

Active Directory (AD) is a Microsoft registry that can be queried by using the LDAP protocol.

It is then possible to use its content for LimeSurvey token queries, but this requires knowledge on how AD is organized.

  • The LDAP root base is dc=my_windows_domain_name,dc=dns_suffix2,dc=dns_suffix1

==> For instance, if your company owns the DNS domain 'my-company.com' and your Windows domain is 'employees', then your root base is dc=employees,dc=my-company,dc=com

  • Users and users-groups are stored below the cn=Users,dc=my_windows_domain_name,dc=dns_suffix2,dc=dns_suffix1 (please note this is not ou=users);
  • Active Directory Groups:
    • Groups objects contain DN of members in their 'member' attribute;
    • Group memberships are also stored in the memberOf attribute of each user entry. This attribute contains DNs of groups the user belongs to;
    • some groups are in CN=Builtin,dc=my_windows_domain_name,dc=dns_suffix2,dc=dns_suffix1:
      • For instance: cn=Administrator,CN=Builtin,dc=my_windows_domain_name,dc=dns_suffix2,dc=dns_suffix1;

In some cases it is not as easy to query an active directory so here is a sample configuration for getting some infomations of an active directory:

//Connection to the active directory Server:
$serverId=0;
$ldap_server[$serverId]['server'] = "10.10.10.10";
$ldap_server[$serverId]['port'] = "389";
$ldap_server[$serverId]['protoversion'] = "ldapv2";
$ldap_server[$serverId]['encrypt'] = "none"; // Most AD LDAP servers will not have encryption set by default
$ldap_server[$serverId]['referrals'] = false;
$ldap_server[$serverId]['binddn'] = "domain\\user";
$ldap_server[$serverId]['bindpw'] = "userpassword";
//$ldap_server[$serverId]['binddn'] = "CN=user,OU=user_group,DC=xxx,DC=yyy"; this one will not work with active directory, that´s why you need to use "domain\\user"
//Here is a sample query for getting all active users of an active directory:
$query_id=0;
$ldap_queries[$query_id]['ldapServerId'] = 0;
$ldap_queries[$query_id]['name'] = 'Staff with an enabled account';
$ldap_queries[$query_id]['userbase'] = 'OU=USER_GROUP,DC=xxx,DC=yyy';
$ldap_queries[$query_id]['userfilter'] = '(&(objectClass=user)(!(userAccountControl=514)))';
//(!(userAccountControl=514)) you are not able to ask active directory for an active user but you are able to ask for a non inactive user
$ldap_queries[$query_id]['userscope'] = 'sub';
$ldap_queries[$query_id]['firstname_attr'] = 'givenname';
$ldap_queries[$query_id]['lastname_attr'] = 'sn';
$ldap_queries[$query_id]['email_attr'] = 'mail';
$ldap_queries[$query_id]['token_attr'] = ''; // Leave empty for Auto Token generation by phpsv
$ldap_queries[$query_id]['language'] = '';
$ldap_queries[$query_id]['attr1'] = '';
$ldap_queries[$query_id]['attr2'] = '';
//Group filtering was not possible in active directory, you need to add the memberOf attribute of an user. Here is a sample query for getting all active users that are member of the group "samplegroup" in active directory:
$query_id++;
$ldap_queries[$query_id]['ldapServerId'] = 0;
$ldap_queries[$query_id]['name'] = 'All members of samplegroup';
$ldap_queries[$query_id]['userbase'] = 'OU=USER_GROUP,DC=xxx,DC=yyy';
$ldap_queries[$query_id]['userfilter'] = '(&(objectClass=user)(memberOf=CN=samplegroup,OU=Group Global,OU=USER_GROUP,DC=xxx,DC=yyy)(!(userAccountControl=514)))';
$ldap_queries[$query_id]['userscope'] = 'sub';
$ldap_queries[$query_id]['firstname_attr'] = 'givenname';
$ldap_queries[$query_id]['lastname_attr'] = 'sn';
$ldap_queries[$query_id]['email_attr'] = 'mail';
$ldap_queries[$query_id]['token_attr'] = ''; // Leave empty for Auto Token generation by phpsv
$ldap_queries[$query_id]['language'] = '';
$ldap_queries[$query_id]['attr1'] = '';
$ldap_queries[$query_id]['attr2'] = '';

Another example User query:

$ldap_queries[$query_id]['userfilter'] = '(&('''objectCategory=Person''')(objectClass='''user''')(!('''userAccountControl=514''')))'; // AD doesn't recognise enabled accounts in the normal way, so instead, we check users are not disabled
  • As suggested in the config file, consider adding (!(email=*)) to your user filters to ignore users with no email address.

Example group query:

$ldap_queries[$query_id]['groupfilter'] = '(&(objectClass='''group''')(cn=Domain Admins))'; // AD doesn't use the standard attribute name for groups, so use this example instead.

Find more information about the Active Directory LDAP structure on Active Directory Architecture and Active Directory Technical Specification.