© Near Infinity Corporation www.nearinfinity.com Using AOP for Enterprise Auditing of J2EE Applications AOSD Practitioners Report March 17, 2005.

Slides:



Advertisements
Similar presentations
An IMS testbed for SIP applications
Advertisements

Spring Roo and the Cloud Shekhar Gulati.
2017/3/25 Test Case Upgrade from “Test Case-Training Material v1.4.ppt” of Testing basics Authors: NganVK Version: 1.4 Last Update: Dec-2005.
J0 1 Marco Ronchetti - Basi di Dati Web e Distribuite – Laurea Specialistica in Informatica – Università di Trento.
J0 1 Marco Ronchetti - Basi di Dati Web e Distribuite – Laurea Specialistica in Informatica – Università di Trento.
Chapter 1: The Database Environment
Fatma Y. ELDRESI Fatma Y. ELDRESI ( MPhil ) Systems Analysis / Programming Specialist, AGOCO Part time lecturer in University of Garyounis,
NetSEC: metrology-based application for network security Jean-François SCARIOT Bernard MARTINET Centre Interuniversitaire de Calcul de Grenoble TNC 2002.
1 Introduction to ASP.Net 4.0 Development David Ringsell MCSD MCT MCPD.
17. Data Access ADO.Net Architecture New Features of ADO.NET
Communicating in J2EE.
19 Copyright © 2005, Oracle. All rights reserved. Distributing Modular Applications: Developing Web Services.
21 Copyright © 2005, Oracle. All rights reserved. Oracle Application Server 10g Transaction Support.
12 Copyright © 2005, Oracle. All rights reserved. Implementing Business Tasks with Session EJBs.
1 Copyright © 2005, Oracle. All rights reserved. Introduction.
18 Copyright © 2005, Oracle. All rights reserved. Distributing Modular Applications: Introduction to Web Services.
5 Copyright © 2005, Oracle. All rights reserved. Accessing the Database with Servlets.
4 Copyright © 2005, Oracle. All rights reserved. Creating the Web Tier: Servlets.
11 Copyright © 2005, Oracle. All rights reserved. Creating the Business Tier: Enterprise JavaBeans.
3 Copyright © 2005, Oracle. All rights reserved. Designing J2EE Applications.
3 Copyright © 2005, Oracle. All rights reserved. Basic Java Syntax and Coding Conventions.
16 Copyright © 2005, Oracle. All rights reserved. Using JDBC to Access the Database.
15 Copyright © 2005, Oracle. All rights reserved. Container-Managed Relationships (CMRs)
1 Copyright © 2005, Oracle. All rights reserved. Introducing the Java and Oracle Platforms.
9 Copyright © 2005, Oracle. All rights reserved. Modularizing JavaServer Pages Development with Tags.
8 Copyright © 2005, Oracle. All rights reserved. Creating the Web Tier: JavaServer Pages.
J2EE Overview.
6 Copyright © 2005, Oracle. All rights reserved. Building Applications with Oracle JDeveloper 10g.
17 Copyright © 2005, Oracle. All rights reserved. Deploying Applications by Using Java Web Start.
Jeopardy Q 1 Q 6 Q 11 Q 16 Q 21 Q 2 Q 7 Q 12 Q 17 Q 22 Q 3 Q 8 Q 13
Jeopardy Q 1 Q 6 Q 11 Q 16 Q 21 Q 2 Q 7 Q 12 Q 17 Q 22 Q 3 Q 8 Q 13
JSP and web applications
Connecting to Databases. relational databases tables and relations accessed using SQL database -specific functionality –transaction processing commit.
Enterprise Java and Data Services Designing for Broadly Available Grid Data Access Services.
Week 2 The Object-Oriented Approach to Requirements
Configuration management
1 Dr. Ashraf El-Farghly SECC. 2 Level 3 focus on the organization - Best practices are gathered across the organization. - Processes are tailored depending.
QA practitioners viewpoint
Application Server Based on SoftSwitch
Campaign Overview Mailers Mailing Lists
ABC Technology Project
Database System Concepts and Architecture
Implementation Architecture
DB Relay An Introduction. INSPIRATION Database access is WAY TOO HARD The crux.
Addition 1’s to 20.
25 seconds left…...
Copyright 2001 Advanced Strategies, Inc. 1 Data Bridging An Overview Prepared for DIGIT By Advanced Strategies, Inc.
Week 1.
Systems Analysis and Design in a Changing World, Fifth Edition
We will resume in: 25 Minutes.
J2EE JavaServer Faces (JSF) Introduction Internetteknologi 2 (ITNET2)
Towards a Standard Interface for Runtime Inspection in AOP Environments OOPSLA Workshop on Tool for AOSD, Seattle, November 2002 Katharina Mehner and Awais.
1 XML Web Services Practical Implementations Bob Steemson Product Architect iSOFT plc.
Aspect-Oriented Programming In Eclipse ® Aspect-Oriented Programming in Eclipse with AspectJ Dr Helen Hawkins and Sian January.
An architecture for webb applications, J2EE
1 Build a Web Application on J2EE. 2 J2EE Scenario Client – Web Server – EIS Resources Client – Web Server – EIS Resources Client – Application Server.
Pragmatic Application Building: Step by Step Jay Sissom Principal Systems Analyst Indiana University
The Spring Framework: A brief introduction to Inversion of Control James Brundege
Struts 2.0 an Overview ( )
UNIT-V The MVC architecture and Struts Framework.
Spring Roo CS476 Aleksey Bukin Peter Lew. What is Roo? Productivity tool Allows for easy creation of Enterprise Java applications Runs alongside existing.
A Free sample background from © 2001 By Default!Slide 1.NET Overview BY: Pinkesh Desai.
Advanced Java New York University School of Continuing and Professional Studies.
© D. Wong  Indexes  JDBC  JDBC in J2EE (Java 2 Enterprise Edition)
Design Patterns Phil Smith 28 th November Design Patterns There are many ways to produce content via Servlets and JSPs Understanding the good, the.
© 2006 IBM Corporation IBM WebSphere Portlet Factory Architecture.
© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 JSP Application Models.
Portals: Architecture & Best Practices Greg Hinkle February 2005.
Java Programming: Advanced Topics 1 Enterprise JavaBeans Chapter 14.
A Presentation Presentation On JSP On JSP & Online Shopping Cart Online Shopping Cart.
Presentation transcript:

