Core Security Patterns: Best Practices and Strategies for J2EE, Web Services, and Identity Management
This section illustrates the design process for the security use cases and applies the security architecture and those identified security design patterns. UML-style sequence diagrams are used to denote the flow of events and how each logical component interacts with specific security patterns. The security service design discussed here should be vendor-agnostic, and can be implemented in practically any language on any platform. We refer to J2EE-specific terminology because our security use cases and system constraints mandated the use of a J2EE environment, but those should not be misinterpreted as a necessary part of the security design. Policy Design
Prior to the design elaboration phase, we need to document our policy design. In terms of security, the policy design must provide rules defining appropriate and inappropriate behavior, who and what to trust, level of control, communication requirements, procedures, and associated tools to support the security infrastructure. To do this as part of eRewards portal security architecture, we need to document the following security policy artifacts:
These policies serve as principal guidelines during implementation and deployment. They also contribute to the regulatory compliance requirements specific to the type of business handled by the eRewards portal. Sarbanes-Oxley (SOX) is one example of those business-related regulatory requirements. Policy design is a tedious undertaking, and a full explanation could consume a chapter in and of itself. In this chapter, we are not able to bore down to the details of the above artifacts. The sample artifacts for policy design are available at http://www.coresecuritypatterns.com. Refer to Chapter 8, "The Alchemy of Security Design: Methodology, Patterns, and Reality Checks," for more information about Policy Design. Factor Analysis
To begin construction of a security design, we must perform a factor analysis to identify the current system infrastructure-specific constraints and requirements. These constraints and requirements will drive the design decisions as we move forward. Forthcoming activities such as detailed security design and implementation will be based heavily on the analysis done here. Infrastructure
Web Tier
Business Tier
Web Services Tier
Security Infrastructure
Based on the identified system requirements, we will evolve a tentative security infrastructure showing the security infrastructure, including application services, hosts, and network topology. Figure 14-8 shows a logical representation of the security infrastructure setup for our Web portal. Figure 14-8. Logical representation of eRewards portal security infrastructure
Security InfrastructureDetailed components
Figure 14-9 further elaborates on the security infrastructure with the physical representation of network security appliances, including switches, firewall, and load-balancer appliances. It also shows how the network topology is segregated physically by network switches as VLANs and how the Web server, application server, and back-end application traffic multiplexed on one VLAN. Figure 14-9. Physical representation of network security components
Tier Analysis
A tier analysis becomes necessary because there are tier-specific factors and issues that will influence our design implementation. This analysis will then serve as the final analysis step in our design process. Web Tier
The decision was made early on to use an external Identity Provider for identity management and authentication. Because authentication will be done externally, we will need to secure the communication channel with the external Identity Provider using a Secure Pipe pattern. The portal will also need to collect the user credentials (username and password) from the client. To do so, we will need to use the Secure Pipe there as well in order to prevent the password being sniffed. We will implement the Secure Pipe using SSL hardware accelerator-based device mechanisms installed on the bastion hosts that run the Web servers. This will provide us with better SSL performance. We chose to use the Authentication Enforcer pattern to represent the form-based authentication process in the Web tier. In our threat profile modeling, we determine that a hacker may try to guess a user's password. To prevent a hacker's success, we will configure our external Identity Provider to make use of strong password policies with minimum lengths and a mixture of alpha-numeric characters that make guessing impractical. We will also mandate account lockouts after a certain number of incorrect attempts. One of the business requirements of the application is to provide the user with a form for reward selection. To prevent attackers from crashing the system by sending junk data in the request, we will use an Intercepting Validator pattern to scrub the data when it is received. We will also use a Secure Logger pattern to securely log all incoming requests for security monitoring and auditing. This will allow us to detect malicious activity and take preventive measures. Business Tier
On the Business tier, we will address auditing and data obfuscation. We have identified the Audit Interceptor and Obfuscated Transfer Object patterns to address these factors. On the Business tier, we are only concerned with business-level auditing. We will not have sufficient insight into the incoming requests to do much security auditing. We can audit some business-level security audit events such as profile modification, but in general, security auditing will not be necessary on the Business tier. We will use an Intercepting Session Façade strategy that will provide us with an easy way to incorporate auditing into our Business tier without impacting our business object developers. This will reduce risk and provide a means to add or modify auditing requirements in parallel to other development. We also must address data obfuscation on the Business tier. On this tier, that means obscuring application-layer data sent between business services. Our Business tier resides in a trusted environment, so we are not going to address securing data within the application, only obscuring sensitive information written to logs or sent from our Business tier outside our environment to our trading partners. We will use two strategies for data obfuscation. Internally, we will use the Obfuscated Transfer Object pattern. Because this is a protected tier and we are not concerned with host-level intrusions for this issue, we will use the Masked List strategy, which will provide data obfuscation for sensitive data written to a log or otherwise output. Web Services Tier
To facilitate communication with service providers with a standardized infrastructure and to address the authentication and authorization requirements such as representation of credentials and message formats, we use the Secure Message Router pattern. Adopting this pattern eliminates point-to-point security intermediaries and makes use of a Liberty agent for enabling SSO, global logout, identity registration, and termination. To address the message-level security requirements of the service providers and to support non-disclosure of message contents to unintended recipients, we will use element-level encryption and signatures. This will be accomplished by using a message configurator to facilitate configuration of messages applying XML Encryption and XML Signature. Identity Tier
We elected to use an external Identity Provider for managing user identities and performing authentication and authorization for the Web portal and the participating trusted service providers. To meet our identity-management requirements and avoid the common pitfall of vendor lock-in, we will choose a vendor that provides a Liberty II protocol-based single sign-on and global logout mechanisms. Through the use of SAML assertions and a Liberty II protocol, we will deliver a vendor-neutral identity infrastructure and provide an industry-standard interface for identity federation and enabling SSO with service providers. Trust Model
With the use of a trusted external Identity Provider, our trust modeling becomes quite straightforward. The trust model in this case is simply based on the vendor's product implementation, which allows establishing trusted relationships between the Web portal and service providers. The Web portal and the service providers trust the SAML assertions issued by the external Identity Provider for authentication and authorization decisions. The portal and service providers make use of Liberty-enabled agents to communicate with the Identity Provider. Threat Profiling
For this case study, we will not perform exhaustive threat profiling. We will take a simple attack tree and look at two branches. Based on our use case scenario, we will assume that the goal (that is, the root node of the tree) is to gain an unearned reward from our partner service. One branch of the attack tree impacts the Web tier and the other impacts the Web Services tier. The first branch involves an attacker trying to gain access to a legitimate user's account. From there, the attacker can modify the user's address information and order rewards for that user that will get shipped to the attacker. To do this, the attacker can use two approaches:
Figure 14-10 is a diagram of the attack tree based on our modeling of this simple profile. Figure 14-10. Threat profile attack tree
Security Design
The first step in our security design is to flesh out our patterns based on the analyses. As part of the architecture, we identified a set of initial security patterns to be used. We can now go back and validate that those patterns fit or choose others as necessary. We will then begin data modeling and create our business and data access objects and services. Relating the Analyses to the Security Patterns
The security analyses we performed previously were necessary to identify the important security elements of the application in relation to the security requirements. This will also help with locating the appropriate security patterns that can be used to address the business problems. For example:
Data Modeling and Objects
Now that the patterns have been established, the designer can set the stage for creating the application-level security design. The first step in this process is to perform data modeling tasks. Data modeling represents the relationship and dependencies of business data and objects in the application design. It is essential to abstract what business data should be accessible (for access rights control), cached (for example, for data look-up), or stored in the database (for traceability and reporting). From a security perspective of data privacy, we would also like to know whether the entire business data contents or a subset of it should be accessible by the service requester. This is particularly important when considering whether the data objects should encapsulate the entire membership record or not. The following section describes the list of business data objects that we will use in the application design and the related data classes. Because this chapter is a case study of the security design, not the functional application design, this section will discuss the security implications of these data objects and classes only. Business Data Objects
Several business data objects can be encapsulated, including the in-basket for the catalog service (for example, a list of the product items selected), product details, purchase order (a "manifest" or collection of the merchandise ordered), and membership record (personal information about the subscriber and the current membership award balance). For data access, we have decided to use Java Data Objects (JDO). The JDO API is a standards-based interface for modeling business data and abstracting the data for persistence. It is a useful technology for implementing business data objects in a functional application architecture design. Refer to http://java.sun.com/products/jdo/index.jsp for details. Data Class
Figure 14-11 depicts a class diagram of the classes represented in the eRewards portal application. The controller servlet uses the order management servlet, the membership servlet, and the catalog servlet. Each of these servlets has its corresponding helper class. Some of the methods or attributes are implementation-specific, and some are added to support specific security requirements. For example, the controller servlet has two methods that are specific to supporting single sign-on functions: redirectLogin (as used in the user login use case) and verifySSOToken (which is used for verifying the security token that is used by the Identity Provider for single sign-on). Figure 14-11. eRewards portal application: class diagram
Service Design
For our service design, we have elected to focus on four major services:
These services represent the main services within the application. We will not address every possible service for the case study because there may be many auxiliary services in a good service-oriented architecture. These are the main services that will allow us to demonstrate the security process sufficiently. User Login Service
The user login service allows a user to sign on to the eRewards portal and makes use of the external Identity Provider for user authentication and single sign-on. Client refers to the subscriber who wants to sign on to the online portal. IdentityProvider refers to the external Identity Provider who provides the user authentication service. The user login service is important in supporting the security requirements of authentication, identity protection, and single sign-on. Figure 14-12 depicts the detailed process between Client and IdentityProvider. Figure 14-12. User login sequence diagram
Catalog Service
The user browses the online catalog to select product items or merchandise for which rewards will be redeemed. The online catalog aggregates merchandise information from various sources, including external partners and service providers. It is essential that the Web servers and the application servers are secure and that the security service introduced here is able to protect the client-to-server or server-to-server session and business transactions associated with the catalog service. In other words, the security patterns here should be able to support authorization, traceability, data privacy or confidentiality, availability, data integrity, and non-repudiation. Figure 14-13a and Figure 14-13b depict the detailed process of how security is used to protect the user while invoking the catalog service. Client refers to the subscriber who wants to sign on to the eRewards portal. Figure 14-13a. Catalog service front-end sequence diagram
Figure 14-13b. Catalog service back-end sequence diagram
Order Management Service
Upon completion of merchandise selection in the catalog service, the user confirms placing an order with the order management service. The order management service also verifies that the user has a sufficient membership award balance before executing the order. Because the order management service involves retrieving personal information, it is essential that the security service introduced here is able to protect the client-to-server or server-to-server session and business transactions associated with the order management service. In other words, the security patterns here should be able to support authorization, traceability, data privacy or confidentiality, availability, data integrity, and non-repudiation. Figure 14-14 depicts the detailed process of how security is used to protect the user while processing an order. Client refers to the subscriber who wants to sign on to the online portal. Figure 14-14. Order Management Service sequence diagram
Figure 14-15 depicts the details of processing the membership award record. Figure 14-15. Fetching membership record status sequence diagram
Order Fulfillment Service
Upon completion of processing the order placement and membership balance verification, the online portal will proceed to send order details to external partners for order fulfillment. Because the order fulfillment service involves sending product details and personal information to external systems, it is essential that the security service introduced here is able to protect the server-to-server session and business transactions associated with the order fulfillment service. In other words, the security patterns here should be able to support authorization, traceability, data privacy or confidentiality, availability, data integrity, and non-repudiation. Figure 14-16 depicts the detailed process of how security is applied to protect the user while fulfilling an order. Client refers to the subscriber who wants to sign on to the online portal. PartnerMerchantService represents the external system that handles order fulfillment requests. Figure 14-16. Order Fulfillment Service sequence diagram
These are our core services. Now that we have created the sequence diagrams and fleshed out the design details, we can turn them over to the developers for implementation. |
Категории