Search the Community
Showing results for tags 'kodi'.
Hi are there a script to prevent ip leakage on vpn disconnect (running on kodi, libreelec)? I found something firewall setting through iptables (up and down scripts), but I'm not sure about their working. Thanks John
19807409 posted a topic in Member TutorialsRequirements: openconnect vpnc vpnc-scripts Install requirements: Ubuntu/Raspbian # Update repository sudo apt-get update # Install openconnect and vpnc scripts sudo apt-get install openconnect vpnc-scripts -y Openwrt/Lede (current available openconnect does not work, you need to compile your own) # Update repository opkg update # Install openconnect and vpnc scripts opkg install openconnect vpnc-scripts Connect to VPN: Method 1 (password stored in a file) (password is stored in plain text) # Method 1 - Password stored in file sudo openconnect -u YourUsername --authgroup=DEFAULT -b --passwd-on-stdin --cafile=/home/pi/torguard/ca.crt --servercert=YourServerCert --pfs Server:Port </home/pi/torguard/userpass.txt Method 2 (pass password in command) (password is in plain text) # Method 2 - Pass password echo YourPass | sudo openconnect -u YourUsername --authgroup=DEFAULT -b --passwd-on-stdin --cafile=/home/pi/torguard/ca.crt --servercert=YourServerCert --pfs Server:Port My results with Raspberry Pi 3 Model B on factory system is 20/20Mb/s during Kodi was running full HD stream. With openconnect, RaspberryPi can be used as streaming service with high vpn encryption provided by TorGuard. Autostart - Method 1 There are plenty of vpnc scripts which can be used. In case of Raspberry Pi 3 Model B, it has onboard WLAN which does not perform very well, I don't get 20Mb/s with it. Connecting USB Wireless N did not solve the issue as it seems that RPi does not provide enough power to get more out of WLAN. For that reason I used external USB HUB with own power supply providing with power wireless or any other device, so that Raspberry itself has enough power. I ran into second problem. Without additional installation or manuall commands typing in terminal, you can't use second wlan that easy. Many suggest methods like to install some additional software for managing wireless, where I do not need onboard wireless at all to boot with the OS. But disabling it turns out often for newbies that they don't remember how to turn it on. That is the reason why I do suggest a very simple method for newbies, especially those who never did deal with this topics before. Using Raspeberry's LAN port is not a problem. I do get 90Mb/s, which is actually almost 100% what 100Mb/Lan card can offer. LAN is always preferable if possible. I will keep this example for the factory delivery of RPi and reffer to Raspberry Pi 3 Model B in this guide. Requirements: CA certificate from TorGuard. You can get it here. Save your password for VPN service into file in plain text, I will use this path in this guide /home/pi/torguard/onlypass-plain.txt Server's fingerprint (SHA1). (If you don't know how to find it, connect manually without and it will print sha1 fingerprint) (you can also always ask TorGuard support for assistance) XTERM xterm is not installed by default, you can install it with this command: sudo apt-get update; sudo apt-get install xterm -y Create a script to start openconnect in new terminal window Path in this guide: /home/pi/Desktop/tg.sh Example of tg.sh: sudo openconnect --verbose --pid-file=/var/run/openconnect.pid -u demouser --authgroup=DEFAULT -b --reconnect-timeout=200 --passwd-on-stdin --cafile=/home/pi/torguard/ca.crt --servercert=FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF --pfs 22.214.171.124:22 </home/pi/torguard/onlypass-plain.txt Create a script for autostarting VPN connection on boot. Path in this guide: /home/pi/Desktop/autostart-openconnect-at-sharedip.sh Because we need separate terminal window where we always can see what is going on, we need to start VPN after desktop has been loaded. There are several ways to achive it, but one simple is xterm: sleep 20 sudo xterm -e "bash /home/pi/Desktop/tg.sh;bash" Xterm starts a new window running a script where new terminal window is not closed after sh command has been run, because if it closes, you closed your VPN connection. Here I use 20 seconds to wait until everything loads or vpn will fail to connect. It works also with 10 seconds, but I would not recommend lower value. For more advanced setups, please use vpnc scripts. Edit LXDE session start script for current user Path to start script: /home/pi/.config/lxsession/LXDE-pi/autostart Add command to run a a script autoconnecting to VPN, add to : /home/pi/.config/lxsession/LXDE-pi/autostart Here I do disable onboard wlan0 because I use USB device and if you don't do that, then VPN will connect over wlan0. sudo ifconfig wlan0 down # Disable onboard Wifi @sudo /home/pi/Desktop/autostart-openconnect-at-sharedip.sh # Connect correctly over wlan1 (Here we have second time sudo, but it will not harm anything, it will only ensure, that if you forget sudo in your tg.sh, then autostart will still work) (You need to have root privileges to be able to access vpns folder) Reboot I hope it helps some newbies to get started with this amazing VPN service. On factory RPi and openconnect, I get 30Mb on download constantly which is great result and is enough for almost anything, including streaming in HD. Those who have/need faster connections, they will need to buy better device. But all in all, you can use RPi as Media Center together with IPTV behind TorGuards VPN and it is working very well, everything works very stable. This is much better replacement for any smart tv around and costs barely â‚¬ 35. I think there is no cheaper device performing better for this price. If you know any, please show me the results, I would love to test them. Once again, TorGuard, thank you very much for such a great service!
MindfÃ¼cker posted a topic in Member TutorialsHi everybody, As a linux n00b and first time poster on this forum I wanted to share my experiences and gained knowledge setting up a VPN on OpenElec. The main reason I wanted to set op a VPN-client on my raspberry Pi was to watch BBC iPlayer from outside the UK. I tried xBian but got into trouble with some DNS-stuff and the TUN adapter. So I flashed openELEC on it and tried again. Setting Up Raspberry Pi 1 Windows 7 PC ExtraPutty Winrar Notepad++ Filezilla Win32 disk imager OpenELEC-RPi.arm-6.95.3 8GB SD card Tips & trics for linux n00bs: You can use TAB to autofill folders the command pwd gives you the current folder name the command ls gives a list of files in the current folder the command cd ~ brings you to your home folder When the terminal looks frozen after running a command, use CTRL+C to return. OpenElec installation First download the latest beta version of openELEC for the Raspberry Pi, then extract the .img file to a folder. Use Win32 disk imager to write the .img to the SD card. Insert the SD card into the raspberry pi and supply power to the device. Complete the wizard. Get the openvpn files Download the openvpn config files from TorGuard HERE and unzip them somewhere. I only needed the TorGuard.UK.London.ovpn files and isolated this one to my desktop. Open the file in Notepad++ and look for: auth-user-pass replace this by: auth-user-pass /storage/login.txt I read somewhere that the TorGuard ovpn files got he incorrect line endings and need to be changed to the Linux EOL. To do this in notepad++, Edit -> EOL Conversion -> Convert to UNIX format. Save the file as all files and rename it to: TorGuard.UK.London.conf Then create a new file in notepad++ and insert yout TorGoard username and password on two lines. [email protected] TGpassword Convert the line endings as stated above and save as, all files, login.txt SSH into the device Make sure your windows computer is connected to the same network as the Raspberry Pi, preferably wired. Find the IP-address of raspberry pi and write it down. (System -> System info -> Network) My IP-address was 192.168.178.30 but your's is definitely different. Open extraputty and insert the IP-address, tick SSH and click "OPEN". A black console should appear asking for a login. If not, upgrade the putty client and check connection with raspberry pi. The password and username are as following: login: root password: openelec congratulations! you're connected to the raspberry pi. Overclock Raspberry pi (optional) I got a Raspberry pi version 1, so speed is a bit of a problem. To overclock the device use: mount /flash -o remount,rw nano /flash/config.txt Look for the line: arm_freq=700 core_freq=250 and replace this by: arm_freq=800 core_freq=300 reboot the device to see the effects. Getting openvpn OpenELEC doesn't have apt-get so you need some hassle to get openvpn. I'ts in the unofficial repository so lets download it. I copy pasted the steps from here, to prevent link rot I also post them here. Make sure you are connected to the internet for this steps. * Open Kodi * Select SYSTEM > File Manager * Select Add Source * Select None * Type the following EXACTLY http://fusion.tvaddons.ag and select Done * Highlight the box underneath Enter a name for this media Source & type fusion * Select OK * Go back to your Home Screen* Select SYSTEM * Select Add-Ons * Select Install from zip file * Select fusion * Select xbmc-repos * Select english * Select repository.metalkettle-x.x.x.zip * Wait for Add-on enabled notification * Select Install from repository or Get Add-Ons on Helix * Select MetalKettles Addon Repository * Select Program add-ons * Select openvpn * Select Install * Wait for Add-on enabled notification * Select VPN for OpenELEC * Select Install * Wait for Add-on enabled notification Copy files to raspberry pi I use Filezilla to transfer files from the Windows computer to the raspberry PI. Open Filezilla HOST: sftp://192.168.178.30 (insertyour own IP) USERNAME: root PASSWORD: openelec quickconnect Drag and drop the TorGuard.UK.London.conf file from the Windows computer in the storage folder. Do the same with the login.txt file. Test the VPN connection SSH into the device using extraPutty, insert root/openelec and you are in the terminal. First test if openvpn is installed: openvpn --help When you see alot of commands and information pop-up, congratulations. then test the VPN connection: openvpn /storage/TorGuard.UK.London.conf When you see: Initialization Sequence Completed the connection is established. To test if the external IP-address is foreign use: openvpn /storage/TorGuard.UK.London.conf & wget http://ipinfo.io/ip -qO - The result is an IP-address you can check online to see if it's foreign. Run on Startup To run the line of code on startup openelec is different from other linux distro's. It uses a file called autostart.sh to tun things. run this to edit/create the file: nano /storage/.config/autostart.sh insert this into the file: ( openvpn /storage/TorGuard.UK.London.conf ) & CTRL-X to save and exit. reboot reboot the system and test the connection. DONE!