Best deploy method for registry and certificates - deployment

I need to deploy some registry keys and install certificates in some stores on each of my clients computer.
To avoid errors and make it easy to use, I want to create an automated process to do so, but I don't what are the options.
What are the possibilities to upgrade the windows registry and install a few certificates?
Batch files?
Installer?
Deployment package?
The sweetest thing would allow my clients to configure their computer by clicking a button right into one of my ASP.net page, is it possible?

I'm facing the following problem :
On windows XP, the utility called "certutil", that is used to deploy certificates is unavailable.
To install it, I must install on each client the Windows server 2003 Administration tools and it's cumbersome.
The best solution I've found so far is to export my certificates from the registry, and install them through my clients' registry ! I can only share a big .REG file that will do all the installation work.
Each one of my certificates must go into the following registry key :
[HKEY_CURRENT_USER\Software\Microsoft\SystemCertificates\Root\Certificates]
And by exporting my registry, I can therefore share the exported .REG file to allow other users to install them!
Can I have trouble with that solution ? Is there a better way ?
Thanks for your help!

I looked again at the group policy preference I was using. There is an option "Run in logged-on user's security context (user policy option)" that I enabled and now the registry entry is persisting

Related

How to sign code built using Azure Pipelines using a certificate/key in Azure Key Vault?

