alexbelgium / hassio-addons

My homeassistant addons
MIT License
1.47k stars 213 forks source link

[transmission_openvpn] Support OVPN files out of the box #367

Closed almico closed 2 years ago

almico commented 2 years ago

Which addon?

transmission_openvpn

name: Feature request about: Support OVPN files out of the box


Which addon?

transmission_openvpn

Describe the solution you'd like

Your Qbittorrent addon requires an OVPN file in order to enable OpenVPN support. Your Transmission_openvpn addon has a different approach that makes it obscure, if reasonably doable, how to use the very same OVPN file.

alexbelgium commented 2 years ago

Ahah, it was a specific request by a github member to have this version. Perhaps we can streamline the process of using a custom config?

alexbelgium commented 2 years ago

BTW, have you checked that your vpn is not supported by default?

almico commented 2 years ago

I have Hotspot Shield. It provides a plain OVPN file. My main issue is that your Qbittorrent addon is no longer working, using the VPN, since one or two days ago. I have tried on a Raspberry (that always worked), on a NUC, with different OS, Supervisor, Core and Qbittorrent. My last resort was to try another addon, like your transmission_openvpn.

alexbelgium commented 2 years ago

Hi, I've pushed a new version. For setting a custom openvpn file, you should flag the "OPENVPN_CUSTOM_PROVIDER" field and reference the path of the *.ovpn file in the "OPENVPN_CUSTOM_PROVIDER_OVPN_LOCATION" field. Normally it should copy your file to the right location and use it :-)

alexbelgium commented 2 years ago

Could you please test "4.0-v5" with your ovpn file ? Thanks

almico commented 2 years ago

When I try to save configuration, I get the following error:

Missing option 'OPENVPN_PROVIDER' in root in Transmission Openvpn (db21ed7f_transmission_openvpn)

What should I enter there? My provider (Hotspot Shield) is not in the list.

almico commented 2 years ago

I tried selecting "protonvpn", but with no luck. This is the log:

Starting...
/etc/cont-init.d/00-banner.sh: executing
-----------------------------------------------------------
 Add-on: Transmission Openvpn
 Docker container running Transmission torrent client with WebUI over an OpenVPN tunnel
-----------------------------------------------------------
 Add-on version: 4.0-v5
 You are running the latest version of this add-on.
 System: Home Assistant OS 7.6  (amd64 / generic-x86-64)
 Home Assistant Core: 2022.4.1
 Home Assistant Supervisor: 2022.05.3
-----------------------------------------------------------
 Please, share the above information when looking for help
 or support in, e.g., GitHub, forums
 https://github.com/alexbelgium/hassio-addons
-----------------------------------------------------------
/etc/cont-init.d/00-banner.sh: exiting 1
/etc/cont-init.d/32-nginx_ingress.sh: executing
/etc/cont-init.d/90-dns_set.sh: executing
[08:11:21] INFO: DNS SERVERS set to 1.1.1.1 8.8.8.8 
/etc/cont-init.d/92-local_mounts.sh: executing
/etc/cont-init.d/92-smb_mounts.sh: executing
/etc/cont-init.d/99-run.sh: executing
[08:11:21] INFO: Exporting variables
DEBUG=false
DNS_server=8.8.8.8,1.1.1.1
LOCAL_NETWORK=192.168.178.0/16
OPENVPN_CUSTOM_PROVIDER=true
OPENVPN_CUSTOM_PROVIDER_OVPN_LOCATION=/config/openvpn/HotspotShield_DE_v4.ovpn
OPENVPN_PASSWORD=somepass
OPENVPN_PROVIDER=protonvpn
OPENVPN_USERNAME=someuser
PGID=1000
PUID=1000
TRANSMISSION_DOWNLOAD_DIR=/share/transmission
TRANSMISSION_HOME=/config/addons_config/transmission
TRANSMISSION_INCOMPLETE_DIR=/share/transmission/incomplete
TRANSMISSION_WATCH_DIR=/share/transmission/watch_dir
TRANSMISSION_WEB_UI=transmission-web-control
[08:11:23] INFO: Custom openvpn provider selected
/./etc/cont-init.d/99-run.sh: line 26: [: bashio::config: binary operator expected
Copying ovpn file to proper location
Exporting variable for custom provider : HotspotShield_DE_v4
[08:11:23] INFO: Running userscript
Enforcing ownership on transmission config directories
Applying permissions to transmission config directories
Setting owner for transmission paths to 1000:1000
Setting permissions for download and incomplete directories
jq: error: Could not open file /config/addons_config/transmission/settings.json: No such file or directory
Mask: 000
Directories: 777
Files: 666
Setting permission for watch directory (775) and its files (664)
-------------------------------------
Transmission will run as
-------------------------------------
User name:   abc
User uid:    1000
User gid:    1000
-------------------------------------
[08:11:24] INFO: Starting app
Starting container with revision: 44c82aa1297b0f4473ad141f2cea326b407d9c22
Using OpenVPN provider: HOTSPOTSHIELD_DE_V4
Running with VPN_CONFIG_SOURCE auto
No bundled config script found for HOTSPOTSHIELD_DE_V4. Defaulting to external config
Downloading configs from https://github.com/haugene/vpn-configs-contrib/archive/main.zip into /tmp/tmp.CbKc2JhAFn
Extracting configs to /tmp/tmp.081c0dwt48
ERROR: Could not find any configs for provider HOTSPOTSHIELD_DE_V4 in downloaded configs
Cleanup: deleting /tmp/tmp.CbKc2JhAFn and /tmp/tmp.081c0dwt48
Supplied config HotspotShield_DE_v4.ovpn could not be found.
Your options for this provider are:
NB: Remember to not specify .ovpn as part of the config name.
alexbelgium commented 2 years ago

I've corrected this error, but will have to try a bit later if it works

alexbelgium commented 2 years ago

Yep I've checked and the app starts with my free vpn using the custom config setting - however it doesn't download yet. But you could try it, it will show if the issue is due to the qbittorrent addon, or perhaps recent HA changes ;-)

almico commented 2 years ago

What should I enter in OPENVPN_PROVIDER?

almico commented 2 years ago

Assuming I can set that option to any value, because, I think, it's superseded by OPENVPN_CUSTOM_PROVIDER, this is what I see at the end of the log:

[11:50:05] INFO: Starting app
Starting container with revision: 44c82aa1297b0f4473ad141f2cea326b407d9c22
Using OpenVPN provider: HOTSPOTSHIELD_DE_V4
Running with VPN_CONFIG_SOURCE auto
No bundled config script found for HOTSPOTSHIELD_DE_V4. Defaulting to external config
Downloading configs from https://github.com/haugene/vpn-configs-contrib/archive/main.zip into /tmp/tmp.kBv3AKbT9T
Extracting configs to /tmp/tmp.4eSomvMoWR
ERROR: Could not find any configs for provider HOTSPOTSHIELD_DE_V4 in downloaded configs
Cleanup: deleting /tmp/tmp.kBv3AKbT9T and /tmp/tmp.4eSomvMoWR
Supplied config HotspotShield_DE_v4.ovpn could not be found.
Your options for this provider are:
NB: Remember to not specify .ovpn as part of the config name.

Trying to access the UI, I see 502: Bad Gateway.

almico commented 2 years ago

or perhaps recent HA changes

I'm performing my tests on a Raspberry PI 4 and on an Intel NUC. The PI has the latest and greatest versions of HA, while the NUC has older versions. Both stall 😢

alexbelgium commented 2 years ago

Yup, it needed lowercase files so I've included that in the code. I've renamed my ovpn config file with the same name as you and it works in the latest version! Hopefully it should work :) as having a connection issue on two different app with two different connections codes would most likely point to something external (von or ha)

almico commented 2 years ago

Transmission, using the very same OVPN file, is much more responsive. To be honest, I've seen download speeds I've never seen with Qbittorrent. Trying some random torrent, one of them is stuck retrieving metadata, but all the others are working pretty well. On the very same system. with the very same OVPN, with the very same magnets, Qbittorrent is stuck on metadata.

alexbelgium commented 2 years ago

That's great! At least they means you have a solution to download torrents with vpn even if it is not qbittorrent :) does this mean we can close this issue? Let's keep open the other one if we can figure how to get it to work

almico commented 2 years ago

I think this issue can be closed. Thank you 😃