What are TSplus Logon Tickets? Why Use Them?


The TSplus logon ticket is a secure token that can be requested from a TSplus Remote Access server to bypass the built-in login page for the HTML5 client and start an HTML5 session. Logon tickets can be used in cases where you have special authentication requirements, such as SSO, and need to start the HTML5 session after the user has already been authenticated using your own custom login web portal. 


This feature is described in point 32 of the faq.html file available on any TSplus Remote Access server:

C:\Program Files (x86)\TSplus\Clients\www\software\html5\faq.html


So that you know, there is a way to request a login ticket using plain text usernames and passwords. However, this article will not discuss this in favor of the more secure encryption method demonstrated. Below are sample workflows and C# code for demonstrating functionality, which your development and security teams should thoroughly vet and test before using in a live environment. We do not offer support for custom code (even our example), and you would be responsible for maintaining your code. 


Caveats with SSO


The HTML5 client for TSplus Remote Access is more than just a website. It also starts a terminal services session, which requires knowledge of the Windows username and password. Most SSO solutions will redirect the user to a trusted third-party website to enter their credentials, meaning you will likely not be able to capture the user's credentials at login time, creating a need to maintain a list of your user's usernames and passwords. 


Workflows


Below are some diagrams displaying the workflow for using logon tickets in a few different scenarios. 



Example: Using a Standalone TSplus Remote Access Server


1. Request the App Server's Modulus and Exponent and Encrypt Credentials


GET Request: https://{TSplus Server's URL:port}/socket.io/WCREDS?GetRuntimePublicModulusExponent

Expected response : modulus:exponent

Sample response: 


995285725c9d5a2d947e5ad3e0a2e8cad60554595a312150f3cbc27beccba75632a70e9d95980187c53ef3299da2cc4b6b10b7470d9512637a365d4bdd35ceab1f7cb19533adef57a9d5b84b75ddcd554412b7bf36682fb1dd6631be7eec8c3d60b5f3266d2b0bd83818490a89a75b7da94e2ac78efcf88bd9a436bada3aacb86c8310f390f718f8b7ced55f6f7297b29b747e9ea2676f7246ce05ade3454724e9c9c9c9a933a6bcb63caf5675901e06819b70fb2212a32eb6ab965b8602403fa7bb973e2e7134ac0db3377e2b5fe0f85a4b6b8f08581b8a3b06e37e8ffa4dea265a856bb654a7b622c16db02cb86ad1a2ec98d3f6903622b670a8708fa9f5eb:10001


Once you have the modulus and exponent, you can use these to encrypt the user’s credentials in the following format with RSA encryption. Just replace the username with the user's actual username and the password with the user's actual password. After the credentials are encrypted, they must be converted to Base64 format.


For a local Windows account:

'WinUser=username&WinPassword=password'


For an Active Directory user account:

'WinUser=DOMAIN\\username&WinPassword=password'


Sample code snippet




2. Request Logon Ticket


GET Request: https://{TSplus Server's URL:port}/socket.io/socket.io/LPW?rsabase64nojs=encryptedPassword

Expected response: logon ticket

Sample response: *8Oa5NxWljnYyXgAVcZDj8T7T4duOZIce


The encryptedPassword parameter in the URL above is the Base64 encoded RSA encrypted password from the previous step.




3. Redirect the User to the Application Server with the Logon Ticket


Once you have this token, it can be used to construct a URL that the user can use to access the TSplus Remote Access server and start an HTML5 session. 


Example:

https://{TSplus Server's URL:port}/software/html5.html?user=logonticketgoeshere





Example: Using Logon Tickets With Load Balancing in a TSplus Remote Access Farm


1. Get the Application Server Chosen During Load Balancing

After receiving this information, you can craft a URL to target the application server in the following format. Then, use the same procedure to obtain the login ticket as the process used for the standalone server. For example, if the application server is named app1, the URL format to access that server is: https://{TSplus Gateway Server's URL:port}/~~app1. Please refer to the workflow for an example.


GET Request: https://{TSplus Server's URL:port}/cgi-bin/hb.exe?action=lb&l=username&d=domain

Expected response: Load balanced server information

Sample response: loadbalancing-on|app4|gw.gw.com/~~app4|https|443


If Load Balancing is not configured, you may receive the unexpected response loadbalancing-off instead.




Example: Using Logon Tickets With Assigned Servers in a TSplus Remote Access Farm


1. Get the List of Assigned Servers for the User

After receiving this information, you can craft a URL to target the application server in the following format. Then, use the same procedure to obtain the login ticket as the process used for the standalone server. For example, if the application server is named app1, the URL format to access that server is: https://{TSplus Gateway Server's URL:port}/~~app1. Please refer to the workflow for an example.


GET Request: https://{TSplus Server's URL:port}/cgi-bin/hb.exe?action=srvassigned&l=username&d=domain

Expected response: list of server information separated by a return and new line "/r/n" (generally not visible)

Sample response:


app1|gw.gw.com/~~app1:443

app2|gw.gw.com/~~app2:443

app3|gw.gw.com/~~app3:443


If the user is not assigned to any server, you may get the unexpected response KO instead.


You can use this list to populate a drop-down box the user can select to pick a specific server and then proceed to request a logon ticket for that server.





Security Considerations


Below are additional settings.bin options on the application server to make the logon tickets more secure. Update C:\Program Files (x86)\TSplus\Clients\webserver\settings.bin with the following optional options. Please note that modifying settings.bin requires restarting the TSplus Remote Access built-in web server:


logon_type_allowance="3"

This setting, configured on “3”, will only allow the use of the logon ticket for HTML5 connections. Thus, the URL parameters method will be denied, and a connection will be made from the TSplus web portal.

        

lpw_timeout_list_ip="|{IP ADDRESS}|"

This setting will only allow a certain IP address to request logon tickets. Replace {IP ADDRESS} with the actual IP address. To allow multiple IPs :

  • lpw_timeout_list_ip="|{IP ADDRESS}|{IP ADDRESS}|{IP ADDRESS}|{IP ADDRESS}|"

       

lpw_phrase="my_secret"

This setting will only access logon ticket requests if the request contains a specific secret key (my_secret is an example, please use a more secure string). When encrypting the credentials, you would add &WinLPWphrase=my_secret at the end, like this:

  •  WinUser=username&WinPassword=password&WinLPWphrase=my_secret

        

accept_lpw_only_rsa_secured=true

This setting will only accept logon ticket requests if the request is done using RSA method. Plain text method will be rejected.