Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Best solution for private torrents? #386

Closed
antoniusostermann opened this issue Jul 25, 2015 · 7 comments
Closed

Best solution for private torrents? #386

antoniusostermann opened this issue Jul 25, 2015 · 7 comments

Comments

@antoniusostermann
Copy link

@antoniusostermann antoniusostermann commented Jul 25, 2015

What would be the best solution to set up private file transfer, so if I want to share a file only with some people or just one person. Would a private tracker be the way to go?

As far as I understood the api, the whole sending / receiving process is inteded to work "cross domain" with all seeders and leechers. Is there any way to create private torrents or to implement an own authentication process to only allow specific persons to download a file I am seeding?

@feross

This comment has been minimized.

Copy link
Member

@feross feross commented Jul 27, 2015

You should consider encrypting the file and only sharing the key with the person who you want to receive the file. That way, if the hash of the file leaks out somehow -- say via a bug in webtorrent #271 -- the file will be worthless.

Running your own private instance of bittorrent-tracker and explicitly disabling the DHT with the { dht: false } option to the WebTorrent constructor would help too.

When you create .torrent files with create-torrent or by calling webtorrent.seed, make sure to use the { private: true } option to tell clients to not share the hash with the DHT or with other peers using peer exchange (PEX).

Feel free to share your findings here, so that others who are trying to do the same thing can benefit!

@feross feross closed this Jul 27, 2015
@antoniusostermann

This comment has been minimized.

Copy link
Author

@antoniusostermann antoniusostermann commented Dec 10, 2015

Is there any option to do this on client side? So, is there any hook/callback available if someone downloads a file / part of a file from me? That way, I could restrict access to files on client side by forbidding the download.

@DiegoRBaquero

This comment has been minimized.

Copy link
Member

@DiegoRBaquero DiegoRBaquero commented Dec 10, 2015

@Canifex Yes, let me explain further what feross said.

You must do var client = new WebTorrent({ dht: false }) and when seeding the private feel do client.seed(myFile, {private: true})

I hope this helps :)

@antoniusostermann

This comment has been minimized.

Copy link
Author

@antoniusostermann antoniusostermann commented Dec 10, 2015

@DiegoRBaquero thanks for your fast helper (and of course @feross for the help before).

I understood that I can use a private tracker and seed files privatly with these options. But is there any additional option on client side to hook in if someone requests one of my seeded files? This would make it possible to implement some security logic on the client, not on a centralized tracker, which could be untrustable from a client's perspective. In addition, you could authorize requests even with using dht.

For example sth like:

var client = new WebTorrent({ dht: false });
client.seed(myFile, {private: true})
client.onLeech(function(file, leecher){
  if (downloadAllowed(file, leecher)) {
    return true;
  } else {
    return false;
  }
});
@DiegoRBaquero

This comment has been minimized.

Copy link
Member

@DiegoRBaquero DiegoRBaquero commented Dec 10, 2015

@Canifex No, at the moment there is not, and I doubt there will be (I think).

As long as you use those options and use a private tracker and don't share the hash/magnet/.torrent with unauthorized people, there's no way to find the file.

@feross

This comment has been minimized.

Copy link
Member

@feross feross commented Jan 9, 2016

There is actually a way to inspect the handshake that the remote peer sends you, and maybe even intercept it / decide to reject it.

The bittorrent-protocol package supports an extension API. Here's an example of an extension implemented with it: https://github.com/feross/ut_metadata/blob/master/index.js

If you hook into the 'wire' event on the torrent, you can add support for your special client-side handling.

Here's some untested code for how you might do it:

torrent.on('wire', function (wire) {
  wire.use(myExtension())
})

Beware that this is really, really low-level.

@lock

This comment has been minimized.

Copy link

@lock lock bot commented May 4, 2018

This thread has been automatically locked because it has not had recent activity. To discuss futher, please open a new issue.

@lock lock bot locked as resolved and limited conversation to collaborators May 4, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.