Bug 441889 - SSH Manager does not allow port numbers greater than 9999
Summary: SSH Manager does not allow port numbers greater than 9999
Status: RESOLVED FIXED
Alias: None
Product: konsole
Classification: Applications
Component: general (show other bugs)
Version: 21.08.0
Platform: Debian unstable Linux
: NOR normal
Target Milestone: ---
Assignee: Konsole Developer
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-09-02 03:04 UTC by Iris Morelle
Modified: 2021-09-02 15:28 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 21.08.2
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Iris Morelle 2021-09-02 03:04:31 UTC
SUMMARY

The new SSH Manager plugin does not accept port numbers above 9999. This is a bit of a problem for my own use case, where I have access to systems with ssh servers listening on port numbers well above 10000.


STEPS TO REPRODUCE

1. Use Plugins -> Show SSH Manager
2. Click on Add to add a new SSH configuration
3. Attempt to enter 12345 into the Port field

OBSERVED RESULT

The maximum port number that may be entered is 9999.

EXPECTED RESULT

The maximum port number that may be entered should be a larger number above 9999 and below 65536 (see Additional Information below).

SOFTWARE/OS VERSIONS

Linux: Debian sid, Linux kernel 5.13.10
KDE Plasma Version: 5.22.5
KDE Frameworks Version: 5.85.0
Qt Version: 5.15.2

ADDITIONAL INFORMATION

While the idea of validating port numbers is nice, the issue with getting too specific with it is that the range for non-ephemeral ports can vary by platform and individual system configuration. For Linux in particular, the default range for ephemeral ports (configurable via procfs /proc/sys/net/ipv4/ip_local_port_range) is 32768-60999, allowing ports 1 through 32767 to be used for anything else. Meanwhile, IANA recommends people to use 49152-65535 for ephemeral ports.

The validation check can be changed to accept port numbers with 5 digits instead of 4 since port numbers are currently 16-bit unsigned integers. If the devs prefer, the port number can be checked to be less than or equal than 65535, but again getting more specific than that is bound to cause incompatibilities with edge cases.
Comment 1 Bug Janitor Service 2021-09-02 11:01:24 UTC
A possibly relevant merge request was started @ https://invent.kde.org/utilities/konsole/-/merge_requests/472
Comment 2 Ahmad Samir 2021-09-02 11:03:26 UTC
I did some research and it looks like the maximum port number is 49151 (see the merge request linked above for more details).
Comment 3 Iris Morelle 2021-09-02 11:27:56 UTC
That is the IANA recommendation indeed, although as I mentioned before Linux does allow customizing the port range for ephemeral ports via procfs, thus adding or taking away from the regular port range.
Comment 4 Ahmad Samir 2021-09-02 15:20:05 UTC
Git commit ee7f71142fedd6eda49b4246e65f434e4b3c5bd5 by Ahmad Samir.
Committed on 02/09/2021 at 10:57.
Pushed by hindenburg into branch 'master'.

Fix the maximum port number in the SSH Manager plugin

It should be in the System Ports 0-1023 or User Ports 1024-49151 ranges.

See:
https://en.wikipedia.org/wiki/Registered_port
https://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xhtml
FIXED-IN: 21.12

M  +3    -1    src/plugins/SSHManager/sshmanagerpluginwidget.cpp

https://invent.kde.org/utilities/konsole/commit/ee7f71142fedd6eda49b4246e65f434e4b3c5bd5
Comment 5 Kurt Hindenburg 2021-09-02 15:28:55 UTC
Git commit 41207a9633c4fcb23df2b6275037d7a810ebfb0a by Kurt Hindenburg, on behalf of Ahmad Samir.
Committed on 02/09/2021 at 15:27.
Pushed by hindenburg into branch 'release/21.08'.

Fix the maximum port number in the SSH Manager plugin

It should be in the System Ports 0-1023 or User Ports 1024-49151 ranges.

See:
https://en.wikipedia.org/wiki/Registered_port
https://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xhtml
FIXED-IN: 21.08.2
(cherry picked from commit ee7f71142fedd6eda49b4246e65f434e4b3c5bd5)

M  +3    -1    src/plugins/SSHManager/sshmanagerpluginwidget.cpp

https://invent.kde.org/utilities/konsole/commit/41207a9633c4fcb23df2b6275037d7a810ebfb0a