Artykuł opisuje listę kroków konieczną do skonfigurowania autologowania w systemie z wykorzystaniem uwierzytelniania Kerberos w środowisku Windows. 

Step-by-step guide

  1. Zbierz wymagane informacje: 
    1. nazwa domeny
    2. adres kontrolera domeny (np. za pomocą polecenia echo %logonserver%)
    3. nazwa i hasło konta służącego do komunikacji z kontrolerem domeny 
    4. adres serwera, który posłuży do przetestowania rozwiązania
    5. konto testowe będące w domenie
  2. Upewnij się, że na kontrolerze domeny zostały odpowiednio skonfigurowane SPN (Service Principal Name) dla konta służącego do komunikacji z kontrolerem domeny

    Aby wyświetlić wszystkie SPN'y dla danego konta: setspn /l <domena>\<użytkownik>

    Aby zarejestrować wymagane SPN'y dla danego konta(Bez wpisywania portu): 
    setspn -s HTTP/<nazwa serwera PlusWorkflow> <domena>\<użytkownik>
    setspn -s HTTP/<nazwa serwera PlusWorkflow>.<domena> <domena>\<użytkownik>

    np.

    setspn -s HTTP/plusworkflow_test suncode\konto_ldap
    setspn -s HTTP/plusworkflow_test.suncode.com suncode\konto_ldap

  3. Dodaj konto testowe będące w domenie do systemu PlusWorkflow 

    1. login: <domena>/<użytkownik>
    2. hasło pozostaw puste
  4. Dodaj serwer LDAP do systemu PlusWorkflow w Administracja -> Konfiguracja Systemu -> Serwery LDAP
  5. W parametrach systemu włącz autologowanie oraz ustaw konto do łączenia się z kontrolerem domeny(konto_ldap)

  6. Zmodyfikuj plik WEB-INF/krb5.conf

    [libdefaults]
    	default_tkt_enctypes = aes256-cts-hmac-sha1-96 aes128-cts rc4-hmac des3-cbc-sha1 des-cbc-md5 des-cbc-crc
    	default_tgs_enctypes = aes256-cts-hmac-sha1-96 aes128-cts rc4-hmac des3-cbc-sha1 des-cbc-md5 des-cbc-crc
    	permitted_enctypes   = aes256-cts-hmac-sha1-96 aes128-cts rc4-hmac des3-cbc-sha1 des-cbc-md5 des-cbc-crc 
    	default_realm = suncode.com
    [realms]
    	suncode.com  = {
    		kdc = KDC.suncode.com
    		default_domain = suncode.com 
    }
    [domain_realm]
    	.suncode.com = suncode.com
    	suncode.com = suncode.com	

    gdzie:

    kdc = FQDN dla Key Distribution Center (najprawdopodobniej kontroler domeny)
    default_tkt_enctypes orad default_tgs_enctypes = dostępne algorytmy szyfrowania ticketów

    Zalecane jest przeniesienie pliku krb5.conf do lokalizacji <plusworkflow.home>/config/kerberos/krb5.conf. Dzięki temu nie ma potrzeby przechowywania tego pliku w projekcie klienckim. System w pierwszej kolejności czyta ten plik z katalogu domowego systemu.

  7. Może się zdarzyć sytuacja, że trzeba zmodyfikować plik WEB-INF/login.conf (w większości przypadków nie trzeba tego robić). W takim przypadku również najlepiej przenieść plik do lokalizacji <plusworkflow.home>/config/kerberos/login.conf, aby uniknąć przechowywania go w projekcie klienckim.

  8. Skonfiguruj przeglądarki
    1. Mozilla Firefox
      1. wpisz w pasku adresu about:config
      2. wyszukaj konfigurację network.negotiate-auth.trusted-uris
      3. jako wartość parametru ustaw ścieżkę do serwera(bez portu) na którym jest uruchomiony system PlusWorkflow np. http://plusworkflow_test
    2. Internet Explorer
      1. dodaj URL systemu do witryn zaufanych w Opcje Internetowe -> zakładka Zabezpieczenia -> Zaufane Witryny
      2. zaznacz opcję Włącz zintegrowane uwierzytelnianie systemu Windows w Opcje Internetowe -> zakładka Zaawansowane -> Zabezpieczenia
      3. poniżej Zaufane witryny kliknąć na Poziom niestandardowy i w sekcji Uwierzytelnianie użytkownika zaznaczyć Zaloguj automatycznie z bieżącą nazwą użytkownika i bieżącym hasłem
  9. Zrestartuj system
  10. Przetestuj działanie SSO
    1. zaloguj się do komputera w domenie przy użyciu konta, które wcześniej dodałeś do systemu PlusWorkflow
    2. usuń z systemu wszystkie tickety za pomocą komendy klist purge
    3. zaloguj się automatycznie do systemu wpisując w pasku przeglądarki adres systemu (loguj się po nazwie serwera, nie adresie). 

 

