LOC-17 Update main README to remove dependancies (to avoid duplication of info)
[LocalChat.git] /
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
# LocalChat


## About

Localchat is a simple and lightweight chat application. It's primary purpose is to provide a means to have a multi-user Off-The-Record transient chat, minimising the likelihood that anyone but the chat participants has even a record that the chat took place.

It is not designed to be exposed to the internet at large. Instead, the primary intended means of use is to deploy it onto a new system (such as an EC2 instance), have user's SSH tunnel in (or use other supported methods) to use it and then discard the system once that chat has completed.

In other words, it's not designed as a generic chat application, but as one to be used for clandestine chats that are hard to monitor/intercept.

The provided client uses basic End To End encryption (currently using PGP as the encryption mechanism), and the server holds encrypted payloads in memory only (to ensure the ciphertext doesn't end up captured on the hosting provider's SAN for a time). Message payloads are purged after a short interval to help reduce the potential exposure were someone to be monitoring the server's memory.

The default behaviour is a Multi-User Chat (MUC), however direct messaging between participants within a room is also supported.






## Dependancies

### Server

See [server/README.md](server/README.md)


### Client

See [client/README.md](client/README.md)





## Deployment Options

LocalChat is not designed to be publicly accessible and discoverable. It's been written to be relatively light-weight for ease of deployment (and subsequent destruction).

Under no circumstances should you configure it to bind to `0.0.0.0` as doing so would allow adversaries to not only discover it, but to start probing it in order to try and establish whether it's in use (and who's using it). There should *always* be some additional step (i.e. being able to SSH into a server, or knowing exactly where to find it) required before access is available.

Over time, it will likely be hardened further, but it's unlikely it will ever be considered safe for completely unrestricted access - allowing discoverability would allow adversaries to establish likely meeting places in advance.



### Direct Communication

The most simple deployment method is to run the server component somewhere, and then simply run the client on the same system. The problem with this is it means that the E2E encryption keys are in memory on the same system as the server.

    ./server/LocalChat.py
    ./client/LocalChatClient.py


So, it's recommended that you run the client on a seperate system and use a SSH tunnel to allow communication

    user@server1 $ ./server/LocalChat.py

    remuser@mymachine $ ssh -L 8090:127.0.0.1:8090 user@server1
    remuser@mymachine $ ./client/LocalChatClient.py

This ensures that anyone able to observe memory on the server cannot see the E2E keys.

As a variation of this, if you do not want the server component to appear on the server's filesystem (you will still need to install dependancies though) then you can also create a reverse tunnel back to another machine. Just be aware that if the connection drops, the server will be unavailable, so ensure you've a reliable connection


    user@server2 $ ./server/LocalChat.py
    user@server2 $ ssh -R 127.0.0.1:8090:127.0.0.1:8090 user@server1

    remuser@mymachine $ ssh -L 8090:127.0.0.1:8090 user@server1
    remuser@mymachine $ ./client/LocalChatClient.py
    

    
### Proxied Communications

It may be that you decide it's better to "hide" the server within an existing website, so that chat connections are mixed in with traffic to that site.

To do this, you simply need to proxy a path on that website back to the server. So you may have an existing Nginx server block like this:

    server {
            listen 443;

            root /usr/share/nginx/example.com/;
            index index.html;

            server_name example.com;

            ssl                  on;
            ssl_certificate      /etc/pki/tls/certs/example.com.crt;
            ssl_certificate_key  /etc/pki/tls/private/example.com.key;

            ssl_session_timeout  5m;

            location / {
                try_files $uri $uri/ =404;
            }

    }

You'd then add a `location` statement with a hard to guess path to handle the chat client

    server {
            listen 443;

            root /usr/share/nginx/example.com/;
            index index.html;

            server_name example.com;

            ssl                  on;
            ssl_certificate      /etc/pki/tls/certs/example.com.crt;
            ssl_certificate_key  /etc/pki/tls/private/example.com.key;

            ssl_session_timeout  5m;

            location / {
                try_files $uri $uri/ =404;
            }
            
            
            location /SM9vbtNrnZ0d6WQa1ByLjZEX/ {
                proxy_pass https://127.0.0.1:8090/;
            }        

    }

And make the server component available on that port (either by running directly, or using a SSH reverse tunnel as described above).

Assuming `example.com` serves a publicly signed and trusted certificate (you'd hope it does), we'll also want to re-enable cert verification. So the client is called with verification enabled and being passed the URL to use for requests

    ./client/LocalChatClient.py --verify https://example.com/SM9vbtNrnZ0d6WQa1ByLjZEX/
 
Later versions will implement the ability to include auth headers in the request so that you can 404 unauthorised requests to the 'hidden' path. Until then, unless there's a particularly strong reason not to, the SSH methods described above are the recommended routes of access.




## Copyright

LocalChat is Copyright (C) 2018 B Tasker. All Rights Reserved. 

Released Under GNU GPL V2 License, see LICENSE.