Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Add: Prompt for secure connection choice#6409

Merged
vadi2 merged 20 commits intoMudlet:developmentfrom
mpconley:mssp_ssl
Nov 12, 2022
Merged

Add: Prompt for secure connection choice#6409
vadi2 merged 20 commits intoMudlet:developmentfrom
mpconley:mssp_ssl

Conversation

@mpconley
Copy link
Contributor

@mpconley mpconley commented Nov 6, 2022

Brief overview of PR additions

To encourage enhanced data transfer protection and privacy, respond to detection of the TLS (or SSL legacy) key of MSSP (Mud Server Status Protocol) and prompt a user not on a TLS connection with a choice to reconnect with the advertised TLS port from MSSP.

Screen Shot 2022-11-05 at 7 03 05 PM

If the user selects Yes, automatically update the port with the TLS value gathered from MSSP, check-mark the Secure checkbox on the connection dialog, then reconnect. If the user selects No, automatically update a profile preference so they are not asked again for the current profile, then reconnect. This preference may be controlled on the Settings->Connection menu. This preference is enabled by default.

Screen Shot 2022-11-05 at 7 37 14 PM

  • MSSP TLS key values of -1 or 0 are indicators the game does not offer a TLS port.
  • If an TLS (or legacy SSL) key/value pair does not exist, nothing happens.

Motivation for adding to Mudlet

Data protection and privacy.

Other info (issues closed, discussion etc)

Closes Issue #5075 Make use of MSSP's secure connection flag

Release Notes

To encourage enhanced data transfer protection and privacy, users will be prompted for a choice to switch to an encrypted port when this is advertised by their game via the Mud Server Status Protocol (MSSP).

  • Many more users will shift over easily to secure ports, which are little known to others than their game runners.
  • Increasing awareness of the TLS key of MSSP among game runners will be needed.

Wiki Updated

How to Test
  1. Connect to host: stickmud.com port: 7680 with the Secure checkbox unchecked. If you use the default game button in Mudlet, be sure to make the appropriate updates specified previously.
  2. Receive the prompt, select Yes, then verify you receive the secure connection confirmations.
  3. Close Mudlet, open Mudlet, connect to StickMUD, and note the port is changed to 7670 and the Secure checkbox is checked. There should be no prompt and you will continue to the logon screen of StickMUD.
  4. Close Mudlet, open Mudlet, change the port back to 7680 and uncheck the Secure checkbox, then connect to StickMUD.
  5. Receive the prompt, select No, then connect to StickMUD without receiving the secure connection confirmations.
  6. Open up Settings->Connection and note that Allow secure connection reminder is unchecked.
  7. Close Mudlet, open Mudlet, then connect to StickMUD without receiving the prompt.
  8. Open up Settings->Connection and checkmark Allow secure connection reminder and hit the Save button.
  9. Close Mudlet, open Mudlet, change the port back to 7680, then connect to StickMUD.
  10. Receive the prompt.
Design Decisions

Although it would be preferred to not reconnect when the user selects No, the buffer would not continue writing without hitting the return key afterward. Since this scenario only happens once per profile, the approach to reconnect was selected.

This PR could be followed up with an enhancement to test the TLS port before activating this scenario, but the control offered by the profile preference should offer a good work-around to solve any outlier edge cases and that may never be needed.

Miscellaneous

At the time of submitting this PR, there was an issue with timestamps appearing upon the second profile load which is reported in Issue #6408.

@mpconley mpconley requested a review from a team as a code owner November 6, 2022 00:26
@mpconley mpconley requested review from a team November 6, 2022 00:26
@add-deployment-links
Copy link

add-deployment-links bot commented Nov 6, 2022

Hey there! Thanks for helping Mudlet improve. 🌟

Test versions

You can directly test the changes here:

No need to install anything - just unzip and run.
Let us know if it works well, and if it doesn't, please give details.

@cpu
Copy link

cpu commented Nov 6, 2022

Cool idea! Thanks for implementing it @mpconley 🎉 🔒 🎉

I would also be curious if you or the Mudlet developers have thought about adding RFC 2941 support for using AUTHENTICATION negotiation to upgrade an existing telnet connection to use encryption opportunistically. I haven't found any MUD clients with support yet, so I've been putting off implementing support in my server. Very possible MUD client developers are playing the same chicken/egg game from the other side :-)

respond to detection of the SSL key of MSSP (Mud Server Status Protocol)

I don't know how tightly specified MSSP is but I'd love to see Mudlet also respect a TLS key when detected in the MTTS information. It's pedantic but I hate to propagate the legacy protocol name further.

This would introduce the complication of having to decide what to do if a server's MTTS info contains both keys. It seems reasonable to prefer the TLS key in that case. WDYT?

@Kebap
Copy link
Contributor

Kebap commented Nov 6, 2022

TLS builds on the now-deprecated SSL (Secure Sockets Layer) specifications

Source: https://en.wikipedia.org/wiki/Transport_Layer_Security

Better rename SSL to TLS.

@vadi2
Copy link
Member

vadi2 commented Nov 6, 2022

I would also be curious if you or the Mudlet developers have thought about adding RFC 2941 support for using AUTHENTICATION negotiation to upgrade an existing telnet connection to use encryption opportunistically.

I've thought about this problem, did not know there was a spec already for it. Would be very happy to see this supported in Mudlet.

I don't know how tightly specified MSSP is but I'd love to see Mudlet also respect a TLS key when detected in the MTTS information. It's pedantic but I hate to propagate the legacy protocol name further.

Agreed!

This would introduce the complication of having to decide what to do if a server's MTTS info contains both keys. It seems reasonable to prefer the TLS key in that case. WDYT?

Also agreed.

@mpconley
Copy link
Contributor Author

mpconley commented Nov 6, 2022

TLS builds on the now-deprecated SSL (Secure Sockets Layer) specifications

Source: https://en.wikipedia.org/wiki/Transport_Layer_Security

Better rename SSL to TLS.

I will add a TLS key as well into the code. Current games are using SSL as the port indicator.

@mpconley
Copy link
Contributor Author

mpconley commented Nov 6, 2022

I would also be curious if you or the Mudlet developers have thought about adding RFC 2941 support for using AUTHENTICATION negotiation to upgrade an existing telnet connection to use encryption opportunistically. I haven't found any MUD clients with support yet, so I've been putting off implementing support in my server. Very possible MUD client developers are playing the same chicken/egg game from the other side :-)

If you'd consider implementing it in your MUD and LDMud 2.4.5 code, I may be able to do the Mudlet side of the equation. I could do the MUD side too (and perhaps will!) but you've got the mad skills and it will take me longer :)

I don't know how tightly specified MSSP is but I'd love to see Mudlet also respect a TLS key when detected in the MTTS information. It's pedantic but I hate to propagate the legacy protocol name further.

Were you thinking a TLS key to carry over the port information via MTTS, or for authentication? I have MTTS in my game, but it is an odd protocol, and we'd need to cut @SlySven 's internet access for a while to get it merged into Mudlet :) Would be nice to know how many games are implementing to understand the value of adding it.

@cpu
Copy link

cpu commented Nov 6, 2022

If you'd consider implementing it in your MUD and LDMud 2.4.5 code, I may be able to do the Mudlet side of the equation.

👍 - I'll take a look at doing that. I think Gnomi contributed the hard parts but hasn't wired them up in the 2.4.5 example game.

Were you thinking a TLS key to carry over the port information via MTTS

@mpconley I was thinking that in the Mud Server Status Protocol I'd like to support sending TLS = "$PORT" in place of (or alongside if required for interop with other clients) SSL = "$PORT", and have Mudlet detect it to prompt users on a telnet port to switch.

@mpconley
Copy link
Contributor Author

mpconley commented Nov 6, 2022

@mpconley I was thinking that in the Mud Server Status Protocol I'd like to support sending TLS = "$PORT" in place of (or alongside if required for interop with other clients) SSL = "$PORT", and have Mudlet detect it to prompt users on a telnet port to switch.

OK, cool. The latest build here supports TLS = "$PORT" now with MSSP.

@mpconley
Copy link
Contributor Author

mpconley commented Nov 6, 2022

Test cases passed on: ats.trekmush.org 1701 and cheeseworld.wtf 3000 to respond to MSSP and flip them over to TLS.

@cpu
Copy link

cpu commented Nov 6, 2022

I don't have MSSP setup on dunemud.net but on dev.dunemud.net the MSSP info was updated with both TLS and SSL keys in case you want a test host advertising both. You should be able to hit dev.dunemud.net:4242 (telnet) and get prompted to switch to dev.dunemud.net:4241 (TLS).

@mpconley
Copy link
Contributor Author

mpconley commented Nov 6, 2022

Worked for me!

Screen Shot 2022-11-06 at 1 40 31 PM

Screen Shot 2022-11-06 at 1 40 50 PM

Nice login controls once you get inside the game to lock people down to the TLS port, @cpu !

@vadi2
Copy link
Member

vadi2 commented Nov 6, 2022

Great stuff. Just highlighting that #6409 (comment) has up to date links with dev builds that you can unzip and run.

@mpconley
Copy link
Contributor Author

mpconley commented Nov 6, 2022

Screen Shot 2022-11-06 at 4 27 46 PM

@demonnic
Copy link
Member

demonnic commented Nov 8, 2022

So this is functional, but on the preference screen where the new preference is I'm also seeing an extra box outline

image

And in Light mode, it is behind the checkbox

image

Other than that, it lgtm

@SlySven
Copy link
Member

SlySven commented Nov 8, 2022

🤦‍♂️ That option in the preferences should be a QCheckBox NOT a QGroupBox there is not other information to be displayed within the element so it shouldn't be a container-type widget. {Edit: That is why Demonnic is seeing that extra empty box - and the reason why the two examples he showed looked different is that in "Dark mode" the Style factory used is forced to be Qt's own "Fusion" one whereas in "Normal" /"Light" mode it uses whatever is the default for that OS which on Windows is "windowsvista" and on MacOS is something else - and they do look different!}

Also please call the widget in the form/dialogue something beginning with checkBox_ rather than something beginning with m. It helps to keep track what shape the knob has in the C++ methods that use it.

Also also, can you check that if you are multi-playing (have another profile already open, can be to a different MUD) that the QMessageBox that pop-up does NOT stop things working in the other profile while it is waiting for an answer. I have a nasty suspicion that (particularly on WIndows) such an item stalls the main event-loop which might not be a good idea. See: https://doc.qt.io/qt-5/qmessagebox.html#exec and for further enlightenment I found this article {incidentally by the guy behind the "QtKeychain" interface to the OS's secure storage system library!}

@atari2600tim
Copy link
Contributor

atari2600tim commented Nov 10, 2022

I put my IP address and unencrypted port into a new profile, connected. It brings up the question. I click Yes. It reconnects, brings up the profile preferences window, "The host name did not match any of the valid hosts for this certificate", which is completely appropriate, as my certificate is issued for the domain name and not IP address.

On the preferences window there are options to "Accept self-signed certificates", "Accept expired certificates", "Accept all certificate errors". Nothing sounds like accept this specific certificate (which is outside the scope of this PR, but perhaps something to consider later).

172.105.4.154 7680 for StickMUD does the same thing.
image

MSSP does usually have "HOSTNAME". Perhaps offer to change both the port and also the hostname if it does not match the stored hostname, with an updated message that mentions this.

Then I tried 192.99.10.40 3000 for Cheeseworld, clicked yes, and it went straight into it. At first I figured maybe their certificate is configured different than me and StickMUD and includes the IP and I should be doing the same on mine? I look in the connection tab and it says issued to coremud.org. I look in Chrome and https://coremud.org uses a certificate that says Certificate Subject Alternative Name has coremud.org, cheeseworld.wtf, and core.evilmog.io. I guess because the reverse lookup of the 192.99.10.40 returns coremud.org, that's what made it working match? Mudlet connected with [ INFO ] - Looking up the IP address of server: 192.99.10.40:3022 ... [ INFO ] - Trying secure connection to coremud.org: 3022 ... so I guess it is aware of the reverse lookup even though it was given the IP directly. What I probably should do on my own game next time I mess with letsencrypt I guess is either set the reverse lookup to say my domain name, or else change my certificates to include the Google Cloud name.

Anyway, after I have connected to Cheeseworld with the secure port and saved my profile and then closed and reopened client, that profile comes up saying 192.99.10.40 3022 with secure checked, with the connect button disabled and a warning saying SSL connections require URL. So they'd benefit from utilizing HOSTNAME even though their switching over worked initially.