Troubleshooting

  1. Po poprawnej konfiguracji i próbie automatycznego logowania komenda klist powinna wyświetlić tickety podobne do poniższych:


  2. Upewnij się, że wielkość liter w loginie użytkownika w kontrolerze domeny jest identyczna z wielkością liter w loginie użytkownika w systemie PW.
  3. Podczas zaznaczania checbox'ów w ustawieniach usera, należy zmienić hasło na inne nowe i ponownie wprowadzić je do systemu (parametry systemu oraz LDAP jeżeli tam jest to samo konto zdefiniowane)
  4. Zweryfikować czy na serwerze AD prawidłowo zostało wykonane polecenie setspn, wykonując (zazwyczaj musi zrobić to klient gdyż my nie mamy dostępu do tego serwera) skrypt w powershellu:

    $serviceType="HTTP"
    
    $spns = @{}
    
    $filter = "(servicePrincipalName=$serviceType/*)"
    $domain = New-Object System.DirectoryServices.DirectoryEntry
    $searcher = New-Object System.DirectoryServices.DirectorySearcher
    $searcher.SearchRoot = $domain
    $searcher.PageSize = 1000
    $searcher.Filter = $filter
    $results = $searcher.FindAll()
    
    
    foreach ($result in $results){
     $account = $result.GetDirectoryEntry()
     foreach ($spn in $account.servicePrincipalName.Value){
      if($spn.contains("$serviceType/")){
       $spns[$("$spn`t$($account.samAccountName)")]=1;
      }
     }
    }
    $spns.keys | sort-object

    Wynik działania tego skryptu klient powinien podesłać nam. Należy wówczas sprawdzić czy na liście wpisów spn jest serwer PlusWorkflow ze wskazaną nazwą użytkownika.

 

Related articles

Related articles appear here based on the labels you select. Click to edit the macro and add or change labels.

Related issues 

The article describes the list of steps necessary to set up auto login on a system using Kerberos authentication in a Windows environment.