We're in the process of moving from on-premise build servers to Azure Pipelines. We produce "shrink-wrap" desktop software so clearly we need to sign all our binaries before releasing. Our current build infrastructure does this using a USB hardware token from GlobalSign, but clearly that isn't going to work when we're doing cloud builds - sadly, clouds are not equipped with USB ports :D
Now, GlobalSign has recently started advertising Azure Key Vault as a key storage option, and they're perfectly happy to sell this to us, but I'm not sure how we'd actually integrate that with our build pipelines (or indeed whether that's even possible).
Has anyone actually made this work?
Code Signing
I've been battling with Azure Key Vault and Azure Pipelines to get our code signed, and succeeded. So here's what I found out.
Critically, Extended Validation (EV) certificates used for code signing are very different animals to 'normal' SSL certificates. The standard ones can be exported as much as you like, which means you can upload it to Azure Pipelines and use it with the standard Microsoft Sign Tool.
However, once an EV certificate is in Azure Key Vault, it isn't coming out in any usual fashion. You must call it from Pipelines using the excellent Azure Sign Tool as discovered by Anodyne above
Get your certificate into Key Vault. You can use any certificate authority you like to generate the certificate, as long as they understand that you'll need an EV certificate, and critically one that has a hardware security module (HSM), and not one with a physical USB key. Any cloud based system like Key Vault will need an HSM version.
To get the permissions to access this certificate externally you can follow this page but beware it misses a step. So read that document first, then these summarised steps, to get the Key Vault set up:
Open the Azure portal, go to the Azure Active Directory area, and create an App registration: put in a memorable name, ignore the Redirect URI, and save it.
Go to your specific Key Vault, then Access control (IAM), then Add role assignment. Type the name of the app you just created into the select input box. Also choose a Role, I suggest Reader and then save.
The Missing Part: Still in the Key Vault, click the Access policies menu item. Click Add Access Policy and add your application. The Certificate Permissions need to have the Get ticked. And the Key Permissions, despite the fact that you may not have any keys at all in this vault, need to have Get and Sign. You would have thought these two would be in the certificate perms...
Go back to the application you just created. Select the Certificates & secrets, and either choose to upload a certificate (a new one purely for accessing the Key Vault remotely) or create a client secret. If the latter, keep a copy of the password, you won't see it again!
In the Overview section of the app will be the Application (client) ID. This, and the password or certificate, is what will be fed to the Azure Sign Tool later on in a Pipelines task.
Handling the actual code signing from Azure requires a number of steps. The following applies to Microsoft hosted agents, although similar issues will affect any private agents that you have.
The Azure Sign Tool needs the .NET Core SDK to be installed, but a version that's at least version 2.x, and since the latest .NET Core SDK is always used, this means as long as the version of Windows is current enough, you don't need to install it yourself. And you can see which version of the SDK is shipped with which Windows agent.
The current Hosted OS version in Azure Pipelines, also called Default Hosted, is, at the time of writing, Windows Server 2012 R2. Which isn't up to date enough. Installing a newer .NET Core SDK to overcome this is a time drag on every build, and although the installation works, calling the Azure Sign Tool may not work. It seems to be finding only older versions of the SDK, and throws this error: Unable to find an entry point named 'SignerSignEx3' in DLL 'mssign32'.
So the easiest thing to do is change your build to use a later OS image. Windows 2019 works like a charm. And there is no need to install any version of .NET Core.
Then create a command line task to install the Azure Sign Tool. You can use a .NET Core CLI task as well, but there is no need. In the task, type this:
set DOTNET_SKIP_FIRST_TIME_EXPERIENCE=true
dotnet tool install --global AzureSignTool --version 2.0.17
Naturally using whichever version that you want.
The DOTNET_SKIP_FIRST_TIME_EXPERIENCE environment variable isn't strictly necessary, but setting it speeds things up quite a bit (see here for an explanation).
Finally, create another command line task and type in the Azure Sign Tool command that you wish to run with. On Windows this would be something like below, note with ^ not / as a line continuation marker. Naturally, see here for more parameter information:
AzureSignTool.exe sign -du "MY-URL" ^
-kvu https://MY-VAULT-NAME.vault.azure.net ^
-kvi CLIENT-ID-BIG-GUID ^
-kvs CLIENT-PASSWORD ^
-kvc MY-CERTIFICATE-NAME ^
-tr http://timestamp.digicert.com ^
-v ^
$(System.DefaultWorkingDirectory)/Path/To/My/Setup/Exe
And in theory, you should have success! The output of the sign tool is rather good, and usually nails where the problem is.
Re-issuing Certificates
If you need to re-issue a certificate, the situation is quite different.
In Azure, go to the certificate and click on it, opening a page showing the versions of that certificate, both current and older versions.
Click the 'New Version' button, probably accepting the defaults (depending on the choices you wish to make) and click 'Create'.
This takes you back to the Versions page, and there will be a message box stating 'The creation of certificate XXXX is currently pending'. Click there (or on the 'Certificate Operation' button) to open the 'Certificate Operation' side page. Once there, download the CSR (certificate signing request).
In GlobalSign, follow their instructions to re-issue the existing certificate. Once it has been re-issued, they will send an email describing how to download it.
Log into GlobalSign again, and after entering the temporary password, open the CSR and copy the whole text (which starts with -----BEGIN CERTIFICATE REQUEST-----) into GlobalSign. Submit it.
Download using the 'Install My Certificate' button. Then in the Azure 'Certificate Operation' side page - use the 'Merge Signed Request' button that to upload the .CER file to Azure. This creates the new version of the certificate.
Disable the old version of the certificate.
Yes, it's able to do this in Azure DevOps Service Build pipeline.
For normal situation, we usually use SignTool.exe commands to sign files. There is also an extension Code Signing in marketplace, which could sign a single file, you could use script to run SignTool.exe commands for multiple files.
So you can export your codesigning certificate to a pfx file, which you then upload as a secure file to Azure Devops secure file storage which makes it available to your builds.
Azure DevOps could store secure files. Check this link for details: Secure files
Azure Key Vault instance is kind of more complicated. We also have an Azure Key Vault task.
Use this task in a build or release pipeline to download secrets such
as authentication keys, storage account keys, data encryption keys,
.PFX files, and passwords from an Azure Key Vault instance.
The task can be used to fetch the latest values of all or a subset of
secrets from the vault, and set them as variables that can be used in
subsequent tasks of a pipeline.
Not sure how GlobalSign will integrate code sign with your environment. Theoretically, it's able to do this. For the detail parts and implementation, you may need to discuss with their pre-sales. Hope this helps.
If anyone else is looking for this and using RBAC, I found these steps essential:
Key Vault Reader on the RESOURCE GROUP
Key Vault Certificates Officer on the KEY VAULT and on the CERTIFICATE
Key Vault Crypto Office on the CERTIFICATE (to use the key for signing!)

How to share a self-signed clickonce certificate with different clients for development

