Installing EJBCA

Installing EJBCA

What made me want to install EJBCA?

When I setup 802.11x (RADIUS/Enterprise Wi-Fi) for my home network, I was asked, do you trust this certificate, and then I thought, can I personalise this certificate? So I did exactly that, but then I thought, why shouldn't I setup my own CA (Certificate Authority)? First, I looked at my services, does one of them support managing a CA? Then I found ADCS (Windows Server), and I tried setting it up, to no avail. So eventually I scoured the internet, and found this article: https://arminreiter.com/2022/01/create-your-own-certificate-authority-ca-using-openssl/, but it was using the command line, I mean, I am comfortable using it, but I just wanted something simple, from my browser. So I asked ChatGPT, and after looking at the possibilities, websites, and ways to set it up, I eventually chose EJBCA.

Installing EJBCA

I'm going to use Docker, so if you want to use another way of installing it, you may need to skip a bit.

💡
In this tutorial, I'll use Ubuntu Server 22.04. There may be some things that won't work depending on your chosen distro.

Prerequisites

  • Docker engine
  • Docker compose v2

Creating the directory and file

First, cd to the directory you want the EJBCA files to be in. In my case it's my home directory, ~. Use the following command to cd there.

$ cd ~/

Now, let's create and cd into the directory using

$ mkdir ejbca/ && cd ejbca/

After that, create a compose file using

$ nano compose.yml

With the following text, you can edit it to your needs.

version: '3'

services:
  ejbca:
    image: primekey/ejbca-ce:latest
    container_name: ejbca
    environment:
      - DB_HOST=db
      - DB_DATABASE=ejbca
      - DB_USERNAME=ejbca
      - DB_PASSWORD= # Change this to a secure password
    ports:
      - "8080:8080"
      - "8443:8443"
    depends_on:
      - db

  db:
    image: mysql:5.7
    container_name: ejbca_db
    environment:
      MYSQL_ROOT_PASSWORD: # Change this to another secure password
      MYSQL_DATABASE: ejbca
      MYSQL_USER: ejbca
      MYSQL_PASSWORD: # Change this to the first password
    volumes:
      - db_data:/var/lib/mysql

volumes:
  db_data:

Starting and accessing the container

Now, Start the container using

$ sudo docker compose up

When you come across this block of text, you are ready to browse to https://yourIP:8443/ejbca/adminweb/

That finishes this installation of EJBCA. Thanks for reading!