-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Add support for more VPN providers #22
Comments
Bumped to version 1.2 after changes for issue #22
Hi Kristian, many thanks for doing this. I get the following error: VPN PROVIDER: BTGUARD |
Hmm. Which command are you using to run this container? Are you providing the --privileged flag? |
I run from the UNRAID NAS system. I have got privilged on, yes /usr/bin/docker run -d --name="TransmissionVPNDEV" --net="bridge" --privileged="true" -e OPENVPN_PROVIDER="BTGUARD" -e OPENVPN_USERNAME="xxxxx" -e OPENVPN_PASSWORD="xxxxxxx" -e TZ="Europe/London" -p 9092:9092/tcp -p 54322:54322/tcp -v "/mnt/user/Downloads/":"/mnt/user/Downloads/":rw -v "/mnt/cache/.apps/transmissionVPN":"/config":rw haugene/transmission-openvpn:dev |
Ok. The reason I asked was that I reproduced the error message by switching off privileged here. But if you have that flag it's not that. I see that others have the same problem with OpenVPN in docker: It seems it might have to do with your host platform or kernel version. Does the /dev/net/tun device exist on your host? The privileged flag is necessary to modify the tun device on the host machine. So when I switch my privileged flag off I get the same error, but I guess that your error comes because it actually isn't there. |
And btw. It should not have anything to do with this error but you should probably change your volume mount from -v "/mnt/user/Downloads/":"/mnt/user/Downloads/":rw to -v "/mnt/user/Downloads/":"/data":rw This is because the container will store stuff in /data. Also you shouldn't have to mount anything to the /config directory if you don't have some plan for it. It's only a directory for storing transmission and openvpn credentials but it will be rewritten on each container startup as these are read from environment variables. Don't think you need the --net="bridge" either, but all this comes second to getting your /dev/net/tun device up and running. |
I am going to try to sound not too stupid here! Linux version 4.0.4-unRAID (root@develop64) (gcc version 4.8.2 (GCC) ) #5 SMP PREEMPT Fri Jun 19 22:47:24 PDT 2015 I have played in the past (before Docker) with an openvpn plugin and that worked, but I didn't want the whole machine going through the tunnel, and Docker suddenly open the possibilities Here is my list of devices: ls /dev tun is not there but I always assumed it was created on the fly by openvpn?? |
I'm not sure here either. I think the OpenVPN inside the container will create a tun interface, namely tun0. But to do so it needs to modify the tun device on the host. So I guess you need to have the TUN/TAP driver installed. Maybe if you install the openvpn plugin then that will also install the necessary drivers? You will not be using the OpenVPN plugin itself but that might create the needed /dev/net/tun device. If not you have to try to create the device some other way, maybe by quanta's suggestion in the serverfault lik above. Don't know. |
You were right, I have re-installed but disabled an openvpn plugin and it does create the tun device
I then install nginx, with the following config
But I get a bad gateway when I try to access though the 8080 port. Then I realised that I have allowed port 9092 through to this container but nowhere have I specified which port should Transmission listen to. Did I miss that? |
Aha. But this is looking good! 👍 You could either change it for 9091:9091, and update your nginx.conf to 9091 as well. Or you could map port 9092 on your host to 9091 in the container by writing -p 9092:9091/tcp and then your nginx should be OK. Try it out and let me know. |
Of course! and now that works, I can see the UI through the proxy. |
I am struggling with my very limited understanding of Docker!
Here is the command line that is generated by UNRAID after setting the docker up in the UNRADI UI: Thanks! |
I get it, Docker is a lot of magic :) 1a) The KEEP_TRANSMISSION_STATE flag has been removed, it was an option before but wasn't done in a good way and it went away. I think I know a better way to fix it now, so I could add that again.
1b )I'll have a look at how to keep the transmission state. Probably I'll just juggle some of the scripts out of /etc/transmission-daemon/ folder and then that folder could be mounted in order to keep daemon state. Right now the container depends on some scripts there, so mounting it would fail. |
…his allows mounting of /etc/transmission-daemon to keep state, ref issue #22
OK, so I've updated the code to let you keep the transmission state. I moved all transmission control scripts to /etc/transmission, which leaves /etc/transmission-daemon only containing the settings.json (generated on each startup) plus the transmission state. You can now mount a folder on your host to keep the state. That is: -v /your/state/storage/location:/etc/transmission-daemon:rw The state will be kept in the directory you mount to the container. The settings.json file will also be written to this directory, but remember that you can't change it there... The code is built and if you pull the image again from docker registry it should work. |
Thanks Kristian, the state is now saved and that is a great advantage. |
Sounds like it has something to do with the VPN yes. You could exec into your container and check that you have internet connectivity from there. If you want the logs, you could add this yourself. Edit the file /etc/transmission/start For something like this: After changing that, stop and start the container and it should start with logging enabled. PS: And if nginx says bad gateway it probably means that the openvpn container startup failed, so it would be nice to see the logs from that startup to know the problem. |
Pls disregard the PORT_FORWARDING issue, it seems to fail as I had TRUE instead of true. Now fixed. |
Sorry missed your last one, let me try |
OK I am starting the see the problem, the tun device is up but nothing is going through. Ping does not work on anything. This is my ifconfig:
I cannot see a log for openvpn either, do I need a similar trick to start it with one? |
You've got no docker0 interface. And you should have an interface named something like this: veth45878ea per container. Its a virtual ethernet interface that is created per container. Upgrade and/or restart your docker service? Give it sudo? I don't know, might be it's not behaving right. |
I am thinking that this is how Docker behaves on this version, maybe UNRAID specific, but I just went into my Plex container and I can definitely ping there, and I only see eth0 and lo as well. |
Ok, so docker is probably working alright. And I agree, the config file would be a prime suspect. Well, depends on the command you use. "docker run" will always create a fresh container from the image. docker start/stop will start and stop an existing container. |
I have been looking at the openvpn config but cannot see anything wrong. But looking a the log file, I see a route with a mention of "via 172.17.42.1". That doesn't look familiar. Here is the relevant portion of the log file showing that tun0 is opened successfully. Could you check yours to compare the routing?
Below is the equivalent on my Rpi, although the version is slightly older so messages are a bit different, but I cannot see this 172 address in there
Below are the differences between your btguard.conf and the one on my Rpi
|
The 172.17.42.1 address is the Docker daemon. All your docker containers will have IP address 172.17.42.xxx You could play around with the three differences in btguard.conf. Read about what they do here: https://openvpn.net/index.php/open-source/documentation/manuals/69-openvpn-21.html Can you test the container on a regular linux box? Or if you could find me on facebook or something and borrow me your BTGuard credentials I could do more testing myself as well. VPN PROVIDER: PIA |
I figured I'd check out a month of BTGUARD, and do some testing. Container starts without problem on my host. Your host does something different when adding routes though. And you get a warning on addressing. VPN PROVIDER: BTGUARD |
The container now supports BTGuard, closing this issue. If you still have problems running the container on your NAS or on your Rpi, I suggest you create a new issue for that. |
Support for more OpenVPN providers, other than PIA, was proposed in the comments on the Docker registry.
The container should be expanded so that the OpenVPN provider is customizable and the solution should make it as easy and flexible as possible to add more providers later.
An implementation has been done on the dev branch, awaiting some testing before merging to master.
The text was updated successfully, but these errors were encountered: