Skip to content

Example of creating a self-signed certificate for the server and clients

License

Notifications You must be signed in to change notification settings

mrt1m/self-signed-certificate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Example of a self-signed certificate

In this repository, I suggest looking at options for working with self-signed certificates. If you find any errors or want to suggest an improvement, please, make an issue in a current repository

Requirements

  • Docker version 25.0.5

Quick guide

  1. Copy env and build openssl image

    cp .env.example .env
    make openssl-build-image
  2. Create root certificate chain, server certificate, user certificates and configuration for nginx

    make step-create_all_certs-and-nginx_configs step-run_nginx

    screenshot of the result of creating a certificate chain

  3. Run tests to check HTTPS and connections with the client certificate

    make step-run_tests

    screenshot of the result of tests

  4. Check links in browser

  1. Import intermediate CA

    macOS
    make import-macos-ca CA_NAME=intermediate.level_2.root.ca
  2. Check links in browser

  1. Import client certificates

    macOS
    make import-macos-client CA_NAME=intermediate.level_2.root.ca CLIENT_EMAIL=user_1@lol.kek
    make import-macos-client CA_NAME=intermediate.level_2.root.ca CLIENT_EMAIL=user_2@lol.kek
  2. Re-enter the OS profile so that the system selects user certificates

  3. Run nginx

    make step-run_nginx
  4. Check links in browser incognito mode

Important

Remember, if you want to change the user certificate, you need to restart the browser

screenshot of selecting a user certificate

  1. Now in the OS settings we will see the following certificates

    macOS
    1. open keychain
      screenshot of keychain icon
    2. certificates
      screenshot of certificates screenshot of ca certificate screenshot of clients certificates
    3. keychains
      screenshot of keychains

Task lists

  • Add import commands for Windows and Linux
  • Add documentation
  • Add openssl OCSP example