0
Deploy your own P2P network            Dobrica Pavlinušić            http://blog.rot13.org     FOI Security Symposium, 201...
Static file distributionIf its good for w@rez and p00rn, it must have legitimate uses:   ● static file distribution (Linux...
BitTorrent overview BEP 0003 ● static .torrent file (SHA1 of info value)     ○ announce (tracker URL)     ○ comment, creat...
BitTorrent protocolhttp://wiki.theory.org/BitTorrentSpecification real detailed, up-to-date protocol documentation, not fa...
Torrent trackerMany, many choices, mostly php scripts...Wanted simpliest possible solution (without RDBMS if at allpossibl...
BitTorrent clientLeeching - have torrent, downloadSeeding - have torrent and whole file, uploadTransmission ● http://www.t...
I c@n haz t0rrent neTw0rk?$ opentracker -i $ip_tracker1 -p 6969 -s 9696$ opentracker -i $ip_tracker2 -p 6969 -s 9696$ rtor...
Conclusion● Its possible to build Torrent network at home!● Protocol is not documented as well as we would like     ○ it w...
Deploy your own P2P network
Upcoming SlideShare
Loading in...5
×

Deploy your own P2P network

2,184

Published on

Peer-to-peer networks are right solution for distributing mostly static content to multiple clients while exploiting bandwidth of all clients to share file chunks and available bandwidth.

Torrent is currently most used P2P network protocol, but in this day and age it suffers from lack of official specification and has stigma attached to it. However, if you want to distribute software updates or create multiple disaster recovery sites it makes sense to create private torrent network which will to it's job.

In this presentation I will try to explain what it takes to create your own peer-to-peer cloud based on torrent protocol.

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
2,184
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
9
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Transcript of "Deploy your own P2P network"

  1. 1. Deploy your own P2P network Dobrica Pavlinušić http://blog.rot13.org FOI Security Symposium, 2011-09-23 http://fsec.foi.hr
  2. 2. Static file distributionIf its good for w@rez and p00rn, it must have legitimate uses: ● static file distribution (Linux distributions, software updates, disaster recovery) ● sharing chunks between clients ○ get chunks already available on local LAN (behind NAT!) ○ distributed upload ○ aggregated bandwidth usageUse existing protocol: Bit Torrent (~50 % of Internet traffic, soit must work) but build private P2P cloud controlling all parts ofit.Dont create private swarm if you dont have to - be part ofpublic torrent swarm if possible to get all benefit of peers!Think about future: IPv6 support, scalability, etc.
  3. 3. BitTorrent overview BEP 0003 ● static .torrent file (SHA1 of info value) ○ announce (tracker URL) ○ comment, creation_date ○ info ■ name (MD5) ■ piece_length (2^18 = 256 K) ■ pieces (20*SHA1 of chunks) ■ length ● tracker ○ HTTP get protocol: info_hash, peer_id, ip, port, uploaded, downloaded, left, event ● BitTorrent clienthttp://bittorrent.org/beps/bep_0003.html
  4. 4. BitTorrent protocolhttp://wiki.theory.org/BitTorrentSpecification real detailed, up-to-date protocol documentation, not fake introduction!.torrent ● info ○ announce-list ○ private (disable PEX DHT!) ○ created_byTracker ● HTTP/HTTPS protocol ● scrapingPeer wire protocol (TCP)Bencoding, Algorithms, Extensions
  5. 5. Torrent trackerMany, many choices, mostly php scripts...Wanted simpliest possible solution (without RDBMS if at allpossible) with support for multiple instances, ergo:http://erdgeist.org/arts/software/opentracker/Documentation needs a bit of love: some options available arenot documented, and some documented options dont work inrecent versionCompilation from CVS repositoryPublic tracker at http://openbittorrent.com/
  6. 6. BitTorrent clientLeeching - have torrent, downloadSeeding - have torrent and whole file, uploadTransmission ● http://www.transmissionbt.com/ ● nice JSON-based API ● I failed to make file seeding work :-(rTorrent ● http://libtorrent.rakshasa.no/ ● XML/RPC API (over socket or port), RTPG protocol ● needs .rtorrent.rc to make API work ○ scgi_local=/tmp/rtorrent.socket
  7. 7. I c@n haz t0rrent neTw0rk?$ opentracker -i $ip_tracker1 -p 6969 -s 9696$ opentracker -i $ip_tracker2 -p 6969 -s 9696$ rtorrent -O directory=$srv/md5 -O session=$var/session -O schedule=watch_directory,5,5,load_start=$var/watch/*.torrent -O schedule=tied_directory,5,5,start_tied= -O schedule=untied_directory,5,5,close_untied= -O scgi_local=$var/socket -O bind=$ip_seed -O port_range=6890-6999 -O dht=auto -O dht_port=6881 -O peer_exchange=yes -O download_rate=15 -O upload_rate=15$ mktorrent --announce http://$ip_tracker1:6969/announce --announce http://$ip_tracker2:6969/announce --no-date --verbose --output $file.torrent $file$ ln -s $file.torrent $var/watch/ # seed!
  8. 8. Conclusion● Its possible to build Torrent network at home!● Protocol is not documented as well as we would like ○ it would be nice to have torrent files which dont use filename as part of SHA1 (thus, md5 filenames) ○ it would be handy to have chunks shared, even between different torrent files (since we allready have SHA1 sums) ○ PEX and DHT are black art (and important for NAT scenarios)
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×