Skip to content

Commit 2e318e5

Browse files
Update README.md
1 parent ad8870f commit 2e318e5

1 file changed

Lines changed: 107 additions & 1 deletion

File tree

README.md

Lines changed: 107 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,107 @@
1-
# Practica2
1+
# SDIS P2 Module 3: Secure RMI (SSL/TLS) & Streaming Auditing
2+
3+
<div align="center">
4+
5+
![Java](https://img.shields.io/badge/Java-ED8B00?style=for-the-badge&logo=java&logoColor=white)
6+
![Secure RMI](https://img.shields.io/badge/Architecture-Secure_RMI-blue?style=for-the-badge)
7+
![SSL/TLS](https://img.shields.io/badge/Security-SSL%2FTLS-success?style=for-the-badge)
8+
![TCP Sockets](https://img.shields.io/badge/Streaming-TCP_Sockets-red?style=for-the-badge)
9+
![Auditing](https://img.shields.io/badge/Logging-File_Auditing-yellow?style=for-the-badge)
10+
![Academic](https://img.shields.io/badge/Academic_Project-2nd_Year-purple?style=for-the-badge)
11+
12+
</div>
13+
14+
> **ABOUT THIS MODULE:**
15+
> This repository contains the final evolution (Module 3) of our Distributed Spotify architecture. It builds upon the Hybrid Streaming System from Module 2 by introducing **End-to-End Encryption (SSL/TLS)** for all RMI Control Plane communications and Callbacks. It also implements a **Persistent Auditing System** to log TCP streaming events.
16+
>
17+
> ⚠️ *Note: If you want to test the streaming architecture without generating SSL certificates, please switch to the `module-2` branch.*
18+
19+
---
20+
21+
## Architecture & Key Features
22+
23+
* **Secure RMI (SSL/TLS):** The entire control plane (metadata fetching, playlist management, and remote triggers) is secured using `SslRMIClientSocketFactory` and `SslRMIServerSocketFactory`.
24+
* **Encrypted Callbacks:** The server securely invokes methods on the client (like launching the media player) using bi-directional SSL handshakes.
25+
* **Persistent Event Logging:** Implements a robust `Utils` logger that records stream connections, TCP client IPs, and total transmitted bytes to a physical `streams.txt` file for server auditing.
26+
* **Auto-Discovery & Preloading (Bonus):** The server dynamically scans the `mp3files/origin` and `jpgfiles/` directories on startup, automatically preloading all available media files and their respective covers without manual client population.
27+
* **Network-Ready:** The system explicitly defines the `java.rmi.server.hostname` property, preventing `BindExceptions` and allowing deployment across different physical machines on the same LAN.
28+
29+
---
30+
31+
## Project Structure
32+
33+
```text
34+
Distributed-Spotify-Java-RMI
35+
┣ 📂 jpgfiles/
36+
┣ 📂 logs/
37+
┃ ┗ 📜 streams.txt
38+
┣ 📂 mp3files/
39+
┃ ┣ 📂 destination/
40+
┃ ┗ 📂 origin/
41+
┗ 📂 src/spotify/
42+
┣ 📂 media/
43+
┃ ┣ 📜 Globals.java
44+
┃ ┣ 📜 Media.java
45+
┃ ┗ 📜 MediaPlayer.java
46+
┣ 📂 rmi/
47+
┃ ┣ 📂 client/
48+
┃ ┃ ┣ 📜 SpotifyClientImpl.java
49+
┃ ┃ ┗ 📜 SpotifyStreamingClient.java
50+
┃ ┣ 📂 common/
51+
┃ ┃ ┣ 📜 ServerMessages.java
52+
┃ ┃ ┣ 📜 Spotify.java
53+
┃ ┃ ┣ 📜 SpotifyClient.java
54+
┃ ┃ ┗ 📜 SpotifyServer.java
55+
┃ ┗ 📂 server/
56+
┃ ┣ 📜 SpotifyLauncher.java
57+
┃ ┗ 📜 SpotifyServerImpl.java
58+
┣ 📂 stream/
59+
┃ ┣ 📜 ClientStream.java
60+
┃ ┗ 📜 ServerStream.java
61+
┗ 📂 utils/
62+
┣ 📜 ConcurrentMultiMap.java
63+
┣ 📜 MediaDirectory.java
64+
┗ 📜 Utils.java
65+
```
66+
67+
## Getting Started
68+
### 1. Generate the SSL Certificate (Mandatory)
69+
Before compiling or running, you must generate a dummy Keystore for the SSL Handshake. Open a terminal in the root directory and run:
70+
71+
```bash
72+
keytool -genkey -noprompt -alias spotify -dname "CN=localhost" -keyalg RSA -keystore keystore.jks -storepass 123456 -keypass 123456
73+
(Ensure the keystore.jks file is present in the execution directory for both Server and Client).
74+
```
75+
76+
### 2. Compilation
77+
Compile the entire project from your src directory:
78+
79+
```bash
80+
javac spotify/common/*.java spotify/media/*.java spotify/utils/*.java spotify/server/*.java spotify/client/*.java spotify/stream/*.java
81+
```
82+
83+
### 3. Execution
84+
Start the Secure Server:
85+
The server will bind the secure registry and start logging to ./logs/streams.txt.
86+
87+
```bash
88+
java spotify.server.SpotifyLauncher
89+
```
90+
91+
Start the Secure Client:
92+
```bash
93+
java spotify.client.SpotifyStreamingClient
94+
```
95+
96+
Interaction Example (Server Auditing)
97+
When a client streams a song, the server console and the logs/streams.txt file will register:
98+
99+
```bash
100+
📝 DEBUG LOGS: Escrito registro en -> .../logs/streams.txt
101+
[2024-05-20 18:30:15] [STREAM] Streaming to: /127.0.0.1
102+
[2024-05-20 18:30:16] [STREAM] Stream finished. Tx Bytes: 242449
103+
```
104+
105+
### Authors
106+
107+
Iván Moro Cienfuegos, David Martín Sebastián, Eric Soto San José y Héctor

0 commit comments

Comments
 (0)