Sign inSign up

pgarrett/openssl-alpine

By pgarrett

•Updated over 8 years ago

OpenSSL Alpine

Image
3

10K+

pgarrett/openssl-alpine repository overview

⁠OpenSSL Alpine

Docker image based on Alpine Linux that uses OpenSSL to generate a three tier x509 certificate chain.

x509 is a standard for a public key infrastructure (PKI) to manage digital certificates, public-key encryption and a key part of the Transport Layer Security (TLS) protocol used to secure web and email communication.

⁠Customisation

The image comes with default values, but they can be overridden using the following environment variables when running a docker container to customise the generated certificates:

VARIABLEDESCRIPTIONDEFAULT
COUNTYCertificate subject country stringUK
STATECertificate subject state stringGreater London
LOCATIONCertificate subject location stringLondon
ORGANISATIONCertificate subject organisation stringExample
ROOT_CNRoot certificate common nameRoot
ISSUER_CNIntermediate issuer certificate common nameExample Ltd
PUBLIC_CNPublic certificate common name*.example.com
ROOT_NAMERoot certificate filenameroot
ISSUER_NAMEIntermediate issuer certificate filenameexample
PUBLIC_NAMEPublic certificate filenamepublic
RSA_KEY_NUMBITSThe size of the rsa keys to generate in bits2048
DAYSThe number of days to certify the certificates for365
KEYSTORE_NAMEKeystore filenamekeystore
KEYSTORE_PASSKeystore passwordchangeit

For example, to run a container, customise variables and mount the certificates in a volume:

docker run --rm \
  -e COUNTY="ME" \
  -e STATE="Middle Earth" \
  -e LOCATION="The Shire" \
  -e ORGANISATION="Hobbit" \
  -e ISSUER_CN="J R R Tolkien" \
  -e PUBLIC_CN="hobbit.com" \
  -e ISSUER_NAME="tolkien" \
  -e PUBLIC_NAME="hobbit" \
  -v hobbit:/etc/ssl/certs \
  pgarrett/openssl-alpine

List the generated certificates:

ls -la /var/lib/docker/volumes/hobbit/_data

View the public certificate details:

openssl x509 -in /var/lib/docker/volumes/hobbit/_data/hobbit.crt -text -noout

Tag summary

Content type

Image

Digest

Size

3.4 MB

Last updated

over 8 years ago

docker pull pgarrett/openssl-alpine