© Near Infinity Corporation Using AOP for Enterprise Auditing of J2EE Applications AOSD Practitioners Report March 17, 2005

© Near Infinity Corporation 2 Agenda Background Framework Components Audit Data Collection Techniques Utilizing Aspects Lessons Learned Future Direction Questions

© Near Infinity Corporation 3 Background Experiences in this presentation are a result of 1.5 years of product development with AOP Product idea based on customer experiences –Auditing is often an afterthought –Audit implementations are rarely robust –Audit requirements are not always clear until the system is complete Development Effort –Four developers total, two working with AOP –Initial implementation in AspectJ 1.1 & –Current implementation in AspectWerkz 2.0

© Near Infinity Corporation 4 Auditing Framework Solution Goals of an Auditing Framework –Consistent information collection across applications –Common audit data format –Ability to correlate events between application tiers –Minimal impact to apps as requirements change APIs of interest –JDBC –EJB –JNDI –Servlet

© Near Infinity Corporation 5 Audit Framework Components

© Near Infinity Corporation 6 Architecture

© Near Infinity Corporation 7 Collection Solutions Audit Logs Custom API Aspects

© Near Infinity Corporation 8 Audit Logs Advantages –Many servers create standardized logs –Little development effort required to use Problems –Information collected is minimal –Logs are not correlated between tiers Web access logs Database audit logs –Data is scattered across the network

© Near Infinity Corporation 9 Custom API Advantages –Audit exactly what you want Problems –Figuring out what you want to audit is difficult –Auditing is coded into the application (tightly coupled) –Time consuming to add audit code –Boring to add audit code –Significant impact if auditing requirements change

© Near Infinity Corporation 10 Aspects Advantages –Audit exactly what you want –Collection of audit data is consistent in all applications –Easier to change the audit requirements –Moves audit decisions out of the developers hands –Can go places that a hand coded API cant Generated code Third-party libraries Dynamic code using reflection –J2EE interfaces allow reuse of aspects across apps Problems –Robust aspect systems not available in all languages

© Near Infinity Corporation 11 Aspect Solution Criteria Aspects must use load-time weaving –Not all of the relevant code is available until runtime Entity beans JSPs –Changing audit requirements shouldnt force a new build and deploy cycle for all applications Aspects must be robust –Cant assume anything about how the apps are coded –Application errors may be blamed on the new technology

© Near Infinity Corporation 12 Auditing JDBC Database access in Java involves several interfaces. Three are of particular interest –Statement –PreparedStatement –CallableStatement On these interfaces, audit two types of activities –Simple SQL can be captured in a single action Statement+.execute*(String,..) || Statement+.addBatch(String) –Parameterized SQL must be constructed over several actions Connection.prepare*(String,..) PreparedStatement+.set*(int,*) PreparedStatement+.execute*() || PreparedStatement+.addBatch()

