Translate

jeudi 3 septembre 2009

Résoudre les erreurs 0-1-492 dans Communicator Web Access 2007 R2 sur Windows 2008

Si vous avez des erreurs 0-1-492 (Erreur: l'horloge interne de votre client n'est pas synchronisée avec celle du serveur) au moment de l'authenticiation intégrée sur un site CWA Interne, il faut vérifier le nom de service Kerberos du compte CWA doit comporter "http/fqdn.dusite.ext".

Par exemple, si votre site CWA interne est publié au niveau DNS avec le nom "cwa.societe.com", le nom de service principal sera "http/cwa.societe.com". Il n'est pas utile d'ajouter "as.cwa.societe.com" ni "download.cwa.societe.com" car ce sont des enregistrements CNAME (pointant vers "cwa.societe.com"). Le plus simple pour ajouter le nom principal Kerberos au compte CWA est d'utiliser SetSPN, par exemple:

setspn -A DOMAINE\CWAService http/cwa.societe.com
... Et de redémarrer le(s) serveur(s) (le Kerberos étant résident, un IISRESET ne résoudra probablement pas immédiatement le souci).
Malgré tout, cela peut ne pas suffire. Ce problème est récurrent dans les implémentations où le site CWA interne est mis derrière un répartiteur de charge. Il semble accentué dans une topologie multi-forêts (en particulier en mode forêt de ressource lorsque l'authentification NTLM est utilisée au niveau de la relation d'approbation (approbation de domaine, et non de forêt)).
Pour (définitivement :)) résoudre le problème, la solution de contournement est d'autoriser les accès anonymes sur la page /cwa/AuthMainCommandHandler.ashx du site CWA interne.
Microsoft n'a pas prévu de correctif car cela reviendrait à modifier le programme d'installation d'OCS 2007 R2, mais un article de la KB est en cours de rédaction, et sera probablement ensuite intégré dans la documentation.
Au lieu d'un long discours, voici un script pour le faire:
'
' $File:
' Fix-CWAUthentication.vbs
'
' $Description:
' Configures AuthMainCommandHandler.ashx on CWA Internal Web Sites to allow
' Anonymous authentication and fix CWA Authentication issues that
' may arise when deploying load-balanced CWA Web Sites.
'
' $Author:
' Benoit Boudeville
'
' $Date:
' September 3rd, 2009
'
Option Explicit
Const C_SERVER_TYPE = "Internal"

FixCWAAuthentication

Function FixCWAAuthentication
On Error Resume Next
Dim objShell, objWMIService, objItem, colItems
Dim strComputer, strSystemRoot, strCmd

FixCWAAuthentication = False
strComputer = "."

Err.Clear
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\default\rtccwa_repository")
Set colItems = objWMIService.ExecQuery("Select * from MSFT_CWASiteSetting where ServerType = '" & C_SERVER_TYPE & "'")
If Err <> 0 Then
WScript.Echo "[ERROR]: Unable to query CWA WMI Settings!"
Exit Function
End If

Set objShell = CreateObject("WScript.Shell")
strSystemRoot = objShell.ExpandEnvironmentStrings("%SystemRoot%")
For Each objItem In colItems
objShell.Run """%SystemRoot%\System32\inetsrv\appcmd.exe"" set config """ & objItem.Description & "/cwa/AuthMainCommandHandler.ashx"" -section:system.webServer/security/authentication/anonymousAuthentication /enabled:""True"" /commit:apphost", 2, True
Next
FixCWAAuthentication = True

Set objShell = Nothing
Set objItem = Nothing
Set colItems = Nothing
Set objWMIService = Nothing
End Function