@SlySven
Copy link
Member

SlySven commented Nov 11, 2022

You needed the latest development code as I broke that branch recently...

@mpconley
Copy link
Contributor Author

So this is functional, but on the preference screen where the new preference is I'm also seeing an extra box outline

image

And in Light mode, it is behind the checkbox

image

Other than that, it lgtm

@demonnic could you take another look now? This is now a QCheckBox. I had my reasons on Mac for doing what I did, but your comments provided insight that needed addressed for other platforms - so thank you!

@mpconley
Copy link
Contributor Author

Also please call the widget in the form/dialogue something beginning with checkBox_ rather than something beginning with m. It helps to keep track what shape the knob has in the C++ methods that use it.

@SlySven this naming conflict is resolved.

@mpconley
Copy link
Contributor Author

mpconley commented Nov 12, 2022

Also also, can you check that if you are multi-playing (have another profile already open, can be to a different MUD) that the QMessageBox that pop-up does NOT stop things working in the other profile while it is waiting for an answer. I have a nasty suspicion that (particularly on WIndows) such an item stalls the main event-loop which might not be a good idea. See: https://doc.qt.io/qt-5/qmessagebox.html#exec and for further enlightenment I found this article {incidentally by the guy behind the "QtKeychain" interface to the OS's secure storage system library!}

@SlySven QMessageBox is also used with downloading a map in Mudlet, and things keep happening in the background during that dialog being open, so that is evidence that the main event loop is not halted completely. I took the advice of the article you shared, which uses a QPointer and uses a delete right after the exec() is called. This differs from the OTB example from the Qt documentation of QMessageBox. The change works the same. Hopefully straying from the documentation does not lead someone in the future to ask WTH this Tamarindo was thinking when he created this QPointer.

Copy link
Member

@demonnic demonnic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

functions as it says it does, and now the option looks cleaner in the settings dialog for me. Thanks =)

@mpconley
Copy link
Contributor Author

172.105.4.154 7680 for StickMUD does the same thing.

Thank you @atari2600tim. This inspired some more changes. I limited this from prompting if there are any scenarios out there that could lead to confusion for non-technical users. For now, this will filter out prompting profiles that are using an IP address as their host name. Also, decided not to prompt if a HOSTNAME is define by MSSP, but that does not match the host name in Mudlet. That could be an indicator that a game has not updated their MSSP information over time and provides the slightest reason not to prompt.

@mpconley
Copy link
Contributor Author

Handled known comments to date and no more changes planned from my side.

Copy link
Member

@vadi2 vadi2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fantastic stuff and works great!

@atari2600tim
Copy link
Contributor

atari2600tim commented Nov 12, 2022

Try out 172-105-4-154.ip.linodeusercontent.com 7680 (not that any players would be using that, but just to be thorough)

"Issued to" is probably enough for a geeky type to figure out what's going on, someone who is setting up their own game or something I mean.

@mpconley
Copy link
Contributor Author

172-105-4-154.ip.linodeusercontent.com 7680

Cool. Tested and I did not see anything I did not expect there.

@vadi2 vadi2 added the needs documentation This pull request changes things the players would use/see and thus needs an update in the manual label Nov 12, 2022
@vadi2 vadi2 added this to the 4.17.0 milestone Nov 12, 2022
@vadi2 vadi2 enabled auto-merge (squash) November 12, 2022 19:57
@vadi2
Copy link
Member

vadi2 commented Nov 12, 2022

LGTM, thanks!

@vadi2 vadi2 merged commit 87b04d4 into Mudlet:development Nov 12, 2022
@mpconley mpconley deleted the mssp_ssl branch November 12, 2022 20:42
vadi2 pushed a commit that referenced this pull request Mar 3, 2023
…6606)

#### Brief overview of PR changes/additions

Do not build `promptTlsConnectionAvailable` in ctelnet if `QT_NO_SSL` is
set.

#### Motivation for adding to Mudlet

Tried to build using Qt built without SSL support and noticed the
changes from #6409 do not check if `QT_NO_SSL` is defined.

#### Other info (issues closed, discussion etc)
@mpconley mpconley removed the needs documentation This pull request changes things the players would use/see and thus needs an update in the manual label Mar 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants