3

Is it possible to limit BitTorrent Sync connections to a a specific network using the client software? Right now the closest I can come up with would be IP limitations imposed on each client using a firewall. This seems like it would work fine, except for if any client somehow ventures outside those firewall restrictions.

Squeak
  • 271
  • 1
  • 5

1 Answers1

3

If you are using Linux, iptables has a match called "owner" where you can apply certain rules based off the UID or GID of the process sending the data.

For instance:

  • Put the IP's or CIDR network addresses in a file (one entry per line)
  • Create a new user called btsync
  • Run the following:

    #/bin/bash
    
    RESTRICTED_IP_FILE="/some/file"
    
    sudo iptables -N btsync_filter
    sudo iptables -I OUTPUT -m owner --uid-owner btsync -j btsync_filter
    
    while read ip; do 
        [[ -n "$ip" ]] && sudo iptables -A btsync_filter -d $ip -j DROP
    done < $RESTRICTED_IP_FILE
    
    sudo -u btsync btsync
    

This will run btsync as the user btsync and all packets from that process that are going to a restricted IP will be dropped.

hololeap
  • 261
  • 1
  • 8