gdr / tuntox (public) (License: GPLv3) (since 2017-01-24) (hash sha1)
Tunnel TCP connections over the Tox protocol
List of commits:
Subject Hash Author Date (UTC)
Fixed some warnings b3b0e345a94830a186168a4ecd53e0259a00b0c0 GDR! 2016-12-07 14:26:38
Travis 5667e567a59041b673861804fc6eba3cf99fcb05 GDR! 2016-12-07 14:11:16
Travis 16bea5fe486f6d1bf47de820642e4568c1b1dc20 GDR! 2016-12-07 14:05:50
Made tuntox build with TokTok/c-toxcore e093c65637385fe3b3db6ce5a830e5c9c2a00dd4 GDR! 2016-12-07 13:56:26
Obtain shared secret from TUNTOX_SHARED_SECRET env variable ae6ff817c202fa6e41b6ec705152fbfee6c92cd1 GDR! 2016-12-07 12:55:06
Typo in -f help 3af296c20050408ec4c668bf052fe77441ebc538 GDR! 2016-10-12 11:46:55
corrected typo 315ee76599c2ebf92c9fed9b13ffad5ef50b849b Pietro Bonfa 2016-10-10 19:54:39
better comments and if logic f5da6d8db758db9367807b45fdf4fb1a5d09e815 Pietro Bonfa 2016-10-10 19:44:50
removed enforce option bb08cc0ae4789084f88586460c9c617fe6cbb328 Pietro Bonfa 2016-10-09 16:31:39
changed arguments for rules optoins fd085c2862153d16443451d96fc56d2e67873e9e Pietro Bonfa 2016-10-08 12:10:47
fixed bug with filter_policy 230e7ae1347fe613d63f3dca136128b29331f80d Pietro Bonfa 2016-10-07 12:17:09
Changed gdr.name relay ports d194df598555e6ba31d53f5b1ec74f370b869c8c GDR! 2016-10-05 19:45:34
Separate TCP relays from bootstrap nodes during bootstrap a5b237c6fc56787e8ce9e29c4c4778f462c0d849 GDR! 2016-10-05 18:56:18
Updated node list with generate_tox_bootstrap.py 298776994486b7c07dfede1d4190ff0e5aa8789a GDR! 2016-10-05 18:40:02
Added filter for hostname and port requests e5bf743ccb6f80b70a6017a39c30f7610012979b Pietro Bonfa 2016-10-05 18:10:15
Update README.md 24a0f954ce773571aff6562084553028c8352142 GDR! 2016-10-04 08:16:39
Whitelist debug statement a971c172985088d38297ed30318910144140a44b GDR! 2016-06-08 20:36:52
Coverity fix b081686b05931064b4f9a26621d77a5d43941832 GDR! 2016-06-08 15:28:41
Fixed default value for server whitelist mode e682a05cf64ea85e30cb88a089fe220c2081e5da GDR! 2016-06-08 15:16:25
Documentation for #14 e9393fb439f94461fdc665eb85af54f156e5be75 GDR! 2016-06-07 20:00:13
Commit b3b0e345a94830a186168a4ecd53e0259a00b0c0 - Fixed some warnings
Author: GDR!
Author date (UTC): 2016-12-07 14:26
Committer name: GDR!
Committer date (UTC): 2016-12-07 14:26
Parent(s): 5667e567a59041b673861804fc6eba3cf99fcb05
Signer:
Signing key:
Signing status: N
Tree: 724820bfcc6e770be3d8053a436257494a8b2b96
File Lines added Lines deleted
Makefile 1 1
README.md 1 1
client.c 7 9
client.h 1 1
main.c 1 1
main.h 3 0
File Makefile changed (mode: 100644) (index 1c4effd..1226d25)
1 1 SOURCES = $(wildcard *.c) SOURCES = $(wildcard *.c)
2 2 DEPS=libsodium toxcore DEPS=libsodium toxcore
3 3 CC=gcc CC=gcc
4 CFLAGS=-g #-std=c99
4 CFLAGS=-g -Wall #-std=c99
5 5 CFLAGS += $(shell pkg-config --cflags $(DEPS)) CFLAGS += $(shell pkg-config --cflags $(DEPS))
6 6 LDFLAGS=-g -pthread -lm -static -lrt LDFLAGS=-g -pthread -lm -static -lrt
7 7 LDFLAGS += $(shell pkg-config --static --libs $(DEPS)) LDFLAGS += $(shell pkg-config --static --libs $(DEPS))
File README.md changed (mode: 100644) (index cd38142..6007e75)
... ... Client can be ran as a regular non-root user, [unless A < 1024](https://www.linu
62 62
63 63 ## Security / threat model ## Security / threat model
64 64
65 **TUNTOX IS NOT SECURE WITHOUT THE -s SWITCH.** Supply *-s yourpassword* both on the server and the client, and you will be fine. This switch is introduced in 0.0.4, codename "Mr. Lahey's Got My Porno Tape!".
65 **TUNTOX IS NOT SECURE WITHOUT THE -s SWITCH.** Supply *-s yourpassword* both on the server and the client, and you will be fine. This switch is introduced in 0.0.4, codename "Mr. Lahey's Got My Porno Tape!". Even better, run `TUNTOX_SHARED_SECRET=yourpassword tuntox ...` on both sides.
66 66
67 67 The Tuntox server generates a new Tox ID on every startup, or saves its private key in a file. Anyone who wants to connect to this server needs its Tox ID, which consists of the publicly-known pubkey and a secret 32-bit "antispam" value. Then, the client sends a shared secret which is then compared to the secred supplied on server's command line. If they don't match, friend request is left unanswered. The Tuntox server generates a new Tox ID on every startup, or saves its private key in a file. Anyone who wants to connect to this server needs its Tox ID, which consists of the publicly-known pubkey and a secret 32-bit "antispam" value. Then, the client sends a shared secret which is then compared to the secred supplied on server's command line. If they don't match, friend request is left unanswered.
68 68
File client.c changed (mode: 100644) (index 0634702..381087c)
... ... int handle_pong_frame(protocol_frame *rcvd_frame)
37 37
38 38 if(ping_mode) if(ping_mode)
39 39 { {
40 // state = CLIENT_STATE_PONG_RECEIVED;
41 40 state = CLIENT_STATE_SEND_PING; state = CLIENT_STATE_SEND_PING;
42 41 } }
43 42 return 0; return 0;
 
... ... int handle_server_tcp_frame(protocol_frame *rcvd_frame)
198 197
199 198 if(sent_bytes < 0) if(sent_bytes < 0)
200 199 { {
201 char data[PROTOCOL_BUFFER_OFFSET];
200 uint8_t data[PROTOCOL_BUFFER_OFFSET];
202 201 protocol_frame frame_st, *frame; protocol_frame frame_st, *frame;
203 202
204 203 log_printf(L_INFO, "Could not write to socket %d: %s\n", write_sockfd, strerror(errno)); log_printf(L_INFO, "Could not write to socket %d: %s\n", write_sockfd, strerror(errno));
 
... ... int handle_server_tcp_frame(protocol_frame *rcvd_frame)
231 230 int handle_server_tcp_fin_frame(protocol_frame *rcvd_frame) int handle_server_tcp_fin_frame(protocol_frame *rcvd_frame)
232 231 { {
233 232 tunnel *tun=NULL; tunnel *tun=NULL;
234 int offset = 0;
235 233 int connid = rcvd_frame->connid; int connid = rcvd_frame->connid;
236 234
237 235 HASH_FIND_INT(by_id, &connid, tun); HASH_FIND_INT(by_id, &connid, tun);
 
... ... int handle_server_tcp_fin_frame(protocol_frame *rcvd_frame)
258 256 } }
259 257
260 258 /* Main loop for the client */ /* Main loop for the client */
261 int do_client_loop(char *tox_id_str)
259 int do_client_loop(unsigned char *tox_id_str)
262 260 { {
263 261 unsigned char tox_packet_buf[PROTOCOL_MAX_PACKET_SIZE]; unsigned char tox_packet_buf[PROTOCOL_MAX_PACKET_SIZE];
264 262 unsigned char tox_id[TOX_ADDRESS_SIZE]; unsigned char tox_id[TOX_ADDRESS_SIZE];
 
... ... int do_client_loop(char *tox_id_str)
273 271 client_tunnel.sockfd = 0; client_tunnel.sockfd = 0;
274 272 FD_ZERO(&client_master_fdset); FD_ZERO(&client_master_fdset);
275 273
276 tox_callback_friend_lossless_packet(tox, parse_lossless_packet, NULL);
274 tox_callback_friend_lossless_packet(tox, parse_lossless_packet);
277 275
278 276 if(!string_to_id(tox_id, tox_id_str)) if(!string_to_id(tox_id, tox_id_str))
279 277 { {
 
... ... int do_client_loop(char *tox_id_str)
292 290 while(1) while(1)
293 291 { {
294 292 /* Let tox do its stuff */ /* Let tox do its stuff */
295 tox_iterate(tox);
293 tox_iterate(tox, NULL);
296 294
297 295 switch(state) switch(state)
298 296 { {
 
... ... int do_client_loop(char *tox_id_str)
307 305 break; break;
308 306 case CLIENT_STATE_CONNECTED: case CLIENT_STATE_CONNECTED:
309 307 { {
310 uint8_t* data = "Hi, fellow tuntox instance!";
308 uint8_t* data = (uint8_t *)"Hi, fellow tuntox instance!";
311 309 uint16_t length = sizeof(data); uint16_t length = sizeof(data);
312 310 TOX_ERR_FRIEND_ADD add_error; TOX_ERR_FRIEND_ADD add_error;
313 311
314 312 if(use_shared_secret) if(use_shared_secret)
315 313 { {
316 data = shared_secret;
314 data = (uint8_t *)shared_secret;
317 315 data[TOX_MAX_FRIEND_REQUEST_LENGTH-1] = '\0'; data[TOX_MAX_FRIEND_REQUEST_LENGTH-1] = '\0';
318 length = strlen(data)+1;
316 length = strlen((char *)data)+1;
319 317 log_printf(L_DEBUG, "Sent shared secret of length %u\n", length); log_printf(L_DEBUG, "Sent shared secret of length %u\n", length);
320 318 } }
321 319
File client.h changed (mode: 100644) (index 1ac5008..abba3ab)
... ... int handle_pong_frame(protocol_frame *rcvd_frame);
18 18 int handle_acktunnel_frame(protocol_frame *rcvd_frame); int handle_acktunnel_frame(protocol_frame *rcvd_frame);
19 19 int handle_server_tcp_frame(protocol_frame *rcvd_frame); int handle_server_tcp_frame(protocol_frame *rcvd_frame);
20 20 int handle_server_tcp_fin_frame(protocol_frame *rcvd_frame); int handle_server_tcp_fin_frame(protocol_frame *rcvd_frame);
21 int do_client_loop(char *tox_id_str);
21 int do_client_loop(unsigned char *tox_id_str);
File main.c changed (mode: 100644) (index 783b509..99d9e52)
... ... void set_tox_username(Tox *tox)
177 177 int gai_result; int gai_result;
178 178 TOX_ERR_SET_INFO error; TOX_ERR_SET_INFO error;
179 179
180 gethostname(hostname, 1024);
180 gethostname((char*)hostname, 1024);
181 181 hostname[1023] = '\0'; hostname[1023] = '\0';
182 182
183 183 tox_self_set_name(tox, hostname, strlen(hostname), &error); tox_self_set_name(tox, hostname, strlen(hostname), &error);
File main.h changed (mode: 100644) (index 329135f..fdffa11)
... ... extern tunnel *by_id;
109 109 void parse_lossless_packet(Tox *tox, uint32_t friendnumber, const uint8_t *data, size_t len, void *tmp); void parse_lossless_packet(Tox *tox, uint32_t friendnumber, const uint8_t *data, size_t len, void *tmp);
110 110 tunnel *tunnel_create(int sockfd, int connid, uint32_t friendnumber); tunnel *tunnel_create(int sockfd, int connid, uint32_t friendnumber);
111 111 void tunnel_delete(tunnel *t); void tunnel_delete(tunnel *t);
112 void update_select_nfds(int fd);
113 int send_frame(protocol_frame *frame, uint8_t *data);
114 int send_tunnel_request_packet(char *remote_host, int remote_port, int friend_number);
112 115
113 116 void print_version(void); void print_version(void);
114 117 #endif #endif
Hints:
Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://rocketgit.com/user/gdr/tuntox

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@ssh.rocketgit.com/user/gdr/tuntox

Clone this repository using git:
git clone git://git.rocketgit.com/user/gdr/tuntox

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a merge request:
... clone the repository ...
... make some changes and some commits ...
git push origin main