Skip to content
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

Add support for storing RDP licenses from Windows Desktops #51250

Merged
merged 23 commits into from
Jan 23, 2025

Conversation

probakowski
Copy link
Contributor

@probakowski probakowski commented Jan 20, 2025

Windows desktop can send license during initial exchange, the client should store it and send it again during future connections. We have this already implemented in v14 in rdp-rs, this change adds it to the newer versions using recent changes in IronRDP (Devolutions/IronRDP#634).

Storing and retrieving licenses on the Go side inspired by #47634

changelog: Add support for storing RDP licenses from Windows Desktops

lib/srv/desktop/rdp/rdpclient/client.go Outdated Show resolved Hide resolved
lib/srv/desktop/rdp/rdpclient/src/client.rs Outdated Show resolved Hide resolved
lib/auth/storage/storage.go Outdated Show resolved Hide resolved
item := backend.Item{
Key: p.rdpLicenseKey(version, issuer, company, productID),
Value: license,
Expires: p.BackendStorage.Clock().Now().Add(28 * 24 * time.Hour),
Copy link
Contributor

Choose a reason for hiding this comment

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

Any particular reason behind the 28d expiration? Maybe add a comment?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This one was copied from #47634, @zmb3 any particular reason for that?

lib/auth/storage/storage.go Outdated Show resolved Hide resolved
lib/auth/storage/storage.go Outdated Show resolved Hide resolved
lib/auth/storage/storage.go Show resolved Hide resolved
lib/srv/desktop/rdp/rdpclient/client.go Outdated Show resolved Hide resolved
lib/srv/desktop/rdp/rdpclient/client.go Show resolved Hide resolved
lib/srv/desktop/rdp/rdpclient/client.go Show resolved Hide resolved
lib/srv/desktop/rdp/rdpclient/client.go Outdated Show resolved Hide resolved
lib/srv/desktop/rdp/rdpclient/src/license.rs Outdated Show resolved Hide resolved
lib/srv/desktop/rdp/rdpclient/client.go Outdated Show resolved Hide resolved
lib/srv/desktop/rdp/rdpclient/client.go Outdated Show resolved Hide resolved
lib/srv/desktop/rdp/rdpclient/client.go Outdated Show resolved Hide resolved
lib/auth/storage/storage.go Outdated Show resolved Hide resolved
lib/auth/storage/storage.go Outdated Show resolved Hide resolved
lib/auth/storage/storage_test.go Outdated Show resolved Hide resolved
lib/auth/storage/storage.go Outdated Show resolved Hide resolved
@codingllama
Copy link
Contributor

Looks good, just waiting for a resolution on #51250 (comment).

Copy link
Contributor

@codingllama codingllama left a comment

Choose a reason for hiding this comment

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

Looks good, Przemko. Thanks for all the changes.

Please address the final comments.

api/types/desktop.go Show resolved Hide resolved
api/types/desktop.go Outdated Show resolved Hide resolved
lib/auth/storage/storage.go Outdated Show resolved Hide resolved
@probakowski probakowski enabled auto-merge January 23, 2025 17:43
@@ -543,3 +543,11 @@ func checkNameAndScreenSize(name string, screenSize *Resolution) error {
}
return nil
}

// RDPLicenseKey is struct for retrieving licenses from backend cache, used only internally
Copy link
Contributor

Choose a reason for hiding this comment

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

If this type is only used internally then it probably shouldn't exist in the api module.


// WriteRDPLicense writes an RDP license to local storage.
func (p *ProcessStorage) WriteRDPLicense(ctx context.Context, key *types.RDPLicenseKey, license []byte) error {
value, err := json.Marshal(rdpLicense{Data: license})
Copy link
Contributor

Choose a reason for hiding this comment

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

If you are still working here it's worth checking if key is nil, both in this method and the Read.

@probakowski probakowski added this pull request to the merge queue Jan 23, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jan 23, 2025
@probakowski probakowski added this pull request to the merge queue Jan 23, 2025
Merged via the queue into master with commit dc118f9 Jan 23, 2025
46 checks passed
@probakowski probakowski deleted the probakowski/license branch January 23, 2025 23:01
@public-teleport-github-review-bot

@probakowski See the table below for backport results.

Branch Result
branch/v15 Failed
branch/v16 Failed
branch/v17 Failed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants