Professional Documents
Culture Documents
Project Report
Contents
1 Introduction 1 1.1 What the problem is . . . . . . . . . . . . . . . . . . . . . . . . . 1 1.2 Importance of the problem . . . . . . . . . . . . . . . . . . . . . 2 2 State of the Art 3 3 System Architecture 4 3.1 ESS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 3.2 CSS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 3.3 Smart Device Client . . . . . . . . . . . . . . . . . . . . . . . . . 5 3.4 Architecture Notes . . . . . . . . . . . . . . . . . . . . . . . . . . 6 4 How happyRC.NET works 7 4.1 Registering New User . . . . . . . . . . . . . . . . . . . . . . . . 7 4.2 Activating Remote Device . . . . . . . . . . . . . . . . . . . . . . 7 4.3 Showing Device State Change Interface . . . . . . . . . . . . . . 7 4.4 Calculating New State Numbers . . . . . . . . . . . . . . . . . . 7 4.5 Changing the State . . . . . . . . . . . . . . . . . . . . . . . . . . 8 4.6 Logging O_ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 4.7 Overall Activity Flow . . . . . . . . . . . . . . . . . . . . . . . . 8 5 Design Issues 11 5.1 ESS Client Design . . . . . . . . . . . . . . . . . . . . . . . . . . 11 5.2 CSS Server Design . . . . . . . . . . . . . . . . . . . . . . . . . . 13 5.3 WebService Design . . . . . . . . . . . . . . . . . . . . . . . . . . 13 6 Speci_c Technologies used 15 6.1 .NET Framework . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 6.1.1 The Common Language Runtime . . . . . . . . . . . . . . 16 6.2 .NET Remoting . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 7 Conclusion and Future Scope 18 A User Manuals 19 A.1 Manual for the ESS Client . . . . . . . . . . . . . . . . . . . . . . 19 A.1.1 Requirements . . . . . . . . . . . . . . . . . . . . . . . . . 19 A.1.2 Installing the Application . . . . . . . . . . . . . . . . . . 19 A.1.3 Using the Program . . . . . . . . . . . . . . . . . . . . . . 21 A.2 Manual for the CSS Server . . . . . . . . . . . . . . . . . . . . . 24 iii A.2.1 Requirements . . . . . . . . . . . . . . . . . . . . . . . . . 24 A.2.2 Using the Program . . . . . . . . . . . . . . . . . . . . . . 24 A.3 Manual for the CSS Webservice . . . . . . . . . . . . . . . . . . . 26 B Hardware Details 28 C CSS-ESS Protocol Details 29 C.1 Getting Connected . . . . . . . . . . . . . . . . . . . . . . . . . . 29 C.2 Security Paranoia and Encryption . . . . . . . . . . . . . . . . . 29 C.2.1 Two Types of Cryptography . . . . . . . . . . . . . . . . 29 C.2.2 Security Attacks . . . . . . . . . . . . . . . . . . . . . . . 30 C.2.3 Security Solution in happyRC.NET . . . . . . . . . . . . 30 C.3 The Request Reply Protocol . . . . . . . . . . . . . . . . . . . . . 31 C.3.1 Key Transfer . . . . . . . . . . . . . . . . . . . . . . . . . 31 C.3.2 Client Authentication . . . . . . . . . . . . . . . . . . . . 31 C.3.3 Getting the Device Details . . . . . . . . . . . . . . . . . 32 C.3.4 Commanding the ESS . . . . . . . . . . . . . . . . . . . . 32 C.3.5 Logging O_ . . . . . . . . . . . . . . . . . . . . . . . . . . 32 C.3.6 Exceptional Messages . . . . . . . . . . . . . . . . . . . . 33 C.4 Protocol at a glance . . . . . . . . . . . . . . . . . . . . . . . . . 33 D Device Con_guration File Format 34 E Developer Details { Writing a client for CSS 36
Bibliography 37 iv
List of Figures
3.1 Architecture of the overall System . . . . . . . . . . . . . . . . . 4 4.1 Overall Activity Flow Diagram . . . . . . . . . . . . . . . . . . . 9 A.1 Installation of .NET Framework 2.0 . . . . . . . . . . . . . . . . 20 A.2 ESS Client Installation Requirements Veri_cation . . . . . . . . . 20 A.3 ESS Client Installation Security Warning . . . . . . . . . . . . . 21 A.4 ESS Application Login Screen . . . . . . . . . . . . . . . . . . . . 21 A.5 ESS Application Settings Dialogue . . . . . . . . . . . . . . . . . 22 A.6 ESS Application { User Logged In . . . . . . . . . . . . . . . . . 23 A.7 ESS Application { Change Password . . . . . . . . . . . . . . . . 24 A.8 CSS Login Screen . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 A.9 Administration Tasks on the CSS . . . . . . . . . . . . . . . . . . 26 A.10 Smart Device: Logging in . . . . . . . . . . . . . . . . . . . . . . 26 A.11 Smart Device: Authentication Process . . . . . . . . . . . . . . . 27 A.12 Smart Device: Controlling Remote Device . . . . . . . . . . . . . 27 B.1 Hardware Circuit Diagram . . . . . . . . . . . . . . . . . . . . . . 28 C.1 CSS-ESS Protocol Overview . . . . . . . . . . . . . . . . . . . . . 33 v
List of Tables
5.1 Division of project work among team members . . . . . . . . . . 11 5.2 ESS Software Model Element Statistics Summary . . . . . . . . . 12 5.3 ESS Timeline Summary . . . . . . . . . . . . . . . . . . . . . . . 12 5.4 WebService Timeline Summary . . . . . . . . . . . . . . . . . . . 14 D.1 Device Con_guration File Format . . . . . . . . . . . . . . . . . . 35 vi
Chapter 1
Introduction
Computers and the related technologies are becoming more and more ubiquitous. Various technical arenas in the _eld of Computer Science and Engineering, or Information Technology have come very near to the common people. The number of homes with Personal Computers1 is gradually increasing. A day will come, somewhere in the long future, when PC is referred to in the same class of \Food, clothing and shelter". Improvements in the Networking technologies have fostered growth of very dense networks. Land line telephones have been becoming less and less popular and people now prefer communicating while on the move. ISPs are now laying down their own networks to provide broadband Internet access to customers. When people have a good connectivity at their disposal, with tremendous power of mobile computing to supplement the same, we can think of \connecting their home appliances to the mobile phone". With this, people would be able to turn on and o_, and to some extent, control the appliances at their home even from a distant place. One of the very basic examples of an utility of this is { switching on the air conditioner in the room just some time before reaching home, so that the room is su_ciently cool by then.
the device functionality on the internet, and then access the device from a smart device. However, this has certain disadvantages. 1. PC are not server systems. They should typically not run \server" softwares. 2. It is necessary that every PC has a global IP address that is recognized on the Internet. With the current stubborn setup of IPv4 and IPv6 not picking up momentum, this would be a major challenge. Users would de_nitely not be ready to shell out a lot of money for a leased IP address.
1Personal
1 V Sem Mini Project Report, Revision 1, December 3, 2004 2 Even if they are willing to, there is a very low limit to how many users can get such a privilege. 3. Keeping so many client server systems secure is a serious problem. With such unmanageable setup, maintaining the software system would be a mammoth task. The problem then is, to install a system that would facilitate many clients to use its architecture and get their devices \online" very quickly, inexpensively, and with minimal e_ort.
Chapter 2
Chapter 3
System Architecture
The happyRC.NET system consists of three main parts, namely the End User Server System(ESS), the Central Server System(CSS), and the Smart Device Client. Figure 3.1 shows the logical structure of these parts, and an outline of the components therein. Figure 3.1: Architecture of the overall System A brief description of these components is as follows:
3.1 ESS
The End user Server System is a client1 application that runs on the user's PC. It takes authentication details from the user and uses an encrypted TCP/IP
1The
word Server System is a misnomer. The Client installed on ESS acts as if there was a server exporting the device functionality
4 V Sem Mini Project Report, Revision 1, December 3, 2004 5 channel(See Appendix C) to talk to the CSS. It has a con_guration _le that contains details about the controllable hardware attached to the PC. It is the job of the ESS to understand commands from the CSS and change the device state accordingly.
3.2 CSS
The Central Server System is the heart of the art. It has three roles to play, and therefore has three components that export various important functionalities. General Component The General CSS Component is where most of the functionality resides. It is the job of this component to receive connections from various ESS PCs, and maintain their authentication states. This maintains a lookup information about exactly which ESS particular users are connected from, and what the device con_guration of their system is. It shares its memory space with the Remoting component described next. It is the job of this component to proxy requests from the remoting component to the ESS system, and return the occurrence of a success or failure. Remoting Component This component is a stub for .NET Remoting2 calls. It gives a reference to an object which has proxy functions written to allow Remoting clients to call functions of the General Component. Every connection to this component instantiates a new object which maintains the state (authentication, etc.) of the client. Methods in this object wait for a reply from the General Component and send the reply back to the client. Web Service To facilitate easy HTTP3 access from smart clients, this component becomes crucial. It sits on a web server (running IIS) and communicates to the General Component via the Remoting Component. The job of this component is to maintain authentication states over the web. It should ask the Remoting Component to provide the description of the user's device. It should then parse the description out, and display an interface that can change the device state. Put together, these components build up the CSS System which can provide facilities for any user to register his device online, and later on, use browser complaint smart client to remotely control the same.
V Sem Mini Project Report, Revision 1, December 3, 2004 6 Smart Devices Running Browsers This category includes devices that are very thin in functionality. Typically, these include mobile phones, Wireless PDAs, etc. They do not have the capability of running large programs, and ship with an operating system that provides a minimal browsing functionality. All that these can do is display primary interfaces, and request simple form submitted by the users. They need to interact with the Web Service component of the CSS in order to facilitate service. Smart Devices Running CSS Client Some devices have more features than plain smart devices, and are smarter then we think. Pocket PCs that run operating systems like Microsoft Windows CE have capabilities of running custom programs. A custom made CSS client(See Appendix E) can be installed on these devices so as to customize user interfaces. These devices can skip the Web Service component and directly interact with the CSS using .NET Remoting. Clearly, Laptops and Computers are smarter then even pocket PCs, and they can fall into this category.
Chapter 4
When the users log in to the system using the ESS, the ESS connects to the CSS and veri_es their identity. Having done that, the CSS requests the ESS to send the device details. The CSS parses the con_guration _le into an serialized object and sends it over to the CSS. The device is now ready to be remotely controlled
7 V Sem Mini Project Report, Revision 1, December 3, 2004 8 groups, these bytes can be combined into one. Thus, if the policy of a certain group is OR, a bitwise OR would be performed among all the states in that group. This newly generated number is the state of that group. For every such group speci_ed in the con_guration _le, a new state number is calculated. These state numbers are ordered by their group numbers, say 1,2,3, and stored for further processing. Group Zero is a special group, where there is no union policy. Every state in this group is sent as if it were in an independent group and the state numbers of all states in this device are added to the end of the stored list.
4.6 Logging O_
When the users log o_ from the smart clients, no signi_cant state changes occur in the CSS. The ESS still remains connected, and users can again use the smart client for further communication with device. However, when the uses log o_ from the ESS, the CSS discards all dynamic entries for this connection, and if some smart client tries to communicate with that discarded identity, they are returned error.
V Sem Mini Project Report, Revision 1, December 3, 2004 9 Figure 4.1: Overall Activity Flow Diagram 5. ESS communicates the details of the device to the CSS on the already established channel, and sets up callbacks on the CSS, so that it can receive interesting information from the same. 6. The CSS, when it receives the device details, it sets up a set of functions for the device, on the web service, to be remotely invoked. 7. The CSS maintains a table containing entries of which authenticated user is using which instance of the CSS-ESS messenger program. 8. A user can switch on his smart client. The client knows the CSS, or else, asks the user about the address of the CSS. 9. If the client is able to establish a connection to the CSS, it asks authentication details to the user. 10. The client calls the initialize function on the CSS by parameterizing it with the authentication details. 11. The CSS veri_es the authentication and if the client is a_rmatively identi _ed, it sends the device description to the client, along with the current state of the device, if asked. 12. The client extracts a form out of the obtained description and displays it to the user. 13. If the user suggests any changes in the form, the client parses those changes, and categorizes them into batch requests to the server, depending on the action groups. V Sem Mini Project Report, Revision 1, December 3, 2004 10 14. For each request that the client makes to the CSS, the CSS sends a word to the ESS that has to be written on the parallel port of the same. 15. The ESS acknowledges the CSS which in turn nods to the client. 16. The client maintains state using some form of cookies and repeatedly keeps asking user for further change in the circuit. The user can choose to logout or change his password. 17. Once logged out, there are no changes on the CSS and the ESS. 18. However, the user can choose to disconnect his circuit by closing the ESS application. In such a case, the CSS would dump all the connection details, including the device details of the disconnected ESS, into garbage. 19. In any use case, the client shall not allow remote disconnection of the ESS application.
Chapter 5
Design Issues
In this chapter, we would give details about how the project was conceived and built, i.e. the Analysis and design phase. Because the project team consists of four members, the work was distributed in blocks of modules as described in Table 5.1. Table 5.1: Division of project work among team members Modules Primary Assignment Person Hardware Circuit Varun Khullar ESS Client, Security Parlikar Alok Ulhas CSS (General Component) Shubham Shrestha Agrwal CSS (Web Service), Architecture Nishant Shrivastava Because the modules have been designed almost independently, the design issues are separately sectioned.
parallel port. The Managed Runtime of the .NET platform that was being used to develop the project does not allow \unsafe" I/O calls like this, and hence a DLLImport followed by a call to one of the entry points in the DLL was to be performed. The Windows documentation mentions how the Kernel API can be used to interact with external devices.[Mic03] The other essential thing was to tell the software, details of the hardware connected. To do this, a con_guration _le format was formulated. The format allows access to devices with up to 256 states. More details of the format can be found in Appendix D. Communicating with the CSS This task involved formulating a protocol that works over TCP/IP channel, and then an implementation of the same. The protocol was formulated taking a skeleton of SMTP like RequestReply protocols. Details of the protocol and how the transmission is suf_ciently strongly encrypted can be found in Appendix C. 11 V Sem Mini Project Report, Revision 1, December 3, 2004 12 The User Interface This task involved creating a GUI for the user to interact with the system. Some salient features of the GUI are: 1. Strict validation of inputs 2. Based on a state machine 3. User friendly errors 4. Use of registry to save settings. The key used for the purpose is HKEYnLocalMachinenSoftwarenhappyRC The ESS was designed in a round trip engineering mode. To start o_, we had a basic class diagram, with bare functionality built in. Then an automated code generation was done. That code was edited, and the diagrams modi_ed accordingly. The class diagram was always synchronized, and many times, adding more functionality was done from within the diagram. The tools Microsoft Visual Studio .NET 2005 and Microsoft Visio Enterprise Architect 2005 were very handy in this kind of approach. Table 5.2 shows the Element Statistics Summary of the ESS Software. It should be noted that the numbers in the table also count the classes and packages that the .NET provides. For example, every object is a specialization of the Object class, and hence the counter for Generalizations is that high. Table 5.2: ESS Software Model Element Statistics Summary Number of Interfaces 17 Number of Classes 41 Number of Data Types 2 Number of Attributes 81 Number of Parameters 62 Number of Operations 53 Number of Generalizations 45 Number of Packages 11 Number of Subsystems 1 Table 5.3 shows the Timeline Details imported as text from the Grant Chart. Dates speci_ed herein are not Assigned Dates, but are Actual dates. (That is, these are a posteriori Grant Chart Details). Table 5.3: ESS Timeline Summary Task Name Start Date Duration(Days) End Date Analysis of Software Tue 3/8/04 8 Thu 12/8/04 Basic Use Cases Wed 11/8/04 7 Thu 19/8/04 Basic Class Diagram Sun 22/8/04 8 Wed 1/9/04 Coding Implementation Wed 1/9/04 25 Tue 5/10/04 Minute Design Changes Fri 24/9/04 3 Tue 28/9/04 Testing/Debugging Tue 28/9/04 25 Mon 1/11/04 Deployment Ready Wed 17/11/04 3 Fri 19/11/04
The \Design Changes" mentioned in this Table (5.3) involved splitting up a class into two. The Refactoring tools in Visual Studio were used for the purpose. V Sem Mini Project Report, Revision 1, December 3, 2004 13
state of the User's ESS and the groups and the policy associated with groups of the User's appliances. After receiving the request of the user, as to what changes he wishes to make to the _nal state of the appliances, the _nal state of the end System is calculated and the words to output to the end system are transmitted to the CSS which in turn sends the data to the ESS. Table 5.4: WebService Timeline Summary Task Name Start Date Duration(Days) End Date Analysis of Software 6/8/04 8 15/8/04 Basic Use Cases 16/8/04 2 Thu 17/8/04 Coding Implementation Wed 12/9/04 13 Tue 26/9/04 Minute Design Changes Fri 24/10/04 3 Tue 28/10/04 Testing/Debugging Tue 28/10/04 4 Mon 1/11/04 Deployment Ready Wed 1/11/04 2 Fri 4/11/04
Chapter 6
hosts.
Chapter 7
Appendix A
User Manuals
The user manual of the ESS, CSS, and the Interface.
A.1.1 Requirements
Although e_orts were made to keep the ESS Client as light as possible, it still has a set of minimum system requirements, as follows: _ Microsoft Windows1 98 and Later. _ .NET Framework version 2.0 or later _ Network Connection _ Parallel Port (LPT1) on the host system
is possible to port the client to other operating systems like Linux, however the application as a part of this project compiles, but does not run on Linux
installed. Once you are done with the installation, restart your system and continue with the installation of this application. Figure A.1: Installation of .NET Framework 2.0 4. The installation would check for system requirements, during which it would show a progress splash screen as shown in Figure A.2. Figure A.2: ESS Client Installation Requirements Veri_cation 5. If you get a dialogue as shown in Figure A.3, you must be running the setup from a network location. Make sure you have copied the installation _les to your local system. 6. If your system had met the requirements of the application, it would get successfully installed. A shortcut would be added to the Start Menu, at the location All Programs -> IIITA. You can use this shortcut to run the application. 7. Just after the installation, the application would start running. You may proceed to start using the same. V Sem Mini Project Report, Revision 1, December 3, 2004 21 Figure A.3: ESS Client Installation Security Warning
Figure A.6: ESS Application { User Logged In Changing the Password 1. Follow steps in Section A.1.3 to log on from the ESS client. This would take you to the Logged In screen(Figure A.6). 2. Click the Change Password link. You would be taken to the password change interface as shown in Figure A.7. 3. Enter the old and new passwords. Also enter the new password again, for con_rmation, and click the Change button. If the password change was successful, you would be taken back to the Logged In Screen (Figure A.6). 4. In case there is some error changing the password, a red blinking icon would be displayed on the screen which would show the exact error on hovering the mouse over it. Please read the error and take the suggested corrective action. V Sem Mini Project Report, Revision 1, December 3, 2004 24 Figure A.7: ESS Application { Change Password Logging Out From the Logged In Screen (Figure A.6), click the Logout link in order to log out. The application will ask for a con_rmation during logout. Click OK to continue with the logout. You would be presented with the Login screen (Figure A.4) again.
A.2.1 Requirements
The CSS provides many to many connectivity for its users, and thus it is required that the underlying OS of the system supports this heavy network load. Here is a set of minimum requirements. _ .Net Framework 1.1 or Higher _ Windows Server 2003 (Recommended) or Windows XP (Professional)
V Sem Mini Project Report, Revision 1, December 3, 2004 26 User Management 1. Log in as told above. 2. Click the Admin task button after logging in. 3. Select the appropriate activity, from those shown in Figure A.9. 4. Write the user's name for performing that activity and click OK. Figure A.9: Administration Tasks on the CSS
Appendix B
Hardware Details
The following components were used to build the hardware. _ Relays- OMROM 5A/25 V DC : 10A/220 V Ac : 12V DC _ Optocouplers- 4N35 1.2v to drive. _ Resistors- 1 kilo ohm. _ DC Adaptor or Transformer -12V. _ Switch and socket, Bulb The relay is used as a electromechanical relay. The circuit consists of four independent sub-circuits which in turn can run four di_erent aplliances. The parallel port gives a potential of 3.3v to 3.5v which has been used to drive the optocoupler. The optocoupler is used as a switch for a 12v DC supply (given by a transformer). This 12V is being used to Switch on the relay. The relay is connected to 220 volts AC power supply. This power supply is now controlled by parallel port and can be used to run various appliances. Figure B.1 shows the circuit diagram of the connection. Figure B.1: Hardware Circuit Diagram 28
Appendix C
to talk to each other. A one liner description of the protocol is "Request Reply protocol over Encrypted TCP/IP Channel". The following sections explain how di_erent issues are tackled in the protocol.
the encryption algorithms used are symmetric, but the key transfer is done by encrypting the symmetric key in a public key encryption.[Sta02]
_ The system employs symmetric (shared key) cryptography _ The Rijndeal algorithm is used for the encryption.2 _ The shared key is not _xed, but is generated dynamically. _ The key is generated from two salts { a random string, and the user's password. Defense against Attacks It is important to note the following. _ The user's password is known to the ESS as the user is going to enter it for authentication purposes.
2.NET
V Sem Mini Project Report, Revision 1, December 3, 2004 31 _ The user's password is known to the CSS because it has a password database. _ No one else knows the user's password. (The user is supposed to keep it secret) A Symmetric Cryptography algorithm begins with sharing of the key. The key that we are using is generated from two parts, one of which is known to both the ESS and CSS. After the connection, CSS generates a random string and transmits it plain text to the ESS. Using this string and the password, both of them generate a \shared" key. 1. Because any evesdropper does not know the user's password, even if he reads the random string, he can not generate the key that is shared by CSS and ESS. 2. Because the generated key depends on a random string, which ought to be di_erent for every connection, the \shared key" is di_erent for every connection, and thus, the evesdropper can not replay his transaction log onto the network. Thus we see that the attacks of tapping, Log-Replay and man in the middle are defended by the system.
ESS: AUTH userName pA55w0rd CSS: ERR The ESS sends an encrypted text containing the username and password of the user. If the password was correct, the message could be decrypted by the CSS. In such a case, it would reply with a plaintext OK saying that the authentication is done. If it is not able to decrypt, it understands that the ESS had a di_erent shared key because the user entered incorrect password, and hence returns ERR in plain text. Note: The CSS replies to the authentication request in plain text. This was necessary because if the user has entered incorrect password, it would not be able to decrypt even the ERR response, and there would be a in_nite loop in the state machine.
C.3.5 Logging O_
The user on the ESS may choose to log his client o_. It is the job of the ESS to notify the CSS about the action and then close the network connection. ESS: OFF V Sem Mini Project Report, Revision 1, December 3, 2004 33 The ESS closes the socket immediately after this transfer. The CSS should close its end too, after it gets the noti_cation.
The earlier section describes that the protocol uses the commands KEY, AUTH, DESC, WRITE, OFF, EMERGENCY, OK, and ERR. Figure C.1 shows a graphical overview of the protocol. Figure C.1: CSS-ESS Protocol Overview
Appendix D
Appendix E
Bibliography
[Gri02] Fergal Grimes. Microsoft .NET for Programmers. Manning Publications Co., 2002. [Lam03] Leslie Lamport. LATEX - A document preparation system. Pearson Education, 2 edition, 2003. [Mic03] Microsoft. MSDN Documentation, 2003. [Sta02] William Stallings. Cryptography and Network Security. Pearson Education Asia, 2 edition, 2002. [Tan00] Andrew S. Tanenbaum. Computer Networks. Prentice Hall of India, 2000. 37