sexta-feira, 21 de maio de 2010

MediaWiki - Autenticando acesso via LDAP

A classe PHP LdapAuthentication, ou no linguajar do Wiki: "extensão LdapAuthentication" prover fucionalidades de autenticação e também algumas funcionalidades de autorização para o seu wiki, ele se integra com os seguintes serviços: Active Directory - Smartcard - Kerberos já disponiveis em sua rede.

Para instalação dessa funcionalidade em seu wiki você primeiramente deverá identificar a versão do seu mediawiki, para isso vá em páginas especiais do seu wiki depois vá no link Versões(/Especial:Version) e veja a sua versão essa funcionalidade esta disponivel para funcionar nos wikis aparti da versão 1.6+. Identificado a versão do seu wiki você deverá baixar a extensão LdapAuthentication em http://www.mediawiki.org/wiki/Special:ExtensionDistributor/LdapAuthentication de acordo com a versão do wiki.... Após ter baixado a extensão coloque no dirétorio extension do wiki, como mostra o comando abaixo:


# tar -xzf LdapAuthentication-MW1.13-r36354.tar.gz -C /var/www/mediawiki/extensions/LdapAuthentication/


Após ter feito isto você deverá configurar o seu LocalSetings.php, aqui utilizo a versão 1.11.0 do MediaWiki e a versão 1.10 do LdapAuthentication para realizar a autenticação dos usuário wiki utilizando o AD, configurações no LocalSettings.php:




/*
AUTENTICAÇAO NO AD PARA O WIKI
POR LEONARDO COUTO CONRADO
EM 20.04.2010

PROCURA NA BASE LDAP O OBJETO(USUÁIO DIGITADO NO LOGIN), A AUTENTICACAO FICA MAIS DINAMICA,POIS, NÃO SE LIGA DIRETO A UM UNICO OBJ(USUARIO LDAP)
ELE IRÁ AUTENTICAR UM CONJUNTO DE USUARIOS LDAP INFORMADO NO ATRIBUTO $wgLDAPBaseDNs - FUNCIONANDO-OK - EM PRODUÇÃO:
*/

require_once( "$IP/extensions/LdapAuthentication/LdapAuthentication.php" );
$wgAuth = new LdapAuthenticationPlugin();
$wgLDAPDomainNames = array("NOMEDOMINIO");
$wgLDAPServerNames = array("NOMEDOMINIO"=>"srvpdc1tecnotrlocal.nomedominio.local");
$wgLDAPEncryptionType = array("NOMEDOMINIO"=>"clear");
$wgLDAPUseLocal = false;
$wgMinimalPasswordLength = 1;

//A COLEÇÃO DE USUÁRIO QUE SERÁ PERMITIDO LOGAR NESTE WIKI SERÁ O CONTAINER(O.U.) LDAP ABAIXO:
$wgLDAPBaseDNs = array("NOMEDOMINIO"=>"OU=USUARIOS,OU=TRSSA,DC=nomedominio,DC=local");

//ATRIBUTO PARA CHECK, PESQUISA E COMPARA O QUE O USUÁRIO DIGITOU PARA REALIZAR O LOGIN NO WIKI, UTILIZANDO O TIPO DE ATRIBUTO LDAP sAMAccountName QUE CORRESPONDE AO NOME DE USUÁRIO(Exemplo.: sAMAccountName de Leonardo Conrado = leonardo.conrado):
$wgLDAPSearchAttributes = array("NOMEDOMINIO"=>"sAMAccountName");

//SOMENTE MEMBROS DESTE GRUPO SERÁ PERMITIDO LOGAR NO WIKI :
$wgLDAPGroupDN = "cn=GRUPO_WIKI,ou=USUARIOS,ou=TRSSA,dc=NOMEDOMINIO,dc=LOCAL";

//USUÁRIO PROXY PARA LEITURA DA BASE LDAP:
$wgLDAPProxyAgent = array("NOMEDOMINIO"=>"cn=winbind.user,cn=users,dc=NOMEDOMINIO,dc=LOCAL");

//SENHA DESTE USUÁRIO PROXY:
$wgLDAPProxyAgentPassword = array("NOMEDOMINIO"=>"linux123");

//CHECAR SE O USUÁRIO NÃO ESTAR DESABILITADO NO AD:
$wgLDAPRequireAuthAttribute = array("NOMEDOMINIO"=>true);

//The userAccountControl attribute has hex flags that specify information about a user's account a hex flag of 2 specifies the user's account is disabled:
$wgLDAPAuthAttribute = array("NOMEDOMINIO"=>"!(userAccountControl:1.2.840.113556.1.4.803:=2)");