© Near Infinity Corporation 13 Auditing JDBC public aspect SimpleStatementAspect { pointcut statementExecute(String sql) : (call(* Statement+.execute*(String,..)) || call(* Statement+.addBatch(String))) && args(sql) && !within(com.nearinfinity..*); after(String sql) : statementExecute(sql) { AuditAPI.auditSimpleSQL(sql); } The simple case…

© Near Infinity Corporation 14 Auditing JDBC The parameterized case… public aspect ParameterizedStatementAspect { pointcut statementPrepare(String sql) : call(* Connection+.prepare*(String,..)) && args(sql) && !within(com.nearinfinity..*); pointcut statementParamSet(PreparedStatement stmt, int pos) : call(* PreparedStatement+.set*(int, *)) && args(pos, *) && target(stmt) && !within(com.nearinfinity..*); pointcut statementExecute(PreparedStatement stmt) : (call(* PreparedStatement+.execute*()) || call(* PreparedStatement+.addBatch())) && target(stmt) && !within(com.nearinfinity..*); … NEXT SLIDE … }

© Near Infinity Corporation 15 Auditing JDBC public aspect ParameterizedStatementAspect { … PREVIOUS SLIDE … after (String sql) returning (PreparedStatement stmt) : statementPrepare(sql) { AuditAPI.auditParameterizedSQL(stmt, sql); } after (PreparedStatement stmt, int pos) : statementParamSet(stmt, pos) { Object[] args = thisJoinPoint.getArgs(); AuditAPI.auditParameterizedSQLArgument(stmt, pos, args[1]); } after (PreparedStatement stmt) : statementExecute(stmt) { AuditAPI.finishParameterizedSQL(stmt); } The parameterized case (cont.)…

© Near Infinity Corporation 16 Auditing EJBs Auditing EJBs is much simpler than JDBC public aspect EJBExecutionAspect { pointcut ejbExecution(): (call(* EJBObject+.*(..)) || call(* EJBLocalObject+.*(..))) && !within(com.nearinfinity..*); after() : ejbExecution() { String method = thisJoinPointStaticPart.getSignature().toLongString(); AuditAPI.auditEJBExecution (method); }

© Near Infinity Corporation 17 Auditing JNDI JNDI provides access to J2EE resources –EJB –JDBC DataSource –LDAP –And more… Just as easy as auditing EJBs… but a lot more code –All auditing is done on the Context interface –Many methods of interest Bind List Search Rename

© Near Infinity Corporation 18 Auditing JNDI One example of auditing JNDI… public aspect LookupAspect { pointcut lookupByString(String context) : (call(* Context+.lookup(String)) || call(* Context+.lookupLink(String))) && args(context) && !withincode(com.nearinfinity..*); pointcut lookupByName(Name context) : (call(* Context+.lookup(Name+)) || call(* Context+.lookupLink(Name+))) && args(context) && !withincode(com.nearinfinity..*); after(String context) : lookupByString(context) { AuditAPI.auditJNDILookup(context); } after(Name context) : lookupByName(context) { AuditAPI.auditJNDILookup( context==null ? "null" : context.toString() ); }

© Near Infinity Corporation 19 Auditing Web Resources Decided to use a servlet filter instead of aspects to audit access to web resources –Implementing in aspects is difficult Not all requests are handled by application code –Not Found (404) requests –Requests for static resources (images, html, css) Aspects must weave into container classes to get all requests –Difficult to figure out which application a request is for –Difficult to configure applications differently –Easier to get working in many containers –Has the downside of requiring a modification to web.xml of audited applications

© Near Infinity Corporation 20 Sample Data Wed Dec 01 22:25:25 EST POST my search text my search text

© Near Infinity Corporation 21 Lessons Learned IDE tools are not as helpful when developing aspect libraries –You dont have the code you are writing aspects for –Sample applications provide only a few test cases Knowledge of J2EE classloader architectures is important when developing aspects –Drives how the aspects are deployed –Determines how the pointcuts can be written Weaving performance is critical in load-time situations

© Near Infinity Corporation intelliPrints TM The concepts discussed today were used in the creation of Near Infinitys intelliPrints

© Near Infinity Corporation 23 Future Directions Add aspects to audit security related events –Execution of system commands –Socket I/O –File manipulation Add aspects to audit third party products –Search engine APIs –Web frameworks –Persistence frameworks

© Near Infinity Corporation 24 Questions?