Install tranmission plugin…
1st problem, get OPENvpn working with an auth file
Source : http://forums.freenas.org/index.php...-connects-to-the-vpn.18669/page-2#post-108802
1) Gain shell acess to you jail, ssh into your freenas instance and list the jail instances
# jls
This command then allows you to enter the jail, replace the $ with the number shown for your transmission jail.
# jexec $ /bin/tcsh
1) Remove existing OPENvpn
# pkg remove openvpn
2) Get source of openvpn and recompile, at the blue screen enable the save_passwords option
# portsnap fetch
# portsnap extract
# cd /usr/ports/security/openvpn
# make install clean
Get your open vpn script from you VPN service, I'm using ipvanish which are pretty good. And check that you can log in ok
# openvpn nameofyourconf.conf
If your VPN logs in ok, then you can add this line to the conf file at the bottom that runs it in the background.
daemon
and add the path to you auth.txt where the first line is your account username and the second is the vpn password. now try running openvpn nameofconf.conf and it should automatically log in for you. run ifconfig to check and then pkill openvpn will shut it down.
#ifconfig
This should give you an entry called tun0, which we will use to bind transmission to so that if the VPN fails then it does not fall over to your normal connection. This works quite nicely. I've tried to use the --up command from OPENvpn to run a little script, which works fine in debian, but not in freebsd / in a jail.. I just could not get it working. I made a post elsewhere about it
http://forums.freenas.org/index.php?threads/transmission-vpn-script-fail.19928/
1. Next the script that passes the tun0 IP.
Make a script called up.sh
# nano up.sh
And place this into it
-----------------------------------
#!/bin/bash
/usr/local/etc/rc.d/transmission stop
pkill openvpn
sleep 5
echo "Starting VPN"
# you will need to point this to the location of you conf script. The wait is to get it to load before obtaining the IP
openvpn /media/home/vpn.conf
echo "Waiting for vpn to start..."
sleep 10
# This line extracts the IP from ifconfig. If anyone knows a better way to do this, let me know. The two -v removes the localhost,
# and the LAN IP, which should leave one entry which is your tun0 interface. Cut and paste this to see if it works.
var=$(ifconfig | grep -E 'inet.[0-9]' | grep -v '127.0.0.1' | grep -v '192.168.1.40' | awk '{ print $2}')
echo "VPN started IP: $var"
# This took some figuring out, but it essentially replaces the bind address in the settings.json with your vpn IP….
sed -i -e "s/\"bind-address-ipv4\".*/\"bind-address-ipv4\": \"$var\",/" /usr/pbi/transmission-amd64/etc/transmission/home/settings.json
echo "Transmission settings updated"
# start transmission again
/usr/local/etc/rc.d/transmission start
-------------------------------------
now when you run up.sh it should automatically start the VPN and bind transmission to it. I should say that there is an alternative method of using sed online but it takes a settings_template.json file and replaces some text. I did not like this approach as any settings you adjusted when the client was running were lost. this keeps the original settings.json file.
happy torrenting...
1st problem, get OPENvpn working with an auth file
Source : http://forums.freenas.org/index.php...-connects-to-the-vpn.18669/page-2#post-108802
1) Gain shell acess to you jail, ssh into your freenas instance and list the jail instances
# jls
This command then allows you to enter the jail, replace the $ with the number shown for your transmission jail.
# jexec $ /bin/tcsh
1) Remove existing OPENvpn
# pkg remove openvpn
2) Get source of openvpn and recompile, at the blue screen enable the save_passwords option
# portsnap fetch
# portsnap extract
# cd /usr/ports/security/openvpn
# make install clean
Get your open vpn script from you VPN service, I'm using ipvanish which are pretty good. And check that you can log in ok
# openvpn nameofyourconf.conf
If your VPN logs in ok, then you can add this line to the conf file at the bottom that runs it in the background.
daemon
and add the path to you auth.txt where the first line is your account username and the second is the vpn password. now try running openvpn nameofconf.conf and it should automatically log in for you. run ifconfig to check and then pkill openvpn will shut it down.
#ifconfig
This should give you an entry called tun0, which we will use to bind transmission to so that if the VPN fails then it does not fall over to your normal connection. This works quite nicely. I've tried to use the --up command from OPENvpn to run a little script, which works fine in debian, but not in freebsd / in a jail.. I just could not get it working. I made a post elsewhere about it
http://forums.freenas.org/index.php?threads/transmission-vpn-script-fail.19928/
1. Next the script that passes the tun0 IP.
Make a script called up.sh
# nano up.sh
And place this into it
-----------------------------------
#!/bin/bash
/usr/local/etc/rc.d/transmission stop
pkill openvpn
sleep 5
echo "Starting VPN"
# you will need to point this to the location of you conf script. The wait is to get it to load before obtaining the IP
openvpn /media/home/vpn.conf
echo "Waiting for vpn to start..."
sleep 10
# This line extracts the IP from ifconfig. If anyone knows a better way to do this, let me know. The two -v removes the localhost,
# and the LAN IP, which should leave one entry which is your tun0 interface. Cut and paste this to see if it works.
var=$(ifconfig | grep -E 'inet.[0-9]' | grep -v '127.0.0.1' | grep -v '192.168.1.40' | awk '{ print $2}')
echo "VPN started IP: $var"
# This took some figuring out, but it essentially replaces the bind address in the settings.json with your vpn IP….
sed -i -e "s/\"bind-address-ipv4\".*/\"bind-address-ipv4\": \"$var\",/" /usr/pbi/transmission-amd64/etc/transmission/home/settings.json
echo "Transmission settings updated"
# start transmission again
/usr/local/etc/rc.d/transmission start
-------------------------------------
now when you run up.sh it should automatically start the VPN and bind transmission to it. I should say that there is an alternative method of using sed online but it takes a settings_template.json file and replaces some text. I did not like this approach as any settings you adjusted when the client was running were lost. this keeps the original settings.json file.
happy torrenting...