haugene / docker-transmission-openvpn

Docker container running Transmission torrent client with WebUI over an OpenVPN tunnel
GNU General Public License v3.0
4.11k stars 1.21k forks source link

TRANSMISSION_PEER_PORT_RANDOM_ON_START: unbound variable #2404

Closed yongbi85 closed 1 year ago

yongbi85 commented 1 year ago

Is there a pinned issue for this?

Is there an existing or similar issue/discussion for this?

Is there any comment in the documentation for this?

Is this related to a provider?

Are you using the latest release?

Have you tried using the dev branch latest?

Docker run config used

version: '3' services: transmission: image: haugene/transmission-openvpn:latest container_name: transmission networks:

Current Behavior

Docker constantly crashing on start.

Expected Behavior

I was expecting it to start as usual and no permanent crash with the /etc/openvpn/start.sh: line 262: TRANSMISSION_PEER_PORT_RANDOM_ON_START: unbound variable error This used to work perfectly weel until yesterday.

How have you tried to solve the problem?

Tried dev branch but encountered a whole lot of different error I deleted entirely the data and config folders Redownloaded the image and recreated the stack completely Deleted some the country config option, deleted all nordvpn specific config option, ... Always the same error

Only thing solving the issue is to disable ufw (which obviously isn't ideal...)

Log output

Starting container with revision: bf4c4e8e147978c0ffd700c64648491c317c17ee Creating TUN device /dev/net/tun Using OpenVPN provider: NORDVPN Running with VPN_CONFIG_SOURCE auto Provider NORDVPN has a bundled setup script. Defaulting to internal config Executing setup script for NORDVPN INFO: OVPN: Checking curl installation INFO: OVPN: DNS resolution ok INFO: OVPN: ok, configurations download site reachable INFO: OVPN: Removing existing configs in /etc/openvpn/nordvpn Checking NORDPVN API responses INFO: OVPN:Selecting the best server... INFO: OVPN: Searching for country : Fr (74) INFO: OVPN: Searching for group: legacy_p2p INFO: OVPN:Searching for technology: openvpn_udp INFO: OVPN: Best server : fr662.nordvpn.com, load: 7 INFO: OVPN: Downloading config: fr662.nordvpn.com.ovpn INFO: OVPN: Downloading from: https://downloads.nordcdn.com/configs/files/ovpn_udp/servers/fr662.nordvpn.com.udp.ovpn Starting OpenVPN using config fr662.nordvpn.com.ovpn Modifying /etc/openvpn/nordvpn/fr662.nordvpn.com.ovpn for best behaviour in this container Modification: Point auth-user-pass option to the username/password file Modification: Change ca certificate path Modification: Change ping options Modification: Update/set resolv-retry to 15 seconds Modification: Change tls-crypt keyfile path Modification: Set output verbosity to 3 Modification: Remap SIGUSR1 signal to SIGTERM, avoid OpenVPN restart loop Modification: Updating status for config failure detection Setting OpenVPN credentials... Disable and blank firewall Firewall stopped and disabled on system startup enabling firewall Firewall is active and enabled on system startup /etc/openvpn/start.sh: line 262: TRANSMISSION_PEER_PORT_RANDOM_ON_START: unbound variable

HW/SW Environment

- OS: DSM Synology 6.2
- Docker: Docker version 20.10.3, build b35e731

Anything else?

Just for information, on latest commit : works only if UFW is disabled, else i get the mentioned error And when I try dev branch, i get another error which is also related to UFW too : ERROR: Couldn't determine iptables version Reverting to 3.7.1 also solves the issue and permit to enable ufw, so I'm back on this for now.

haugene commented 1 year ago

Hmm, this is another instance of https://github.com/haugene/docker-transmission-openvpn/discussions/2395 where references to unset variables are failing with NordVPN because the nordvpn configuration script specifies the -u option.

Setting TRANSMISSION_PEER_PORT_RANDOM_ON_START= in your environment variables should fix it, but another might show up. Would you mind testing it and let me know if there are more? Then I can add some defaults to it in this scenario, seems it's only related to the UFW part of the scripts then.

Not sure whats the best way forward here, maybe we should just drop the -u checking.

yongbi85 commented 1 year ago

It works with this additional environment variable (i set it to false)

tmknight commented 1 year ago

Not sure whats the best way forward here, maybe we should just drop the -u checking.

Seems prudent to remove from production until all variables are accounted for and declared in the image.

karpana commented 1 year ago

Hi There, I'm having the same issue with my installation; seem to have been happening since about 2 or 3 days ago (which seems to coincide with the last upate).

I've tried setting TRANSMISSION_PEER_PORT_RANDOM_ON_START= as well as TRANSMISSION_PEER_PORT_RANDOM_ON_START=false and neither seems to resolve the issue for me.

edit-- For the time being, I've fallen back to 3.7.1, as I am getting the same issue on latest, dev, 4.2, 4.1 and 4.0 images.

haugene commented 1 year ago

Hello again. I just did some testing locally and I got an error for more of the variables and decided to do a middle ground solution and disable the checking from the UFW part of the script and out. This has only been hitting NordVPN users and such has a smaller blast radius (although I understand it's not fun to be in it). Running with -u for the rest shows that we might not be too far away from turning it on everywhere. I think that should be the end game here, optionally I've also considered migrating it to Python. Bash gets chaotic at a certain size and I think we're getting closer.

Anyways. I have pushed a fix to the master and dev branches so that should be available on edge and dev tags in a few minutes. Note that latest will be the latest tagged release going forward - instead of being the latest commit on master.

haugene commented 1 year ago

I assume this can be closed now @yongbi85? The issue is fixed and is included in the 4.3 release. Is also available with the latest tag now.

yongbi85 commented 1 year ago

Hello, This particular issue can be closed, however as said when I was testing out dev branch and confirmed with latest commit pull now I have another error... "Cannot determine iptables version"

Reverted to 3.7.1 for the moment

edgd1er commented 1 year ago

to fix unbound variable one may define a default value: portNum=${1:-''}

haugene commented 1 year ago

I'm closing this then, and making a note that there might be issues with UFW in the new image :+1:

michaelfedell commented 1 year ago

Also got an issue with TRANSMISSION_RPC_USERNAME: unbound variable in version 5.0.2 with NordVPN provider

For more context: I'm running this on a Synology NAS where the Docker engine requires you to provide a value for every specified environment variable (cannot provide empty value). So your options are to either delete the env var or to set it to a single space (=" ")or other phony character.

image