====== Vibemosphere Auto Updater ====== Ingest folders, Authenticode signing, WiX 7 / NSIS / deb packaging and the update repository for ISSP products (disabled until it is switched on). ^ Id | ''auto-updater'' | ^ Role | ''deployment'' - needed for the page and the REST API (administrators always may) | ^ Page | **Plugins > Open** (overlay with an X at the top right) or ''/plugins/auto-updater/'' | ^ REST | ''/api/plugins/auto-updater/...'' and, for callers with the role, ''/plugins/auto-updater/...'' | ===== Open the configuration ===== In the administration open **Plugins**, select the row of this plug-in and press **Open**. The page opens in an overlay dialog: close it with the **X** at the top right, with Esc or by clicking outside; //Open in a new tab// next to the title shows it full size. {{vibecat:plugin-auto-updater.png?900|Vibemosphere Auto Updater: the plug-in page in its overlay dialog}} ===== The page in detail ===== {{vibecat:plugin-auto-updater-full.png?900|auto-updater: first tab, Products}} ===== Tabs ===== The page is divided into the tabs **Products**, **Folders and watchdog**, **Signing**, **Engines**. ==== Folders and watchdog ==== {{vibecat:plugin-auto-updater-tab2.png?900|auto-updater: tab Folders and watchdog}} ==== Signing ==== {{vibecat:plugin-auto-updater-tab3.png?900|auto-updater: tab Signing}} ==== Engines ==== {{vibecat:plugin-auto-updater-tab4.png?900|auto-updater: tab Engines}} ===== Fields and columns ===== ^ Label ^ Meaning ^ | Ingest directory (new versions are dropped here: ingest/[/] ) | | | Repository directory (the published packages: repository/[/] ) | | | products.json (empty: products.json in the plug-in data folder; e.g. the file of live.pimia.io) | | | URL prefix of the update clients | | | Default installation engine | | | Manufacturer | | | Releases kept in the history | | | Ingested files after a build | | | Serve the repository | | | Look at the ingest folders | | | How | | | Interval in seconds | | | Wait until the files are still for (seconds) | | | Sign the files | | | Program that signs (not used for Option 4) | | | Digest | | | Sign the package too (MSI / setup EXE) | | | Sysworx.AuthenticodeSigner.exe (empty: tools\authenticode-signer of Vibecat) | | | signtool.exe (empty: found in the Windows SDK) | | | Own command ({file} {pfx} {thumbprint} {timestamp}; the password is in the environment variable SIGN_PFX_PASSWORD) | | | PFX file | | | PFX password (stored apart, never shown again) | | | or the name of an environment variable with the password | | | Thumbprint of a certificate with private key in the Windows store of the account that runs Vibecat (My, current user or computer; smart card and HSM work too) | | | Certificate authority | | | Common name (empty: manufacturer Code Signing) | | | Organization | | | Valid for (days) | | | Renew when fewer days are left | | | Key | | | Issue a new certificate on demand | | | Endpoint of the region | | | Account name | | | Certificate profile name | | | Azure signing client library ( Azure.CodeSigning.Dlib.dll , file or folder; empty: the folder of the client tools) | | | Tenant ID (empty: az login / managed identity of the account) | | | Client ID of the app registration | | | Client secret (stored apart, never shown again) | | | Time stamp server (RFC 3161) - choose a free one or type any URL; empty: the signature ends with the certificate | | | wix.exe (WiX Toolset 7; empty: found automatically) | | | WiX 7 EULA / maintenance fee acknowledgement ( -acceptEula ) | | | Architecture | | | makensis.exe (NSIS; empty: found automatically) | | | deb maintainer | | | deb architecture | | | New ingest folder | | ===== Actions ===== * **Enable** * **Edit schedule ...** * **Scan now** * **Issue a code signing certificate now** * **Test the time stamp server** * **Check the signing settings** * **Save settings** * **Create** * **Build everything that changed** * **Save products.json** * **Insert a sample** ===== Notes from the page ===== * New product versions are dropped into ingest folders. The plug-in signs the primary EXE / MSI (Authenticode), builds the package with the engine of the product ( WiX 7 MSI, NSIS setup, deb or the files as they are), publishes it in the repository and serves it to the update clients. A watchdog looks at the ingest folders by interval or schedule. Documentation * A change is built when its files have not changed for the wait time (so a copy that is still running is not taken). * The auto updater asks the CA plug-in for a code signing certificate, keeps the PKCS#12 file in its data folder ( signing-ca , the password in secrets.json ) and signs with it. Computers trust the signature when they trust the root certificate of that CA. * The certificate stays in Azure: signtool.exe signs through the Azure client library ( /dlib , /dmdf with the account and profile above); identity from the Azure environment variables, az login or a managed identity. Needs a recent Windows SDK signtool (10.0.2261 or newer) and the Azure Artifact Signing client tools; the time stamp server timestamp.acs.microsoft.com is used when none is chosen. * The primary EXE of a product is signed before it goes into the package, the MSI / setup EXE after it was built. Products can turn signing off with "sign": false and sign more files with "signFiles": ["*.dll"] . * Folders, engines, signing and watchdog are saved together. ===== Reference ===== The ISSP auto update repository (formerly the servlet ''autoupdate.war'') as a Vibecat plug-in. A new product version is **dropped into an ingest folder**; the plug-in **signs** the primary EXE / MSI with Microsoft Authenticode, builds the **installation package** with the engine of the product, puts it into the **repository** and serves it to the update clients. A **watchdog** looks at the ingest folders by interval or by schedule. **The plug-in is disabled when it ships.** Nothing is watched, built or served until //Enable// is pressed on its page (the setting is ''enabled'' in ''plugin-data\auto-updater\settings.json''). ==== Folders ==== D:\autoupdater\ingest\elo25client\ files, ZIP, MSI or EXE of the new version (a product with one part) D:\autoupdater\ingest\pimia\pjs\ a product with several parts: pimia = pjs + pct D:\autoupdater\ingest\pimia\pct\ | watchdog (interval or schedule) - sign primary file - engine - sign package v D:\autoupdater\repository\elo25client\ the MSI / setup EXE / deb (+ .release.json: version, SHA-256, signed files) D:\autoupdater\repository\pimia\pjs\ D:\autoupdater\repository\_history\... earlier releases (the last 5; roll back on the page) The two folders are set on the page. ZIP files in an ingest folder are unpacked (a single top folder is dropped, so ''pjs-2.1\...'' and ''...'' are the same); other files and folders are taken as they are. The files must **stay unchanged for the wait time** (10 s) before they are built, so a copy that is still running is not taken. ''version.txt'' (first line) or ''product.json'' in the ingest folder give the version and the settings of that part; without them the version of the primary EXE / MSI is used, and at last the time of the build. ==== Installation engines ==== ^ engine ^ result ^ how ^ | ''copy'' | the files as they are | a dropped MSI / EXE stays what it is (and is signed); the default | | ''wix'' | ''-.msi'' | **WiX Toolset 7** (''wix build''). From the files: a generated ''Package.wxs'' (per-machine, Program Files, major upgrade with a stable UpgradeCode per product, desktop links and program menu entries from the product definition). Or your own ''*.wxs'' in the ingest folder (variables ''SourceDir'', ''Version'', ''ProductName'', ''Manufacturer''). WiX 7 asks for an acknowledgement of its licence terms: the page has the ''-acceptEula'' value (''wix7''). | | ''nsis'' | ''--setup.exe'' | **NSIS** (''makensis''). From the files: a generated script (installer, uninstaller, links, uninstall entry). Or your own ''*.nsi'' (defines ''VERSION'', ''PRODUCT_NAME'', ''OUTFILE''). | | ''deb'' | ''__amd64.deb'' | built in Java (ar + tar.gz, no ''dpkg'' needed): files below ''/opt/'', one ''.desktop'' file per link in ''/usr/share/applications'', desktop links copied to ''~/Desktop'' by the postinst script. Options in the product: ''debPackage'', ''debInstallDir'', ''depends'', ''maintainer'', ''debArch''. | ==== products.json ==== The file of ''live.pimia.io'' (''data\products.json'') is used as it is; set its path on the page (empty: ''products.json'' in the plug-in data folder). An entry becomes a part of a product through the new ''ingest'' object; ''shortcuts'' describe the links. Everything else in the entry is left to live.pimia.io. { "PCT": { "caption": "PIMIA Config Tool (PCT)", "exeName": "FTP4ELOConfig.exe", "ingest": { "product": "pimia", "component": "pct", // ingest\pimia\pct "engine": "wix", // copy | wix | nsis | deb "primaryFile": "FTP4ELOConfig.exe", // signed first, gives the version "sign": true, "signFiles": ["COLDEditor.exe"], // more files to sign (* and ? allowed) "manufacturer": "ISSP", "installDir": "ISSP\\PIMIA\\Config", "version": "" // empty: version.txt or the version of the primary file }, "shortcuts": { "desktop": [ {"name": "PIMIA Config Tool", "target": "FTP4ELOConfig.exe"} ], "programMenu": { "folder": "PIMIA", "items": [ {"name": "COLD Editor", "target": "COLDEditor.exe", "arguments": "", "description": ""} ] } } } } A ''target'' is relative to the install folder. The same product description is delivered to the clients: ''products.json'' and the file list of the repository (below) contain the shortcuts, so a client that installs files by itself can create the links as well. A folder with a ''product.json'' overrides the entry (same keys, without the wrapper). ==== Authenticode signing ==== Signing is **off** until it is switched on. Two choices: **where the certificate comes from** (four options, radio boxes on the page) and **which program signs** (Windows signs, so the plug-in starts a program of the computer it runs on; Windows only). ^ certificate ^ how ^ | **Option 1: PFX file** | a PFX with the password (stored apart in ''secrets.json'', or read from an environment variable) | | **Option 2: Certificate store (thumbprint)** | a certificate with private key in the Windows store of the account that runs Vibecat (My, current user or computer); smart cards and HSMs work the same way because the key never leaves its provider | | **Option 3: CA certificate** (only when the plug-in //Vibemosphere Certificate Authority// is running) | the auto updater asks the CA for a **code signing certificate** (choose the CA, common name, validity), **keeps** the PKCS#12 file in ''plugin-data\auto-updater\signing-ca'' (password in ''secrets.json'') and signs with it. A missing certificate, or one that runs out within the renew period (30 days), is **issued again before the build** (switchable). Computers trust the signatures when they trust the root of that CA - roll the CA certificate out by policy. | | **Option 4: Azure Artifact Signing** (formerly Azure Trusted Signing) | the certificate stays in Azure. ''signtool.exe'' (Windows SDK 10.0.2261 or newer) signs through the Azure client library ''Azure.CodeSigning.Dlib.dll'' with ''/dlib'' and a metadata file (''/dmdf'') that the plug-in writes from //endpoint//, //account// and //certificate profile//. The identity comes from the environment (''AZURE_TENANT_ID'', ''AZURE_CLIENT_ID'', a client secret kept apart), ''az login'' or a managed identity. Default time stamp server: ''timestamp.acs.microsoft.com''. | **Time stamp server:** the field takes any URL and offers well-known free RFC 3161 servers (DigiCert, Sectigo, GlobalSign, Microsoft, Certum, Entrust, SSL.com, IdenTrust, FreeTSA ...); //Test the time stamp server// asks it for a real time stamp. The program (options 1 to 3): ^ mode ^ uses ^ | ''sysworx'' | ''Sysworx.AuthenticodeSigner.exe'', the C# sample of the security framework (''samples\signing'', with its source): SHA-256 and an RFC 3161 time stamp, PFX file or certificate store. .NET 8 runtime. | | ''powershell'' | ''Set-AuthenticodeSignature'' of Windows PowerShell - nothing to install | | ''signtool'' | ''signtool.exe'' of the Windows SDK | | ''command'' | your own command line with ''{file}'', ''{pfx}'', ''{thumbprint}'', ''{timestamp}'' | A password never appears on a command line. The primary EXE is signed **before** it goes into the package, the MSI / setup EXE **after** it was built. The page checks the settings and shows the state of the signatures in the repository. A code signing certificate from a public authority is needed for Windows to trust the publisher; a self-signed one (''Sysworx.AuthenticodeSigner.exe new-test-cert'') shows "signed, root not trusted" - enough for tests. ==== Watchdog ==== The watchdog looks at the ingest folders **every n seconds** or **by schedule**: the page has the cloccojs schedule dialog (interval with a time window, daily, weekly, monthly, once, cron), the same one that is part of cloccojs (''scheduler.js''). The schedule is a JSON object (see ''settings.json'') read by the class ''Schedule'' with the same rules as the preview in the dialog. //Scan now// looks at once; //Build now// builds one part even if nothing changed. A build that failed is not repeated for the same files (change them or press //Build now//). ==== For the update clients ==== Below the URL prefix (default ''/autoupdate''), on every port of the web applications, read only and public (protect the URL with a reverse proxy if the files are not for everybody). The protocol is the one of the old servlet: ^ URL ^ answers ^ | ''/autoupdate?cmd=applist'' | JSON: applications with version, file count, size | | ''/autoupdate?cmd=filelist&appname=pimia/pct&md5=1'' | XML ''descriptor / files / file'' (file name, time, version of EXE / DLL / MSI, MD5, SHA-256, MSI properties) and ''shortcuts'' | | ''/autoupdate?cmd=latest&appname=...'' | JSON: the release (version, engine, signed files, SHA-256 of every file) | | ''/autoupdate/store/Applications//'' | the file (with ''Range''); ''/store/Config/...'' serves ''repository\_config\'' | | ''/autoupdate/products.json'' | the products and parts with version and links | ==== REST of the page ==== Below ''/api/plugins/auto-updater'': ''GET /state'', ''PUT /settings'', ''GET|PUT /products'', ''POST /run'' (''{"id":"pimia/pct","force":true}'', empty = scan), ''GET /jobs'', ''GET|POST|DELETE /ingest?id=&name='' (POST body = the file), ''POST /verify'', ''GET /history?id='', ''POST /rollback'', ''POST /check-signing''. Changes need the administrator role. [[vibecat:plugins:start|All plug-ins]]