3 comentários:

  1. Cara,
    Já fiz de tudo, porém quando tento logar, dá usuário e senha inválido. Seria obvio a resposta, porém uso esse usuário na rede e não dá problema.
    Poderia me ajudar?

    ResponderExcluir
    Respostas
    1. Olá Julio,

      Eu quando configurei já tive problemas com as versões do MediaWiki e a extensão LDAP. Bom, recentemente realizei essa config vou passar as versões usadas nas configs que obtiveram sucesso, abaixo segue:

      - MediaWiki 1.20.5
      - LDAP Authentication Plugin (Versão 2.0c)

      Julio abaixo segue as configs usadas:

      /*
      AUTENTICAÇAO NO AD PARA O WIKI
      POR LEONARDO COUTO CONRADO
      EM 19.09.2013

      PROCURA NA BASE LDAP O OBJETO(USUÁIO DIGITADO NO LOGIN), A AUTENTICACAO FICA MAIS DINAMICA,POIS, NÃO SE LIGA DIRETO A UM UNICO OBJ(USUARIO LDAP)
      ELE IRÁ AUTENTICAR UM CONJUNTO DE USUARIOS LDAP INFORMADO NO ATRIBUTO $wgLDAPBaseDNs - FUNCIONANDO-OK - EM PRODUÇÃO:
      */


      require_once( "$IP/extensions/LdapAuthentication/LdapAuthentication.php" );
      $wgAuth = new LdapAuthenticationPlugin();
      $wgLDAPDomainNames = array("GRUPOBR");
      $wgLDAPServerNames = array("GRUPOBR"=>"srvfs01.grupobr.com.br");
      $wgLDAPEncryptionType = array("GRUPOBR"=>"clear");
      $wgLDAPUseLocal = false;
      $wgMinimalPasswordLength = 1;

      //A COLEÇÃO DE USUÁRIO QUE SERÁ PERMITIDO LOGAR NESTE WIKI SERÁ O CONTAINER(O.U.) LDAP ABAIXO:
      $wgLDAPBaseDNs = array("GRUPOBR"=>"OU=TI,OU=DCORP,OU=LM IGUATEMI,OU=GRUPOBR,DC=grupobr,DC=com,DC=br");

      //ATRIBUTO PARA CHECK, PESQUISA E COMPARA O QUE O USUÁRIO DIGITOU PARA REALIZAR O LOGIN NO WIKI, UTILIZANDO O TIPO DE ATRIBUTO LDAP sAMAccountName QUE CORRESPONDE AO NOME DE USUÁRIO(Exemplo.: sAMAccountName de Leonardo Conrado = leonardo.conrado):
      $wgLDAPSearchAttributes = array("GRUPOBR"=>"sAMAccountName");


      //SOMENTE MEMBROS DESTE GRUPO SERÁ PERMITIDO LOGAR NO WIKI :
      $wgLDAPGroupDN = "CN=LM_SSA_TI_WIKI,OU=TI,OU=DCORP,OU=LM IGUATEMI,OU=GRUPOBR,DC=grupobr,DC=com,DC=br";

      //USUÁRIO PROXY PARA LEITURA DA BASE LDAP:
      $wgLDAPProxyAgent = array("GRUPOBR"=>"CN=helpdesk otrs,OU=TI,OU=DCORP,OU=LM IGUATEMI,OU=GRUPOBR,DC=grupobr,DC=com,DC=br");

      //SENHA DESTE USUÁRIO PROXY:
      $wgLDAPProxyAgentPassword = array("GRUPOBR"=>"ot141414");

      //CHECAR SE O USUÁRIO NÃO ESTAR DESABILITADO NO AD:
      $wgLDAPRequireAuthAttribute = array("GRUPOBR"=>true);

      //The userAccountControl attribute has hex flags that specify information about a user's account a hex flag of 2 specifies the user's account is disabled:
      $wgLDAPAuthAttribute = array("GRUPOBR"=>"!(userAccountControl:1.2.840.113556.1.4.803:=2)");

      $wgDebugLogGroups['ldap'] = '/tmp/debug.log';

      Excluir
  2. Looking for a Porn Blacklist? Well, I have news for you, Shalla is crap compared to Squidblacklist.org!

    Our proprietary platform allows us to leverage multiple data sets across the web to pull in new data for the most complete and extensive adult blacklist found anywhere. It gives us a competitive advantage on the competition that allows us to produce an adult blacklist that is second to none. It is currently the worlds largest adult domain blacklist in the world, with over 1,320,00 domains and growing with every update.

    --
    Signed,

    Benjamin E. Nichols
    http://www.pornblacklist.com

    ResponderExcluir

Seguidores