Easy Way To Generate Key And Csr Windows

/ Comments off
  1. Easy Way To Generate Key And Csr Windows 6
  2. Easy Way To Generate Key And Csr Windows 1
  3. Generate Key Code
  4. Easy Way To Generate Key And Csr Windows 5
  5. Easy Way To Generate Key And Csr Windows 7

Jul 21, 2016 I found a bunch of articles but none really convinced me on the right way to do this, some for old versions others from other operating systems. How can i create a CSR for 'monitoring.domain.com' from a Windows 10 installation with the latest PRTG? It will run on port 4343 not on 443. Csr prtg ssl ssl-certificate. Aug 14, 2019  Use openssl to generate a new private key. When prompted, enter an easy password value as it will only be used when generating the CSR and not by your app at runtime. Heroku only supports RSA keys for certs. Elliptic curve keys are not supported. That way you only need to ssh to FMC. I generated a new key and CSR using XCA (free Windows app). You could also use openssl - just got to know the right syntax and it's a bit more cumbersome if you're a Windows person like me. The key and certificate files are short ascii text so very easy to just paste into the ssh session.

Some of you may have seen me posting various comments on Let's Encrypt and to be honest I do have a little man crush on this initiative. PKI has a huge impact on the web of trust and Let's Encrypt is an initiative I believe will change and hopefully break the SSL Certificate monopoly (top 10 Public Certificate Authorities).

3 Key reasons why I am really excited about Let's Encrypt
It's Free
It's Automatable
It's Transparent

