LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Containers
User Name
Password
Linux - Containers This forum is for the discussion of all topics relating to Linux containers. Docker, LXC, LXD, runC, containerd, CoreOS, Kubernetes, Mesos, rkt, and all other Linux container platforms are welcome.

Notices


Reply
  Search this Thread
Old 11-14-2023, 12:05 AM   #1
kzo81
Member
 
Registered: Aug 2014
Location: Hungary
Distribution: Debian, Linux Mint, CentOS
Posts: 197

Rep: Reputation: Disabled
Certificate generator with docker-compose


Hi Folks,

I got this minimal setup for a reverse proxy, but for some reason it only runs on local machine, however there is still an error.

Do you have any idea?

Code:
# docker-compose.yml
version: "3.5"

services:
  certificate_generator:
    container_name: certificate_generator
    image: docker.io/maptiler/tileserver-gl:latest
    entrypoint: bash
    command: /tmp/certgen.sh
    working_dir: /tmp/certs/
    volumes:
      - ./certgen.sh:/tmp/certgen.sh:ro
      - ./certs:/tmp/certs/
    restart: "no"
Code:
#generate-certificates.sh
KEY="mapserver.key"
CRT="mapserver.crt"
DAYS=365
STATE="Hungary"
CITY="Budapest"
CN="mapserver01.local.lan"

if [ ! -f "$CRT" -o ! -f "$KEY" ]; then
  openssl rand -writerand .rnd
  openssl req -x509 -rand .rnd -nodes -newkey "rsa:2048" \
    -days $DAYS \
    -subj "/C=HU/ST=$STATE/L=$CITY/O=MapTiler/OU=Development/CN=$CN" \
    -keyout "$KEY" \
    -out "$CRT"
  rm -f .rnd
fi
exit 0

Output:

Code:
Creating gen_certs ... done
Attaching to gen_certs
gen_certs    | Can't load /root/.rnd into RNG
gen_certs    | 140707024888256:error:2406F079:random number generator:RAND_load_file:Cannot open file:../crypto/rand/randfile.c:88:Filename=/root/.rnd
gen_certs    | Generating a RSA private key
gen_certs    | .+++++
gen_certs    | ...........+++++
gen_certs    | writing new private key to 'mapserver.key'
gen_certs    | -----
gen_certs exited with code 0
On the target host:
Code:
docker-compose up
WARNING: Found orphan containers (nginx) for this project. If you removed or renamed this service in your compose file, you can run this command with the --remove-orphans flag to clean it up.
Starting certificate_generator ... done
Attaching to certificate_generator
certificate_generator    | Cannot write random bytes:
certificate_generator    | 139930728330560:error:24070079:random number generator:RAND_write_file:Cannot open file:../crypto/rand/randfile.c:233:Filename=.rnd
certificate_generator    | Can't load .rnd into RNG
certificate_generator    | 140626904618304:error:2406F079:random number generator:RAND_load_file:Cannot open file:../crypto/rand/randfile.c:98:Filename=.rnd

Last edited by kzo81; 11-14-2023 at 03:58 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Deprecated Linux commands, Podman Compose vs. Docker Compose, and more sysadmin tips LXer Syndicated Linux News 0 07-05-2022 08:14 AM
LXer: Podman Compose or Docker Compose: Which should you use in Podman? LXer Syndicated Linux News 0 06-18-2022 04:48 PM
LXer: Setup Ruby on Rails Development environment with Docker and Docker Compose on Ubuntu LXer Syndicated Linux News 0 05-22-2019 10:42 PM
LXer: Docker Engine 1.6 Debuts Alongside Docker Registry 2.0 and Compose 1.2.0 LXer Syndicated Linux News 0 04-17-2015 09:02 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Containers

All times are GMT -5. The time now is 12:21 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration