-
-
Notifications
You must be signed in to change notification settings - Fork 507
feat(extras/scripts): update qBittorrent peer port with optional authentication #2700
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
base: master
Are you sure you want to change the base?
Conversation
|
I'm currently working on something similar, but I guess this would be a better solution. 👍 |
|
The only downside of these scripts is that they don't cover a scenario when a client is started after gluetun. |
|
@astappiev Looks good to me. The only thing I would appreciate is if we could add an option for Nmap to check whether the port is actually open. I'm on a couple of private trackers, and if my TCP port is filtered, I could get heat—or in the worst case—have my account banned. I tried integrating it into my script and controlling the VPN via the control server, but Gluetun doesn't have an API for WireGuard yet. |
|
I think it should be implemented as another script (as it is not client dependent), or even in the gluetun core. |
| # default values | ||
| WEBUI_PORT="8080" | ||
| DEFAULT_URL=$(build_default_url) | ||
| WGET_OPTS="--retry-connrefused --tries=5" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might require some time until qbittorrent is up and listening when I start my compose stack
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a comment for this? 😉
| @@ -0,0 +1,124 @@ | |||
| #!/bin/sh | |||
|
|
|||
| # Description: This script updates the peer-port for the qBittorrent torrent client using its WebUI API. | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See qdm12/gluetun-wiki@55ffd92
We should have a "down" mode to change the port to something else.
Or, maybe better, have it set it to some random port i.e. 9876, and then to the actual port we want, such that there is only an up command to set.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure what's best here; the provider I'm using is always giving a unique port.
For now, I set it to 0 as a "safe" port to reset the setting. If we use any "random" port, there is a minor chance that it might match with an actual port.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
setting it to 0 is a good idea, although that's not done here. Maybe we could do it right before calling the API to set to the desired port?
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
| echo " (Omit if not required)" | ||
| echo " -p, --pass PASS Specify the qBittorrent password." | ||
| echo " (Omit if not required)" | ||
| echo " -P, --port PORT Specify the qBittorrent peer-port." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should accept a comma separated list of ports from Gluetun's {{PORTS}} to simplify usage of this script.
And then it should use $(echo {{PORTS}} | cut -d, -f1) to take only the first port just in case, since qbitorrent supports only one port.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if I got it right, does it mean we should use it like this bittorrent-port-update.sh --port {{PORTS}}?
E.g. via VPN_PORT_FORWARDING_UP_COMMAND=/bin/sh -c "/scripts/qbittorrent-port-update.sh --port {{PORTS}} --webui-port 9081"
If so, it's already supported, this is exactly how I used it since beggining.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct, but {{PORTS}} can have multiple ports so for convenience and a shorter command, let's cut and use the first port within the script. The flag should be renamed to --ports and indicate that despite the name it only picks the first port
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the other way around, let's keep it named as --port to indicate that only one of them is used.
The logic to split and keep the first was already there
https://github.com/astappiev/gluetun/blob/839e318c9c30676c8ecd9f042c524e87a1634f32/extras/scripts/qbittorrent-port-update.sh#L60
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually....
Added support for {{PORT}} variable in fcdba0a which takes the first of the ports. No reason to have it supported in scripts!
This comment was marked as off-topic.
This comment was marked as off-topic.
|
@AndaPlays for this nmap command to succeed, I suppose you do need a program listening on the forwarded port right? What I'm thinking is to, when setting up port forwarding:
I'm going to mark our comments as off topic, would you please open an issue for this? Thanks!! |
|
Hey guys, I know it's not a native solution but this use case is exactly why I made qSticky. Been working very well and it doesn't matter what order things come up as it's a middleman between the two applications. |
Inspired by #2611 and talks in #1555 created a script to update peer-port of qBittorrent.
Upd: added option to authenticate.