This is an image for running your own EJBCA PKI server.
Follow the steps below to set up the container. These instructions assume you have chosen /opt/docker/ejbca as a base folder for storing settings and data. If you choose a different path, please update the path in the commands below accordingly.
host# mkdir -p /opt/docker/ejbca/{mysql,data}host# docker-compose pull ejbcahost# docker-compose up ejbcaIn the future, you can update the container by simply re-running docker-compose pull ejbca followed by docker-compose up --force-recreate ejbca. These commands will automatically pull the latest version of the image(s) from the registry and replace it without affecting your data or configurations.
Below is a sample docker-compose.yml file for your reference:
#
# Sample configuration for 'ejbca' container
#
version: "3"
services:
mariadb:
container_name: mariadb
image: dataknightllc/mariadb:stable
volumes:
- /opt/docker/mariadb/rsyslog:/etc/rsyslog/conf.d
- /opt/docker/mariadb/data:/var/lib/mysql
ports:
- 3306:3306
environment:
TZ: ${TZ:-UTC}
SECRETS_FOLDER: /run/secrets
ejbca:
container_name: ejbca
image: dataknightllc/ejbca:stable
volumes:
- /opt/docker/ejbca/syslog-ng:/etc/syslog-ng/conf.d
- /opt/docker/ejbca/mysql:/var/lib/mysql
- /opt/docker/ejbca/data:/var/lib/ejbca
ports:
- 8080:8080
- 8442:8442
- 8443:8443
environment:
TZ: ${TZ:-UTC}
Once you have configured the container per the instructions above, you simply need to backup the /opt/docker/ejbca folder and subfolders to save your configuration and data.
This container image is configured so that the first time you boot it, it will automatically initialize a new Certificate Authority and database for you with little to no intervention. Please be aware that the first boot of the container may take some time (~5 minutes or so) in order to initialize the MySQL database and Wildfly server for running EJBCA.
You may notice several folders such as /var/lib/mysql/.init and /var/lib/ejbca/.init that are created automatically during first boot. You should not touch these folders or files. They are used for keeping initialization state for your container between reboots and upgrades or container rebuilds. Likewise, once the initial boot has been performed, you should not alter the values or settings in the /var/lib/mysql/.vault and /var/lib/ejbca/.vault files unless otherwise noted.
If you wish to use the default settings, you do not have to do anything other than set up the container as described in the steps above. A default certificate authority called Root Certificate Authority will be created and initialized for you automatically during first boot.
If you wish to customize settings for the initialization, you may do so by following the instructions below. Any files created below should be owned by the root user and set to mode 0600. Settings for .properties files described below are assigned values each on a single line using setting=value syntax. If the value of any setting contains spaces, be sure to wrap it in double quote (") marks. If you choose to create a file, it must contain all of the settings specified.
NOTE: If you choose to supply your own password for any of the settings listed below, it must be a minimum of 6 characters long.
MySQL User Customization If you wish to set your own password for the root and/or ejbca user, simply create a new file corresponding to the username in the /var/lib/mysql/.vault folder. The file should only contain the password and nothing else.
Certificate Authority Customization If you wish to customize the CA that is created during first boot, create a new file called ca.properties inside the /var/lib/ejbca/.vault folder.
Java Customization If you wish to customize Java settings used during first boot, create a new file called java.properties inside the /var/lib/ejbca/.vault folder.
SuperAdmin Customization If you wish to customize settings used to create the super administrator account during first boot, create a new file called superadmin.properties inside the /var/lib/ejbca/.vault folder.
HTTPS Server Customization If you wish to customize settings used for the SSL certificate for the Wildfly web server generated during first boot, create a new file called httpsserver.properties inside the /var/lib/ejbca/.vault folder.
SMTP Server Customization If you wish to customize settings used for sending email from EJBCA, create a new file called smtpserver.properties inside the /var/lib/ejbca/.vault folder.
Once the server is up and running, you'll want to connect to the Web UI and login as the administrator.
After the initial boot of the container, you will need to activate the certificate authority for use. You'll need to log into the Web UI and perform the steps that follow.
Note that afterwards you may want to turn on auto-activation by clicking on the link for the CA and going into edit mode and making the change.
...TO BE DOCUMENTED...
If you wish to update the SSL certificate used by the Wildfly front-end web server because it has expired or if you wish to change its properties or use a different CA to sign the certificate, you'll need to perform the steps that follow.
Using the EJBCA Certificate Authority Follow the steps below to generate a new certificate using the EJBCA Certificate Authority you created.
/opt/ejbca/bin/ejbca.sh batchkeytool -changealias -keystore /var/lib/ejbca/p12/tomcat.jks -alias _CertCN_ -destalias ejbca
(Be sure to change CertCN to the actual CN you specified for the certificate!)cp /var/lib/ejbca/wildfly/keystore/keystore.jks /var/lib/ejbca/wildfly/keystore/keystore.jks.bakcp /var/lib/ejbca/p12/tomcat.jks /var/lib/ejbca/wildfly/keystore/keystore.jkschown wildfly:wildfly /var/lib/ejbca/wildfly/keystore/keystore.jks*/opt/wildfly/bin/jboss-cli.sh -c --command=":shutdown(restart=true)"Using a 3rd Party Certificate Authority Follow the steps below to generate a new certificate using a 3rd party CA such as Verisign, Comodo, Thawte, etc.
keytool -genkey -alias ejbca -keyalg RSA -keysize 2048 -keystore /tmp/keystore.jkskeytool -certreq -alias ejbca -keyalg RSA -file /tmp/request.csr -keystore /tmp/keystore.jkskeytool -import -trustcacerts -alias ejbca -file /tmp/cert.p7b -keystore /tmp/keystore.jkscp /var/lib/ejbca/wildfly/keystore/keystore.jks /var/lib/ejbca/wildfly/keystore/keystore.jks.bakcp /tmp/keystore.jks /var/lib/ejbca/wildfly/keystore/keystore.jkschown wildfly:wildfly /var/lib/ejbca/wildfly/keystore/keystore.jks*/opt/wildfly/bin/jboss-cli.sh -c --command=":shutdown(restart=true)"Importing an Existing SSL Key Pair ...TO BE DOCUMENTED...
If you encounter any issues with Wildfly not restarting, simply copy the keystore.jks.bak file back to keystore.jks and issue the restart command to jboss-cli.sh.
If you have issues, be sure to check the log files in the /var/log folder for details. The majority of information will be stored in the wildfly.log file.
If you have questions, find bugs or need additional help, please send an email to [email protected].
Content type
Image
Digest
Size
638.1 MB
Last updated
over 8 years ago
docker pull sean666888/docker-ejbca-image