Skip to content

Add support for storing RDP licenses from Windows Desktops#51250

Merged
probakowski merged 23 commits intomasterfrom
probakowski/license
Jan 23, 2025
Merged

Add support for storing RDP licenses from Windows Desktops#51250
probakowski merged 23 commits intomasterfrom
probakowski/license

Conversation

@probakowski
Copy link
Copy Markdown
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

Comment thread lib/srv/desktop/rdp/rdpclient/client.go Outdated
Comment thread lib/srv/desktop/rdp/rdpclient/src/client.rs Outdated
Comment thread lib/auth/storage/storage.go Outdated
item := backend.Item{
Key: p.rdpLicenseKey(version, issuer, company, productID),
Value: license,
Expires: p.BackendStorage.Clock().Now().Add(28 * 24 * time.Hour),
Copy link
Copy Markdown
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
Copy Markdown
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?

Comment thread lib/auth/storage/storage.go Outdated
Comment thread lib/auth/storage/storage.go Outdated
Comment thread lib/auth/storage/storage.go
Comment thread lib/srv/desktop/rdp/rdpclient/client.go
Comment thread lib/srv/desktop/rdp/rdpclient/client.go
Comment thread lib/srv/desktop/rdp/rdpclient/client.go
Comment thread lib/srv/desktop/rdp/rdpclient/client.go Outdated
Comment thread lib/srv/desktop/rdp/rdpclient/src/license.rs Outdated
Comment thread lib/srv/desktop/rdp/rdpclient/client.go Outdated
Comment thread lib/srv/desktop/rdp/rdpclient/client.go Outdated
Comment thread lib/srv/desktop/rdp/rdpclient/client.go Outdated
@codingllama
Copy link
Copy Markdown
Contributor

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

Copy link
Copy Markdown
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.

Comment thread api/types/desktop.go
Comment thread api/types/desktop.go Outdated
Comment thread lib/auth/storage/storage.go Outdated
@probakowski probakowski enabled auto-merge January 23, 2025 17:43
Comment thread api/types/desktop.go
return nil
}

// RDPLicenseKey is struct for retrieving licenses from backend cache, used only internally
Copy link
Copy Markdown
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
Copy Markdown
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
@probakowski probakowski deleted the probakowski/license branch January 23, 2025 23:01
@public-teleport-github-review-bot
Copy link
Copy Markdown

@probakowski See the table below for backport results.

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

carloscastrojumo pushed a commit to carloscastrojumo/teleport that referenced this pull request Feb 19, 2025
…onal#51250)

* Licensing

* Licensing

* formatting

* dependency review

* review comments

* review comments

* review comments

* review comments

* test

* gci

* introduce RDPLicenseKey

* Update lib/auth/storage/storage_test.go

Co-authored-by: Alan Parra <alan.parra@goteleport.com>

* review comments

* fix test

* review comments

* review comments

* fix tests

* gci

* gci

---------

Co-authored-by: Alan Parra <alan.parra@goteleport.com>
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