cesanta / docker_auth

Authentication server for Docker Registry 2
Apache License 2.0
1.28k stars 305 forks source link

Failing to parse private key #353

Open SeanOMik opened 2 years ago

SeanOMik commented 2 years ago

I'm getting an error when I try to start a docker_auth docker container:

Failed to load config: failed to load server cert and key: tls: failed to parse private key

This is my docker_auth configuration:

server:
  addr: ":5001"
  certificate: "/cert/cert.pem"
  key: "/cert/key.pem"

token:
  issuer: "Acme auth server"  # Must match issuer in the Registry config.
  expiration: 900

users:
  # Password is specified as a BCrypt hash. Use `htpasswd -nB USERNAME` to generate.
  "seanomik":
    password: "REDACTED"

acl:
  - match: {account: "seanomik"}
    actions: ["*"]
    comment: "Has full access to everything."
  - match: {account: "/.+/"}
    actions: ["push", "pull"]
    comment: "Logged in users can push and pull."
  - match: {account: ""}
    actions: ["pull"]
    comment: "Anonymous users can only pull."

And this is the docker-compose:

version: "3.5"

services:
  auth:
    image: cesanta/docker_auth:1
    ports:
      - 5001:5001
    volumes:
      - ./auth_config.yml:/config/auth_config.yml:ro
      - ./logs/auth:/logs

      - ./cert:/cert
    command: --v=2 --alsologtostderr /config/auth_config.yml

The .cert directory has key.pem and cert.pem which I generated with this openssl command:

openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -sha256 -days 365