8/19/20151 Securing a Database Based on notes by Fei Li and Hong Li.

Slides:



Advertisements
Similar presentations
Message Passing Vs Distributed Objects
Advertisements

What is RMI? Remote Method Invocation –A true distributed computing application interface for Java, written to provide easy access to objects existing.
VOYAGER: Yet Another Secure Web Browser to Demonstrate Secure Socket Layer Working and Implementation By : Shrinivas G. Deshpande Advisor: Dr. Chung E.
SSL (Secure Socket Layer)
Copyright © 2001 Qusay H. Mahmoud RMI – Remote Method Invocation Introduction What is RMI? RMI System Architecture How does RMI work? Distributed Garbage.
Company LOGO Remote Method Invocation Georgi Cholakov, Emil Doychev, University of Plovdiv “Paisii.
FONG CHAN SING (143334) WONG YEW JOON (143388). JAVA RMI is a distributive system programming interface introduced in JDK 1.1. A library that allows an.
Real-Time Authentication Using Digital Signature Schema Marissa Hollingsworth BOISECRYPT ‘09.
Java Security Model Lab#1 I. Omaima Al-Matrafi. Safety features built into the JVM Type-safe reference casting Structured memory access (no pointer arithmetic)
LAB#2 JAVA SECURITY OVERVIEW Prepared by: I.Raniah Alghamdi.
Notes to the presenter. I would like to thank Jim Waldo, Jon Bostrom, and Dennis Govoni. They helped me put this presentation together for the field.
Chapter 7 HARDENING SERVERS.
Remote Method Invocation Chin-Chih Chang. Java Remote Object Invocation In Java, the object is serialized before being passed as a parameter to an RMI.
Distributed Application Development B. Ramamurthy.
Component-Based Software Engineering Introducing the Bank Example Paul Krause.
Certificates, SSL and IPsec Ahmed Muaydh Sara Bin Saif Shi-Jey Chou Advisor:Dr. Leszek Lilien.
Java Server Programming Jeff Schmitt Towson University October 15, 1998.
Web Proxy Server. Proxy Server Introduction Returns status and error messages. Handles http CGI requests. –For more information about CGI please refer.
JSSE API University of Palestine Eng. Wisam Zaqoot April 2010.
Softsmith Infotech Secure Socket Layer (SSL) and Tomcat.
CSCI 6962: Server-side Design and Programming
Advance Computer Programming Java Database Connectivity (JDBC) – In order to connect a Java application to a database, you need to use a JDBC driver. –
Getting connected.  Java application calls the JDBC library.  JDBC loads a driver which talks to the database.  We can change database engines without.
JDBC Vs. Java Blend Presentation by Gopal Manchikanti Shivakumar Balasubramanyam.
1 CSC 440 Database Management Systems JDBC This presentation uses slides and lecture notes available from
SYSTEM ADMINISTRATION Chapter 13 Security Protocols.
CHAPTER 2 PCs on the Internet Suraya Alias. The TCP/IP Suite of Protocols Internet applications – client/server applications The client requested data.
Oracle8 JDBC Drivers Section 2. Common Features of Oracle JDBC Drivers The server-side and client-side Oracle JDBC drivers provide the same basic functionality.
Securing Large Applications CSCI 5931 Web Security Rungang Mo, Yingying Sun.
Hands-On Microsoft Windows Server Security Enhancements in Windows Server 2008 Windows Server 2008 was created to emphasize security –Reduced attack.
Objectives Configure routing in Windows Server 2008 Configure Routing and Remote Access Services in Windows Server 2008 Network Address Translation 1.
CSCI 6962: Server-side Design and Programming Web Services.
CS 390- Unix Programming Environment CS 390 Unix Programming Environment Topics to be covered: Distributed Computing Fundamentals.
MySQL, Java, and JDBC CSE 3330 Southern Methodist University.
Protecting Internet Communications: Encryption  Encryption: Process of transforming plain text or data into cipher text that cannot be read by anyone.
CS4273: Distributed System Technologies and Programming Lecture 13: Review.
Connecting to Oracle using Java November 4, 2009 David Goldschmidt, Ph.D. David Goldschmidt, Ph.D.
Advanced Programming Collage of Information Technology University of Palestine, Gaza Prepared by: Mahmoud Rafeek Alfarra Lecture12: Accessing Databases.
Spring/2002 Distributed Software Engineering C:\unocourses\4350\slides\DefiningThreads 1 RMI.
Database Architectures Database System Architectures Considerations – Data storage: Where do the data and DBMS reside? – Processing: Where.
UNIT III - JDBC JDBC Overview – JDBC implementation – Connection class – Statements - Catching Database Results, handling database Queries. Networking–
Java Remote Method Invocation (RMI) Overview of RMI Java RMI allowed programmer to execute remote function class using the same semantics as local functions.
TIBCO BusinessWorks.  Generating the key   You will have to create a certificate as you own the server.  The ‘Keytool’ is a utility provided in the.
JS (Java Servlets). Internet evolution [1] The internet Internet started of as a static content dispersal and delivery mechanism, where files residing.
Database Security Cmpe 226 Fall 2015 By Akanksha Jain Jerry Mengyuan Zheng.
JSP Server Integrated with Oracle8i Project2, CMSC691X Summer02 Ching-li Peng Ying Zhang.
WEB SERVER SOFTWARE FEATURE SETS
CSI 3125, Preliminaries, page 1 JDBC. CSI 3125, Preliminaries, page 2 JDBC JDBC stands for Java Database Connectivity, which is a standard Java API (application.
Basics of JDBC Session 14.
Designing a Middleware Server for Abstract Database Connection.
Ch. NoNameMarks 01AWT24 02Networking18 03JDBC20 04Swing18 05Servlet20 Advance Java Programming.
UMBC Distributed Computing with Objects RMI/Corba CMSC 432 Shon Vick.
TCS Internal Security. 2 TCS Internal Objective Objective :  Android Platform Security Architecture.
JDBC Java and Databases. SWC – JDBC JDBC – Java DataBase Connectivity An API (i.e. a set of classes and methods), for working with databases in.
CSC 480 Software Engineering Lab 6 – RMI Nov 8, 2002.
EMI is partially funded by the European Commission under Grant Agreement RI Common Authentication Library Daniel Kouril, for the CaNL PT EGI CF.
JDBC.
1 Example security systems n Kerberos n Secure shell.
Liang, Introduction to Java Programming, Fifth Edition, (c) 2005 Pearson Education, Inc. All rights reserved Chapter 29 Remote Method.
NET8 Protocol Analysis & Emulation Guided by Dr. Ran Giladi Students: Michal Bukai Ran Steinherz.
Data Virtualization Tutorial… SSL with CIS Web Data Sources
ODBC, OCCI and JDBC overview
JDBC Database Management Database connectivity
Advanced Web Automation Using Selenium
What is RMI? Remote Method Invocation
NETWORK PROGRAMMING CNET 441
Chapter 3: Windows7 Part 4.
Based on notes by Fei Li and Hong Li
Mr. Harish Sharma Asst. Professor Dept. of CA & IT SGRRITS Dehradun
Designing IIS Security (IIS – Internet Information Service)
Presentation transcript:

8/19/20151 Securing a Database Based on notes by Fei Li and Hong Li

8/19/20152 Topics  Securing the connections to the database: 1.SSL-tunneling between client machine and database machine 2.A secure JDBC driver  Securing the data within a database  Secure Thin JDBC Connection Sample

8/19/20153 JDBC Basics  JDBC is a Java API for executing SQL statements  JDBC makes it possible to do three things: 1.establish a connection with a database 2.send SQL statements 3.process the results.

8/19/20154 Securing a database  Two points of attack against a database –The connection between clients and database –The data in the database

8/19/20155 Securing the JDBC driver transmission  Approach 1: SSL-tunneling –Running a daemon on the client machine –Advantage: simplicity and performance –Disadvantage: not enough of authentication, esp. if the client machine is a shared or multi-user environment.  Approach 2: Proxy to JDBC drivers –developing a JDBC driver proxy –Advantage: provide more security –Disadvantage: much more complex

8/19/20156 SSL-Tunneling TunnelServer Database instance Database Machine TunnelServer Client Machine Client Application SQL request SQL response SQL request SSL Socket

8/19/20157 The SSL-Tunneling Approach  Two instances of the tunnel server, one on the client machine and the other on the database server machine  Each instance serves as a proxy.  Simplicity of encrypting the database connection by SSL-tunneling between the client application and the DBMS

8/19/20158 Query processing Client Machine Client application The JDBC client Client-side tunnel server Reads unencrypted data from the JDBC client; Write it encrypted to the database machine over SSL Database Machine Server-side tunnel server Reads the encrypted data from the client-side tunnel server; Sends it unencrypted to the DBMS over localhost Database server

8/19/20159 Response processing Client Machine Client-side tunnel server Reads encrypted data from the server-side tunnel server; Write it unencrypted to the JDBC client; Client application Database Machine Database server Sends query result to the tunnel server Server-side tunnel server Reads the query result from the DBMS over localhost; Sends it encrypted to the client-side tunnel server;

8/19/ The SSL-Tunneling Approach TunnelServer Database instance Database Machine TunnelServer Client Machine Client Application 3. SQL request 4. SQL response 6. SQL response 1. SQL request 2. Encrypted SQL request 5. Encrypted SQL response Assumption: Connections to localhost cannot be snooped. True or false?

8/19/ Example 1: The Tunnel Server  Two classes –TunnelServer –TunnelThread  TunnelServer class (p. 310) –Correction: client (mRemote == false) or the server (mRemote == true) public TunnelServer (String server, int appPort, int tunnelPort, boolean remote) { super(); mDestServer = server; mAppPort = appPort; mTunnelPort = tunnelPort; mRemote = remote; waitForConnections(); }

8/19/ Example1: The Tunnel Server  Get server socket, waiting for connections, and create two instances of TunnelThread. private void waitForConnections() { …… serverSocket = getServerSocket(); while (mListening) { try { logMessage("Waiting for connections."); srcSocket = serverSocket.accept(); …… destSocket = connect(); logMessage("Connected to remote server at " + destSocket.getInetAddress() + "."); fromClient = getTunnelThread("fromClient"); toClient = getTunnelThread("toClient"); ……

8/19/ Example1: The Tunnel Server  The TunnelThread class (p ) –Forwarding requests and responds /** Creates new TunnelThread name a name for this thread*/ public TunnelThread(String name) { super(name); setDaemon(true); } /**Default constructor -- create a tunnel thread with a default name*/ public TunnelThread( ) { super( ); setDaemon(true); } public void run ( ) { }

8/19/ Example1: The Tunnel Server  Run the Tunnel Server with JDBC 1.Generate keystore/certificates for client and server  serverKeyStore, clientKeyStore (p.317) 2.Copy serverKeyStore to the database server; Start the tunnel server on the server side (database machine) 3.Copy clientKeyStore to the client machine; Start the tunnel server on the client side (client machine) (p.318) 4.Run a test application on the client machine

8/19/ Example1: The Tunnel Server  Create Keystore >keytool -genkey -keyalg RSA -keystore serverKeyStore >keytool -genkey -keyalg RSA -keystore clientKeyStore

8/19/ Example1: The Tunnel Server  Create Keystore –Export the certificates >keytool -export -keystore serverKeyStore -file server.cer >keytool -export -keystore clientKeyStore -file client.cer

8/19/ Example1: The Tunnel Server  Create Keystore –Import the certificates >keytool -import -file client.cer -alias client -keystore serverKeyStore >keytool -import -file server.cer -alias server -keystore clientKeyStore

8/19/ Example1: The Tunnel Server  Start the tunnel server on the server –Copy serverKeyStore TunnelServer.class, and TunnelThread.class to the database machine >java -Djavax.net.ssl.keyStore=serverKeyStore -Djavax.net.ssl.keyStorePassword=sps2020 -Djavax.net.ssl.trustStore=serverKeyStore com.isnetworks.crypto.net.TunnelServer localhost remote  Exercise: –Use the TunnelServer.java source code to trace the execution of the server-side TunnelServer and show its screen output.

8/19/ Example1: The Tunnel Server  Start the tunnel server on the client –Copy clientKeyStore TunnelServer.class, and TunnelThread.class to the clinet machine >java -Djavax.net.ssl.keyStore=clientKeyStore -Djavax.net.ssl.keyStorePassword=cps2020 -Djavax.net.ssl.trustStore=clientKeyStore com.isnetworks.crypto.net.TunnelServer diamond.rocks.uhcl.edu local

8/19/ Example1: The Tunnel Server  Run a test application on the client machine –Use JDBCTest.java –Set the JDBC driver (classes.zip) in the classpath DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver()); Connection conn = DriverManager.getConnection ( “username", “password");

8/19/ Example1: The Tunnel Server  Sample programs for running Tunnel Server on dcm.uhcl.edu (the client application) and diamond.rocks.uhcl.edu (the DBMS server): –TunnelServer.javaTunnelServer.java –TunnelThread.javaTunnelThread.java –JDBCTest.javaJDBCTest.java  Detailed instructions: instructions.docinstructions.doc

8/19/ Securing the JDBC Driver Transmission  Approach 2: Proxy to JDBC drivers –developing a JDBC driver proxy –Advantage: provide more security –Disadvantage: much more complex

8/19/ The JDBC Driver Proxy  Provide the encryption and authentication for many applications –Delegate all the calls to dynamically bound driver  Provide proxies to JDBC driver classes –Proxy design pattern in distributed computing  Use SSL for the connection –Encryption –Authentication later on

8/19/ The JDBC Driver Database Machine DB Secure JDBC Driver Proxy Database client (application server)

8/19/ The JDBC Driver  Client-Server communication –Server handles configuration, connections to the DB, and delegation of the JDBC calls –Client delegates all the connections to the server  Choose RMI as a network transport for communication –Have to add one more layer to the remote call –The diagram on p.321.

8/19/  Implementation –Delegate the common operations to an abstract super class. –Use a single remote class to pass any method call instead of creating an RMI proxy for each JDBC interface –Is a complex solution to a simple problem –Proxy pattern enables developer to add service The JDBC Driver

8/19/  Using the secure JDBC driver Detailed instructions for running the sample application: SecureDriver.rtfSecureDriver.rtf  Steps of Configuring the driver: 1.Generate the keys and certificates 2.Edit the SecureDriver_config.xml file 3.Create policy files for the server and client The JDBC Driver

8/19/  Edit the SecureDriver_config.xml file –Defines JDBC connection directly to the database from the secure driver  Create policy files –RMI requires that code run with a security manager –Add some special permissions to policy files –Server policy file The ability to connect to the database The ability to talk to the RMI registry The ability to receive a connection from a remote client The JDBC Driver

8/19/ The JDBC Driver  Connecting to the RMI server process: –The connect( ) method is called by DriverManager and connects to the RMI server process, which is where the actual JDBC connections reside.

8/19/ The JDBC Driver  Discussion: Can the application be modified to run without RMI? How?

8/19/ Securing Data in the Database  Protect the data in database –Database permission Should be set properly by the administrator –Read- or write-only database If it is well protected, highly controlled, and not often accessed Large online retailers use write-only database

8/19/ Securing data in the database  Protect the data in databases –Symmetric encryption Applications storing a secret key need to be completely safe –Asymmetric encryption Public key is used for encrypting the data in the DB Private key must be stored somewhere safe.  Disadvantage of encrypting data –Expensive –Remove some of the value of using a database

8/19/ Example3: Encrypting credit cards Credit Cards 3Xizmj2 Cg31C1l … Database (Stores encrypted credit card data) Finance client Decrypt Server One-way encrypt

8/19/ Encrypting credit cards CreditCardFactory -mPublicKey +createCreditCard() +findAllCreditCards() +findCreditCard() CreditCard -mAccountID -mCreditCardNumber +CreditCard() +getAccountID() +getCreditCardNumber() DatabaseOperations +getAllCreditCardAccountIDs() +loadCreditCardDBO() +store(creditCardDBO:CreditCardDBO) CrditCardDBO -mAccountID -mEncryptedCCNumber -mEncryptedSessionKey +CreditCardDBO() +getAccountID() +getEncryptedCCNumber() +getEncryptedSessionKey()

8/19/ Encrypting credit cards  Testing the application – CreateTest.java –Create a credit card based on user-specified account ID and credit card number Create a Properties object from the file system Properties properties = new Properties(); FileInputStream fis = new FileInputStream(PROPERTIES_FILE); properties.load(fis); fis.close(); // Create the credit card CreditCardFactory factory = new CreditCardFactory(properties); CreditCard creditCard = factory.createCreditCard(id,ccNumber);

8/19/ Encrypting credit cards  Testing the application – ViewTest –Define the location of the keystore –Load the keystore to retrieve the private key private static final String KEYSTORE = "creditcardExample.ks"; …… // Load the keystore to retrieve the private key. String ksType = KeyStore.getDefaultType(); KeyStore ks = KeyStore.getInstance(ksType); FileInputStream fis = new FileInputStream(KEYSTORE); ks.load(fis,PASSWORD); fis.close(); PrivateKey privateKey = (PrivateKey)ks.getKey("mykey",PASSWORD);

8/19/ Secure Thin JDBC Connection  Oracle JDBC Thin Driver –The Oracle JDBC Thin driver is a 'Type IV' (native protocol, 100% Pure Java) implementation that complies with the JDBC 1.22 standard. –The JDBC Thin driver uses Java Sockets to connect directly to the Oracle Server –The JDBC Thin driver does not require Oracle software on the client side

8/19/ Secure Thin JDBC Connection  Encryption and integrity support –use Oracle Advanced Security data encryption and integrity features in your Java database applications – When using the Thin driver, the parameters are set through a Java properties file –Encryption is enabled or disabled based on a combination of the client-side encryption-level setting and the server-side encryption-level setting

8/19/ Secure Thin JDBC Connection  Get SecureThinDriver.jar to run the sample –Configuring Encryption Parameter Using Oracle Net Manager –Run the Application using JDeveloper Environment –Run the Application from JDK Environment

8/19/ Reference [1] JDBC Introduction [2] J. Garms and D. Somerfield. Professional Java Security [3] Secure Thin JDBC Connection iver/Readme.html [4] The status of HIPNS eding.htm [5] Improving Database Performance with Oracle8 ‚