Configuring SPNEGO protocol support in CAs

Source: Internet
Author: User

Write it in front.

The company's original certification system, is based on the CAS4.1.8, and has been able to work, the requirements are to achieve support spnego, during a large circle around, the main reason is not familiar with the ad domain.

At the time of development, there are three machines, Windows Server (providing DNS service and AD Domain Services), client (i.e. client), WEB application Server (the server that deploys the CAS application, typically a Linux system, Here I take Windows system as an example)

Environment:

Windows Server r2,jdk1.8,win7 (client and Web application server)

Specific steps: 1. Windows server creates a DNS server

Specific reference: http://jingyan.baidu.com/article/e9fb46e17822727520f76652.html

2.Windows Server Create AD Domain service

Refer to: http://www.cnblogs.com/wanggege/p/4605678.html, assuming that the added domain is: example.com

3. Add a domain user

This assumes that the client user name is clients and the application Server user name is server.

Start->active Directory users and Computers->users-> new user, set account password never expires.

After adding a user, to modify the user account option: Select the account to which you want to modify the user right-click Property, in the Account option, only tick "This account supports Kerberos AES 256-bit encryption" and reset the user password.

4. Add two machines to the AD domain

Reference: http://jingyan.baidu.com/article/358570f67d81b2ce4724fcfe.html

5. Create an SPN account

On Windows Server, run Cmd.exe, enter command setspn-s http/[email protected] Server, add SPN account, enter command setspn-l server, check if add is successful.

6.ktpass.exe Exporting keytab files

Reference: Https://technet.microsoft.com/en-us/library/cc753771.aspx, run cmd.exe, input command example:

Ktpass/princ Http/[email protected]/mapuser server/pass ******/out Server.keytab/crypto all/ptype KRB5_NT_PRINCIPAL /mapop Set

To generate the keytab file, in the CMD entry directory, copy the Server.keytab file, paste it to the Web application server, and remember the file directory.

7. Configure the browser

Ie:internet options, advanced, check Enable integrated Windows authentication, Internet Options, security, local intranet-> site, advanced, add http://server.example.com, save

Firefox: Enter "About:config" on the address bar, go to the configuration page, search "Negotiate" for "Network.negotiate-auth.trusted-uris" for http://server.example.com

8.Java Password Extension

There is a limit to the addition and decryption of Java-published run environment packages. For example, the default is not to allow 256-bit key AES encryption, the workaround is to modify the policy file. The official website provides a download of the JCE unrestricted permissions policy file:
Jdk7:http://www.oracle.com/technetwork/java/javase/downloads/jce-7-download-432124.html
Jdk8:http://www.oracle.com/technetwork/java/javase/downloads/jce8-download-2133166.html

Related configuration document:http://www.javamex.com/tutorials/cryptography/unrestricted_policy_files.shtml

9. Configuring CAS Components

Refer to: https://apereo.github.io/cas/4.2.x/installation/SPNEGO-Authentication.html

Login-webflow.xml, state viewLoginForm before state, define two new action State

<action-stateID= "Startauthenticate">  <Evaluateexpression= "Negociatespnego" />  <transition on= "Success" to= "Spnego" /></action-state> <action-stateID= "Spnego">  <Evaluateexpression= "Spnego" />  <transition on= "Success" to= "Sendticketgrantingticket" />  <transition on= "Error" to= "Viewloginform" /></action-state>

Find generateLoginTicket action, replace viewLoginForm with startauthenticate

Define two beans in cas-servlet.xml

<id= "Negociatespnego"  class= " Org.jasig.cas.support.spnego.web.flow.SpnegoNegociateCredentialsAction "/><   ID= "Spnego"  class= " Org.jasig.cas.support.spnego.web.flow.SpnegoCredentialsAction "      P: Centralauthenticationservice-ref= "Centralauthenticationservice"/>

  

Update Deployerconfigcontext.xml with the following template

  

<BeanID= "Jcifsconfig"class= "Org.jasig.cas.support.spnego.authentication.handler.support.JCIFSConfig"P:jcifsserviceprincipal= "Http/[email protected]"P:kerberosdebug= "false"P:kerberosrealm= "example.com"P:KERBEROSKDC= "172.10.1.10"p:loginconf= "/login.conf" /><BeanID= "Spnegoauthentication"class= "Jcifs.spnego.Authentication" /><BeanID= "Spnegohandler"class= "Org.jasig.cas.support.spnego.authentication.handler.support.JCIFSSpnegoAuthenticationHandler"P:authentication-ref= "Spnegoauthentication"P:principalwithdomainname= "false"p:ntlmallowed= "true" /><BeanID= "Spnegoprincipalresolver"class= "Org.jasig.cas.support.spnego.authentication.principal.SpnegoPrincipalResolver" /><BeanID= "AuthenticationManager"class= "Org.jasig.cas.authentication.PolicyBasedAuthenticationManager">  <Constructor-arg>    <Map>      <entryKey-ref= "Spnegohandler"Value-ref= "Spnegoprincipalresolver"/>    </Map>  </Constructor-arg>  < Propertyname= "Authenticationmetadatapopulators">    <List>      <Beanclass= "Org.jasig.cas.authentication.SuccessfulHandlerMetaDataPopulator" />    </List>  </ Property></Bean>

Provide the login.conf file, here I put the file under the Classpath

jcifs.spnego.initiate {   com.sun.security.auth.module.Krb5LoginModule required storekey=true usekeytab=true keytab= "C:/users/server/server.keytab";}; jcifs.spnego.accept {   com.sun.security.auth.module.Krb5LoginModule required storekey=true usekeytab=true KeyTab = "C:/users/server/server.keytab";};
10. Modify the client Hosts file

Add to

172.10.1.10 server.example.com
11. If necessary, modify the Web. xml

Modify the properties Casserverloginurl and servername, changing the IP in which is server.psso.com

Configuring SPNEGO protocol support in CAs

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.