GithubHelp home page GithubHelp logo

update-server-server-sync's Introduction

Windows Update Services ServerServer Sync Protocol

Provide a C# implementation (.NET Core) of the Microsoft Update Server-Server sync protocol, both client and server.

Use this library to

  • programmatically browse the Microsoft Update catalog
  • sync updates locally and run advanced queries on update metadata
  • export updates to WSUS
  • run an upstream update server in ASP.NET Core and serve updates to downstream WSUS servers
  • run an update server in ASP.NET Core and serve updates Windows Update clients

Reference the library in your project

Visual Studio 2022 with .Net Core development tools is required to build the solution provided at build\microsoft-update.sln

Use the library

Please refer to the API documentation for help on using the library.

Code samples

Use the upsync utility

The upsync command line utility is provided as a sample for using the library. Upsync can be used to browse Microsoft's update catalog, sync updates locally and serve them to Windows Update clients or downstream WSUS servers.

You can build upsync in Visual Studio; it builds from the same solution as the library.

Or download and unzip upsync from https://github.com/microsoft/update-server-server-sync/releases

See upsync examples

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.

When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

update-server-server-sync's People

Contributors

almost-done avatar microsoft-github-policy-service[bot] avatar microsoftopensource avatar msftgits avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

update-server-server-sync's Issues

Unable to store query results in a local file

I have followed the instructions and was able to query results and print in console, however, I wasn't able to store it in a local file, could you please advise?

When I run the command .\upsync.exe query --store-path .\store --package-type microsoft-update, it works just fine. However, when I try to pipe it to a result file (.\upsync.exe query --store-path .\store --package-type microsoft-update *> results.txt), it has an error. I have attached the error message in a file attached in this email.

I later found out this might be because the console library is being used in the MicrosoftUpdateMetadata.cs file. I tried to run it in a separate cmd inside Powershell but only generated partial results, I also attached the result in this email.

Do you know how to store the result in a local file? Thank you so much.

error-message.txt
partial-result.txt

ClassificationIndex and ProductIndex values are null after we get categories

I run following code as shown in examples. catogorySource is retrived but ProductIndex and ClassificationIndex values are null for creating a filter.

var server = new UpstreamServerClient(Endpoint.Default);
var categoriesSource = await server.GetCategories();

// Create a filter for first product and all classifications for it
var filter = new QueryFilter(
categoriesSource.ProductsIndex.Values.Take(1),
categoriesSource.ClassificationsIndex.Values);

https://microsoft.github.io/update-server-server-sync/examples/metadata_basic.html

SSL error on Linux

upsync works fine on Windows but it fails on Linux.

I have tried with Ubuntu 18.04, openSUSE Leap 15.1 and others. I have tried with .NET Core 2.2 and 3.0. It always fails with:

$ dotnet run -p src/sync-tool/upsync-tool.csproj pre-fetch --master --destination master.zip
Creating compressed metadata store master.zip
Fetching categories ...
Acquiring new access token...
Unhandled Exception: System.ServiceModel.Security.SecurityNegotiationException: Could not establish trust relationship for the SSL/TLS secure channel with authority 'sws.update.microsoft.com'. ---> System.Net.Http.HttpRequestException: The SSL connection could not be established, see inner exception. ---> System.Security.Authentication.AuthenticationException: The remote certificate is invalid according to the validation procedure.
at System.Net.Security.SslState.StartSendAuthResetSignal(ProtocolToken message, AsyncProtocolRequest asyncRequest, ExceptionDispatchInfo exception)
at System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken message, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.ProcessReceivedBlob(Byte[] buffer, Int32 count, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.StartReadFrame(Byte[] buffer, Int32 readBytes, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken message, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.ProcessReceivedBlob(Byte[] buffer, Int32 count, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.StartReadFrame(Byte[] buffer, Int32 readBytes, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.PartialFrameCallback(AsyncProtocolRequest asyncRequest)
--- End of stack trace from previous location where exception was thrown ---
at System.Net.Security.SslState.ThrowIfExceptional()
at System.Net.Security.SslState.InternalEndProcessAuthentication(LazyAsyncResult lazyResult)
at System.Net.Security.SslState.EndProcessAuthentication(IAsyncResult result)
at System.Net.Security.SslStream.EndAuthenticateAsClient(IAsyncResult asyncResult)
at System.Net.Security.SslStream.<>c.b__47_1(IAsyncResult iar)
at System.Threading.Tasks.TaskFactory1.FromAsyncCoreLogic(IAsyncResult iar, Func2 endFunction, Action1 endAction, Task1 promise, Boolean requiresSynchronization)
--- End of stack trace from previous location where exception was thrown ---
at System.Net.Http.ConnectHelper.EstablishSslConnectionAsyncCore(Stream stream, SslClientAuthenticationOptions sslOptions, CancellationToken cancellationToken)
--- End of inner exception stack trace ---
at System.Net.Http.ConnectHelper.EstablishSslConnectionAsyncCore(Stream stream, SslClientAuthenticationOptions sslOptions, CancellationToken cancellationToken)
at System.Threading.Tasks.ValueTask1.get_Result() at System.Net.Http.HttpConnectionPool.CreateConnectionAsync(HttpRequestMessage request, CancellationToken cancellationToken) at System.Threading.Tasks.ValueTask1.get_Result()
at System.Net.Http.HttpConnectionPool.WaitForCreatedConnectionAsync(ValueTask1 creationTask) at System.Threading.Tasks.ValueTask1.get_Result()
at System.Net.Http.HttpConnectionPool.SendWithRetryAsync(HttpRequestMessage request, Boolean doRequestAuth, CancellationToken cancellationToken)
at System.Net.Http.AuthenticationHelper.SendWithAuthAsync(HttpRequestMessage request, Uri authUri, ICredentials credentials, Boolean preAuthenticate, Boolean isProxyAuth, Boolean doRequestAuth, HttpConnectionPool pool, CancellationToken cancellationToken)
at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at System.Net.Http.DecompressionHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at System.Net.Http.HttpClient.FinishSendAsyncUnbuffered(Task1 sendTask, HttpRequestMessage request, CancellationTokenSource cts, Boolean disposeCts) at System.ServiceModel.Channels.HttpChannelFactory1.HttpClientRequestChannel.HttpClientChannelAsyncRequest.SendRequestAsync(Message message, TimeoutHelper timeoutHelper)
--- End of inner exception stack trace ---
at System.Runtime.AsyncResult.End[TAsyncResult](IAsyncResult result)
at System.ServiceModel.Channels.ServiceChannel.SendAsyncResult.End(SendAsyncResult result)
at System.ServiceModel.Channels.ServiceChannel.EndCall(String action, Object[] outs, IAsyncResult result)
at System.ServiceModel.Channels.ServiceChannelProxy.TaskCreator.<>c__DisplayClass1_0.b__0(IAsyncResult asyncResult)
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.UpdateServices.Client.ClientAuthenticator.GetAuthenticationInfo() in /home/pagarcia/dev/wsus/update-server-server-sync/src/library/Client/ClientAuthenticator.cs:line 181
at Microsoft.UpdateServices.Client.ClientAuthenticator.Authenticate() in /home/pagarcia/dev/wsus/update-server-server-sync/src/library/Client/ClientAuthenticator.cs:line 155
at Microsoft.UpdateServices.Client.ClientAuthenticator.Authenticate(ServiceAccessToken cachedAccessToken) in /home/pagarcia/dev/wsus/update-server-server-sync/src/library/Client/ClientAuthenticator.cs:line 107
at Microsoft.UpdateServices.Client.UpstreamServerClient.RefreshAccessToken(String accountName, Nullable1 accountGuid) in /home/pagarcia/dev/wsus/update-server-server-sync/src/library/Client/UpstreamServerClient.cs:line 95 at Microsoft.UpdateServices.Client.UpstreamServerClient.GetCategories(IMetadataSink destination) in /home/pagarcia/dev/wsus/update-server-server-sync/src/library/Client/UpstreamServerClient.cs:line 140 at Microsoft.UpdateServices.Tools.UpdateRepo.MetadataSync.FetchUpdates(QueryFilter queryToRun, CompressedMetadataStore destinationResult) in /home/pagarcia/dev/wsus/update-server-server-sync/src/sync-tool/MetadataFetch.cs:line 167 at Microsoft.UpdateServices.Tools.UpdateRepo.MetadataSync.FetchCategories(FetchCategoriesOptions options) in /home/pagarcia/dev/wsus/update-server-server-sync/src/sync-tool/MetadataFetch.cs:line 98 at Microsoft.UpdateServices.Tools.UpdateRepo.Program.<>c.<Main>b__0_2(FetchCategoriesOptions opts) in /home/pagarcia/dev/wsus/update-server-server-sync/src/sync-tool/Program.cs:line 28 at CommandLine.ParserResultExtensions.WithParsed[T](ParserResult1 result, Action`1 action)
at Microsoft.UpdateServices.Tools.UpdateRepo.Program.Main(String[] args) in /home/pagarcia/dev/wsus/update-server-server-sync/src/sync-tool/Program.cs:line 15

I have tried all the workarounds described in the .NET Core GitHub issue tracker but none of them work for me :-?

Unresolved bundle updates Exception when performing fetch on local upstream server

Greetings,
I was testing the upsync tool functionality for another project when i came across the Exception 'Unresolved bundle updates' when performing a fetch operation on an locally running upsync server (also with the upsync tool).

The following commands were used to get this Exception:

Populating the upstream server filtered by the product id for Visual Studio 2017:

.\upsync.exe pre-fetch --master --destination master.zip

copy master.zip master-test.zip

.\upsync.exe fetch --product-filter 682005f1-54fd-440f-b3b3-b9c652351d01 --baseline .\master-test.zip
 
.\upsync.exe fetch-content --metadata-source .\master-test-1.zip --destination .\

.\upsync.exe fetch-config --destination server-config.json

.\upsync.exe run-upstream-server --endpoint localhost --metadata-source master-test-1.zip --content-source .\ --service-config server-config.json

Trying to get the updates from the local upstream server:

.\upsync.exe  pre-fetch --endpoint http://localhost:32150 --destination local_master.zip

copy .\local_master.zip .\local_master_test.zip

.\upsync.exe  fetch --product-filter 682005f1-54fd-440f-b3b3-b9c652351d01 --baseline local_master_test.zip

This is the Exception i get:

Unhandled Exception: System.Exception: Unresolved bundle updates
   at Microsoft.UpdateServices.Storage.CompressedMetadataStore.SaveBundlesIndex() in E:\src\temp\update-server-server-sync\src\library\Storage\Metadata\CompressedMetadataStore-BundlesIndex.cs:line 119
   at Microsoft.UpdateServices.Storage.CompressedMetadataStore.Commit() in E:\src\temp\update-server-server-sync\src\library\Storage\Metadata\CompressedMetadataStore-Sink.cs:line 44
   at Microsoft.UpdateServices.Tools.UpdateRepo.MetadataSync.FetchUpdates(QueryFilter queryToRun, CompressedMetadataStore destinationResult) in E:\src\temp\update-server-server-sync\src\sync-tool\MetadataFetch.cs:line 182
   at Microsoft.UpdateServices.Tools.UpdateRepo.MetadataSync.FetchUpdates(FetchUpdatesOptions options) in E:\src\temp\update-server-server-sync\src\sync-tool\MetadataFetch.cs:line 156
   at CommandLine.ParserResultExtensions.WithParsed[T](ParserResult`1 result, Action`1 action)
   at Microsoft.UpdateServices.Tools.UpdateRepo.Program.Main(String[] args) in E:\src\temp\update-server-server-sync\src\sync-tool\Program.cs:line 15

Is there something i am missing or is there an error in the upsync tool?

Different Id's from WSUS and Client

I want to query some update metadata for id's which are scanned by wuapi searcher. But i think there is a "mismatch" between the WSUS UpdateId and the wuapi UpdateIdentity.UpdateId - is that true?

grafik

grafik

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.