Self-Signed Certs in One Command

As security becomes more critical to web based applications the need to test and develop locally with SSL is good practice. Outside of spending mountains of money generating local test environment official SSL Certificates, we can create what is called a ‘Self-Signed’ Certificate.

There are plenty of articles out there that walk through steps to creating a self-signed certificate, some more detailed than others. This post aims to serve two purposes. First, to provide me a future (easy to find) reference point. Secondly, provide helpful information to the fewest number of steps required for creating a self-signed certificate.

Sitecore Fundamentals Install

As a Sitecore developer first (and most of my current teams are Sitecore related) the usage of the Sitecore Fundamentals Install framework will already be on their machine. For those not into Sitecore development, the following additional quick steps will need to be ran.

Setup PowerShell to interact with the Sitecore MyGet feed

  1. Open a PowerShell command prompt, ensure you are running it as Admin
  2. Register the connection to MyGet feed, at the prompt enter
    Register-PSRepository -Name SitecoreGallery -SourceLocation https://sitecore.myget.org/f/sc-powershell/api/v2

    Sitecore Fundamentals - Register Sitecore Gallery

  3. Install the Sitecore Fundamentals module, at the prompt enter
    Install-Module SitecoreFundamentals
  4. PowerShell will ask if untrusted scripts can be ran, enter ‘A‘ and hit Enter.Sitecore Fundamentals -  Accept Untrusted Scripts
  5. Before performing any other steps, and each time before you use the module, you will want to perform a check and update of the module via
    Update-Module SitecoreFundamentals
  6. Confirming everything installed correctly is as easy as running the following command, at time of writing the current version is 1.1.0
    Get-Module SitecoreFundamentals -ListAvailable

    Sitecore Fundamentals - Available Versions

Setup SSL

  1. Ensure your site exists in IIS
  2. Open a PowerShell command prompt, ensure you are running it as Admin
  3. Run the following at the prompt
    Import-Module SitecoreFundamentals
  4. Run the following at the prompt, this will create the self-signed certificate and assign it to your site
    Add-WebFeatureSSL -HostName "ENTER THE HOSTNAME FOR SITE" -RootDnsName "DO_NOT_TRUST_TheCodeAttic"
  5. Enjoy developing securely!!!
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.