LOC-18 Deploy server with ansible
[LocalChat.git] / README.md
B Tasker 1 # LocalChat
2
3
B Tasker 4 ## About
B Tasker 5
6 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.
7
8 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.
9
10 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.
11
12 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.
13
14 The default behaviour is a Multi-User Chat (MUC), however direct messaging between participants within a room is also supported.
15
16
B Tasker 17
18
19
20
21 ## Dependancies
B Tasker 22
B Tasker 23 ### Server
24
25 See [server/README.md](server/README.md)
B Tasker 26
B Tasker 27
B Tasker 28 ### Client
29
B Tasker 30 See [client/README.md](client/README.md)
B Tasker 31
32
B Tasker 33
34
B Tasker 35
B Tasker 36 ## Deployment Options
37
38 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).
B Tasker 39
40 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.
41
42 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.
43
44
45
46 ### Direct Communication
47
48 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.
49
50 ./server/LocalChat.py
51 ./client/LocalChatClient.py
52
53
54 So, it's recommended that you run the client on a seperate system and use a SSH tunnel to allow communication
55
56 user@server1 $ ./server/LocalChat.py
57
58 remuser@mymachine $ ssh -L 8090:127.0.0.1:8090 user@server1
59 remuser@mymachine $ ./client/LocalChatClient.py
60
61 This ensures that anyone able to observe memory on the server cannot see the E2E keys.
62
63 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
64
65
66 user@server2 $ ./server/LocalChat.py
67 user@server2 $ ssh -R 127.0.0.1:8090:127.0.0.1:8090 user@server1
68
69 remuser@mymachine $ ssh -L 8090:127.0.0.1:8090 user@server1
70 remuser@mymachine $ ./client/LocalChatClient.py
71
72
73
74 ### Proxied Communications
75
76 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.
77
78 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:
79
80 server {
81 listen 443;
82
83 root /usr/share/nginx/example.com/;
84 index index.html;
85
86 server_name example.com;
87
88 ssl on;
89 ssl_certificate /etc/pki/tls/certs/example.com.crt;
90 ssl_certificate_key /etc/pki/tls/private/example.com.key;
91
92 ssl_session_timeout 5m;
93
94 location / {
95 try_files $uri $uri/ =404;
96 }
97
98 }
99
100 You'd then add a `location` statement with a hard to guess path to handle the chat client
101
102 server {
103 listen 443;
104
105 root /usr/share/nginx/example.com/;
106 index index.html;
107
108 server_name example.com;
109
110 ssl on;
111 ssl_certificate /etc/pki/tls/certs/example.com.crt;
112 ssl_certificate_key /etc/pki/tls/private/example.com.key;
113
114 ssl_session_timeout 5m;
115
116 location / {
117 try_files $uri $uri/ =404;
118 }
119
120
121 location /SM9vbtNrnZ0d6WQa1ByLjZEX/ {
122 proxy_pass https://127.0.0.1:8090/;
123 }
124
125 }
126
127 And make the server component available on that port (either by running directly, or using a SSH reverse tunnel as described above).
128
129 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
130
131 ./client/LocalChatClient.py --verify https://example.com/SM9vbtNrnZ0d6WQa1ByLjZEX/
132
133 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.
134
135
136
137
138 ## Copyright
139
140 LocalChat is Copyright (C) 2018 B Tasker. All Rights Reserved.
141
142 Released Under GNU GPL V2 License, see LICENSE.
B Tasker 143
144
145
146
147
148