5.7.6.1. SPNEGO Server Configuration

In this section, we will describe some necessary steps for setup Kerberos server on Linux. This server will then be used for SPNEGO authentication against GateIn 3.2

Note

If you don't have Linux but you are using Windows and Active Directory domain, then these informations are not important for you and you may jump to the Section 5.7.6.3, “GateIn 3.2 Configuration” to see how to integrate SPNEGO with GateIn 3.2. Please note that Kerberos setup is also dependent on your Linux distribution and so steps can be slightly different in your environment.

  1. Correct the setup of network on the machine. For example, if you are using the "server.local.network" domain as your machine where Kerberos and GateIn 3.2 are located, add the line containing the machine's IP address to the /etc/hosts file.

    192.168.1.88  server.local.network
              

    Note

    It is not recommended to use loopback addresses.

  2. Install Kerberos with these packages: krb5-admin-server, krb5-kdc, krb5-config, krb5-user, krb5-clients, and krb5-rsh-server.

  3. Edit the Kerberos configuration file at /etc/krb5.config, including:

    • Uncomment on these lines:

      default_tgs_enctypes = des3-hmac-sha1
      default_tkt_enctypes = des3-hmac-sha1
      permitted_enctypes = des3-hmac-sha1
      
    • Add local.network as a default realm and it is also added to the list of realms and remove the remains of realms. The content looks like:

      [libdefaults]
          default_realm = LOCAL.NETWORK
       
      # The following krb5.conf variables are only for MIT Kerberos.
          krb4_config = /etc/krb.conf
          krb4_realms = /etc/krb.realms
          kdc_timesync = 1
          ccache_type = 4
          forwardable = true
          proxiable = true
       
      # The following encryption type specification will be used by MIT Kerberos
      # if uncommented.  In general, the defaults in the MIT Kerberos code are
      # correct and overriding these specifications only serves to disable new
      # encryption types as they are added, creating interoperability problems.
      #
      # Thie only time when you might need to uncomment these lines and change
      # the enctypes is if you have local software that will break on ticket
      # caches containing ticket encryption types it doesn't know about (such as
      # old versions of Sun Java).
       
          default_tgs_enctypes = des3-hmac-sha1
          default_tkt_enctypes = des3-hmac-sha1
          permitted_enctypes = des3-hmac-sha1
       
      # The following libdefaults parameters are only for Heimdal Kerberos.
          v4_instance_resolve = false
          v4_name_convert = {
              host = {
                  rcmd = host
                  ftp = ftp
              }
              plain = {
                  something = something-else
              }
          }
          fcc-mit-ticketflags = true
       
      [realms]
          LOCAL.NETWORK = {
              kdc = server.local.network
              admin_server = server.local.network
          }
       
      [domain_realm]
          .local.network = LOCAL.NETWORK
          local.network = LOCAL.NETWORK
       
      [login]
          krb4_convert = true
          krb4_get_tickets = false
      
  4. Edit the KDC configuraton file at /etc/krb5kdc/kdc.conf that looks like.

    [kdcdefaults]
        kdc_ports = 750,88
     
    [realms]
        LOCAL.NETWORK = {
            database_name = /home/gatein/krb5kdc/principal
            admin_keytab = FILE:/home/gatein/krb5kdc/kadm5.keytab
            acl_file = /home/gatein/krb5kdc/kadm5.acl
            key_stash_file = /home/gatein/krb5kdc/stash
            kdc_ports = 750,88
            max_life = 10h 0m 0s
            max_renewable_life = 7d 0h 0m 0s
            master_key_type = des3-hmac-sha1
            supported_enctypes = aes256-cts:normal arcfour-hmac:normal des3-hmac-sha1:normal des-cbc-crc:normal des:normal des:v4 des:norealm des:onlyrealm des:afs3
            default_principal_flags = +preauth
        }
     
    [logging]
            kdc = FILE:/home/gatein/krb5logs/kdc.log
            admin_server = FILE:/home/gatein/krb5logs/kadmin.log
    
    • Create krb5kdc and krb5logs directory for Kerberos database as shown in the configuration file above.

    • Next, create a KDC database using the following command.

      sudo krb5_newrealm
      
    • Start the KDC and Kerberos admin servers using these commands:

      sudo /etc/init.d/krb5-kdc restart
      sudo /etc/init.d/krb-admin-server restart
      
  5. Add Principals and create Keys.

    • Start an interactive 'kadmin' session and create the necessary Principals.

      sudo kadmin.local
      
    • Add the GateIn 3.2 machine and keytab file that need to be authenticated.

      addprinc -randkey HTTP/server.local.network@LOCAL.NETWORK
      ktadd HTTP/server.local.network@LOCAL.NETWORK
      
    • Add the default GateIn 3.2 user accounts and enter the password for each created user that will be authenticated.

      addprinc john
      addprinc demo
      addprinc root
      
  6. Test your changed setup by using the command.

    kinit -A demo
    
    • If the setup works well, you are required to enter the password created for this user in Step 5. Without the -A, the kerberos ticket validation involved reverse DNS lookups, which can get very cumbersome to debug if your network's DNS setup is not great. This is a production level security feature, which is not necessary in this development setup. In production environment, it will be better to avoid -A option.

    • After successful login to Kerberos, you can see your Kerberos ticket when using this command.

      klist
      
    • If you want to logout and destroy your ticket, use this command.

      kdestroy
      
Copyright ©2012. All rights reserved. eXo Platform SAS