├── .gitignore ├── CODE_OF_CONDUCT.md ├── LICENSE ├── README.md ├── SECURITY.md ├── build └── client-server-sync.sln ├── docfx ├── .gitignore ├── api │ ├── .gitignore │ └── index.md ├── docfx.json ├── examples │ ├── custom_startup.md │ ├── default_startup.md │ └── toc.yml ├── index.md ├── toc.yml └── webservices.filter.yaml ├── docs ├── api │ ├── Microsoft.UpdateServcies.WebServices.ClientReporting.BasicData.html │ ├── Microsoft.UpdateServcies.WebServices.ClientReporting.ChangedComputer.html │ ├── Microsoft.UpdateServcies.WebServices.ClientReporting.ComputerChangeType.html │ ├── Microsoft.UpdateServcies.WebServices.ClientReporting.ComputerLastRollupNumber.html │ ├── Microsoft.UpdateServcies.WebServices.ClientReporting.ComputerRollupDetails.html │ ├── Microsoft.UpdateServcies.WebServices.ClientReporting.ComputerRollupInfo.html │ ├── Microsoft.UpdateServcies.WebServices.ClientReporting.ComputerStatusRollupInfo.html │ ├── Microsoft.UpdateServcies.WebServices.ClientReporting.ComputerStatusRollupUpdateStatus.html │ ├── Microsoft.UpdateServcies.WebServices.ClientReporting.ComputerTargetIdentifier.html │ ├── Microsoft.UpdateServcies.WebServices.ClientReporting.Cookie.html │ ├── Microsoft.UpdateServcies.WebServices.ClientReporting.DetailedVersion.html │ ├── Microsoft.UpdateServcies.WebServices.ClientReporting.DownstreamServerRollupClientActivitySummary.html │ ├── Microsoft.UpdateServcies.WebServices.ClientReporting.DownstreamServerRollupClientSummary.html │ ├── Microsoft.UpdateServcies.WebServices.ClientReporting.DownstreamServerRollupInfo.html │ ├── Microsoft.UpdateServcies.WebServices.ClientReporting.DownstreamServerRollupServerSummary.html │ ├── Microsoft.UpdateServcies.WebServices.ClientReporting.ExtendedData.html │ ├── Microsoft.UpdateServcies.WebServices.ClientReporting.PrivateData.html │ ├── Microsoft.UpdateServcies.WebServices.ClientReporting.ProcessorArchitecture.html │ ├── Microsoft.UpdateServcies.WebServices.ClientReporting.ReportingEvent.html │ ├── Microsoft.UpdateServcies.WebServices.ClientReporting.ReportingInventory.html │ ├── Microsoft.UpdateServcies.WebServices.ClientReporting.RollupConfiguration.html │ ├── Microsoft.UpdateServcies.WebServices.ClientReporting.UpdateRevisionIdentifier.html │ ├── Microsoft.UpdateServcies.WebServices.ClientReporting.WebServiceSoap.html │ ├── Microsoft.UpdateServcies.WebServices.ClientReporting.WebServiceSoapChannel.html │ ├── Microsoft.UpdateServcies.WebServices.ClientReporting.WebServiceSoapClient.EndpointConfiguration.html │ ├── Microsoft.UpdateServcies.WebServices.ClientReporting.WebServiceSoapClient.html │ ├── Microsoft.UpdateServcies.WebServices.ClientReporting.html │ ├── Microsoft.UpdateServices.ClientSync.Server.ClientServerSyncContentController.html │ ├── Microsoft.UpdateServices.ClientSync.Server.ClientSyncContentController.html │ ├── Microsoft.UpdateServices.ClientSync.Server.ClientSyncWebService.UnApprovedUpdatesRequestedDelegate.html │ ├── Microsoft.UpdateServices.ClientSync.Server.ClientSyncWebService.html │ ├── Microsoft.UpdateServices.ClientSync.Server.ContentController.html │ ├── Microsoft.UpdateServices.ClientSync.Server.ReportingWebService.html │ ├── Microsoft.UpdateServices.ClientSync.Server.SimpleAuthenticationWebService.html │ ├── Microsoft.UpdateServices.ClientSync.Server.UpdateServerStartup.html │ ├── Microsoft.UpdateServices.ClientSync.Server.html │ ├── index.html │ └── toc.html ├── examples │ ├── custom_startup.html │ ├── default_startup.html │ └── toc.html ├── favicon.ico ├── fonts │ ├── glyphicons-halflings-regular.eot │ ├── glyphicons-halflings-regular.svg │ ├── glyphicons-halflings-regular.ttf │ ├── glyphicons-halflings-regular.woff │ └── glyphicons-halflings-regular.woff2 ├── index.html ├── logo.svg ├── manifest.json ├── search-stopwords.json ├── styles │ ├── docfx.css │ ├── docfx.js │ ├── docfx.vendor.css │ ├── docfx.vendor.js │ ├── lunr.js │ ├── lunr.min.js │ ├── main.css │ ├── main.js │ └── search-worker.js ├── toc.html └── xrefmap.yml ├── nuget ├── UpdateServices.ClientServerSync.nuspec ├── nuget.exe └── readme.txt └── src ├── client-server-sync-lib ├── Connected Services │ ├── Microsoft.UpdateServcies.WebServices.ClientReporting │ │ ├── ConnectedService.json │ │ └── Reference.cs │ ├── Microsoft.UpdateServices.WebServices.ClientAuthentication │ │ ├── ConnectedService.json │ │ └── Reference.cs │ └── Microsoft.UpdateServices.WebServices.ClientSync │ │ ├── ConnectedService.json │ │ └── Reference.cs ├── Server │ ├── ClientSync.cs │ ├── ClientSyncContentController.cs │ ├── ClientSync_Approvals.cs │ ├── ClientSync_Drivers.cs │ ├── ClientSync_Software.cs │ ├── IClientSync.cs │ ├── IReportingService.cs │ ├── ISimpleAuthentication.cs │ ├── ReportingService.cs │ ├── SimpleAuthentication.cs │ ├── UpdateServerStartup.cs │ └── UpdateXmlTransformer.cs ├── client-server-sync-lib.csproj └── client-server-sync-lib.xml └── downsync-tool ├── CommandLineOptions.cs ├── ConsoleOutput.cs ├── Program.cs ├── UpdateServer.cs ├── default-server-configuration.json ├── downsync-tool.csproj └── publish.txt /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | ## 4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 5 | 6 | # User-specific files 7 | *.suo 8 | *.user 9 | *.userosscache 10 | *.sln.docstates 11 | 12 | # User-specific files (MonoDevelop/Xamarin Studio) 13 | *.userprefs 14 | 15 | # Build results 16 | [Dd]ebug/ 17 | [Dd]ebugPublic/ 18 | [Rr]elease/ 19 | [Rr]eleases/ 20 | x64/ 21 | x86/ 22 | bld/ 23 | [Bb]in/ 24 | [Oo]bj/ 25 | [Ll]og/ 26 | 27 | # Visual Studio 2015/2017 cache/options directory 28 | .vs/ 29 | # Uncomment if you have tasks that create the project's static files in wwwroot 30 | #wwwroot/ 31 | 32 | # Visual Studio 2017 auto generated files 33 | Generated\ Files/ 34 | 35 | # MSTest test Results 36 | [Tt]est[Rr]esult*/ 37 | [Bb]uild[Ll]og.* 38 | 39 | # NUNIT 40 | *.VisualState.xml 41 | TestResult.xml 42 | 43 | # Build Results of an ATL Project 44 | [Dd]ebugPS/ 45 | [Rr]eleasePS/ 46 | dlldata.c 47 | 48 | # Benchmark Results 49 | BenchmarkDotNet.Artifacts/ 50 | 51 | # .NET Core 52 | project.lock.json 53 | project.fragment.lock.json 54 | artifacts/ 55 | **/Properties/launchSettings.json 56 | 57 | # StyleCop 58 | StyleCopReport.xml 59 | 60 | # Files built by Visual Studio 61 | *_i.c 62 | *_p.c 63 | *_i.h 64 | *.ilk 65 | *.meta 66 | *.obj 67 | *.iobj 68 | *.pch 69 | *.pdb 70 | *.ipdb 71 | *.pgc 72 | *.pgd 73 | *.rsp 74 | *.sbr 75 | *.tlb 76 | *.tli 77 | *.tlh 78 | *.tmp 79 | *.tmp_proj 80 | *.log 81 | *.vspscc 82 | *.vssscc 83 | .builds 84 | *.pidb 85 | *.svclog 86 | *.scc 87 | 88 | # Chutzpah Test files 89 | _Chutzpah* 90 | 91 | # Visual C++ cache files 92 | ipch/ 93 | *.aps 94 | *.ncb 95 | *.opendb 96 | *.opensdf 97 | *.sdf 98 | *.cachefile 99 | *.VC.db 100 | *.VC.VC.opendb 101 | 102 | # Visual Studio profiler 103 | *.psess 104 | *.vsp 105 | *.vspx 106 | *.sap 107 | 108 | # Visual Studio Trace Files 109 | *.e2e 110 | 111 | # TFS 2012 Local Workspace 112 | $tf/ 113 | 114 | # Guidance Automation Toolkit 115 | *.gpState 116 | 117 | # ReSharper is a .NET coding add-in 118 | _ReSharper*/ 119 | *.[Rr]e[Ss]harper 120 | *.DotSettings.user 121 | 122 | # JustCode is a .NET coding add-in 123 | .JustCode 124 | 125 | # TeamCity is a build add-in 126 | _TeamCity* 127 | 128 | # DotCover is a Code Coverage Tool 129 | *.dotCover 130 | 131 | # AxoCover is a Code Coverage Tool 132 | .axoCover/* 133 | !.axoCover/settings.json 134 | 135 | # Visual Studio code coverage results 136 | *.coverage 137 | *.coveragexml 138 | 139 | # NCrunch 140 | _NCrunch_* 141 | .*crunch*.local.xml 142 | nCrunchTemp_* 143 | 144 | # MightyMoose 145 | *.mm.* 146 | AutoTest.Net/ 147 | 148 | # Web workbench (sass) 149 | .sass-cache/ 150 | 151 | # Installshield output folder 152 | [Ee]xpress/ 153 | 154 | # DocProject is a documentation generator add-in 155 | DocProject/buildhelp/ 156 | DocProject/Help/*.HxT 157 | DocProject/Help/*.HxC 158 | DocProject/Help/*.hhc 159 | DocProject/Help/*.hhk 160 | DocProject/Help/*.hhp 161 | DocProject/Help/Html2 162 | DocProject/Help/html 163 | 164 | # Click-Once directory 165 | publish/ 166 | 167 | # Publish Web Output 168 | *.[Pp]ublish.xml 169 | *.azurePubxml 170 | # Note: Comment the next line if you want to checkin your web deploy settings, 171 | # but database connection strings (with potential passwords) will be unencrypted 172 | *.pubxml 173 | *.publishproj 174 | 175 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 176 | # checkin your Azure Web App publish settings, but sensitive information contained 177 | # in these scripts will be unencrypted 178 | PublishScripts/ 179 | 180 | # NuGet Packages 181 | *.nupkg 182 | # The packages folder can be ignored because of Package Restore 183 | **/[Pp]ackages/* 184 | # except build/, which is used as an MSBuild target. 185 | !**/[Pp]ackages/build/ 186 | # Uncomment if necessary however generally it will be regenerated when needed 187 | #!**/[Pp]ackages/repositories.config 188 | # NuGet v3's project.json files produces more ignorable files 189 | *.nuget.props 190 | *.nuget.targets 191 | 192 | # Microsoft Azure Build Output 193 | csx/ 194 | *.build.csdef 195 | 196 | # Microsoft Azure Emulator 197 | ecf/ 198 | rcf/ 199 | 200 | # Windows Store app package directories and files 201 | AppPackages/ 202 | BundleArtifacts/ 203 | Package.StoreAssociation.xml 204 | _pkginfo.txt 205 | *.appx 206 | 207 | # Visual Studio cache files 208 | # files ending in .cache can be ignored 209 | *.[Cc]ache 210 | # but keep track of directories ending in .cache 211 | !*.[Cc]ache/ 212 | 213 | # Others 214 | ClientBin/ 215 | ~$* 216 | *~ 217 | *.dbmdl 218 | *.dbproj.schemaview 219 | *.jfm 220 | *.pfx 221 | *.publishsettings 222 | orleans.codegen.cs 223 | 224 | # Including strong name files can present a security risk 225 | # (https://github.com/github/gitignore/pull/2483#issue-259490424) 226 | #*.snk 227 | 228 | # Since there are multiple workflows, uncomment next line to ignore bower_components 229 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 230 | #bower_components/ 231 | 232 | # RIA/Silverlight projects 233 | Generated_Code/ 234 | 235 | # Backup & report files from converting an old project file 236 | # to a newer Visual Studio version. Backup files are not needed, 237 | # because we have git ;-) 238 | _UpgradeReport_Files/ 239 | Backup*/ 240 | UpgradeLog*.XML 241 | UpgradeLog*.htm 242 | ServiceFabricBackup/ 243 | *.rptproj.bak 244 | 245 | # SQL Server files 246 | *.mdf 247 | *.ldf 248 | *.ndf 249 | 250 | # Business Intelligence projects 251 | *.rdl.data 252 | *.bim.layout 253 | *.bim_*.settings 254 | *.rptproj.rsuser 255 | 256 | # Microsoft Fakes 257 | FakesAssemblies/ 258 | 259 | # GhostDoc plugin setting file 260 | *.GhostDoc.xml 261 | 262 | # Node.js Tools for Visual Studio 263 | .ntvs_analysis.dat 264 | node_modules/ 265 | 266 | # Visual Studio 6 build log 267 | *.plg 268 | 269 | # Visual Studio 6 workspace options file 270 | *.opt 271 | 272 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 273 | *.vbw 274 | 275 | # Visual Studio LightSwitch build output 276 | **/*.HTMLClient/GeneratedArtifacts 277 | **/*.DesktopClient/GeneratedArtifacts 278 | **/*.DesktopClient/ModelManifest.xml 279 | **/*.Server/GeneratedArtifacts 280 | **/*.Server/ModelManifest.xml 281 | _Pvt_Extensions 282 | 283 | # Paket dependency manager 284 | .paket/paket.exe 285 | paket-files/ 286 | 287 | # FAKE - F# Make 288 | .fake/ 289 | 290 | # JetBrains Rider 291 | .idea/ 292 | *.sln.iml 293 | 294 | # CodeRush 295 | .cr/ 296 | 297 | # Python Tools for Visual Studio (PTVS) 298 | __pycache__/ 299 | *.pyc 300 | 301 | # Cake - Uncomment if you are using it 302 | # tools/** 303 | # !tools/packages.config 304 | 305 | # Tabs Studio 306 | *.tss 307 | 308 | # Telerik's JustMock configuration file 309 | *.jmconfig 310 | 311 | # BizTalk build output 312 | *.btp.cs 313 | *.btm.cs 314 | *.odx.cs 315 | *.xsd.cs 316 | 317 | # OpenCover UI analysis results 318 | OpenCover/ 319 | 320 | # Azure Stream Analytics local run output 321 | ASALocalRun/ 322 | 323 | # MSBuild Binary and Structured Log 324 | *.binlog 325 | 326 | # NVidia Nsight GPU debugger configuration file 327 | *.nvuser 328 | 329 | # MFractors (Xamarin productivity tool) working folder 330 | .mfractor/ 331 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Microsoft Open Source Code of Conduct 2 | 3 | This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). 4 | 5 | Resources: 6 | 7 | - [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/) 8 | - [Microsoft Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) 9 | - Contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with questions or concerns 10 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) Microsoft Corporation. All rights reserved. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Windows Update Services ClientServer Sync Protocol 2 | 3 | Provides a sample C# implementation (.NET Core) for the [Microsoft Update Client-Server protocol](https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-wusp/b8a2ad1d-11c4-4b64-a2cc-12771fcb079b), server side. This server implementation can be run on-premises or as a ASP.NET Web App in the cloud. 4 | 5 | Use this library to build solutions for deploying Microsoft updates to Windows PCs. 6 | 7 | This library assumes update metadata and content was acquired and indexed using the [Server-Server Sync library](https://github.com/microsoft/update-server-server-sync). 8 | 9 | ## Reference the library in your project 10 | In your .NET Core project, add a reference to the **[UpdateServices.ClientServerSync NuGet package](https://www.nuget.org/packages/UpdateServices.ClientServerSync)**. 11 | 12 | Alternatively, you can compile the code yourself. Visual Studio 2017 with .Net Core development tools is required to build the solution provided at build\client-server-sync.sln 13 | 14 | ## Using the library 15 | Please refer to the [API documentation](https://microsoft.github.io/update-client-server-sync/) for help on using the library. 16 | 17 | [Using UpdateServerStartup to start a ASP.NET web app](https://microsoft.github.io/update-client-server-sync/examples/default_startup.html) 18 | 19 | [Creating a custom ASP.NET web app](https://microsoft.github.io/update-client-server-sync/examples/custom_startup.html) 20 | 21 | ## Use the downsync utility 22 | The downsync utility is provided as a sample for using the library. Downsync can be used to deploy updates to Windows PC. 23 | 24 | You can build downsync in Visual Studio; it builds from the same solution as the library. Or download and unzip downsync from https://github.com/microsoft/update-client-server-sync/releases 25 | 26 | See [Using the DownSync utility](https://github.com/microsoft/update-client-server-sync/wiki/Using-the-DownSync-utility) 27 | 28 | # Contributing 29 | 30 | This project welcomes contributions and suggestions. Most contributions require you to agree to a 31 | Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us 32 | the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com. 33 | 34 | When you submit a pull request, a CLA bot will automatically determine whether you need to provide 35 | a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions 36 | provided by the bot. You will only need to do this once across all repos using our CLA. 37 | 38 | This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). 39 | For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or 40 | contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. 41 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | ## Security 4 | 5 | Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet), [Xamarin](https://github.com/xamarin), and [our GitHub organizations](https://opensource.microsoft.com/). 6 | 7 | If you believe you have found a security vulnerability in any Microsoft-owned repository that meets [Microsoft's definition of a security vulnerability](https://aka.ms/opensource/security/definition), please report it to us as described below. 8 | 9 | ## Reporting Security Issues 10 | 11 | **Please do not report security vulnerabilities through public GitHub issues.** 12 | 13 | Instead, please report them to the Microsoft Security Response Center (MSRC) at [https://msrc.microsoft.com/create-report](https://aka.ms/opensource/security/create-report). 14 | 15 | If you prefer to submit without logging in, send email to [secure@microsoft.com](mailto:secure@microsoft.com). If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://aka.ms/opensource/security/pgpkey). 16 | 17 | You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://aka.ms/opensource/security/msrc). 18 | 19 | Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue: 20 | 21 | * Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.) 22 | * Full paths of source file(s) related to the manifestation of the issue 23 | * The location of the affected source code (tag/branch/commit or direct URL) 24 | * Any special configuration required to reproduce the issue 25 | * Step-by-step instructions to reproduce the issue 26 | * Proof-of-concept or exploit code (if possible) 27 | * Impact of the issue, including how an attacker might exploit the issue 28 | 29 | This information will help us triage your report more quickly. 30 | 31 | If you are reporting for a bug bounty, more complete reports can contribute to a higher bounty award. Please visit our [Microsoft Bug Bounty Program](https://aka.ms/opensource/security/bounty) page for more details about our active programs. 32 | 33 | ## Preferred Languages 34 | 35 | We prefer all communications to be in English. 36 | 37 | ## Policy 38 | 39 | Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://aka.ms/opensource/security/cvd). 40 | 41 | 42 | -------------------------------------------------------------------------------- /build/client-server-sync.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.29102.190 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "client-server-sync-lib", "..\src\client-server-sync-lib\client-server-sync-lib.csproj", "{7CA6D48D-61AA-4F56-9C38-DB63D938C524}" 7 | EndProject 8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "downsync-tool", "..\src\downsync-tool\downsync-tool.csproj", "{1DC8340E-65E1-42A2-9B9F-C111D2185DA2}" 9 | EndProject 10 | Global 11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 12 | Debug|Any CPU = Debug|Any CPU 13 | Release|Any CPU = Release|Any CPU 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {7CA6D48D-61AA-4F56-9C38-DB63D938C524}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 17 | {7CA6D48D-61AA-4F56-9C38-DB63D938C524}.Debug|Any CPU.Build.0 = Debug|Any CPU 18 | {7CA6D48D-61AA-4F56-9C38-DB63D938C524}.Release|Any CPU.ActiveCfg = Release|Any CPU 19 | {7CA6D48D-61AA-4F56-9C38-DB63D938C524}.Release|Any CPU.Build.0 = Release|Any CPU 20 | {1DC8340E-65E1-42A2-9B9F-C111D2185DA2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 21 | {1DC8340E-65E1-42A2-9B9F-C111D2185DA2}.Debug|Any CPU.Build.0 = Debug|Any CPU 22 | {1DC8340E-65E1-42A2-9B9F-C111D2185DA2}.Release|Any CPU.ActiveCfg = Release|Any CPU 23 | {1DC8340E-65E1-42A2-9B9F-C111D2185DA2}.Release|Any CPU.Build.0 = Release|Any CPU 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | GlobalSection(ExtensibilityGlobals) = postSolution 29 | SolutionGuid = {9B6C1277-D8C9-421A-A028-3B936C23579C} 30 | EndGlobalSection 31 | EndGlobal 32 | -------------------------------------------------------------------------------- /docfx/.gitignore: -------------------------------------------------------------------------------- 1 | ############### 2 | # folder # 3 | ############### 4 | /**/DROP/ 5 | /**/TEMP/ 6 | /**/packages/ 7 | /**/bin/ 8 | /**/obj/ 9 | _site 10 | -------------------------------------------------------------------------------- /docfx/api/.gitignore: -------------------------------------------------------------------------------- 1 | ############### 2 | # temp file # 3 | ############### 4 | *.yml 5 | .manifest 6 | -------------------------------------------------------------------------------- /docfx/api/index.md: -------------------------------------------------------------------------------- 1 | This library provides a C# reference implementation for a Windows Update server writtent as a ASP.NET web app. 2 | 3 | #### Requirements 4 | Updates must be fetched from an upstream server and indexed before they can be served to Windows clients. 5 | 6 | Use [the Server-Server Sync library](https://github.com/microsoft/update-server-server-sync) to aquire updates. 7 | 8 | A pre-built tool to fetch and index updates is available: [UpSync](https://github.com/microsoft/update-server-server-sync/wiki/UpSync-examples) 9 | 10 | #### The reference [UpdateServerStartup](Microsoft.UpdateServices.ClientSync.Server.UpdateServerStartup.html) 11 | Use UpdateServerStartup to add all the required update services to your ASP.NET instance. 12 | 13 | Prerequisites: 14 | * updates were fetched to a file named master.zip 15 | * content was downloaded to .\content 16 | * the server configuration JSON is in server_configuration.json 17 | * the server address is http://my_update_server 18 | 19 | ``` 20 | var host = new WebHostBuilder() 21 | .UseUrls(@"http://my_update_server") 22 | .UseStartup() 23 | .UseKestrel() 24 | .ConfigureKestrel((context, opts) => { }) 25 | .ConfigureAppConfiguration((hostingContext, config) => 26 | { 27 | var configDictionary = new Dictionary() 28 | { 29 | { "metadata-source", @"master.zip" }, 30 | { "server-config", @"server_configuration.json"}, 31 | { "content-source", @".\content" }, 32 | { "content-http-root", @"http://my_update_server" } 33 | }; 34 | config.AddInMemoryCollection(configDictionary); 35 | }) 36 | .Build(); 37 | 38 | host.Run(); 39 | ``` 40 | 41 | If your server does not store update content, just metadata, then "content-source" and "content-http-root" settings can be null. In this case, Windows clients will download content from the official Microsoft Update content servers. -------------------------------------------------------------------------------- /docfx/docfx.json: -------------------------------------------------------------------------------- 1 | { 2 | "metadata": [ 3 | { 4 | "src": [ 5 | { 6 | "files": [ "**.csproj" ], 7 | "exclude": [ "**/bin/**", "**/obj/**" ], 8 | "src": "../src/client-server-sync-lib" 9 | } 10 | ], 11 | "dest": "api", 12 | "disableGitFeatures": false, 13 | "disableDefaultFilter": false, 14 | "filter": "webservices.filter.yaml" 15 | } 16 | ], 17 | "build": { 18 | "content": [ 19 | { 20 | "files": [ 21 | "api/**.yml", 22 | "api/index.md" 23 | ] 24 | }, 25 | { 26 | "files": [ 27 | "examples/**.md", 28 | "examples/**/toc.yml", 29 | "toc.yml", 30 | "*.md" 31 | ] 32 | } 33 | ], 34 | "resource": [ 35 | { 36 | "files": [ 37 | "images/**" 38 | ] 39 | } 40 | ], 41 | "overwrite": [ 42 | { 43 | "files": [ 44 | "apidoc/**.md" 45 | ], 46 | "exclude": [ 47 | "obj/**", 48 | "_site/**" 49 | ] 50 | } 51 | ], 52 | "dest": "_site", 53 | "globalMetadataFiles": [], 54 | "fileMetadataFiles": [], 55 | "template": [ 56 | "default" 57 | ], 58 | "postProcessors": [], 59 | "markdownEngineName": "markdig", 60 | "noLangKeyword": false, 61 | "keepFileLink": false, 62 | "cleanupCacheHistory": false, 63 | "disableGitFeatures": false 64 | } 65 | } -------------------------------------------------------------------------------- /docfx/examples/custom_startup.md: -------------------------------------------------------------------------------- 1 | ### Adding the update service and content service to your ASP.NET web app 2 | 3 | #### Prerequisites 4 | * update metadata was fetched to a file named master.zip. Use UpSync to fetch updates from an upstream server ([link](https://github.com/microsoft/update-server-server-sync/wiki/UpSync-examples)) 5 | * the server configuration JSON is in server_configuration.json. Get a default configuration file from [here](https://raw.githubusercontent.com/microsoft/update-client-server-sync/master/src/downsync-tool/default-server-configuration.json) 6 | * update content was downloaded to .\content. Use UpSync to fetch update content. 7 | * the server address is http://: or http://: 8 | 9 | #### Add update services to your startup 10 | 11 | ``` 12 | // Startup's ConfigureServices 13 | public void ConfigureServices(IServiceCollection services) 14 | { 15 | var localMetadataSource = CompressedMetadataStore.Open(sourcePath); 16 | 17 | var contentSource = new FileSystemContentStore(contentPath); 18 | 19 | var updateServiceConfiguration = Newtonsoft.Json.JsonConvert.DeserializeObject( 20 | File.ReadAllText("server_configuration.json")); 21 | 22 | // Add ClientSyncContentController from its containing assembly 23 | services.TryAddSingleton( 24 | new ClientSyncContentController(localMetadataSource, contentSource)); 25 | 26 | services 27 | .AddMvc() 28 | .AddApplicationPart( 29 | Assembly.Load( 30 | "Microsoft.UpdateServices.ClientSync.Server.ClientSyncContentController")) 31 | .AddControllersAsServices(); 32 | 33 | // Enable SoapCore; this middleware provides translation services from WCF/SOAP to Asp.net 34 | services.AddSoapCore(); 35 | 36 | services.TryAddSingleton( 37 | new Server.ClientSyncWebService( 38 | localMetadataSource, UpdateServiceConfiguration, "http://my_update_server")); 39 | 40 | services.TryAddSingleton(); 41 | services.TryAddSingleton(); 42 | } 43 | 44 | // Startup's configure 45 | public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) 46 | { 47 | // Add the content controller to MVC route 48 | app.UseMvc(routes => 49 | { 50 | routes.MapRoute( 51 | name: "getContent", 52 | template: "Content/{directory}/{name}", 53 | defaults: new 54 | { 55 | controller = "ClientSyncContent", 56 | action = "GetUpdateContent" 57 | }); 58 | }); 59 | 60 | // Wire the SOAP services 61 | app.UseSoapEndpoint( 62 | "/ClientWebService/client.asmx", 63 | new BasicHttpBinding(), 64 | SoapSerializer.XmlSerializer); 65 | 66 | app.UseSoapEndpoint( 67 | "/SimpleAuthWebService/SimpleAuth.asmx", 68 | new BasicHttpBinding(), 69 | SoapSerializer.XmlSerializer); 70 | 71 | app.UseSoapEndpoint( 72 | "/ReportingWebService/WebService.asmx", 73 | new BasicHttpBinding(), 74 | SoapSerializer.XmlSerializer); 75 | } 76 | ``` 77 | -------------------------------------------------------------------------------- /docfx/examples/default_startup.md: -------------------------------------------------------------------------------- 1 | ### Use UpdateServerStartup to add update services to your ASP.NET web app 2 | 3 | #### Prerequisites 4 | * updates were fetched to a file named master.zip. Use UpSync to fetch some updates from an upstream server ([link](https://github.com/microsoft/update-server-server-sync/wiki/UpSync-examples)) 5 | * the server configuration JSON is in server_configuration.json. Get a default configuration file from [here](https://raw.githubusercontent.com/microsoft/update-client-server-sync/master/src/downsync-tool/default-server-configuration.json) 6 | 7 | #### Use the startup in your app 8 | 9 | ``` 10 | var host = new WebHostBuilder() 11 | .UseUrls("http://my_update_server") 12 | .UseStartup() 13 | .UseKestrel() 14 | .ConfigureKestrel((context, opts) => { }) 15 | .ConfigureAppConfiguration((hostingContext, config) => 16 | { 17 | var configDictionary = new Dictionary() 18 | { 19 | { "metadata-source", @"master.zip" }, 20 | { "server-config", File.ReadAllText(@"server_configuration.json")}, 21 | // This server does not serve update content; clients will be directed 22 | // to the Microsoft Update CDN 23 | { "content-source", null }, 24 | // Not required when content downloads are redirected to the official CDN 25 | { "content-http-root", null } 26 | }; 27 | config.AddInMemoryCollection(configDictionary); 28 | }) 29 | .Build(); 30 | 31 | host.Run(); 32 | ``` 33 | -------------------------------------------------------------------------------- /docfx/examples/toc.yml: -------------------------------------------------------------------------------- 1 | - name: Reference UpdateServerStartup 2 | href: default_startup.md 3 | 4 | - name: Custom ASP.NET startup 5 | href: custom_startup.md 6 | -------------------------------------------------------------------------------- /docfx/index.md: -------------------------------------------------------------------------------- 1 | # Microsoft.UpdateServices Client Sync 2 | 3 | This library provides a C# implementation (.NET Core) of the Microsoft Update Client-Server sync protocol. The server implementation enables deploying Microsoft updates to Windows PCs and is compatible with the Windows Update client included with the Windows operating system. 4 | 5 | 6 | The server implementation is cross platform and can be used on all platforms where .NET Core is avaialble. It can also be run as a ASP.NET web app in the cloud. 7 | 8 | 9 | To fetch update metadata and content for deploying with this library, please see the [documentation for the Microsoft Update Server-Server sync protocol](https://microsoft.github.io/update-server-server-sync) and the [GitHub repo](https://github.com/microsoft/update-server-server-sync) 10 | 11 | 12 | To get started, see [how to run updates services in a ASP.NET web app](examples/default_startup.html) 13 | 14 | 15 | See [MS-WUSP](https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-wusp/b8a2ad1d-11c4-4b64-a2cc-12771fcb079b) for the complete technical documentation of the protocol. 16 | -------------------------------------------------------------------------------- /docfx/toc.yml: -------------------------------------------------------------------------------- 1 | - name: Examples 2 | href: examples/ 3 | - name: Api Documentation 4 | href: api/ 5 | homepage: api/index.md 6 | -------------------------------------------------------------------------------- /docfx/webservices.filter.yaml: -------------------------------------------------------------------------------- 1 | apiRules: 2 | 3 | - exclude: 4 | uidRegex: ^Microsoft\.UpdateServices\.WebServices\.ClientReporting$ 5 | type: Namespace 6 | 7 | - exclude: 8 | uidRegex: ^Microsoft\.UpdateServices\.WebServices\.ClientAuthentication$ 9 | type: Namespace 10 | 11 | - exclude: 12 | uidRegex: ^Microsoft\.UpdateServices\.WebServices\.ClientSync$ 13 | type: Namespace 14 | 15 | - exclude: 16 | uidRegex: ^Microsoft\.AspNetCore\.Mvc$ 17 | type: Namespace 18 | 19 | - exclude: 20 | uidRegex: ^System\.Object 21 | type: Type 22 | 23 | - exclude: 24 | uidRegex: ^System\.Exception 25 | type: Type -------------------------------------------------------------------------------- /docs/api/Microsoft.UpdateServcies.WebServices.ClientReporting.ChangedComputer.html: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | Class ChangedComputer 9 | 10 | 11 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 |
28 | 29 | 52 | 53 | 60 |
61 | 157 | 158 |
159 |
160 | 169 |
170 |
171 | 172 | 173 | 174 | 175 | 176 | 177 | -------------------------------------------------------------------------------- /docs/api/Microsoft.UpdateServcies.WebServices.ClientReporting.ComputerChangeType.html: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | Enum ComputerChangeType 9 | 10 | 11 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 |
28 | 29 | 52 | 53 | 60 |
61 | 120 | 121 |
122 |
123 | 132 |
133 |
134 | 135 | 136 | 137 | 138 | 139 | 140 | -------------------------------------------------------------------------------- /docs/api/Microsoft.UpdateServcies.WebServices.ClientReporting.ComputerLastRollupNumber.html: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | Class ComputerLastRollupNumber 9 | 10 | 11 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 |
28 | 29 | 52 | 53 | 60 |
61 | 157 | 158 |
159 |
160 | 169 |
170 |
171 | 172 | 173 | 174 | 175 | 176 | 177 | -------------------------------------------------------------------------------- /docs/api/Microsoft.UpdateServcies.WebServices.ClientReporting.ComputerTargetIdentifier.html: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | Class ComputerTargetIdentifier 9 | 10 | 11 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 |
28 | 29 | 52 | 53 | 60 |
61 | 132 | 133 |
134 |
135 | 144 |
145 |
146 | 147 | 148 | 149 | 150 | 151 | 152 | -------------------------------------------------------------------------------- /docs/api/Microsoft.UpdateServcies.WebServices.ClientReporting.Cookie.html: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | Class Cookie 9 | 10 | 11 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 |
28 | 29 | 52 | 53 | 60 |
61 | 157 | 158 |
159 |
160 | 169 |
170 |
171 | 172 | 173 | 174 | 175 | 176 | 177 | -------------------------------------------------------------------------------- /docs/api/Microsoft.UpdateServcies.WebServices.ClientReporting.PrivateData.html: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | Class PrivateData 9 | 10 | 11 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 |
28 | 29 | 52 | 53 | 60 |
61 | 157 | 158 |
159 |
160 | 169 |
170 |
171 | 172 | 173 | 174 | 175 | 176 | 177 | -------------------------------------------------------------------------------- /docs/api/Microsoft.UpdateServcies.WebServices.ClientReporting.ProcessorArchitecture.html: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | Enum ProcessorArchitecture 9 | 10 | 11 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 |
28 | 29 | 52 | 53 | 60 |
61 | 128 | 129 |
130 |
131 | 140 |
141 |
142 | 143 | 144 | 145 | 146 | 147 | 148 | -------------------------------------------------------------------------------- /docs/api/Microsoft.UpdateServcies.WebServices.ClientReporting.ReportingInventory.html: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | Class ReportingInventory 9 | 10 | 11 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 |
28 | 29 | 52 | 53 | 60 |
61 | 182 | 183 |
184 |
185 | 194 |
195 |
196 | 197 | 198 | 199 | 200 | 201 | 202 | -------------------------------------------------------------------------------- /docs/api/Microsoft.UpdateServcies.WebServices.ClientReporting.UpdateRevisionIdentifier.html: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | Class UpdateRevisionIdentifier 9 | 10 | 11 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 |
28 | 29 | 52 | 53 | 60 |
61 | 157 | 158 |
159 |
160 | 169 |
170 |
171 | 172 | 173 | 174 | 175 | 176 | 177 | -------------------------------------------------------------------------------- /docs/api/Microsoft.UpdateServcies.WebServices.ClientReporting.WebServiceSoapClient.EndpointConfiguration.html: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | Enum WebServiceSoapClient.EndpointConfiguration 9 | 10 | 11 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 |
28 | 29 | 52 | 53 | 60 |
61 | 120 | 121 |
122 |
123 | 132 |
133 |
134 | 135 | 136 | 137 | 138 | 139 | 140 | -------------------------------------------------------------------------------- /docs/api/Microsoft.UpdateServices.ClientSync.Server.ClientSyncWebService.UnApprovedUpdatesRequestedDelegate.html: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | Delegate ClientSyncWebService.UnApprovedUpdatesRequestedDelegate 9 | 10 | 11 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 |
28 | 29 | 52 | 53 | 60 |
61 | 118 | 119 |
120 |
121 | 130 |
131 |
132 | 133 | 134 | 135 | 136 | 137 | 138 | -------------------------------------------------------------------------------- /docs/api/Microsoft.UpdateServices.ClientSync.Server.SimpleAuthenticationWebService.html: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | Class SimpleAuthenticationWebService 9 | 10 | 11 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 |
28 | 29 | 52 | 53 | 60 |
61 | 153 | 154 |
155 |
156 | 165 |
166 |
167 | 168 | 169 | 170 | 171 | 172 | 173 | -------------------------------------------------------------------------------- /docs/api/Microsoft.UpdateServices.ClientSync.Server.html: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | Namespace Microsoft.UpdateServices.ClientSync.Server 9 | 10 | 11 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 |
28 | 29 | 52 | 53 | 60 |
61 | 117 | 118 |
119 |
120 | 129 |
130 |
131 | 132 | 133 | 134 | 135 | 136 | 137 | -------------------------------------------------------------------------------- /docs/api/index.html: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 |
26 | 27 | 50 | 51 | 58 |
59 | 122 | 123 |
124 |
125 | 134 |
135 |
136 | 137 | 138 | 139 | 140 | 141 | 142 | -------------------------------------------------------------------------------- /docs/api/toc.html: -------------------------------------------------------------------------------- 1 |  2 |
3 |
4 |
5 |
6 | 7 | 8 |
9 |
10 |
11 |
12 | 13 | 40 |
41 |
42 |
43 |
-------------------------------------------------------------------------------- /docs/examples/custom_startup.html: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | Adding the update service and content service to your ASP.NET web app 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 |
26 | 27 | 50 | 51 | 58 |
59 | 161 | 162 |
163 |
164 | 173 |
174 |
175 | 176 | 177 | 178 | 179 | 180 | 181 | -------------------------------------------------------------------------------- /docs/examples/default_startup.html: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | Use UpdateServerStartup to add update services to your ASP.NET web app 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 |
26 | 27 | 50 | 51 | 58 |
59 | 117 | 118 |
119 |
120 | 129 |
130 |
131 | 132 | 133 | 134 | 135 | 136 | 137 | -------------------------------------------------------------------------------- /docs/examples/toc.html: -------------------------------------------------------------------------------- 1 |  2 |
3 |
4 |
5 |
6 | 7 | 8 |
9 |
10 |
11 |
12 | 13 | 21 |
22 |
23 |
24 |
-------------------------------------------------------------------------------- /docs/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/update-client-server-sync/a17fb38c26d7c7eff57971d9f97cd410869a42dd/docs/favicon.ico -------------------------------------------------------------------------------- /docs/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/update-client-server-sync/a17fb38c26d7c7eff57971d9f97cd410869a42dd/docs/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /docs/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/update-client-server-sync/a17fb38c26d7c7eff57971d9f97cd410869a42dd/docs/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /docs/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/update-client-server-sync/a17fb38c26d7c7eff57971d9f97cd410869a42dd/docs/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /docs/fonts/glyphicons-halflings-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/update-client-server-sync/a17fb38c26d7c7eff57971d9f97cd410869a42dd/docs/fonts/glyphicons-halflings-regular.woff2 -------------------------------------------------------------------------------- /docs/index.html: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | Microsoft.UpdateServices Client Sync 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 |
26 | 27 | 50 | 51 | 58 |
59 | 86 | 87 |
88 |
89 | 98 |
99 |
100 | 101 | 102 | 103 | 104 | 105 | 106 | -------------------------------------------------------------------------------- /docs/logo.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 7 | 8 | Created by Docfx 9 | 10 | 12 | 15 | 21 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /docs/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "homepages": [], 3 | "source_base_path": "E:/src/update-client-server-sync/docfx", 4 | "xrefmap": "xrefmap.yml", 5 | "files": [ 6 | { 7 | "type": "ManagedReference", 8 | "source_relative_path": "api/Microsoft.UpdateServices.ClientSync.Server.ClientSyncContentController.yml", 9 | "output": { 10 | ".html": { 11 | "relative_path": "api/Microsoft.UpdateServices.ClientSync.Server.ClientSyncContentController.html", 12 | "hash": "rOrRoO4c5NVvTSdzvmOd0A==" 13 | } 14 | }, 15 | "is_incremental": false, 16 | "version": "" 17 | }, 18 | { 19 | "type": "ManagedReference", 20 | "source_relative_path": "api/Microsoft.UpdateServices.ClientSync.Server.ClientSyncWebService.UnApprovedUpdatesRequestedDelegate.yml", 21 | "output": { 22 | ".html": { 23 | "relative_path": "api/Microsoft.UpdateServices.ClientSync.Server.ClientSyncWebService.UnApprovedUpdatesRequestedDelegate.html", 24 | "hash": "Yrmey/8UsZjE/7iHhAFc9Q==" 25 | } 26 | }, 27 | "is_incremental": false, 28 | "version": "" 29 | }, 30 | { 31 | "type": "ManagedReference", 32 | "source_relative_path": "api/Microsoft.UpdateServices.ClientSync.Server.ClientSyncWebService.yml", 33 | "output": { 34 | ".html": { 35 | "relative_path": "api/Microsoft.UpdateServices.ClientSync.Server.ClientSyncWebService.html", 36 | "hash": "hUNZQgGfQr+yTtQ02PYSig==" 37 | } 38 | }, 39 | "is_incremental": false, 40 | "version": "" 41 | }, 42 | { 43 | "type": "ManagedReference", 44 | "source_relative_path": "api/Microsoft.UpdateServices.ClientSync.Server.ReportingWebService.yml", 45 | "output": { 46 | ".html": { 47 | "relative_path": "api/Microsoft.UpdateServices.ClientSync.Server.ReportingWebService.html", 48 | "hash": "inZM3BqXLyC8C4Ize8e2nQ==" 49 | } 50 | }, 51 | "is_incremental": false, 52 | "version": "" 53 | }, 54 | { 55 | "type": "ManagedReference", 56 | "source_relative_path": "api/Microsoft.UpdateServices.ClientSync.Server.SimpleAuthenticationWebService.yml", 57 | "output": { 58 | ".html": { 59 | "relative_path": "api/Microsoft.UpdateServices.ClientSync.Server.SimpleAuthenticationWebService.html", 60 | "hash": "+Sv5h2T4CJ2u/HS+rgxsgw==" 61 | } 62 | }, 63 | "is_incremental": false, 64 | "version": "" 65 | }, 66 | { 67 | "type": "ManagedReference", 68 | "source_relative_path": "api/Microsoft.UpdateServices.ClientSync.Server.UpdateServerStartup.yml", 69 | "output": { 70 | ".html": { 71 | "relative_path": "api/Microsoft.UpdateServices.ClientSync.Server.UpdateServerStartup.html", 72 | "hash": "fdunLWzJIG9adkvd4dQeNw==" 73 | } 74 | }, 75 | "is_incremental": false, 76 | "version": "" 77 | }, 78 | { 79 | "type": "ManagedReference", 80 | "source_relative_path": "api/Microsoft.UpdateServices.ClientSync.Server.yml", 81 | "output": { 82 | ".html": { 83 | "relative_path": "api/Microsoft.UpdateServices.ClientSync.Server.html", 84 | "hash": "r3G/d3lg8PozzCpia8IHtA==" 85 | } 86 | }, 87 | "is_incremental": false, 88 | "version": "" 89 | }, 90 | { 91 | "log_codes": [ 92 | "InvalidFileLink" 93 | ], 94 | "type": "Conceptual", 95 | "source_relative_path": "api/index.md", 96 | "output": { 97 | ".html": { 98 | "relative_path": "api/index.html", 99 | "hash": "lmVMI+RNqOI7OWcsrKBj8Q==" 100 | } 101 | }, 102 | "is_incremental": false, 103 | "version": "" 104 | }, 105 | { 106 | "type": "Toc", 107 | "source_relative_path": "api/toc.yml", 108 | "output": { 109 | ".html": { 110 | "relative_path": "api/toc.html", 111 | "hash": "uiV+LacgDUv3KgdzqQkHaA==" 112 | } 113 | }, 114 | "is_incremental": false, 115 | "version": "" 116 | }, 117 | { 118 | "type": "Conceptual", 119 | "source_relative_path": "examples/custom_startup.md", 120 | "output": { 121 | ".html": { 122 | "relative_path": "examples/custom_startup.html", 123 | "hash": "ZjTlqPY7lMHsQYtW3pwQ8w==" 124 | } 125 | }, 126 | "is_incremental": false, 127 | "version": "" 128 | }, 129 | { 130 | "type": "Conceptual", 131 | "source_relative_path": "examples/default_startup.md", 132 | "output": { 133 | ".html": { 134 | "relative_path": "examples/default_startup.html", 135 | "hash": "GO0qyrqpCPC4WnroB5dehQ==" 136 | } 137 | }, 138 | "is_incremental": false, 139 | "version": "" 140 | }, 141 | { 142 | "type": "Toc", 143 | "source_relative_path": "examples/toc.yml", 144 | "output": { 145 | ".html": { 146 | "relative_path": "examples/toc.html", 147 | "hash": "xRUvUvdriOtD9bonWoLYyw==" 148 | } 149 | }, 150 | "is_incremental": false, 151 | "version": "" 152 | }, 153 | { 154 | "log_codes": [ 155 | "InvalidFileLink" 156 | ], 157 | "type": "Conceptual", 158 | "source_relative_path": "index.md", 159 | "output": { 160 | ".html": { 161 | "relative_path": "index.html", 162 | "hash": "QGWboM18kQR3qKlK5jdrog==" 163 | } 164 | }, 165 | "is_incremental": false, 166 | "version": "" 167 | }, 168 | { 169 | "type": "Toc", 170 | "source_relative_path": "toc.yml", 171 | "output": { 172 | ".html": { 173 | "relative_path": "toc.html", 174 | "hash": "dOL6XVUnx0MIRE6uvyZNAA==" 175 | } 176 | }, 177 | "is_incremental": false, 178 | "version": "" 179 | } 180 | ], 181 | "incremental_info": [ 182 | { 183 | "status": { 184 | "can_incremental": true, 185 | "incrementalPhase": "build", 186 | "total_file_count": 0, 187 | "skipped_file_count": 0 188 | }, 189 | "processors": { 190 | "TocDocumentProcessor": { 191 | "can_incremental": false, 192 | "details": "Processor TocDocumentProcessor cannot support incremental build because the processor doesn't implement ISupportIncrementalDocumentProcessor interface.", 193 | "incrementalPhase": "build", 194 | "total_file_count": 0, 195 | "skipped_file_count": 0 196 | }, 197 | "ConceptualDocumentProcessor": { 198 | "can_incremental": true, 199 | "incrementalPhase": "build", 200 | "total_file_count": 4, 201 | "skipped_file_count": 1 202 | }, 203 | "ManagedReferenceDocumentProcessor": { 204 | "can_incremental": true, 205 | "incrementalPhase": "build", 206 | "total_file_count": 7, 207 | "skipped_file_count": 3 208 | } 209 | } 210 | }, 211 | { 212 | "status": { 213 | "can_incremental": true, 214 | "details": "Can support incremental post processing.", 215 | "incrementalPhase": "postProcessing", 216 | "total_file_count": 0, 217 | "skipped_file_count": 0 218 | }, 219 | "processors": {} 220 | } 221 | ], 222 | "version_info": {}, 223 | "groups": [ 224 | { 225 | "xrefmap": "xrefmap.yml" 226 | } 227 | ] 228 | } -------------------------------------------------------------------------------- /docs/search-stopwords.json: -------------------------------------------------------------------------------- 1 | [ 2 | "a", 3 | "able", 4 | "about", 5 | "across", 6 | "after", 7 | "all", 8 | "almost", 9 | "also", 10 | "am", 11 | "among", 12 | "an", 13 | "and", 14 | "any", 15 | "are", 16 | "as", 17 | "at", 18 | "be", 19 | "because", 20 | "been", 21 | "but", 22 | "by", 23 | "can", 24 | "cannot", 25 | "could", 26 | "dear", 27 | "did", 28 | "do", 29 | "does", 30 | "either", 31 | "else", 32 | "ever", 33 | "every", 34 | "for", 35 | "from", 36 | "get", 37 | "got", 38 | "had", 39 | "has", 40 | "have", 41 | "he", 42 | "her", 43 | "hers", 44 | "him", 45 | "his", 46 | "how", 47 | "however", 48 | "i", 49 | "if", 50 | "in", 51 | "into", 52 | "is", 53 | "it", 54 | "its", 55 | "just", 56 | "least", 57 | "let", 58 | "like", 59 | "likely", 60 | "may", 61 | "me", 62 | "might", 63 | "most", 64 | "must", 65 | "my", 66 | "neither", 67 | "no", 68 | "nor", 69 | "not", 70 | "of", 71 | "off", 72 | "often", 73 | "on", 74 | "only", 75 | "or", 76 | "other", 77 | "our", 78 | "own", 79 | "rather", 80 | "said", 81 | "say", 82 | "says", 83 | "she", 84 | "should", 85 | "since", 86 | "so", 87 | "some", 88 | "than", 89 | "that", 90 | "the", 91 | "their", 92 | "them", 93 | "then", 94 | "there", 95 | "these", 96 | "they", 97 | "this", 98 | "tis", 99 | "to", 100 | "too", 101 | "twas", 102 | "us", 103 | "wants", 104 | "was", 105 | "we", 106 | "were", 107 | "what", 108 | "when", 109 | "where", 110 | "which", 111 | "while", 112 | "who", 113 | "whom", 114 | "why", 115 | "will", 116 | "with", 117 | "would", 118 | "yet", 119 | "you", 120 | "your" 121 | ] 122 | -------------------------------------------------------------------------------- /docs/styles/main.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/update-client-server-sync/a17fb38c26d7c7eff57971d9f97cd410869a42dd/docs/styles/main.css -------------------------------------------------------------------------------- /docs/styles/main.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See LICENSE file in the project root for full license information. 2 | -------------------------------------------------------------------------------- /docs/styles/search-worker.js: -------------------------------------------------------------------------------- 1 | (function () { 2 | importScripts('lunr.min.js'); 3 | 4 | var lunrIndex; 5 | 6 | var stopWords = null; 7 | var searchData = {}; 8 | 9 | lunr.tokenizer.seperator = /[\s\-\.]+/; 10 | 11 | var stopWordsRequest = new XMLHttpRequest(); 12 | stopWordsRequest.open('GET', '../search-stopwords.json'); 13 | stopWordsRequest.onload = function () { 14 | if (this.status != 200) { 15 | return; 16 | } 17 | stopWords = JSON.parse(this.responseText); 18 | buildIndex(); 19 | } 20 | stopWordsRequest.send(); 21 | 22 | var searchDataRequest = new XMLHttpRequest(); 23 | 24 | searchDataRequest.open('GET', '../index.json'); 25 | searchDataRequest.onload = function () { 26 | if (this.status != 200) { 27 | return; 28 | } 29 | searchData = JSON.parse(this.responseText); 30 | 31 | buildIndex(); 32 | 33 | postMessage({ e: 'index-ready' }); 34 | } 35 | searchDataRequest.send(); 36 | 37 | onmessage = function (oEvent) { 38 | var q = oEvent.data.q; 39 | var hits = lunrIndex.search(q); 40 | var results = []; 41 | hits.forEach(function (hit) { 42 | var item = searchData[hit.ref]; 43 | results.push({ 'href': item.href, 'title': item.title, 'keywords': item.keywords }); 44 | }); 45 | postMessage({ e: 'query-ready', q: q, d: results }); 46 | } 47 | 48 | function buildIndex() { 49 | if (stopWords !== null && !isEmpty(searchData)) { 50 | lunrIndex = lunr(function () { 51 | this.pipeline.remove(lunr.stopWordFilter); 52 | this.ref('href'); 53 | this.field('title', { boost: 50 }); 54 | this.field('keywords', { boost: 20 }); 55 | 56 | for (var prop in searchData) { 57 | if (searchData.hasOwnProperty(prop)) { 58 | this.add(searchData[prop]); 59 | } 60 | } 61 | 62 | var docfxStopWordFilter = lunr.generateStopWordFilter(stopWords); 63 | lunr.Pipeline.registerFunction(docfxStopWordFilter, 'docfxStopWordFilter'); 64 | this.pipeline.add(docfxStopWordFilter); 65 | this.searchPipeline.add(docfxStopWordFilter); 66 | }); 67 | } 68 | } 69 | 70 | function isEmpty(obj) { 71 | if(!obj) return true; 72 | 73 | for (var prop in obj) { 74 | if (obj.hasOwnProperty(prop)) 75 | return false; 76 | } 77 | 78 | return true; 79 | } 80 | })(); 81 | -------------------------------------------------------------------------------- /docs/toc.html: -------------------------------------------------------------------------------- 1 |  2 |
3 |
4 |
5 |
6 | 7 | 8 |
9 |
10 |
11 |
12 | 13 | 21 |
22 |
23 |
24 |
-------------------------------------------------------------------------------- /nuget/UpdateServices.ClientServerSync.nuspec: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | UpdateServices.ClientServerSync 5 | 1.6.1 6 | Microsoft Update Services: Client-Server Sync 7 | Sample implementation of the Windows Update protocol in a ASP.NET Core service 8 | Cristian Petruta 9 | Cristian Petruta 10 | false 11 | MIT 12 | https://microsoft.github.io/update-client-server-sync/ 13 | Sample implementation of the Windows Update protocol in a ASP.NET Core service 14 | Add ability to approve the updates that are offered to connecting clients PCs. 15 | Windows Update WSUS WU MS-WSUSSS MS-WUSP 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /nuget/nuget.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/update-client-server-sync/a17fb38c26d7c7eff57971d9f97cd410869a42dd/nuget/nuget.exe -------------------------------------------------------------------------------- /nuget/readme.txt: -------------------------------------------------------------------------------- 1 | ---------------- Microsoft Update Services Client-Server Sync library ----------------- 2 | 3 | See https://microsoft.github.io/update-client-server-sync/ for API documentation and examples. -------------------------------------------------------------------------------- /src/client-server-sync-lib/Server/ClientSyncContentController.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | using Microsoft.AspNetCore.Mvc; 5 | using Microsoft.UpdateServices.Metadata.Content; 6 | using Microsoft.UpdateServices.Storage; 7 | using System; 8 | using System.Collections.Generic; 9 | using System.Linq; 10 | 11 | namespace Microsoft.UpdateServices.ClientSync.Server 12 | { 13 | /// 14 | /// MVC controller for handling update content requests from Windows clients 15 | /// 16 | /// 17 | /// Attach this service to your ASP.NET service: 18 | /// 19 | /// public void ConfigureServices(IServiceCollection services) 20 | /// { 21 | /// var localMetadataSource = CompressedMetadataStore.Open(sourcePath); 22 | /// var contentSource = new FileSystemContentStore(contentPath); 23 | /// services.TryAddSingleton<ClientSyncContentController>( 24 | /// new ClientSyncContentController(localMetadataSource, contentSource)); 25 | /// // 26 | /// // Add ClientSyncContentController from its containing assembly 27 | /// services 28 | /// .AddMvc() 29 | /// .AddApplicationPart( 30 | /// Assembly.Load( 31 | /// "Microsoft.UpdateServices.ClientSync.Server.ClientSyncContentController")) 32 | /// .AddControllersAsServices(); 33 | /// ... 34 | /// } 35 | /// // Configure routes for the content controller 36 | /// public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) 37 | /// { 38 | /// // Add the content controller to MVC route 39 | /// app.UseMvc(routes => 40 | /// { 41 | /// routes.MapRoute( 42 | /// name: "getContent", 43 | /// template: "Content/{directory}/{name}", 44 | /// defaults: new 45 | /// { 46 | /// controller = "ClientSyncContent", 47 | /// action = "GetUpdateContent" 48 | /// }); 49 | /// }); 50 | /// ... 51 | /// } 52 | /// 53 | /// 54 | public class ClientSyncContentController : Controller 55 | { 56 | IUpdateContentSource ContentSource; 57 | Dictionary UpdateFiles; 58 | 59 | /// 60 | /// Create a content controller from the specified metadata and update content sources. 61 | /// 62 | /// The source of update metadata. Used to build the list of known files to serve. 63 | /// The source of content. Used to read update content and send it to clients. 64 | public ClientSyncContentController(IMetadataSource metadataSource, IUpdateContentSource contentSource) 65 | { 66 | ContentSource = contentSource; 67 | 68 | var updatesWithFiles = metadataSource.GetUpdates().Where(u => u.HasFiles).ToList(); 69 | 70 | UpdateFiles = updatesWithFiles.SelectMany(u => u.Files).GroupBy(f => f.Digests[0].DigestBase64).Select(g => g.First()).ToDictionary( 71 | f => { 72 | // TODO: fix; hack; this is an internal implementation detail; must be exposed from server-server-sync library 73 | byte[] hashBytes = Convert.FromBase64String(f.Digests[0].DigestBase64); 74 | var cachedContentDirectoryName = string.Format("{0:X}", hashBytes.Last()); 75 | 76 | return $"{cachedContentDirectoryName.ToLower()}/{f.Digests[0].HexString.ToLower()}"; 77 | }); 78 | } 79 | 80 | /// 81 | /// Handle HTTP GET requests on the Content/(Directory)/(FileHash) URLs 82 | /// 83 | /// The directory name for an update file 84 | /// The file name for an update file 85 | /// File content on success, other error codes otherwise 86 | [HttpGet("Content/{directory}/{name}", Name = "GetUpdateContent")] 87 | public IActionResult GetUpdateContent(string directory, string name) 88 | { 89 | var lookupKey = $"{directory.ToLower()}/{name.ToLower()}"; 90 | 91 | if (UpdateFiles.TryGetValue(lookupKey, out UpdateFile file) && 92 | ContentSource.Contains(file)) 93 | { 94 | var request = HttpContext.Request; 95 | 96 | var fileResult = new FileStreamResult(ContentSource.Get(file), "application/octet-stream"); 97 | fileResult.FileDownloadName = name; 98 | fileResult.EnableRangeProcessing = true; 99 | return fileResult; 100 | } 101 | else 102 | { 103 | return NotFound(); 104 | } 105 | } 106 | 107 | /// 108 | /// Handle HTTP HEAD requests on the Content/(Directory)/(FileName) URLs 109 | /// 110 | /// The directory name for an update file 111 | /// The file name for an update file 112 | /// File header on success, other error codes otherwise 113 | [HttpHead("Content/{directory}/{name}", Name = "GetUpdateContentHead")] 114 | public void GetUpdateContentHead(string directory, string name) 115 | { 116 | HttpContext.Response.Body = null; 117 | 118 | var lookupKey = $"{directory.ToLower()}/{name.ToLower()}"; 119 | 120 | if (UpdateFiles.TryGetValue(lookupKey, out UpdateFile file) && 121 | ContentSource.Contains(file)) 122 | { 123 | var okResult = new OkResult(); 124 | 125 | using (var contentStream = ContentSource.Get(file)) 126 | { 127 | HttpContext.Response.ContentLength = contentStream.Length; 128 | } 129 | 130 | HttpContext.Response.Body = null; 131 | HttpContext.Response.StatusCode = 200; 132 | } 133 | else 134 | { 135 | HttpContext.Response.StatusCode = 404; 136 | } 137 | } 138 | } 139 | } 140 | -------------------------------------------------------------------------------- /src/client-server-sync-lib/Server/ClientSync_Approvals.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Threading.Tasks; 7 | using Microsoft.UpdateServices.Storage; 8 | using System.Linq; 9 | using Microsoft.UpdateServices.Metadata; 10 | using Microsoft.UpdateServices.WebServices.ClientSync; 11 | using System.IO; 12 | using Microsoft.UpdateServices.ClientSync.DataModel; 13 | using System.Threading; 14 | using System.ServiceModel; 15 | 16 | namespace Microsoft.UpdateServices.ClientSync.Server 17 | { 18 | 19 | public partial class ClientSyncWebService 20 | { 21 | private HashSet ApprovedSoftwareUpdates; 22 | private HashSet ApprovedDriverUpdates; 23 | 24 | /// 25 | /// Delegate method called to report updates applicable to a client but which are not approved and thus not offered 26 | /// 27 | /// 28 | public delegate void UnApprovedUpdatesRequestedDelegate(IEnumerable requestedUnapprovedUpdates); 29 | 30 | /// 31 | /// Event raised when software updates are applicable to a client but are not approved for distribution 32 | /// 33 | public event UnApprovedUpdatesRequestedDelegate OnUnApprovedSoftwareUpdatesRequested; 34 | 35 | /// 36 | /// Event raised when driver updates are applicable to a client but are not approved for distribution 37 | /// 38 | public event UnApprovedUpdatesRequestedDelegate OnUnApprovedDriverUpdatesRequested; 39 | 40 | /// 41 | /// Adds an update identity to the list of approved software updates. 42 | /// Approved updates are made available to clients connecting to this service. 43 | /// 44 | /// Approved update 45 | public void AddApprovedSoftwareUpdate(Identity approvedUpdate) 46 | { 47 | ApprovedSoftwareUpdates.Add(approvedUpdate); 48 | } 49 | 50 | /// 51 | /// Adds a list of update identities to the list of approved software updates. 52 | /// Approved updates are made available to clients connecting to this service. 53 | /// 54 | /// List of approved updates 55 | public void AddApprovedSoftwareUpdates(IEnumerable approvedUpdates) 56 | { 57 | foreach (var approvedUpdate in approvedUpdates) 58 | { 59 | ApprovedSoftwareUpdates.Add(approvedUpdate); 60 | } 61 | } 62 | 63 | /// 64 | /// Adds an update identities to the list of approved driver updates. 65 | /// Approved updates are made available to clients connecting to this service. 66 | /// 67 | /// Approved driver update 68 | public void AddApprovedDriverUpdate(Identity approvedUpdate) 69 | { 70 | ApprovedDriverUpdates.Add(approvedUpdate); 71 | } 72 | 73 | /// 74 | /// Adds a list of update identities to the list of approved driver updates. 75 | /// Approved updates are made available to clients connecting to this service. 76 | /// 77 | /// 78 | public void AddApprovedDriverUpdates(IEnumerable approvedUpdates) 79 | { 80 | foreach (var approvedUpdate in approvedUpdates) 81 | { 82 | ApprovedDriverUpdates.Add(approvedUpdate); 83 | } 84 | } 85 | 86 | /// 87 | /// Removes an approved software update from the list of approved software updates. 88 | /// The software update will not be given to connecting clients anymore. 89 | /// 90 | /// Identity of update to un-approve 91 | public void RemoveApprovedSoftwareUpdate(Identity updateIdentity) 92 | { 93 | ApprovedSoftwareUpdates.Remove(updateIdentity); 94 | } 95 | 96 | /// 97 | /// Removes an approved software update from the list of approved software updates. 98 | /// The software update will not be given to connecting clients anymore. 99 | /// 100 | /// Identity of update to un-approve 101 | public void RemoveApprovedDriverUpdate(Identity updateIdentity) 102 | { 103 | ApprovedDriverUpdates.Remove(updateIdentity); 104 | } 105 | 106 | /// 107 | /// Clears the list of approved driver updates. 108 | /// Un-approved updates are not made available to connecting clients. 109 | /// 110 | public void ClearApprovedDriverUpdates() 111 | { 112 | ApprovedDriverUpdates.Clear(); 113 | } 114 | 115 | /// 116 | /// Clears the list of approved software updates. 117 | /// Un-approved updates are not made available to connecting clients. 118 | /// 119 | public void ClearApprovedSoftwareUpdates() 120 | { 121 | ApprovedSoftwareUpdates.Clear(); 122 | } 123 | } 124 | } 125 | -------------------------------------------------------------------------------- /src/client-server-sync-lib/Server/IClientSync.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | using System.Threading.Tasks; 5 | using System.ServiceModel; 6 | using Microsoft.UpdateServices.WebServices.ClientSync; 7 | 8 | namespace Microsoft.UpdateServices.ClientSync.Server 9 | { 10 | /// 11 | /// Declare an interface for the ClientSoap (WCF) service that can be used in AspNetCore with slight modifications. 12 | /// 13 | [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "2.0.1-preview-30422-0661")] 14 | [System.ServiceModel.ServiceContractAttribute(Namespace = "http://www.microsoft.com/SoftwareDistribution/Server/ClientWebService", ConfigurationName = "Microsoft.UpdateServices.WebServices.ClientSync.ClientSoap")] 15 | interface IClientSyncWebService 16 | { 17 | 18 | [System.ServiceModel.OperationContractAttribute(Action = "http://www.microsoft.com/SoftwareDistribution/Server/ClientWebService/GetConfig", ReplyAction = "http://www.microsoft.com/SoftwareDistribution/Server/ClientWebService/GetConfigRe" + 19 | "sponse")] 20 | System.Threading.Tasks.Task GetConfigAsync(string protocolVersion); 21 | 22 | [System.ServiceModel.OperationContractAttribute(Action = "http://www.microsoft.com/SoftwareDistribution/Server/ClientWebService/GetConfig2", ReplyAction = "http://www.microsoft.com/SoftwareDistribution/Server/ClientWebService/GetConfig2R" + 23 | "esponse")] 24 | System.Threading.Tasks.Task GetConfig2Async(ClientConfiguration clientConfiguration); 25 | 26 | [System.ServiceModel.OperationContractAttribute(Action = "http://www.microsoft.com/SoftwareDistribution/Server/ClientWebService/GetCookie", ReplyAction = "http://www.microsoft.com/SoftwareDistribution/Server/ClientWebService/GetCookieRe" + 27 | "sponse")] 28 | System.Threading.Tasks.Task GetCookieAsync(AuthorizationCookie[] authCookies, Cookie oldCookie, System.DateTime lastChange, System.DateTime currentTime, string protocolVersion); 29 | 30 | [System.ServiceModel.OperationContractAttribute(Action = "http://www.microsoft.com/SoftwareDistribution/Server/ClientWebService/RegisterCom" + 31 | "puter", ReplyAction = "http://www.microsoft.com/SoftwareDistribution/Server/ClientWebService/RegisterCom" + 32 | "puterResponse")] 33 | System.Threading.Tasks.Task RegisterComputerAsync(Cookie cookie, ComputerInfo computerInfo); 34 | 35 | // CODEGEN: Generating message contract since the operation has multiple return values. 36 | [System.ServiceModel.OperationContractAttribute(Action = "http://www.microsoft.com/SoftwareDistribution/Server/ClientWebService/StartCatego" + 37 | "ryScan", ReplyAction = "http://www.microsoft.com/SoftwareDistribution/Server/ClientWebService/StartCatego" + 38 | "ryScanResponse")] 39 | System.Threading.Tasks.Task StartCategoryScanAsync(StartCategoryScanRequest request); 40 | 41 | [System.ServiceModel.OperationContractAttribute(Action = "http://www.microsoft.com/SoftwareDistribution/Server/ClientWebService/SyncUpdates" + 42 | "", ReplyAction = "http://www.microsoft.com/SoftwareDistribution/Server/ClientWebService/SyncUpdates" + 43 | "Response")] 44 | System.Threading.Tasks.Task SyncUpdatesAsync(Cookie cookie, SyncUpdateParameters parameters); 45 | 46 | [System.ServiceModel.OperationContractAttribute(Action = "http://www.microsoft.com/SoftwareDistribution/Server/ClientWebService/SyncPrinter" + 47 | "Catalog", ReplyAction = "http://www.microsoft.com/SoftwareDistribution/Server/ClientWebService/SyncPrinter" + 48 | "CatalogResponse")] 49 | System.Threading.Tasks.Task SyncPrinterCatalogAsync(Cookie cookie, int[] installedNonLeafUpdateIDs, int[] printerUpdateIDs, string deviceAttributes); 50 | 51 | [System.ServiceModel.OperationContractAttribute(Action = "http://www.microsoft.com/SoftwareDistribution/Server/ClientWebService/RefreshCach" + 52 | "e", ReplyAction = "http://www.microsoft.com/SoftwareDistribution/Server/ClientWebService/RefreshCach" + 53 | "eResponse")] 54 | System.Threading.Tasks.Task RefreshCacheAsync(Cookie cookie, UpdateIdentity[] globalIDs, string deviceAttributes); 55 | 56 | [System.ServiceModel.OperationContractAttribute(Action = "http://www.microsoft.com/SoftwareDistribution/Server/ClientWebService/GetExtended" + 57 | "UpdateInfo", ReplyAction = "http://www.microsoft.com/SoftwareDistribution/Server/ClientWebService/GetExtended" + 58 | "UpdateInfoResponse")] 59 | System.Threading.Tasks.Task GetExtendedUpdateInfoAsync(Cookie cookie, int[] revisionIDs, XmlUpdateFragmentType[] infoTypes, string[] locales, string deviceAttributes); 60 | 61 | [System.ServiceModel.OperationContractAttribute(Action = "http://www.microsoft.com/SoftwareDistribution/Server/ClientWebService/GetExtended" + 62 | "UpdateInfo2", ReplyAction = "http://www.microsoft.com/SoftwareDistribution/Server/ClientWebService/GetExtended" + 63 | "UpdateInfo2Response")] 64 | System.Threading.Tasks.Task GetExtendedUpdateInfo2Async(Cookie cookie, UpdateIdentity[] updateIDs, XmlUpdateFragmentType[] infoTypes, string[] locales, string deviceAttributes); 65 | 66 | [System.ServiceModel.OperationContractAttribute(Action = "http://www.microsoft.com/SoftwareDistribution/Server/ClientWebService/GetFileLoca" + 67 | "tions", ReplyAction = "http://www.microsoft.com/SoftwareDistribution/Server/ClientWebService/GetFileLoca" + 68 | "tionsResponse")] 69 | System.Threading.Tasks.Task GetFileLocationsAsync(Cookie cookie, byte[][] fileDigests); 70 | 71 | [System.ServiceModel.OperationContractAttribute(Action = "http://www.microsoft.com/SoftwareDistribution/Server/ClientWebService/GetTimestam" + 72 | "ps", ReplyAction = "http://www.microsoft.com/SoftwareDistribution/Server/ClientWebService/GetTimestam" + 73 | "psResponse")] 74 | System.Threading.Tasks.Task GetTimestampsAsync(GetTimestampsRequest request); 75 | } 76 | } -------------------------------------------------------------------------------- /src/client-server-sync-lib/Server/IReportingService.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | using System.Threading.Tasks; 5 | using System.ServiceModel; 6 | 7 | namespace Microsoft.UpdateServices.ClientSync.Server 8 | { 9 | /// 10 | /// Declare an interface for the IReportingWebService (WCF) service that can be used in AspNetCore with slight modifications. 11 | /// 12 | [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "2.0.1-preview-30422-0661")] 13 | [System.ServiceModel.ServiceContractAttribute(Namespace = "http://www.microsoft.com/SoftwareDistribution", ConfigurationName = "Microsoft.UpdateServices.WebServices.ClientReporting.WebServiceSoap")] 14 | interface IReportingWebService 15 | { 16 | 17 | [System.ServiceModel.OperationContractAttribute(Action = "http://www.microsoft.com/SoftwareDistribution/ReportEventBatch", ReplyAction = "*")] 18 | [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults = true)] 19 | System.Threading.Tasks.Task ReportEventBatchAsync(Microsoft.UpdateServices.WebServices.ClientReporting.Cookie cookie, System.DateTime clientTime, Microsoft.UpdateServices.WebServices.ClientReporting.ReportingEvent[] eventBatch); 20 | 21 | [System.ServiceModel.OperationContractAttribute(Action = "http://www.microsoft.com/SoftwareDistribution/ReportEventBatch2", ReplyAction = "*")] 22 | [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults = true)] 23 | System.Threading.Tasks.Task ReportEventBatch2Async(string computerId, System.DateTime clientTime, Microsoft.UpdateServices.WebServices.ClientReporting.ReportingEvent[] eventBatch); 24 | 25 | [System.ServiceModel.OperationContractAttribute(Action = "http://www.microsoft.com/SoftwareDistribution/GetRequiredInventoryType", ReplyAction = "*")] 26 | [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults = true)] 27 | System.Threading.Tasks.Task GetRequiredInventoryTypeAsync(Microsoft.UpdateServices.WebServices.ClientReporting.Cookie cookie, System.Guid rulesId, string rulesVersion); 28 | 29 | [System.ServiceModel.OperationContractAttribute(Action = "http://www.microsoft.com/SoftwareDistribution/ReportInventory", ReplyAction = "*")] 30 | [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults = true)] 31 | System.Threading.Tasks.Task ReportInventoryAsync(Microsoft.UpdateServices.WebServices.ClientReporting.Cookie cookie, System.DateTime clientTime, Microsoft.UpdateServices.WebServices.ClientReporting.ReportingInventory inventory); 32 | 33 | [System.ServiceModel.OperationContractAttribute(Action = "http://www.microsoft.com/SoftwareDistribution/GetRollupConfiguration", ReplyAction = "*")] 34 | [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults = true)] 35 | System.Threading.Tasks.Task GetRollupConfigurationAsync(Microsoft.UpdateServices.WebServices.ClientReporting.Cookie cookie); 36 | 37 | [System.ServiceModel.OperationContractAttribute(Action = "http://www.microsoft.com/SoftwareDistribution/RollupDownstreamServers", ReplyAction = "*")] 38 | [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults = true)] 39 | System.Threading.Tasks.Task RollupDownstreamServersAsync(Microsoft.UpdateServices.WebServices.ClientReporting.Cookie cookie, System.DateTime clientTime, Microsoft.UpdateServices.WebServices.ClientReporting.DownstreamServerRollupInfo[] downstreamServers); 40 | 41 | [System.ServiceModel.OperationContractAttribute(Action = "http://www.microsoft.com/SoftwareDistribution/RollupComputers", ReplyAction = "*")] 42 | [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults = true)] 43 | System.Threading.Tasks.Task RollupComputersAsync(Microsoft.UpdateServices.WebServices.ClientReporting.Cookie cookie, System.DateTime clientTime, Microsoft.UpdateServices.WebServices.ClientReporting.ComputerRollupInfo[] computers); 44 | 45 | [System.ServiceModel.OperationContractAttribute(Action = "http://www.microsoft.com/SoftwareDistribution/GetOutOfSyncComputers", ReplyAction = "*")] 46 | [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults = true)] 47 | System.Threading.Tasks.Task GetOutOfSyncComputersAsync(Microsoft.UpdateServices.WebServices.ClientReporting.Cookie cookie, System.Guid parentServerId, Microsoft.UpdateServices.WebServices.ClientReporting.ComputerLastRollupNumber[] lastRollupNumbers); 48 | 49 | [System.ServiceModel.OperationContractAttribute(Action = "http://www.microsoft.com/SoftwareDistribution/RollupComputerStatus", ReplyAction = "*")] 50 | [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults = true)] 51 | System.Threading.Tasks.Task RollupComputerStatusAsync(Microsoft.UpdateServices.WebServices.ClientReporting.Cookie cookie, System.DateTime clientTime, System.Guid parentServerId, Microsoft.UpdateServices.WebServices.ClientReporting.ComputerStatusRollupInfo[] computers); 52 | } 53 | } -------------------------------------------------------------------------------- /src/client-server-sync-lib/Server/ISimpleAuthentication.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | using System.Threading.Tasks; 5 | using System.ServiceModel; 6 | 7 | namespace Microsoft.UpdateServices.ClientSync.Server 8 | { 9 | /// 10 | /// Declare an interface for the SimpleAuthSoap (WCF) service that can be used in AspNetCore with slight modifications. 11 | /// GetAuthorizationCookieAsync returns AuthorizationCookie instead of the nested GetAuthorizationCookieResult\GetAuthorizationResultBody 12 | /// 13 | [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "2.0.1-preview-30422-0661")] 14 | [System.ServiceModel.ServiceContractAttribute(Namespace = "http://www.microsoft.com/SoftwareDistribution/Server/SimpleAuthWebService", ConfigurationName = "Microsoft.UpdateServices.WebServices.ClientAuthentication.SimpleAuthSoap")] 15 | interface ISimpleAuthenticationWebService 16 | { 17 | 18 | [System.ServiceModel.OperationContractAttribute(Action = "http://www.microsoft.com/SoftwareDistribution/Server/SimpleAuthWebService/GetAuth" + 19 | "orizationCookie", ReplyAction = "*")] 20 | System.Threading.Tasks.Task GetAuthorizationCookieAsync(Microsoft.UpdateServices.WebServices.ClientAuthentication.GetAuthorizationCookieRequest request); 21 | } 22 | } -------------------------------------------------------------------------------- /src/client-server-sync-lib/Server/ReportingService.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | using System; 5 | using System.Threading.Tasks; 6 | using Microsoft.UpdateServices.WebServices.ClientReporting; 7 | 8 | namespace Microsoft.UpdateServices.ClientSync.Server 9 | { 10 | /// 11 | /// Reporting web service implementation. Placeholder only. 12 | /// 13 | public class ReportingWebService : IReportingWebService 14 | { 15 | /// 16 | /// Not implemented 17 | /// 18 | /// 19 | /// 20 | /// 21 | /// 22 | public Task GetOutOfSyncComputersAsync(Cookie cookie, Guid parentServerId, ComputerLastRollupNumber[] lastRollupNumbers) 23 | { 24 | throw new NotImplementedException(); 25 | } 26 | 27 | /// 28 | /// Not implemented 29 | /// 30 | /// 31 | /// 32 | /// 33 | /// 34 | public Task GetRequiredInventoryTypeAsync(Cookie cookie, Guid rulesId, string rulesVersion) 35 | { 36 | throw new NotImplementedException(); 37 | } 38 | 39 | /// 40 | /// Not implemented 41 | /// 42 | /// 43 | /// 44 | public Task GetRollupConfigurationAsync(Cookie cookie) 45 | { 46 | throw new NotImplementedException(); 47 | } 48 | 49 | /// 50 | /// Not implemented 51 | /// 52 | /// 53 | /// 54 | /// 55 | /// 56 | public Task ReportEventBatch2Async(string computerId, DateTime clientTime, ReportingEvent[] eventBatch) 57 | { 58 | throw new NotImplementedException(); 59 | } 60 | 61 | /// 62 | /// Not implemented 63 | /// 64 | /// 65 | /// 66 | /// 67 | /// 68 | public Task ReportEventBatchAsync(Cookie cookie, DateTime clientTime, ReportingEvent[] eventBatch) 69 | { 70 | throw new NotImplementedException(); 71 | } 72 | 73 | /// 74 | /// Not implemented 75 | /// 76 | /// 77 | /// 78 | /// 79 | /// 80 | public Task ReportInventoryAsync(Cookie cookie, DateTime clientTime, ReportingInventory inventory) 81 | { 82 | throw new NotImplementedException(); 83 | } 84 | 85 | /// 86 | /// Not implemented 87 | /// 88 | /// 89 | /// 90 | /// 91 | /// 92 | public Task RollupComputersAsync(Cookie cookie, DateTime clientTime, ComputerRollupInfo[] computers) 93 | { 94 | throw new NotImplementedException(); 95 | } 96 | 97 | /// 98 | /// Not implemented 99 | /// 100 | /// 101 | /// 102 | /// 103 | /// 104 | /// 105 | public Task RollupComputerStatusAsync(Cookie cookie, DateTime clientTime, Guid parentServerId, ComputerStatusRollupInfo[] computers) 106 | { 107 | throw new NotImplementedException(); 108 | } 109 | 110 | /// 111 | /// Not implemented 112 | /// 113 | /// 114 | /// 115 | /// 116 | /// 117 | public Task RollupDownstreamServersAsync(Cookie cookie, DateTime clientTime, DownstreamServerRollupInfo[] downstreamServers) 118 | { 119 | throw new NotImplementedException(); 120 | } 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /src/client-server-sync-lib/Server/SimpleAuthentication.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | using System; 5 | using System.Threading.Tasks; 6 | using Microsoft.UpdateServices.WebServices.ClientAuthentication; 7 | 8 | namespace Microsoft.UpdateServices.ClientSync.Server 9 | { 10 | /// 11 | /// Authentication service implementation. Reference implementation: all requests are authenticated and a token issued. 12 | /// 13 | public class SimpleAuthenticationWebService : ISimpleAuthenticationWebService 14 | { 15 | /// 16 | /// Handle requests for a authorization token. This implementation issues tokens for all requests without performing any checks. 17 | /// 18 | /// The request paramerets. Not used in this implementation. 19 | /// Authorization cookie 20 | public Task GetAuthorizationCookieAsync(GetAuthorizationCookieRequest request) 21 | { 22 | return Task.FromResult(new AuthorizationCookie() { CookieData = new byte[5], PlugInId = "15" }); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/client-server-sync-lib/Server/UpdateServerStartup.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | using Microsoft.UpdateServices.Storage; 5 | using Microsoft.Extensions.Configuration; 6 | using Microsoft.Extensions.DependencyInjection; 7 | using Microsoft.AspNetCore.Builder; 8 | using Microsoft.Extensions.Logging; 9 | using System.ServiceModel; 10 | using SoapCore; 11 | using Microsoft.Extensions.DependencyInjection.Extensions; 12 | using Microsoft.AspNetCore.Hosting; 13 | using Microsoft.UpdateServices.WebServices.ClientSync; 14 | using System.Reflection; 15 | 16 | namespace Microsoft.UpdateServices.ClientSync.Server 17 | { 18 | /// 19 | /// Startup class for a ASP.NET Core web service that implements the Client-Server sync protocol. 20 | /// A web service started with UpdateServerStartup acts as an update server to Windows PCs. 21 | /// 22 | public class UpdateServerStartup 23 | { 24 | IMetadataSource MetadataSource; 25 | 26 | Config UpdateServiceConfiguration; 27 | 28 | IUpdateContentSource ContentSource = null; 29 | 30 | string ContentRoot; 31 | 32 | /// 33 | /// Initialize a new instance of UpdateServerStartup. 34 | /// 35 | /// 36 | /// ASP.NET configuration. 37 | /// 38 | /// Required: string entry "metadata-source" with the path to file containing updates metadata. 39 | /// Required: string entry "server-config" containing the server configuration in JSON format. A reference server configuration file is provided. 40 | /// Optional: string entry "content-source" containing the path where update content is stored. 41 | /// Optional: string entry "content-http-root" with the root URL where update content is serverd from (e.g. http://my-update-server.com). Usually this set to the address/name of the server. Required if "content-source" is specified. 42 | /// 43 | /// 44 | public UpdateServerStartup(IConfiguration config) 45 | { 46 | // Get the repository path from the configuration 47 | var metadataSourceFile = config.GetValue("metadata-source"); 48 | MetadataSource = CompressedMetadataStore.Open(metadataSourceFile); 49 | if (MetadataSource == null) 50 | { 51 | throw new System.Exception($"Cannot open updates metadata source from path {metadataSourceFile}"); 52 | } 53 | 54 | UpdateServiceConfiguration = Newtonsoft.Json.JsonConvert.DeserializeObject(config.GetValue("server-config")); 55 | 56 | // A file that contains mapping of update identity to a 32 bit, locally assigned revision ID. 57 | var contentPath = config.GetValue("content-source"); 58 | if (!string.IsNullOrEmpty(contentPath)) 59 | { 60 | ContentSource = new FileSystemContentStore(contentPath); 61 | if (ContentSource == null) 62 | { 63 | throw new System.Exception($"Cannot open updates content source from path {contentPath}"); 64 | } 65 | } 66 | 67 | ContentRoot = config.GetValue("content-http-root"); 68 | } 69 | 70 | /// 71 | /// Called by ASP.NET to configure services 72 | /// 73 | /// Service collection. 74 | /// The client-server sync and simple authentication services are added to this list. 75 | /// 76 | public void ConfigureServices(IServiceCollection services) 77 | { 78 | // Enable SoapCore; this middleware provides translation services from WCF/SOAP to Asp.net 79 | services.AddSoapCore(); 80 | 81 | // Enable the upstream WCF services 82 | var clientSyncService = new Server.ClientSyncWebService(UpdateServiceConfiguration, ContentSource == null ? null : ContentRoot); 83 | clientSyncService.SetMetadataSource(MetadataSource); 84 | services.TryAddSingleton(clientSyncService); 85 | services.TryAddSingleton(); 86 | services.TryAddSingleton(); 87 | 88 | // Enable the content controller if serving content 89 | if (ContentSource != null) 90 | { 91 | services.TryAddSingleton(new ClientSyncContentController(MetadataSource, ContentSource)); 92 | } 93 | 94 | // Add ContentController from this assembly 95 | services.AddMvc().AddApplicationPart(Assembly.GetExecutingAssembly()).AddControllersAsServices(); 96 | } 97 | 98 | /// 99 | /// Called by ASP.NET to configure a web app's application pipeline 100 | /// 101 | /// Applicatin to configure. 102 | /// A SOAP endpoint is configured for this app. 103 | /// 104 | /// Hosting environment. 105 | /// Logging factory. 106 | public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) 107 | { 108 | if (ContentSource != null) 109 | { 110 | app.UseMvc(routes => 111 | { 112 | routes.MapRoute( 113 | name: "getContent", 114 | template: "Content/{directory}/{name}", defaults: new { controller = "ClientServerSyncContent", action = "GetUpdateContent" }); 115 | }); 116 | } 117 | 118 | // Wire the upstream WCF services 119 | app.UseSoapEndpoint("/ClientWebService/client.asmx", new BasicHttpBinding(), SoapSerializer.XmlSerializer); 120 | app.UseSoapEndpoint("/SimpleAuthWebService/SimpleAuth.asmx", new BasicHttpBinding(), SoapSerializer.XmlSerializer); 121 | app.UseSoapEndpoint("/ReportingWebService/WebService.asmx", new BasicHttpBinding(), SoapSerializer.XmlSerializer); 122 | } 123 | } 124 | } 125 | -------------------------------------------------------------------------------- /src/client-server-sync-lib/Server/UpdateXmlTransformer.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Xml.Linq; 9 | using System.Xml.XPath; 10 | 11 | namespace Microsoft.UpdateServices.ClientSync.DataModel 12 | { 13 | /// 14 | /// Convert the update XML into various fragments to be sent to clients. 15 | /// See https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-wusp/7b42ccc2-770b-4452-a0f8-e731474ad619 16 | /// 17 | class UpdateXmlTransformer 18 | { 19 | private static readonly string[] AttributesToRemoveInExtendedFragment = { 20 | "UpdateType", 21 | "ExplicitlyDeployable", 22 | "AutoSelectOnWebSites", 23 | "EulaID", 24 | "PublicationState", 25 | "PublisherID", 26 | "CreationDate", 27 | "IsPublic", 28 | "LegacyName", 29 | "DetectoidType", 30 | "OSUpgrade", 31 | "PerUser" 32 | }; 33 | 34 | private static readonly string[] AttributesToKeepInCoreFragment = 35 | { 36 | "UpdateType", "AutoSelectOnWebSites", "EulaID", "ExplicitlyDeployable", "OSUpgrade" 37 | }; 38 | 39 | /// 40 | /// Gets a core XML fragment from full update metadata XML. 41 | /// See: https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-wusp/7b42ccc2-770b-4452-a0f8-e731474ad619 42 | /// 43 | /// Complete update XML 44 | /// Core fragment 45 | public static string GetCoreFragmentFromMetadataXml(string metadataXml) 46 | { 47 | XDocument xml = XDocument.Parse(metadataXml); 48 | StripNamespacesFromXml(xml); 49 | 50 | var identity = xml.Root.XPathSelectElements("/Update/UpdateIdentity").First(); 51 | 52 | var properties = xml.Root.XPathSelectElements("/Update/Properties").First(); 53 | var filteredProperties = FilterElementAttributes(properties, AttributesToKeepInCoreFragment); 54 | 55 | var relationships = xml.Root.XPathSelectElements("/Update/Relationships").FirstOrDefault(); 56 | var applicabilityRules = xml.Root.XPathSelectElements("/Update/ApplicabilityRules").FirstOrDefault(); 57 | 58 | if (applicabilityRules != null) 59 | { 60 | RemoveDriverMetadataNodes(applicabilityRules); 61 | } 62 | 63 | return identity.ToString(SaveOptions.DisableFormatting) + filteredProperties.ToString(SaveOptions.DisableFormatting) + relationships?.ToString(SaveOptions.DisableFormatting) + applicabilityRules?.ToString(SaveOptions.DisableFormatting); 64 | } 65 | 66 | private static void RemoveDriverMetadataNodes(XElement element) 67 | { 68 | foreach(var driverMetadataElement in element.XPathSelectElements("/Update/ApplicabilityRules/Metadata/d.WindowsDriverMetaData")) 69 | { 70 | driverMetadataElement.RemoveNodes(); 71 | } 72 | } 73 | 74 | private static XElement FilterElementAttributes(XElement element, string[] attributesToKeep) 75 | { 76 | var attributesList = element.Attributes().ToList(); 77 | element.RemoveAttributes(); 78 | 79 | foreach (var attribute in attributesList) 80 | { 81 | if (attributesToKeep.Contains(attribute.Name.LocalName)) 82 | { 83 | element.Add(attribute); 84 | } 85 | } 86 | 87 | return element; 88 | } 89 | 90 | private static XElement RemoveElementAttributes(XElement element, string[] attributesToRemove) 91 | { 92 | var attributesList = element.Attributes().ToList(); 93 | element.RemoveAttributes(); 94 | 95 | foreach (var attribute in attributesList) 96 | { 97 | if (!attributesToRemove.Contains(attribute.Name.LocalName)) 98 | { 99 | element.Add(attribute); 100 | } 101 | } 102 | 103 | return element; 104 | } 105 | 106 | private static void StripNamespacesFromXml(XDocument xml) 107 | { 108 | foreach (XElement XE in xml.Root.DescendantsAndSelf()) 109 | { 110 | // Stripping the namespace by setting the name of the element to it's localname only 111 | 112 | if (XE.Name.Namespace.NamespaceName.Equals("http://schemas.microsoft.com/msus/2002/12/BaseApplicabilityRules")) 113 | { 114 | XE.Name = $"b.{XE.Name.LocalName}"; 115 | } 116 | else if (XE.Name.Namespace.NamespaceName.Equals("http://schemas.microsoft.com/msus/2002/12/MsiApplicabilityRules")) 117 | { 118 | XE.Name = $"m.{XE.Name.LocalName}"; 119 | } 120 | else if (XE.Name.Namespace.NamespaceName.Equals("http://schemas.microsoft.com/msus/2002/12/UpdateHandlers/WindowsDriver")) 121 | { 122 | XE.Name = $"d.{XE.Name.LocalName}"; 123 | } 124 | else 125 | { 126 | XE.Name = XE.Name.LocalName; 127 | } 128 | // replacing all attributes with attributes that are not namespaces and their names are set to only the localname 129 | XE.ReplaceAttributes((from xattrib in XE.Attributes().Where(xa => !xa.IsNamespaceDeclaration) select new XAttribute(xattrib.Name.LocalName, xattrib.Value))); 130 | } 131 | } 132 | 133 | /// 134 | /// Get an extended fragment from full update metadata 135 | /// See https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-wusp/7b42ccc2-770b-4452-a0f8-e731474ad619 136 | /// 137 | /// Update metadata XML 138 | /// Extended fragment 139 | public static string GetExtendedFragmentFromMetadataXml(string metadataXml) 140 | { 141 | XDocument xml = XDocument.Parse(metadataXml); 142 | StripNamespacesFromXml(xml); 143 | 144 | var properties = xml.Root.XPathSelectElements("/Update/Properties").First(); 145 | var filteredProperties = RemoveElementAttributes(properties, AttributesToRemoveInExtendedFragment); 146 | filteredProperties.Name = XName.Get("ExtendedProperties"); 147 | 148 | var files = xml.Root.XPathSelectElements("/Update/Files").FirstOrDefault(); 149 | var handlerSpecificData = xml.Root.XPathSelectElements("/Update/HandlerSpecificData").FirstOrDefault(); 150 | 151 | return filteredProperties.ToString(SaveOptions.DisableFormatting) + files?.ToString(SaveOptions.DisableFormatting) + handlerSpecificData?.ToString(SaveOptions.DisableFormatting); 152 | } 153 | 154 | /// 155 | /// Gets localized properties fragment from full update metadata 156 | /// 157 | /// Update metadata XML 158 | /// Language to get the localized properties for 159 | /// Localized properties fragment 160 | public static string GetLocalizedPropertiesFromMetadataXml(string metadataXml, string[] languages) 161 | { 162 | XDocument xml = XDocument.Parse(metadataXml); 163 | StripNamespacesFromXml(xml); 164 | 165 | var localizedProperties = xml.Root.XPathSelectElements("/Update/LocalizedPropertiesCollection/LocalizedProperties"); 166 | 167 | foreach(var localizedProperty in localizedProperties) 168 | { 169 | var languageElement = localizedProperty.XPathSelectElement("Language"); 170 | if (languageElement != null && languages.Contains(languageElement.Value)) 171 | { 172 | return localizedProperty.ToString(SaveOptions.DisableFormatting); 173 | } 174 | else 175 | { 176 | continue; 177 | } 178 | } 179 | 180 | return null; 181 | } 182 | } 183 | } 184 | -------------------------------------------------------------------------------- /src/client-server-sync-lib/client-server-sync-lib.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | netcoreapp2.1 5 | Microsoft.UpdateServices.ClientSync 6 | false 7 | 1.6.1 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /src/downsync-tool/CommandLineOptions.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | using CommandLine; 5 | using System.Collections.Generic; 6 | 7 | namespace Microsoft.UpdateServices.Tools.UpdateServer 8 | { 9 | [Verb("run-server", HelpText = "Serve updates to Windows PCs")] 10 | public class RunUpdateServerOptions 11 | { 12 | [Option("metadata-source", Required = true, HelpText = "Source of update metadata")] 13 | public string MetadataSource { get; set; } 14 | 15 | [Option("content-source", Required = false, HelpText = "Source of update content")] 16 | public string ContentPath { get; set; } 17 | 18 | [Option("port", Required = false, Default = 32150, HelpText = "The port to bind the server to.")] 19 | public int Port { get; set; } 20 | 21 | [Option("endpoint", Required = false, HelpText = "The endpoint to bind the server to.")] 22 | public string Endpoint { get; set; } 23 | 24 | [Option("server-config", Required = false, Default = "default-server-configuration.json", HelpText = "Server configuration file")] 25 | public string ConfigFile { get; set; } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/downsync-tool/ConsoleOutput.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Text; 7 | 8 | namespace Microsoft.UpdateServices.Tools.UpdateServer 9 | { 10 | class ConsoleOutput 11 | { 12 | public static void WriteGreen(string text) 13 | { 14 | Console.ForegroundColor = ConsoleColor.Green; 15 | Console.WriteLine(text); 16 | Console.ResetColor(); 17 | } 18 | 19 | public static void WriteRed(string text) 20 | { 21 | Console.ForegroundColor = ConsoleColor.Red; 22 | Console.WriteLine(text); 23 | Console.ResetColor(); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/downsync-tool/Program.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | using CommandLine; 5 | using System; 6 | 7 | namespace Microsoft.UpdateServices.Tools.UpdateServer 8 | { 9 | class Program 10 | { 11 | static void Main(string[] args) 12 | { 13 | CommandLine.Parser.Default.ParseArguments(args) 14 | .WithParsed(opts => UpdateServer.Run(opts)) 15 | .WithNotParsed(failed => Console.WriteLine("Error")); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/downsync-tool/UpdateServer.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | using Microsoft.AspNetCore.Builder; 5 | using Microsoft.AspNetCore.Hosting; 6 | using Microsoft.Extensions.Configuration; 7 | using Microsoft.Extensions.Logging; 8 | using Microsoft.UpdateServices.ClientSync.Server; 9 | using Microsoft.UpdateServices.Storage; 10 | using System; 11 | using System.Collections.Generic; 12 | using System.IO; 13 | 14 | namespace Microsoft.UpdateServices.Tools.UpdateServer 15 | { 16 | /// 17 | /// Runs a service that provides updates to Windows PCs 18 | /// Requires a local repository. All or a subset of updates from the local repository can be served. 19 | /// 20 | class UpdateServer 21 | { 22 | public static void Run(RunUpdateServerOptions options) 23 | { 24 | // Check that the metadata source file exists 25 | if (!File.Exists(options.MetadataSource)) 26 | { 27 | ConsoleOutput.WriteRed($"There is no metadata source at {options.MetadataSource}"); 28 | return; 29 | } 30 | 31 | if (!File.Exists(options.ConfigFile)) 32 | { 33 | ConsoleOutput.WriteRed($"There is no configuration file at path {options.ConfigFile}"); 34 | return; 35 | } 36 | 37 | if (!string.IsNullOrEmpty(options.ContentPath)) 38 | { 39 | if (!Directory.Exists(options.ContentPath)) 40 | { 41 | ConsoleOutput.WriteRed($"There is no content directory at path {options.ContentPath}"); 42 | return; 43 | } 44 | 45 | if (string.IsNullOrEmpty(options.Endpoint)) 46 | { 47 | ConsoleOutput.WriteRed($"Endpoint is required when serving content"); 48 | return; 49 | } 50 | } 51 | 52 | var configurationJson = File.ReadAllText(options.ConfigFile); 53 | 54 | var host = new WebHostBuilder() 55 | .UseUrls($"http://{options.Endpoint}:{options.Port}") 56 | .UseStartup() 57 | .UseKestrel() 58 | .ConfigureKestrel((context, opts) => { }) 59 | .ConfigureLogging((hostingContext, logging) => 60 | { 61 | logging.AddConfiguration(hostingContext.Configuration.GetSection("Logging")); 62 | logging.AddConsole(); 63 | logging.AddDebug(); 64 | logging.AddEventSourceLogger(); 65 | }) 66 | .ConfigureAppConfiguration((hostingContext, config) => 67 | { 68 | var configDictionary = new Dictionary() 69 | { 70 | { "metadata-source", options.MetadataSource }, 71 | { "server-config", configurationJson}, 72 | { "content-source", options.ContentPath }, 73 | { "content-http-root", string.IsNullOrEmpty(options.Endpoint) ? null : $"http://{options.Endpoint}:{options.Port}" } 74 | }; 75 | 76 | config.AddInMemoryCollection(configDictionary); 77 | }) 78 | .Build(); 79 | 80 | host.Run(); 81 | } 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /src/downsync-tool/default-server-configuration.json: -------------------------------------------------------------------------------- 1 | { 2 | "LastChange": "2017-03-08T21:07:43.58Z", 3 | "IsRegistrationRequired": false, 4 | "AuthInfo": [ 5 | { 6 | "PlugInID": "PidValidator", 7 | "ServiceUrl": "", 8 | "Parameter": "" 9 | }, 10 | { 11 | "PlugInID": "Anonymous", 12 | "ServiceUrl": "", 13 | "Parameter": "" 14 | } 15 | ], 16 | "AllowedEventIds": null, 17 | "Properties": [ 18 | { 19 | "Name": "MaxExtendedUpdatesPerRequest", 20 | "Value": "50" 21 | }, 22 | { 23 | "Name": "ODFFileURL", 24 | "Value": "http://www.update.microsoft.com/odf/v6odf.xml" 25 | }, 26 | { 27 | "Name": "ProtocolVersion", 28 | "Value": "4.2" 29 | }, 30 | { 31 | "Name": "AllowUninstall", 32 | "Value": "0" 33 | }, 34 | { 35 | "Name": "AutoAcceptEula", 36 | "Value": "0" 37 | }, 38 | { 39 | "Name": "AllowDeadline", 40 | "Value": "0" 41 | }, 42 | { 43 | "Name": "ProvideFeaturedUpdate", 44 | "Value": "1" 45 | }, 46 | { 47 | "Name": "ReportBundledPerUpdateEvent", 48 | "Value": "1" 49 | }, 50 | { 51 | "Name": "EventBatchFlushAgeMin", 52 | "Value": "539" 53 | }, 54 | { 55 | "Name": "EventBatchFlushAgeMax", 56 | "Value": "540" 57 | }, 58 | { 59 | "Name": "ReportRetryWaitTimeMin", 60 | "Value": "3600" 61 | }, 62 | { 63 | "Name": "ReportRetryWaitTimeMax", 64 | "Value": "86400" 65 | }, 66 | { 67 | "Name": "EventSamplingThreshold", 68 | "Value": "50" 69 | }, 70 | { 71 | "Name": "DetectEventSamplingThreshold", 72 | "Value": "20" 73 | }, 74 | { 75 | "Name": "CompressBundleEvents", 76 | "Value": "1" 77 | }, 78 | { 79 | "Name": "ReportAURebootCompletedEvent", 80 | "Value": "0" 81 | }, 82 | { 83 | "Name": "ReportMachineInfoExtension", 84 | "Value": "1" 85 | }, 86 | { 87 | "Name": "ReportDetectionEventExtension", 88 | "Value": "1" 89 | }, 90 | { 91 | "Name": "ReportPredeploymentCheck", 92 | "Value": "0" 93 | }, 94 | { 95 | "Name": "AllowExternalEvents", 96 | "Value": "0" 97 | }, 98 | { 99 | "Name": "CanContentChange", 100 | "Value": "1" 101 | }, 102 | { 103 | "Name": "IsHostingExpressContentConfigurable", 104 | "Value": "0" 105 | }, 106 | { 107 | "Name": "RefreshFileLocationsWhenRefreshCache", 108 | "Value": "0" 109 | }, 110 | { 111 | "Name": "MaxExternalEventPayloadSize", 112 | "Value": "0" 113 | }, 114 | { 115 | "Name": "PerformDriverSync", 116 | "Value": "1" 117 | }, 118 | { 119 | "Name": "MicrosoftPreferredCategoryIds", 120 | "Value": "0FA1201D-4330-4FA8-8AE9-B877473B6441;E0789628-CE08-4437-BE74-2495B842F43B" 121 | }, 122 | { 123 | "Name": "DownloadsLimitedBySizeOnRestrictedNetworks", 124 | "Value": "0" 125 | }, 126 | { 127 | "Name": "ServiceSupportsPerUpdateSampling", 128 | "Value": "1" 129 | }, 130 | { 131 | "Name": "DualStackDownloadPrefix", 132 | "Value": "" 133 | }, 134 | { 135 | "Name": "IPv4OnlyDownloadPrefix", 136 | "Value": "" 137 | }, 138 | { 139 | "Name": "BackgroundClientPrefix", 140 | "Value": "au" 141 | }, 142 | { 143 | "Name": "AcquisitionClientPrefix", 144 | "Value": "" 145 | }, 146 | { 147 | "Name": "InteractiveUpdateClientPrefix", 148 | "Value": "" 149 | }, 150 | { 151 | "Name": "MSPreferredContentPrefix", 152 | "Value": "" 153 | }, 154 | { 155 | "Name": "SyncUpdatesSupportsTreatAppCategoryIdsAsInstalled", 156 | "Value": "0" 157 | }, 158 | { 159 | "Name": "SyncUpdatesSupportsAdditionalFragments", 160 | "Value": "0" 161 | } 162 | ] 163 | } -------------------------------------------------------------------------------- /src/downsync-tool/downsync-tool.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Exe 5 | netcoreapp2.1 6 | Microsoft.UpdateServices.Tools.UpdateServer 7 | downsync 8 | 1.6.1.0 9 | 1.6.1.0 10 | 1.6.1 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | Always 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /src/downsync-tool/publish.txt: -------------------------------------------------------------------------------- 1 | dotnet publish --self-contained --runtime win-x64 --configuration Release --output bin\release\publish --------------------------------------------------------------------------------