alexbelgium / hassio-addons

My homeassistant addons
MIT License
1.56k stars 223 forks source link

✨ [REQUEST] Transmission Openvpn , add "custom" value for "OPENVPN_PROVIDER" #1141

Closed Moosketair closed 10 months ago

Moosketair commented 11 months ago

Checked

Which addon?

Transmission Openvpn

Is your feature request related to a problem? Please describe

Unable to apply the "custom" value to OPENVPN_PROVIDER.

Describe the solution you'd like

hello, I am using AirVPN, but it is not available in the list of OPENVPN_PROVIDERS. On the base image, I managed to make it work. To do this, you need to be able to configure the "OPENVPN_PROVIDER" field to "custom," which is currently not possible with your addon.

alexbelgium commented 11 months ago

Hi, is this not working ?

https://github.com/alexbelgium/hassio-addons/tree/master/transmission_openvpn#configuration

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.

Moosketair commented 11 months ago

No, it doesn't work because in the list of openvpn_provider, airvpn is not included. To make everything work, you need to follow the procedure found here:

https://haugene.github.io/docker-transmission-openvpn/supported-providers/.

`Using a local single .ovpn file from a provider

For some providers, like AirVPN, the .ovpn files are generated per user and contain credentials. These files can not be hosted anywhere publicly visible. Then you can mount the files into the container and use them directly from your local host.

Grab all files from your provider (usually a .zip file to download & unzip)

Copy them into a folder on your Docker host, there might be .ovpn files and ca.cert as well (example below /volume1/docker/ipvanish/)

Mount the volume Compose sample:

         - /volume1/docker/ipvanish/:/etc/openvpn/custom/

Declare the Custom provider, the target server and login/password Also important to note here is that OPENVPN_CONFIG value needs to be the name of the ovpn file wanting to be referenced in the /etc/openvpn/custom volume. In the example below the ovpn file name is ipvanish-UK-Maidenhead-lhr-c02.ovpn

Compose sample:

        - OPENVPN_PROVIDER=custom
        - OPENVPN_CONFIG=ipvanish-UK-Maidenhead-lhr-c02
        - OPENVPN_USERNAME=user
        - OPENVPN_PASSWORD=pass

Docker ENV vars sample:

          -e OPENVPN_PROVIDER=custom \
          -e OPENVPN_CONFIG=ipvanish-UK-Maidenhead-lhr-c02 \
          -e OPENVPN_USERNAME=user \
          -e OPENVPN_PASSWORD=pass \`

I did try to force the value in "custom" by switching to YAML mode, but I get this error:

value must be one of ['', 'anonine', 'anonvpn', 'blackvpn', 'btguard', 'bulletvpn', 'cryptostorm', 'expressvpn', 'fastestvpn', 'freevpn', 'froot', 'frostvpn', 'getflix', 'ghostpath', 'giganews', 'goosevpn', 'hideme', 'hidemyass', 'integrityvpn', 'ipvanish', 'ironsocket', 'ivacy', 'ivpn', 'mullvad', 'nordvpn', 'octanevpn', 'ovpn', 'pia', 'privado', 'privatevpn', 'protonvpn', 'proxpn', 'purevpn', 'ra4w', 'safervpn', 'slickvpn', 'slickvpncore', 'smartdnsproxy', 'smartvpn', 'surfshark', 'tiger', 'torguard', 'trustzone', 'tunnelbear', 'vpnac', 'vpnarea', 'vpnbook', 'vpnfacile', 'vpnht', 'vpntunnel', 'vpnunlimited', 'vyprvpn', 'wevpn', 'windscribe', 'zoogvpn']

Furthermore, there remains the issue of volume mounting that I cannot configure.

I don't know if it's possible, and if it's worth making everything work. In any case, thank you once again for the time and effort spent here.

alexbelgium commented 11 months ago

Hi, thanks for the detailed explanations! I have a code described below supposed to make it work without needing to mount a folder, which is not supported by HA. I should have time between 28th and 30th Dec to check if it is not working

The biggest issue with porting add-ons is that you can't work with the normal way of working due to ha limitations , therefore I make bridges in my code to simulate the same action in a different way

https://github.com/alexbelgium/hassio-addons/blob/d68199dada93602b9bf074736e923463b343b285/transmission_openvpn/rootfs/etc/cont-init.d/99-run.sh#L80-L116

alexbelgium commented 10 months ago

Hi, please install version "v5.3.1-6", it allows custom configurations. The way it works is by mapping the /config/addons_config/transmission/openvpn folder to the /etc/openvpn/custom, as per normal way of working. No more strange workarounds as before.

Here is how to make it work : BREAKING CHANGE FOR CUSTOM VPN : if you are using a custom VPN provider, you must remove OPENVPN_CUSTOM_PROVIDER from your addon option and instead set OPENVPN_PROVIDER to "custom", then reference your ovpn file in your "OPENVPN_CONFIG". For example, if AIRVPN has provided to you an *.ovpn filed named AIRVPN.ovpn, you need to install an addon such as Filebrowser, go in the /config/addons_config/transmission/openvpn folder and put the AIRVPN.ovpn here. Then, in the addon option you need to write "AIRVPN" in the "OPENVPN_CONFIG" option

Moosketair commented 10 months ago

thank you very much, it works perfectly for me .