summaryrefslogtreecommitdiffstats
path: root/README.md
blob: 47972eedde9fd98f3d6a7ac992864b81095ce686 (plain) (blame)
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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
# NoshiTalk

Self-hosted encrypted chat over Tor with Ed25519 cryptographic identity.

[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
[![Go 1.19+](https://img.shields.io/badge/Go-1.19+-00ADD8)](https://go.dev/)

## Overview

NoshiTalk is a self-hosted instant messaging platform designed for decentralized operation over Tor. Each instance operates independently with no central authority.

**Key characteristics:**
- Ed25519 cryptographic identity (no registration)
- E2E encryption (ECDH X25519 + AES-256-GCM)
- Ephemeral messages (RAM only, no persistence)
- Tor-only routing (.onion hidden services)
- Zero-knowledge server architecture

---

## VPS Installation (Debian/Ubuntu)

### Requirements

- Debian 11+ or Ubuntu 20.04+
- 512MB RAM minimum (1GB recommended)
- Tor daemon
- Go 1.19+

### Setup

#### 1. Install dependencies

```bash
sudo apt update && sudo apt upgrade -y
sudo apt install -y tor golang-go git build-essential
```

Verify:
```bash
tor --version  # Expected: 0.4.x+
go version     # Expected: 1.19+
```

#### 2. Clone repository

```bash
cd ~
git clone https://github.com/gabrix73/Noshitalk.git
cd Noshitalk
```

#### 3. Build with hardened flags

```bash
go build \
  -ldflags="-s -w" \
  -trimpath \
  -buildmode=pie \
  -o noshitalk-server \
  noshitalk-web-client.go
```

**Build flags:**
- `-ldflags="-s -w"`: Strip symbols and DWARF tables
- `-trimpath`: Remove filesystem paths
- `-buildmode=pie`: Position-independent executable (ASLR)

#### 4. Configure Tor

Edit configuration:
```bash
sudo nano /etc/tor/torrc
```

Add:
```
HiddenServiceDir /var/lib/tor/noshitalk/
HiddenServicePort 8080 127.0.0.1:8080
```

Restart Tor:
```bash
sudo systemctl restart tor
sudo systemctl enable tor
```

Retrieve .onion address:
```bash
sudo cat /var/lib/tor/noshitalk/hostname
```

#### 5. Create systemd service

```bash
sudo nano /etc/systemd/system/noshitalk.service
```

Configuration:
```ini
[Unit]
Description=NoshiTalk Server
After=network.target tor.service
Requires=tor.service

[Service]
Type=simple
User=YOUR_USERNAME
WorkingDirectory=/home/YOUR_USERNAME/Noshitalk
ExecStart=/home/YOUR_USERNAME/Noshitalk/noshitalk-server
Restart=always
RestartSec=10

NoNewPrivileges=true
PrivateTmp=true
ProtectSystem=strict
ProtectHome=true
ReadWritePaths=/home/YOUR_USERNAME/Noshitalk

[Install]
WantedBy=multi-user.target
```

Replace `YOUR_USERNAME` with actual username.

Enable and start:
```bash
sudo systemctl daemon-reload
sudo systemctl enable noshitalk
sudo systemctl start noshitalk
```

Check status:
```bash
sudo systemctl status noshitalk
```

#### 6. Configure firewall

```bash
sudo ufw default deny incoming
sudo ufw default allow outgoing
sudo ufw allow ssh
sudo ufw enable
```

Note: No incoming ports required (Tor handles routing).

#### 7. Verify

Access via Tor Browser:
```
http://YOUR_ONION_ADDRESS.onion
```

---

## Architecture

### Decentralization

Each server operates independently. No federation protocol implemented (servers do not communicate). Users connect directly to specific .onion addresses.

**Network characteristics:**
- No single point of failure
- Geographic/jurisdictional distribution
- Each instance sets own policies

### Cryptographic Implementation

**Identity:** Ed25519 public key hash serves as user identifier

**Key Exchange:** ECDH X25519 generates shared secret

**Encryption:** AES-256-GCM with derived keys

**Authentication:** Challenge-response using Ed25519 signatures

**Transport:** Tor v3 hidden services

### Zero-Knowledge Design

Server cannot:
- Decrypt message content (E2E encrypted)
- Log IP addresses (Tor anonymization)
- Access private keys (client-side generation)
- Store messages (RAM only, no database)

### Client Implementation

**Web:** JavaScript WebCrypto API, keys in browser memory

**Desktop:** Go native with memguard (encrypted RAM)

**CLI:** Go terminal interface

All clients generate keys locally and support .noshikey file export.

---

## Configuration

### Performance Tuning

For high-traffic servers, increase file descriptor limits:

```bash
sudo nano /etc/security/limits.conf
```

Add:
```
YOUR_USERNAME soft nofile 65535
YOUR_USERNAME hard nofile 65535
```

### Monitoring

View logs:
```bash
sudo journalctl -u noshitalk -f
```

Check Tor:
```bash
sudo systemctl status tor
```

### Updates

```bash
cd ~/Noshitalk
git pull
go build -ldflags="-s -w" -trimpath -buildmode=pie -o noshitalk-server noshitalk-web-client.go
sudo systemctl restart noshitalk
```

---

## Troubleshooting

### Server fails to start

Check logs:
```bash
sudo journalctl -u noshitalk -n 50
```

Common causes:
- Tor not running: `sudo systemctl start tor`
- Port conflict: Change port or kill conflicting process
- Permission errors: Verify systemd service user

### Tor connection issues

Verify Tor status:
```bash
sudo systemctl status tor
```

Check Tor logs:
```bash
sudo journalctl -u tor -f
```

Verify hidden service:
```bash
sudo ls -la /var/lib/tor/noshitalk/
```

### Client connection failures

1. Verify .onion address: `sudo cat /var/lib/tor/noshitalk/hostname`
2. Check server listening: `sudo netstat -tlnp | grep 8080`
3. Test locally: `curl -x socks5h://localhost:9050 http://YOUR_ONION.onion`

---

## Technical Specifications

| Component | Algorithm | Key Size |
|-----------|-----------|----------|
| Identity | Ed25519 | 256-bit |
| Key Exchange | ECDH X25519 | 256-bit |
| Encryption | AES-GCM | 256-bit |
| Authentication | HMAC-SHA256 | 256-bit |
| Transport | Tor v3 | - |

**Language:** Go

**License:** MIT

---

## Security

### Threat Model

**Protected against:**
- Network surveillance (Tor)
- Server compromise (E2E encryption)
- Metadata harvesting (zero-knowledge design)

**Not protected against:**
- Client device compromise
- Physical device seizure
- Social engineering
- Global passive adversary

### Memory Protection

**Desktop client:** memguard encrypts key material in RAM

**Web client:** Keys cleared on disconnect/panic

### Build Security

Recommended compilation:
```bash
go build -ldflags="-s -w" -trimpath -buildmode=pie
```

This enables:
- ASLR (Address Space Layout Randomization)
- Symbol stripping (reduced attack surface)
- Path obfuscation (information disclosure prevention)

---

## Contributing

1. Fork repository
2. Create feature branch
3. Commit changes
4. Open pull request

### Development

```bash
git clone https://github.com/gabrix73/Noshitalk.git
cd Noshitalk
go mod download
go test ./...
```

### Security Issues

Report to: security@virebent.art

Do not open public issues for vulnerabilities.

---

## License

MIT License. See [LICENSE](LICENSE) file.

---

## Links

- Documentation: [virebent.art/noshitalk.html](https://virebent.art/noshitalk.html)
- Repository: [github.com/gabrix73/Noshitalk](https://github.com/gabrix73/Noshitalk)
- Issues: [github.com/gabrix73/Noshitalk/issues](https://github.com/gabrix73/Noshitalk/issues)