Nowadays, it is prudent to protect your privacy when downloading torrents on the net. A few lawsuits have recently been brought against ISP’s by businesses seeking damages from users allegedly downloading illegal content. Many of these lawsuits have centered on trying to get the ISP’s to release lists of customer IP addresses along with their associated activity logs. In this post you will learn how to install a VPN in the Transmission jail and when correctly set up, all your Transmission traffic will subsequently go through the VPN.
Using the Radarr, Transmission and Medusa plugins, my NAS system is better than it has ever been and I was also able to import my ZFS raid disks from my old N4F server with no problems. By following this post carefully you will easily be able to get OpenVPN installed and working though the FreeNAS Transmission jail to ensure only protected traffic is tunneled through our BT client. In my experience, this process is WAY easier that the setup required for N4F and I have setup 3 systems now with no problems using this method! Just so we’re clear, this post is NOT meant to be a tutorial on how to set up FreeNas. There are many ways to configure the FN server that depend largely on your system architecture – so head on over to the FN forums if you have basic operational questions.
This how-to is adapted from a post in the FN forums by Tango and I have modified it to work with Torguard though it might work with other VPN providers as well (your mileage may vary). This tutorial assumes you have your Freenas server setup and working correctly and that you have installed and tested the Transmission plugin to your satisfaction. I am currently using Torguard and I can highly recommend them. They offer many locations worldwide, are reasonably priced and have excellent customer service when you need it.
If you can’t see the button below please disable your ADBLOCKER for my site. I promise will never give you ads or track you in any way, but unfortunately the ad blockers see the link below as an ad and erase it from the displayed HTML. Thank you for your cooperation!
Here are the steps I followed to get VPN working on my FreeNas 11.1 server:
- You will need a VPN provider in order to get this going. Click here to try Torguard.
- SSH into freenas. (I use PuTTy)
- Get a list of jails:
root@freenas ~ : jls JID IP Address Hostname Path 3 - 192.168.1.50 transmission_1 /mnt/<volumename>/jails/transmission_1
- jexec into the jail (mine happens to be 3 – yours may vary)
root@freenas: ~ : jexec 3 tsch /bin/sh #(if you are having trouble try- sudo jexec 3 /bin/sh) root@transmisssion_1: ~ / :
- Install bash. May be prompted several times – reply Y then press enter each time.
root@transmission_1: ~ / : pkg install bash
- Install nano. Again, may be prompted several times. Reply Y each time.
root@transmission_1: ~ / : pkg install nano
- Move to the /etc folder.
root@transmission_1: ~ / : cd /etc root@transmission_1: ~ /etc :
- Fetch Portsnap via portsnap fetch:
**This will take a while to download and ask for several prompts – you know the drill.
root@transmission_1: ~ /etc : portsnap fetch
- Extract Ports to /usr/ports
root@transmission_1: ~ /etc : portsnap extract
**This will also take a long time and A LOT of scrolling will happen. It’s normal.
- Navigate to /usr/ports/security/openvpn
root@transmission_1: ~ /etc : cd /usr/ports/security/openvpn root@transmission_1: ~ /usr/ports/security/openvpn :
- Make a clean install which allows us to set the option of a password file.
root@transmission_1: ~ /usr/ports/security/openvpn : make install clean
**Blue screen should appear. Press the DOWN arrow and the SPACE bar to ensure the [ ] next to PW_Save ( 5th option down) has an X in it. Should look this:
x+[X] PW_Save Interactive passwords may be read from a file
(On latest versions of openvpn (Mar. 2016) you MAY NOT get an option #5 as described above, but openvpn appears to read passwords from a textfile anyways so you can safely skip this step.)
**then press enter. Lots of things should happen now…
- Go to root directory of the transmission_1 jail:
root@tranmission_1: ~ /usr/ports/security/openvpn : cd / root@transmission_1: ~ / :
- Enter Bash
root@transmission_1: ~ / : bash root@transmission_1: ~ / :
- Make a directory for OpenVPN & our files that we will download from Torguard:
root@transmission_1: ~ / : mkdir /usr/local/etc/openvpn
- Add lines to the rc.conf so OpenVPN starts when the jail starts:
root@transmission_1 ~ / : cd /etc # Note – use Ctrl+o will write the file and Ctrl+X will exit. root@transmission_1 ~ /etc : nano rc.conf # File is open. # Add the following (can copy/paste using ctrl+C then right clicking in the shell) openvpn_enable=”YES” openvpn_configfile=”/usr/local/etc/openvpn/openvpn.conf” # Write via Ctrl+O. Press Enter # Exit via Ctrl+X.
- Move to a new folder (helps me keep things straight):
root@transmission_1 ~ /etc : cd /media/
- Grab the Torguard files, you’ll likely need to grab them manually and install them through the FreeNas GUI as Torguard does not allow wget file transfers. If you have created your Transmission jail storage correctly (see link at beginning of article) you should be able to drag the Torguard files into your shared NAS ‘downloads’ directory and see them symlinked in your jail’s ‘/media’ directory.
You will need a login CLICK HERE to check out Torguard. Here is the link once you are logged in: https://torguard.net/downloads.php. You will want to grab the ‘Standard Port 443/TCP Configs” in the “OpenVPN Config Files and Scripts” section (near the bottom).
- Unzip the Torguard openvpn files into the ‘Media’ folder:
root@transmission_1 ~ /media : unzip TorguardPRO.zip
- Make a pass.txt file to hold your username and password.
root@tranmission_1 ~ /media : nano pass.txt # Nano will pop up. ONLY type in the following (substituting your REAL username and password of course) USER PASSWRD # Press Ctrl+o. call it pass.txt. then enter. then Ctrl+X
- Configure the .ovpn file of your selected server. (I used a Canadian-based.ovpn’ as it is still legal to torrent in Canada at this time. Torguard asks that you NOT use US-based servers for torrenting)
root@tranmission_1: ~ /media : nano 'Your_Selected.ovpn # On the auth-user-pass line add pass.txt after it like so: auth-user-pass pass.txt # Press Ctrl+o. call it Your_Selected.ovpn. then enter. then Ctrl+X
- Move the fixed Torguard files** into the correct folder we just created
**The actual OpenVPN files we created in Step 20 above.
#ca.crt next: root@transmission_1: ~ /media : cp /media/ca.crt /usr/local/etc/openvpn/ca.crt # our pass.txt file we created: root@transmission_1: ~ /media : cp /media/pass.txt /usr/local/etc/openvpn/pass.txt # Finally renaming the <Server>.ovpn file to .conf file (You'll have to use "" around the name if there is a space in it.) root@transmission_1: ~ /media : cp /media/Your_Selected.ovpn /usr/local/etc/openvpn/openvpn.conf
- Start your OpenVPN server:
root@transmission_1 ~ / : /usr/local/etc/rc.d/openvpn start
- Check your install. You should be able to query the VPN tunnel:
root@tranmission_1: ~ /media : ifconfig tun0 # You should see a printout like: # ifconfig tun0 tun0: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> metric 0 mtu 1500 options=80000<LINKSTATE> inet 10.9.0.22 --> 10.9.0.21 netmask 0xffffffff nd6 options=1<PERFORMNUD> Opened by PID 7036 # Or something similar...
- Congratulations! Your Transmission packets are now using Torguard!
- One caveat worth mentioning here: You probably won’t be able to automagically update the Transmission client from the GUI as I have never been able to get it to successfully update itself. Whether that is the fault of our modifications or just a bug in Freenas I am not sure. To update, just make a note of your Transmission jail’s storage structure and delete the plugin and re-install according to the guide again. It’s a bit of a PITA – but for now, it is the only way.
Not Working? Check out these useful commands and troubleshooting tips.
Useful Open VPN Commands:
#Stop openvpn root@transmission_1: ~ / : /usr/local/etc/rc.d/openvpn stop #Start openvpn root@transmission_1: ~ / : /usr/local/etc/rc.d/openvpn start #Restart openvpn root@transmission_1: ~ / : /usr/local/etc/rc.d/openvpn restart #Query Secure network VPN tunnel root@tranmission_1: ~ / : ifconfig tun0 #Query whole Freenas network root@transmission_1: ~ / : ifconfig # stop all openvpn processes root@transmission_1: ~ / : killall -TERM openvpn
Still not working as you expect? Check out the log files in Freenas before you post a comment.
#Check log files for clues root@transmission_1: ~ / : less /var/log/messages root@transmission_1: ~ / : less /var/log/messages root@transmission_1: ~ / : more -f /var/log/messages root@transmission_1: ~ / : cat /var/log/messages root@transmission_1: ~ / : tail -f /var/log/messages root@transmission_1: ~ / : grep -i error /var/log/messages **This one is good as it will filter the log for error messages.
Still not working? Check this post for clues (it’s a good troubleshooting primer as well). Just telling me it’s not working does not provide enough information to troubleshoot your problem. You wouldn’t take your car into the garage and say, “my car doesn’t work!” – you need to give me some clues to help you fix your problem. Check your steps carefully, every command has to be issued as it is shown in the how to. If you find any mistakes please let me know and I will fix them right away.