Closed Magissia closed 6 years ago
Proposed solution idea : Make a DSM specific config panel that will edit both settings.json and /@appstore/transmission/app/config port the same time, stopping transmission if running before changes, restart it after.
In case port is changed from transmission, when transmission stops, check if port changed in settings.json, if changed, update appropriate file accordingly.
No that will not work. DSM assigns a port to an application and uses that setting in different parts of the package management system. DSM is simply not designed to change ports after installation time.
Why would you even want to change the port?
Because IPv6 is not available everywhere and that port may be taken by something else on NAT already.
DSM correctly reflects changes of ports for DSM web GUI in the firewall when changed, same for DownloadStation when changing default after it was installed.
To avoid package design complexity and keep usage quite easy, ports are set once in package and documented: https://github.com/SynoCommunity/spksrc/wiki/SynoCommunity-Used-Ports
If you are interested in switching a package port, I recommend you to rebuild it from spksrc after changing SERVICE_PORT
value in Makefile.
You may also propose a pull request with implementation of your port switch concept... I think it may be possible to provide it as generic support so that most packages can take benefits from it.
I will try to study what Synology has done with DownloadStation then.
Give it a go!
DownloadStation uses a elaborate set of scripts to do so and has its own gui interface which can steer DSM. To accomplice that you should add functionality to the application itself to make changes to DSM. Transmission must have functionality that can call a script of a program to make changes to DSM when you change the port in transmission. Or you must make an extra application with a gui so you can change the port in the different places. A package cannot do that, because it is only run once during the installation of the package.
@BenjV A quick option may be to "copy" application port from configuration file (or DB) to DSM thanks to a script hook service_prestart
at service startup... So we can document that user has to restart DSM service after changing port in application.
It may be a possibility, but the real question is why bother.
The standard ports used for packages do not conflict with each other and so everything works. There is no real need to change a port. If you let users change them, then they will do so and as a result create conflicts. And there is a good change that seeing the increase security awareness of Synology that in the future the port will be tighter integrated in DSM security/firewall etc.
Adding this functionality will also result in a lot of silly issue's here because lots of people have no idea what they are doing. We have seen how difficult the changes in the permissions are to understand by lots of people and how many pointless issue's it has created.
@BenjV I agree with you - and we cannot take care for users system security typically when ports are opened from internet. To notice that when a package declares its listening ports, DSM already checks there is no conflict on system with others. I guess it is possible for a script to report same error in startup log. Another option to change port, is to do firewall NATing either on network equipment like router or inside DSM itself (if available but as a Linux system, I guess it is)
I find it worth to write a FAQ in wiki about it...
Maybe indeed good to note in the Wiki that it can't be changed. :) I agree with @BenjV that there's just no need to implement a fancy way to change the ports.
"There is no real need to change a port." IPv4 is a real reason to change port, you won't be able to run multiple instances of Transmission over the same port on your router, using upnp is out of the game if you care about security. Let's not assume people will only have one Synology machine on their network, they may have other machines that may run Transmission too, because it's just less costly to let the machine that should store the data do the actual download instead of wasting CPU cycles downloading from one to store on the other.
Ports issues are different from user permission issues from people that are too selfish to understand a system can a will use multiple users sessions, let's not mix them.
Please do write in the wiki that if the port is changed, it won't reflect in DSM at this time, the service_prestart idea seems to be a good one and I will dig there, it would mean the service would have to be restarted to reflect the change, but it's cleaner that hard coded ports in a world where ISP are lagging the IPv6 train.
It is a very silly idea to have more then one Nas running transmission.
Lots of issue will arrive from people that choose ports that conflict with other packages and to accommondate something almost nobody needs, is not the right way to go.
For new Package Requests, see the guidelines
Setup
_Package Name:_Transmission _Package Version:_2.93-14
_NAS Model:_DS918+ _NAS Architecture:_x86_64 _DSM version:_6.1.6-15266 Update 1
Expected behavior
Tell us what should happen Changing Transmission's listening port should reflect in DSM's firewall rules when using package instead of manual port
Actual behavior
Tell us what happens instead Default transmission port is always reported
Steps to reproduce
_1._Open Transmission settings _2._Change listening port _3._Open DSM firewall config _4._Add new rule for Transmission
OR
_1._Ensure Transmission is not running _2._Change listening port in settings.json _3._Start Transmission from package center _4._DSM asks if we want to whitelist inbound connection to Transmission on port 9091
Package log
Check Package Center or
/usr/local/{package}/var/
Other logs
E.g.
/var/log/messages
or/var/log/synopkg.log