I am developing a clickonce C sharp project in Visual Studio.
On my main computer, I have generated a self-signed certificate for the clickonce manifest.
This works fine, I can compile, deploy and run.
I also sync this solution to my github account, and regularly pull updates down to a backup computer.
The backup computer is not able to simply compile this solution, as it gives errors in regards to self-signed keys.
I could generate a new one on the backup computer, but then when I deploy to same testbed, it causes issues because the certificate is from a different location.
I want to quickly be able to deploy from the backup computer in the event that there is an issue with the main.
How can I share the main computer's generated certificate with my backup environment without issue?
My apologies if this is straightforward or I am missing something obvious.
Run certmgr.msc (user) or certlm.msc (computer) and look in My Certificates for the certificate. Right click it an check if you can export it with the private key resulting in am PFX file (PKCS#12).
If this is not possible generate a new one with the -ExportPolicy Exportable option.

Creating and Exporting Certificate for Remote Desktop Connection Manager v2.7

Can anyone help me create a certificate to use with the new version of Remote Desktop Connection Manager v2.7? I see the new version removed the "Store as plain text" option, but added using a certificate to the list.
I was wondering if anyone knew how to create a certificate (self-signed or whatever) that I could install on both computers to allow me to pass the config file between machines. I haven't been able to find anything online!
Thanks in advance.
If you in Remote Desktop Connection Manager click on the Help menu, and Usage, you will see a web page. On the Contents list, click on Encryption Settings (Under Local Options). There you will see how to create a personal certificate that RDCMan can use.
You will first need to get makecert.exe if you don't have it on your computer. You can get it by installing Windows SDK or Visual Studio.

Why Eclipse p2site is asking for credentials?

I have a p2site hosted on my server to provide Eclipse Update Site. The server is running an IIS 7.5
I have the same p2site content stored and provided both in my production environment and in my staging environment (two separate servers, with identical characteristics).
From a couple of days, if I connect with my staging environment p2site from an Eclipse Indigo instance, I'm required to enter credentials, which has never happened before.
Moreover, if I manually download the zip archive and install my plugin from this local archive, I'm asked the credentials too.
I can guess, but I'm not sure, that the problem can be related to the following: in the last days we have added HTTPS enablement for our web site, and installed our certificate in the root certificates of Windows Server 2008 R2.
Anyone knows why Eclipse (Indigo, haven't tested the other platforms yet) is behaving in this way?
And how can I prepare my local zip archive / p2site to overcome this issue?
Thank you very much
cghersi
Just for the sake of completeness, I found the solution on my own: the problem was that for some reasons (that I cannot still recognize...) there was a DENY rule in the .NetAuthorization section for the verbs OPTION,HEAD.
It seems that Eclipse send exactly these kind of requests when looking for p2site and so these requests were rejected and Eclipse was asking for credentials for these requests.
Hope is can be useful in the future for other people.
cghersi

Can a ClickOnce deployed app be silently mass installed?

I have a smart client app (WinForms/WPF) currently deployed using ClickOnce.
A particular client has expressed the desire to silently deploy the app to it's intranet network users as part of its nightly/weekly client PC update service - presumably via MS Systems Management Server (SMS) and Group Policy or similar (I don't understand the exact mechanisms). As such, they've requested a .MSI installer instead.
So a few questions for confirmation (along with my thoughts on answer - am more than happy to be wrong!):
Can a ClickOnce app be silently installed en-mass by admin???
My thoughts: No, because ClickOnce is a per-user installation this would be difficult unless the user is actually logged in at time of remote installation.
Is there a tool to convert a ClickOnce app/project's settings to a simple MSI installer project (e.g. Visual Studio Deployment Project)???
My thoughts: Not in the box, but would love a tool to repeatedly copy/use settings from the ClickOnce config to the deployment project - e.g. ProductName, Version, File Associations etc. This way we only maintain one set of deployment settings.
Any other alternatives for this scenario to get 'er done quick...?
I don't think you can install a ClickOnce application silently, certainly not with SMS. And I don't know of any tool that does that, but it doesn't mean it doesn't exist. ;-)
The idea of deploying a shortcut is an interesting thought. Have you ever noticed that if you leave a shortcut on the desktop even after the application is uninstalled, if the user clicks on it, it reinstalls the application?