- Server Generate Secure Private Key And Certificate Download
- Server Generate Secure Private Key And Certificate Online
- Private Key Definition
- Public Private Key Encryption
- How To Generate A Certificate
- Inventory & Help Desk
Applies to: On-Prem Help Desk, Inventory
Spiceworks comes packaged with a self-signed SSL certificate that is automatically setup and usable after install. This certificateallows for https connections, but has not been signed by a public (trusted root) certificate authority. While this is fine for most folks, you may want to add a signed SSL certificate obtained from a public/trusted root Certificate Authority (CA).
An SSL Certificate is a public key verified and signed by a Certificate Authority. You generate a public/private key pair, then from that generate a Certificate Signing Request (which includes the public key), which you send to the CA. It then signs that public key included in the CSR producing the certificate which it sends. We provide here detailed instructions on how to create a private key and self-signed certificate valid for 365 days. Follow this article if you need to generate a private key and a self-signed certificate, such as to secure GSX Gizmo access using HTTPS.
This article serves as a step-by-step guide - a fairly simple process for creating and configuring Spiceworks to use your SSL certificate.
- Symptoms
- Prepare the server
- Backup existing certificate and httpd.conf
- Install OpenSSL
- Get the cert(s)
- Generate a private key
- Fill out CSR info
- Send your CSR to your CA
- Download your certificate
- Download the intermediate certificate
- Install the cert(s)
- Copy your certificate(s) and primary key to Spiceworks
- Edit the http.conf file
- Finish things up
- Start Spiceworks
- Create another backup
Symptoms
Admins and end users connecting via https to your local Spiceworks installation see a security error like:
not secure
Your connection is not secure
There is a problem with this website’s security certificate.
in their browser.
Prepare the server
Backup existing certificate and httpd.conf
It’s always a good idea to back up config files, right? The same is true when working with the httpd.conf file from your Spiceworks installation. Also, you’ll want to keep backup copies of the current SSL certs in case things go sideways.
To start, head over to
C:Program Files (x86)Spiceworkshttpdconf
and copy the httpd.conf
file to a safe location (Desktop, Documents, etc.). Note: Your installation path may be different.Next, head to the
Spiceworkshttpdssl
folder and do the same for the ssl-cert.pem
and ssl-private-key.pem
files.Install OpenSSL
Next, we’ll need to install OpenSSL. Why? OpenSSL provides a straightforward way to generate a private key and a certificate signingrequest (CSR).
Nowadays, openssl.org doesn’t provide a Windows installer directly, but they do list a few places here:https://wiki.openssl.org/index.php/Binaries.
After you’ve installed OpenSSL you may need to set an environment variable within Windows. To do that, run the following in a command prompt:
(where
C:OpenSSL-Win32
is the installation directory of OpenSSL).Get the cert(s)
Generate a private key
Now it’s time to generate a private key.
First, bring up an elevated (administrator) command prompt and run the following command:
2048-bit RSA keys are most common, but you may want to check with the CA you’ve chosen.
One important thing to note is the
-nodes
parameter. This means “no DES encryption.” Why? Apache on Windows requires an unencrypted private key. Using DES will bork this process.Your private key will likely be in the
C:OpenSSL
directory or in the C:OpenSSL-Win32
directory.Fill out CSR info
Once the private key has been generated, you’ll be asked to fill out a bit of info. This is for the CSR you’ll be sending to your CA.
If you’re not sure what to enter for these prompts, you’ll want to contact your CA.
NOTE: The common name MUST be the fully qualified domain name (FQDN) of the Spiceworks host. For example:
helpdesk.mydomain.com
Your CSR file will likely be created in the
C:OpenSSL
directory or in the C:OpenSSL-Win32
directory.Send your CSR to your CA
You’ll need to send your CSR to your CA. Normally, you do this via your CA’s web portal but that can vary based on your CA. As with the other steps, ask your CA if you’re in doubt.
When you upload/send the CSR to your CA, specify that you’ll be using the cert with an Apache web server.
Download your certificate
Server Generate Secure Private Key And Certificate Download
Your CA should send your certificate to the email address you specified when creating your CSR. You should also be able to download the cert from your CA’s web portal. Generate a key for csr.
If you’re downloading the certificate from your CA’s web portal, you’ll likely have a number of different download options. In most cases, you’ll want to choose the Apache option. Don’t see an option to download for Apache? Check with your CA!
Download the intermediate certificate
Some CA’s require an intermediate certificate in addition to the primary SSL certificate. It’s always a good idea to check with your CA on whether you need to do this step.
Most likely, you’ll download the intermediate certificate along with your primary SSL certificate (if you downloaded it via your CA’s web portal).
Again, if you’re not sure about this step contact your CA. Not knowing whether you need an intermediate certificate or not can cause a lot of frustration in the next few steps.
Install the cert(s)
Copy your certificate(s) and primary key to Spiceworks
Depending on your CA, you may have one or two certificates to drop into place.
Note: At this point you’ll need to shutdown Spiceworks and keep it offline until the you’re finished with the entire process.
If your CA doesn’t require an intermediate certificate, you’ll want to copy your SSL certificate to the
C:Program Files (x86)Spiceworkshttpdssl
folder. Then, rename the certificate to ssl-cert.pem
.If your CA requires an intermediate certificate as well, follow the step mentioned above and then copy your intermediate certificate to the
C:Program Files (x86)Spiceworkshttpdssl
directory and rename it to ssl-intermediate.pem
.Note: This is probably the single-most confusing part of the process. If you don’t know which certificate is the primary and which is the intermediate, contact your CA. They’ll be able to tell you and it will save you the headache of trial and error.
Finally, copy your private key over to the
C:Program Files (x86)Spiceworkshttpdssl
folder and rename it to ssl-private-key.pem
.Edit the http.conf file
Skip this step if you don’t have an intermediate certificate.
Head over to
C:Program Files (x86)Spiceworkshttpdconf
and open the httpd.conf
file.Toward the bottom of the file, you’ll see the following lines:
We’ll want to add the following line just before the </VirtualHost> line:SSLCertificateChainFile “ssl/ssl-intermediate.pem”
So, when you’re finished, you should have:
Now, save the
httpd.conf
file.Finish things up
Start Spiceworks
Now, all you need to do is start Spiceworks. If the app won’t start, shutdown Spiceworks, restore the original certificate filesand httpd.conf file to get back online with the original cert, and read back through the steps and see if you missed anything.
Most often, problems stem from renaming the incorrect files. For example, you may have renamed the primary certificate to
ssl-intermediate
instead of ssl-certificate
by accident.If the app starts, you’re good to go. Confirm you see a “secure lock icon” in your browser when accessing Spiceworks via https.
Create another backup
When updating Spiceworks in the future, it will be necessary to drop in the certificate files and
httpd.conf
file in place again.To avoid headaches, go ahead and create a backup of the
httpd
folder and save it someplace outside of the Spiceworks installation directory.Then, during the next Spiceworks update you can just drop a backup of the
httpd
folder back into place.Documentation and Resources
Below are a few links that may help out while working with some common SSL certificate providers:
Feedback form placeholder | Delete this region to remove feedback form from page.
Finding your Private Key on Different Servers or Control Panels
Linux-Based (Apache, Nginx, LightHttpd)
Windows Operating Systems
Mac OS X
Tomcat
cPanel
WHM
Plesk
Synology NAS DSM
Webmin
VestaCP
DirectAdmin
Webuzo
Linux-Based (Apache, Nginx, LightHttpd)
Windows Operating Systems
Mac OS X
Tomcat
cPanel
WHM
Plesk
Synology NAS DSM
Webmin
VestaCP
DirectAdmin
Webuzo
What Is a Private Key?
What Is a Private Key?
You’ve received your SSL Certificate, and now you need to install it.
Firstly, let’s go through some basics. Public Key Infrastructure (PKI) security is about using two unique keys: the Public Key is encrypted within your SSL Certificate, while the Private Key is generated on your server and kept secret.
All the information sent from a browser to a website server is encrypted with the Public Key, and gets decrypted on the server side with the Private Key. Together the key pair keeps communication secured, and one key will not work without the other.
How do I get it?
The Private Key is generated with your Certificate Signing Request (CSR). The CSR is submitted to the Certificate Authority right after you activate your Certificate. The Private Key must be kept safe and secret on your server or device, because later you’ll need it for Certificate installation.
Note: all Certificates except Multi-Domains support Private Key generation in your browser. The key is always saved during SSL activation, we never receive this information. That’s why it’s important you save and back it up during the process if you use the in-browser automatic generation method. If the Private Key key file is lost, you’ll need to reissue your Certificate.
Can I generate a new Private Key for my Certificate if I lose the old one?
Yes. You can generate a new private key and CSR, or use the automatic CSR and key generation during Certificate reissue (this option is available for all Certificates except for the Multi-Domains).
What does the Private Key look like?
It looks like a block of encoded data, starting and ending with headers, such as —–BEGIN RSA PRIVATE KEY—– and —–END RSA PRIVATE KEY—–.
You may not get to see this code when generating your CSR. Usually, it gets generated in the background with the CSR, and is automatically saved on your server. The system also fills the corresponding field automatically during installation of your Certificate in some control panels, such as cPanel.
The way this works varies depending on your web server, control panel, or any other tools used for CSR generation. Select the one that applies to you in the following section for specific guidance.
Finding your Private Key on Different Servers or Control Panels
Linux-based (Apache, NGINX, LightHttpd)
Normally, the CSR/RSA Private Key pairs on Linux-based operating systems are generated using the OpenSSL cryptographic engine, and saved as files with “.key” or “.pem” extensions on the server.
But no specific extensions are mandatory for text files in Linux, so the key file may have any name and extension, or no extension at all.
If you remember the whole name of the key file or at least part of it, you can use the following command in your console to find the file and its directory:
The slash symbol in this command implies that the search begins from the root directory of the server. This way you have more file options to view. The name of the file in between the single quotation marks should be the part of the name that you remember. To search for the file by extension, enter “*.key” to view all the files with the “.key” extension on your server.
Tip: often the name of the file corresponds to the domain name it was generated for e.g. “domain_tld.key” or “domain.tld.pem”.
Here’s another useful command that lets you search files by their content:
This command will return the absolute path to the Private Key file if it’s located on your server.
Windows Operating Systems (IIS, Exchange, Small Business server)
Windows servers don’t let you view the Private Key in plain text format. When you import your Certificate via MMC or IIS, the Private Key is bound to it automatically if the CSR/Key pair has been generated on the same server.
If you need to obtain the Private Key to install your Certificate on a different server, you can export the key in a password protected PFX (PKCS#12) file. To do that, open the MMC Certificates snap-in tools following these steps:
Win+R >> mmc.exe >> OK >> File >> Add/Remove Snap-in >> Certificates >> Add >> Computer account >> Next >> Local computer >> Finish >> OK
Next, go to Certificate Enrollment Requests >> Certificates (if you haven’t completed the Certificate request yet). If you’ve done that, you’d select Personal >> Certificates, then right-click the Certificate >> select All Tasks >> Export. The Export wizard will open, and give you instructions. You can find more detailed instructions here.
Once that’s done, you will see the .pfx file containing your Certificate, CA-Bundle, and Private Key. To extract the key, use this tool. Choose the PKCS12 to PEM option, then upload the file and enter your chosen password.
Mac OS X
The Keychain tool in the Server application of Mac OS X won’t allow you to access the Private Key via the graphic user interface. Instead use the Terminal, by opening /etc/certificates/ directory and clicking the file.
Its name should be something like “*.key.pem”. And the terminal commands to open the file are: cd /etc/certificates/ , then ls , and sudo nano test.key.pem. https://intensivepotent331.weebly.com/git-bash-generate-ssh-key-windows-pub.html.
Note: to check if the Private Key matches your Certificate, go here. Then paste the Certificate and the Private Key text codes into the required fields and click Match.
Tomcat
If your Tomcat SSL connector is configured in JSSE style, the Private Key must be in a password-protected keystore file with a .jks or .keystore extension. This file, unlike most other cases, is created before the CSR. To extract the Private Key, you’ll need to convert the keystore into a PFX file with the following command:
Tips:
- “Keystore.jks” should be replaced with your actual keystore name,
- “keystore.p12” will be the name of the PKCS12 file you will receive,
- <jkskeyalias>, <jkspassword> and <keypassword> are the alias (key and keystore passwords that were entered during keystore generation),
- <jkskeyalias>, <jkspassword> and <keypassword> should be replaced with your JKS file alias, its password, and Private Key password.
- <newp12password> and <newkeypassword> should be replaced with the passwords you set for your new PKCS12 file and the Private Key.
Server Generate Secure Private Key And Certificate Online
After the PKCS12 file is generated, you can convert it to a PEM file with separated CRT, CA-Bundle and KEY files using this tool. Alternatively, use the following command in the terminal:
“Private.key” can be replaced with any key file title you like.
cPanel
- SSL/TLS Manager
a) The simplest way to get the appropriate key used during SSL installation is reflected in the below picture:
b) Alternatively, you can find the Private key in the Private keys section of the SSL/TLS Manager, which can be located in the cPanel main menu. You will see all the Private Keys ever generated in your cPanel. To view the code of the key, click View & Edit. If there are several keys in that menu, you can copy each of them to find a match with your Certificate code by using this tool. - File manager
On the homepage of your cPanel, click File manager. Find the folder named “ssl” in the folder tree to the left (see screenshot). That folder will contain another folder named “keys”. This key folder also contains all the keys ever generated in your cPanel.
WHM
WHM stores your private keys and CSR codes in the SSL Storage Manager menu. On the homepage, click SSL/TLS >> SSL Storage Manager. To view the Private Key, click the magnifier icon next to the relevant key in the Key column.
Plesk
Click Domains >> your domain >> SSL/TLS Certificates. You’ll see a page like the one shown below. The key icon with the message “Private key part supplied” means there is a matching key on your server.
To get it in plain text format, click the name and scroll down the page until you see the key code. Alternatively, click the green arrow icon on the right. This will download a PEM file, containing your Private Key, Certificate and CA-Bundle files (if they were previously imported to the server). The files can be opened in any text editor, such as Notepad.
Synology NAS DSM
When generating a CSR in Synology DSM, the Private Key is provided to you in a zip file on the last step. The key code is contained within a server.key file, that can be opened with a text editor, such as Notepad.
Webmin
Webmin works as a graphic user interface (GUI) on top of the command-line interface. There is also a file manager called Filemin, that you can use to browse the server file system and find your Private Key file. Alternatively, go to Others >> Command Shell and run the find or grep command, which you can find in the Linux Operating Systems section above.
VestaCP
Your Private Key needs to be saved during CSR generation, as it will not be available via the graphic user interface.
That said, you may be able to retrieve your Private Key via SSH. It is saved as a temporary file in the “/tmp” folder. The path to the file will look something like this: “/tmp/tmp.npAnkmWFcu/domain.com.key”.
Note: the files in the /tmp directory are deleted every time your server is rebooted, so this is not a safe place to store your Private Key.
Private Key Definition
To get the path to your key file, use this Linux command:
Where you see “domain.com”, replace this with the actual domain name you generated the CSR for.
The path to your key file can also be found using the grep command:
DirectAdmin
In the up-to-date version of DirectAdmin, your Private Key is saved on the server. Access it in the “Paste a pre-generated Certificate and key” field during installation.
If that section is empty, it may mean the CSR and key were generated elsewhere, or the key was not saved in DirectAdmin due to a glitch. If a glitch happened, try retrieving the key via SSH. Usually it is saved in this directory:
/usr/local/directadmin/data/users/<user>/domains/<domain>.key
Note: <user> and <domain> are your DirectAdmin details.
Webuzo
Public Private Key Encryption
On the homepage, find the SSL management section by clicking the Private Keys button. This will display a list of all the Private Keys generated in Webuzo. To see the key code, click the pencil icon to the right under the Option column, as shown in the screenshot below:
How To Generate A Certificate
To sum up, ways to find your private key fully depend on the interface of the web server where you generate the CSR. If the methods described above did not help you find the private key for your certificate, the only solution would be to generate a new CSR/private key pair and reissue your certificate and to make sure that the key is saved on your server/local computer this time.