Step-by-step guide

  1. Get the required information:

    1. domain name
    2. the address of the domain controller (e.g. using the echo %logonserver% command)
    3. the name and password of the account used to communicate with the domain controller

    4. the address of the server that will be used to test the solution
    5. the test account that is in the domain
  2. Make sure that the SPN (Service Principal Name) for the account used to communicate with the domain controller has been properly configured on the domain controller

    To view all SPNs for a given account: setspn /l <domain>\<user>

    To register the required SPNs for a given account:
    setspn -s HTTP/<PlusWorkflow server name> <domain>\<user>
    setspn -s HTTP/<PlusWorkflow server name>.<domain> <domain>\<user>

    eg.

    setspn -s HTTP/plusworkflow_test suncode\ldap_account
    setspn -s HTTP/plusworkflow_test.suncode.com suncode\ldap_account

  3. Add a test account that is in your domain to the PlusWorkflow system

    1. login: <domain>/<user>
    2. leave the password blank
  4. Add a LDAP server to the PlusWorkflow system in Administration -> System Configuration -> LDAP Servers
  5. In the system parameters, enable auto login and set the account to connect to the domain controller

  6. Modify the WEB-INF/krb5.conf file

    [libdefaults]
    	default_tkt_enctypes = aes256-cts-hmac-sha1-96 aes128-cts rc4-hmac des3-cbc-sha1 des-cbc-md5 des-cbc-crc
    	default_tgs_enctypes = aes256-cts-hmac-sha1-96 aes128-cts rc4-hmac des3-cbc-sha1 des-cbc-md5 des-cbc-crc
    	permitted_enctypes   = aes256-cts-hmac-sha1-96 aes128-cts rc4-hmac des3-cbc-sha1 des-cbc-md5 des-cbc-crc 
    	default_realm = suncode.com
    [realms]
    	suncode.com  = {
    		kdc = KDC.suncode.com
    		default_domain = suncode.com 
    }
    [domain_realm]
    	.suncode.com = suncode.com
    	suncode.com = suncode.com	

    where:

    kdc = FQDN for Key Distribution Center (most likely domain controller)
    default_tkt_enctypes orad default_tgs_enctypes = available ticket encryption algorithms

    It is recommended to move the krb5.conf file to the <plusworkflow.home>/config/kerberos/krb5.conf location. This eliminates the need to store this file in the client project. The system reads this file from the system's home directory first.

  7. There may be cases where you need to modify the WEB-INF/login.conf file (in most cases you don't need to do this). In this case, too, it is best to move the file to the <plusworkflow.home>/config/kerberos/login.conf location to avoid storing it in the client project.
  8. Configure the browsers
    1. Mozilla Firefox
      1. type about:config in the address bar
      2. search for network.negotiate-auth.trusted-uris configuration
      3.  set as parameter value the path to the server on which PlusWorkflow is running, e.g. http://plusworkflow_test
    2. Internet Explorer
      1. add the system URL to trusted sites in Internet Options -> Security tab -> Trusted Sites
      2. check the Enable Windows Integrated Authentication option in Internet Options -> Advanced tab -> Security
      3. below Trusted Sites, click Custom Level and in the User Authentication section, check Log in automatically with the current username and current password
  9. Restart the system
  10. Test the operation of SSO
    1. log in to the computer in the domain using the account you previously added to the PlusWorkflow system
    2. delete all tickets from the system using the klist purge command
    3. log in to the system automatically by typing the system address in the browser bar (log in by server name, not address)

 

Troubleshooting

  1. Once properly configured and attempted to log in automatically, the klist command should display tickers similar to the following:


  2. Make sure that the case of the user's login in the domain controller is identical to the case of the user's login in the PW system.
  3. When checking the checkboxes in the username settings, change the password to another new one and re-enter it in the system (system parameters and LDAP if the same account defined there)
  4. Verify that the setspn command has been executed correctly on the AD server by executing (usually this must be done by the client since we do not have access to that server) a script in powershell:

    $serviceType="HTTP"
    
    $spns = @{}
    
    $filter = "(servicePrincipalName=$serviceType/*)"
    $domain = New-Object System.DirectoryServices.DirectoryEntry
    $searcher = New-Object System.DirectoryServices.DirectorySearcher
    $searcher.SearchRoot = $domain
    $searcher.PageSize = 1000
    $searcher.Filter = $filter
    $results = $searcher.FindAll()
    
    
    foreach ($result in $results){
     $account = $result.GetDirectoryEntry()
     foreach ($spn in $account.servicePrincipalName.Value){
      if($spn.contains("$serviceType/")){
       $spns[$("$spn`t$($account.samAccountName)")]=1;
      }
     }
    }
    $spns.keys | sort-object

    The result of this script should be sent to us by the client. You should then check if there is a PlusWorkflow server with the indicated username in the list of spn records.

 

Related articles

Related articles appear here based on the labels you select. Click to edit the macro and add or change labels.

Related issues