The stats (available at https://letsencrypt.org/stats/) also suggest that we are on to a winner. Below is an info graphic to illustrate the point.

4 key areas where Let's Encrypt can help in real life:

  1. 'Lesser Priority Domains' - getting budget for SSL certificates can be a nightmare so Let's Encrypt provides a quick way of getting trusted certificates freely.
  2. Changes - changes can occur rapidly. For example a DNS name may be re-purposed or a host might have been changed in production. Issuing a new certificate (knowing the vendor protocols) may be a long process.
  3. Learning about PKI and SSL certificates. Let's Encrypt is an invaluable tool for teaching security experts about the web of trust. There are also a couple of other functions such as OCSP and Certificate Transparency which we can learn about.
  4. As a CA, it's trusted by most modern desktop browsers (I have tested the latest versions at the time of writing of Internet Explorer, Firefox and Chrome)

Why Microsoft IIS?

  • There are quite a few client implementations for ACME (the protocol which enables the automation for Let's Encrypt). A list can be found here: https://letsencrypt.org/docs/client-options/
  • Open source Web Servers such as NGINX and Apache are fairly well covered while IIS is not.
  • IIS is still relevant! Info-graphic of the number of IIS sites is below.
  • There are a couple of good libraries however they do make some assumptions which if you are not aware of can trip you up.

Current State of Play:

We have a website which currently is being protected using a self signed certificate. This creates two challenges; browsers don't trust the site and this is not a good look. Anyone looking at the self signed certificate can deduce the hostname which is not ideal (this is internal information the public web doesn't need to know).

Tools we are going to need:

  • PowerShell
  • OpenSSL (I am using an older version but you should use the latest)
  • www.zerossl.com (a browser based ACME client).

Part 1: Establish an Identity and Create a CSR with ZeroSSL

In order to use Let's Encrypt we need to register an identity. The identity has two components; an email address which is optional but recommended for expiration notices etc and a RSA key for encryption and validation of commands. The RSA key is linked to ALL Lets Encrypt Activities (such as running requests, revocations and listing current certificates. This is a very important key!

As we are doing this the easy way we are not going to generate a key rather we are going to let ZeroSSL generate one for us. We are also going to let ZeroSSL create a CSR for us as well.

Click Next Twice and You Should Get a Screen that looks like this.

Click the Copy button for both the RSA key and the CSR and paste them into files on your local drive (you will need the key for other certificates and the CSR is useful if you need to reissue the certificate or if you have to run through the steps again). I have created a folder called lets LETSENCRYPT for this demonstration to store the information.

Lets have a quick look at both of these with OpenSSL to verify they are correct but also for learning.

openssl version (tells us OpenSSL is installed and is available via PATH)

openssl rsa -in <location of key> -noout -text


openssl req -text -noout -verify -in <location of csr>

Part 2: Domain Verification via HTTP ZeroSSL side

We are going to use HTTP verification. This is often the easiest way as if you have access to the web server you can perform this without too much hassle.

Click Next and you should see a screen like this.

The screen tells us that we need to do3 things.

  • Create a folder structure from the webroot in the format of webroot/.well-known/acme-challenge/
  • Create a file with the name in the file area.
  • Place Content into that file which is a string generated as part of the certificate request process.

NOTE:

  • The file name and content will vary between requests
  • The folder structure will remain the same (.well-known/acme-challenge/)
  • The file has no extension (more about why this can be a challenge later)

Part 3: Domain Verification via HTTP Windows Server Side

Generating rsa keys in java code. I am going to assume that you know how to find the web root folder from IIS sites. If not google is your friend.

Open PowerShell in the web root folder and type the items below. The reason I am using PowerShell is that the . in the .well-known causes issues if you try create a folder from within Windows Explorer. Creating a file with no extension is also problematic from within Windows Explorer.

mkdir .well-known/acme-challenge/

New-Item .<name of file from ZeroSSL> -type file

Paste the content from ZeroSSL into the file. The folder structure, file and content of the file should look something like the below. (remember: your filename and content will be different from this).


Part 4: Enable File MIME Type on IIS So File Can be accessed [IMPORTANT]

If we go back to ZeroSSL and click on the filename (a hyperlink to the file on the webserver) we will see the file cannot be served. This is very improtant because if the file is not able to be served the domain ownership cannot be verified and the SSL certificate cannot be issued.

This is because by default IIS does not know how to server files with no extension. This can be easily fixed by configuring MIME types at the SITE LEVEL.

Note: this could be a security risk so I recommend removing the . MIME type after validation step is complete.

  • File Extension Name: .
  • MIME TYPE: application/text

Click OK. This does not require a site restart. Go Back to ZeroSSL and click the link again. The File should now be served up.

Click Next if the file is able to be served up.

Part 5: Download Certificate and Certificate Private Key

Click Next and your certificate is ready. Make sure you download the certificate and the Certificate Private Key. You need both for the next step.

I usually rename or name the certificate file to .cer. Double click on the .cer file and DO NOT INSTALL. To verify various parameters.

Part 6: Create .PFX file from key and certificate [IMPORTANT]

Windows prefers .pfx format for certificates. We are going to create a .pfx file using OpenSSL.

NOTE: I always recommend putting a password on .pfx files as the private key and original certificate can be exported from these.

openssl pkcs12 -export -out <name of the .pfx file> -inkey <name of the private certificate key that you exported from ZeroSSL> -in <name of certificate that you exported from ZeroSSL>

If successful you should get a file created with the .pfx extension.

NOTE: more on the unable to write random state 'error' - http://stackoverflow.com/questions/12507277/how-to-fix-unable-to-write-random-state-in-openssl

Part 7: Install The Certificate and Reverse the MIME mapping

Installing Certificate - I will not cover this here as there are plenty of guides available on this step.

You will also need to tell IIS to start using the certificate through the bindings. Once again there are plenty of guides on how to do this.

Lastly remove Remove the MIME extension from the IIS site by simply deleting it.

If all is successful you should be able to browse to your site and verify the various comments (e.g. expiry, certificate issuer and certificate serial).


Summary:

  • Let's Encrypt is an awesome initiative which I believe will make PKI more trustworthy but also make better security engineers.
  • The CSR, Lets Encrypt Private Key, Certificate and Certificate Private key were all displayed for us using the ZeroSSL tool
  • We performed a fairly manual certificate verification step with IIS. There is method behind this madness. Before we automate things we should understand some of the challenges associated with them (for example the MIME extension got ya).
  • There are a few questions (for example is my private key stored - it's not) which need to be investigated.
  • There are a few limitation (for example we haven't filled in OU in the certificate or create a SAN entry) due to the fact that we are using a client which we do not have control over (we can't control how CSRs are generated).

Most of the questions I am planning to address in a 5 part series on Let's Encrypt. The Articles I am going to write are below.

Let's Encrypt Part 2 - Using Get HTTPS for Free! for a more complex process

Let's Encrypt Part 3 - Retrofitting Get HTTPS for Free! for Windows Systems

Let's Encrypt Part 4 - The ACME Protocol

Let's Encrypt Part 5 - ACMESharp Client Library and it's Capabilities/Limitations


On Windows, you can create SSH keys in many ways. This document explains how to use two SSH applications, PuTTY and Git Bash.

Joyent recommends RSA keys because the node-manta CLI programs work with RSA keys both locally and with the ssh agent. DSA keys will work only if the private key is on the same system as the CLI, and not password-protected.

PuTTY

PuTTY is an SSH client for Windows. You can use PuTTY to generate SSH keys. PuTTY is a free open-source terminal emulator that functions much like the Terminal application in macOS in a Windows environment. This section shows you how to manually generate and upload an SSH key when working with PuTTY in the Windows environment.

Generate csr windows 10

About PuTTY

PuTTY is an SSH client for Windows that you will use to generate your SSH keys. You can download PuTTY from www.chiark.greenend.org.uk.

When you install the PuTTY client, you also install the PuTTYgen utility. PuTTYgen is what you will use to generate your SSH key for a Windows VM.

This page gives you basic information about using PuTTY and PuTTYgen to log in to your provisioned machine. For more information on PuTTY, see the PuTTY documentation

Generating an SSH key

To generate an SSH key with PuTTYgen, follow these steps:

  1. Open the PuTTYgen program.
  2. For Type of key to generate, select SSH-2 RSA.
  3. Click the Generate button.
  4. Move your mouse in the area below the progress bar. When the progress bar is full, PuTTYgen generates your key pair.
  5. Type a passphrase in the Key passphrase field. Type the same passphrase in the Confirm passphrase field. You can use a key without a passphrase, but this is not recommended.
  6. Click the Save private key button to save the private key. You must save the private key. You will need it to connect to your machine.
  7. Right-click in the text field labeled Public key for pasting into OpenSSH authorized_keys file and choose Select All.
  8. Right-click again in the same text field and choose Copy.

Importing your SSH key

Now you must import the copied SSH key to the portal.

  1. After you copy the SSH key to the clipboard, return to your account page.
  2. Choose to Import Public Key and paste your SSH key into the Public Key field.
  3. In the Key Name field, provide a name for the key. Note: although providing a key name is optional, it is a best practice for ease of managing multiple SSH keys.
  4. Add the key. It will now appear in your table of keys under SSH.

PuTTY and OpenSSH use different formats of public SSH keys. If the text you pasted in the SSH Key starts with —— BEGIN SSH2 PUBLIC KEY, it is in the wrong format. Be sure to follow the instructions carefully. Your key should start with ssh-rsa AAAA….

Once you upload your SSH key to the portal, you can connect to your virtual machine from Windows through a PuTTY session.

Git Bash

The Git installation package comes with SSH. Using Git Bash, which is the Git command line tool, you can generate SSH key pairs. Git Bash has an SSH client that enables you to connect to and interact with Triton containers on Windows.

To install Git:

  1. (Download and initiate the Git installer](https://git-scm.com/download/win).
  2. When prompted, accept the default components by clicking Next.
  3. Choose the default text editor. If you have Notepad++ installed, select Notepad++ and click Next.
  4. Select to Use Git from the Windows Command Prompt and click Next.
  5. Select to Use OpenSSL library and click Next.
  6. Select to Checkout Windows-style, commit Unix-style line endings and click Next.
  7. Select to Use MinTTY (The default terminal of mYSYS2) and click Next.
  8. Accept the default extra option configuration by clicking Install.

When the installation completes, you may need to restart Windows.

Launching GitBash

Easy Way To Generate Key And Csr Windows 6

To open Git Bash, we recommend launching the application from the Windows command prompt:

  1. In Windows, press Start+R to launch the Run dialog.
  2. Type C:Program FilesGitbinbash.exe and press Enter.

Generating SSH keys

Easy Way To Generate Key And Csr Windows 1

First, create the SSH directory and then generate the SSH key pair.

One assumption is that the Windows profile you are using is set up with administrative privileges. Given this, you will be creating the SSH directory at the root of your profile, for example:

  1. At the Git Bash command line, change into your root directory and type.
  1. Change into the .ssh directory C:Usersjoetest.ssh

  2. To create the keys, type:

Generate Key Code

  1. When prompted for a password, type apassword to complete the process. When finished, the output looks similar to:

Uploading an SSH key

To upload the public SSH key to your Triton account:

Easy Way To Generate Key And Csr Windows 5

  1. Open Triton Service portal, select Account to open the Account Summary page.
  2. From the SSH section, select Import Public Key.
  3. Enter a Key Name. Although naming a key is optional, labels are a best practice for managing multiple SSH keys.
  4. Add your public SSH key.

When Triton finishes the adding or uploading process, the public SSH key appears in the list of SSH keys.

What are my next steps?

Easy Way To Generate Key And Csr Windows 7

  • Adding SSH keys to agent.
  • Set up the Triton CLI and CloudAPI on Windows.
  • Set up the Triton CLI and CloudAPI.
  • Create an instance in the Triton Service Portal.
  • Set up the triton-docker command line tool.
  • Visit PuTTYgen to learn more about the PuTTYgen and to seethe complete installation and usage guide.