Skip to content

Commit c6e86fd

Browse files
authored
Merge pull request #44 from manics/openssl
Replace minica with openssl (linux/arm64 compatibility)
2 parents b4e1938 + 3955dd4 commit c6e86fd

File tree

5 files changed

+34
-24
lines changed

5 files changed

+34
-24
lines changed

pebble/files/certificate.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/sh
2+
set -eux
3+
4+
# Self-signed CA key and certificate
5+
# openssl genrsa -out root-key.pem 2048
6+
# openssl req -new -x509 -key root-key.pem -subj "/CN=Pebble Helm Chart self-signed CA" -days 3650 -out root-cert.pem
7+
8+
CA_KEY=/input/root-key.pem
9+
CA_CERT=/input/root-cert.pem
10+
11+
CERT_DIR=/output/localhost
12+
13+
# Convert "a,a.b,a.b.c" to "DNS:a, DNS:a.b, DNS:a.b.c, "
14+
SAN_DNS=`echo "$@" | awk -F, '{for(i=1; i<=NF; i++) {printf "DNS:" $i ", "}}'`
15+
16+
# Server certificate key
17+
if [ ! -f "$CERT_DIR/key.pem" ]; then
18+
openssl genrsa -out "$CERT_DIR/key.pem" 2048
19+
fi
20+
21+
# Server certificate
22+
openssl req -new -key "$CERT_DIR/key.pem" -subj "/CN=localhost" -addext "subjectAltName = $SAN_DNS IP:127.0.0.1" -addext "extendedKeyUsage = serverAuth,clientAuth" -out "$CERT_DIR/req.csr"
23+
openssl x509 -CAkey "$CA_KEY" -CA "$CA_CERT" -req -copy_extensions copy -in "$CERT_DIR/req.csr" -days 3650 -out "$CERT_DIR/cert.pem"

pebble/templates/pebble-configmap.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ data:
2929
# ref: https://github.com/letsencrypt/pebble/tree/HEAD/test/certs
3030
{{- (.Files.Glob "files/root-cert.pem").AsConfig | nindent 2 }}
3131
{{- (.Files.Glob "files/root-key.pem").AsConfig | nindent 2 }}
32+
{{- (.Files.Glob "files/certificate.sh").AsConfig | nindent 2 }}
3233
{{- end }}
3334

3435
{{- include "pebble.configmap" . | fromYaml | merge .Values.pebble.merge.configmap | toYaml }}

pebble/templates/pebble-deployment.yaml

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,7 @@ spec:
2828

2929
initContainers:
3030
- name: pebble-tls-leaf-creation
31-
# This image was built Dec 10, 2018, so it probably has the version
32-
# 1.0.1 if minica. The latest version of minica is currently version
33-
# 1.0.2.
34-
#
35-
# Related:
36-
# - https://github.com/jsha/minica/releases
37-
# - https://hub.docker.com/layers/twalter/minica/latest/images/sha256-3c33ecad86f04fb466ee9dfb2a08f15f7f8cc8f6268304137ebd39eac2218aca?context=explore
38-
#
39-
# FIXME: Transition to use https://github.com/ryantk/docker-minica and
40-
# https://hub.docker.com/layers/ryantk/minica/latest/images/sha256-c67e2c1885d438b5927176295d41aaab8a72dd9e1272ba85054bfc78191d05b0?context=explore
41-
# that has a linked Dockerfile as well and use version 1.0.2.
42-
#
43-
image: twalter/minica@sha256:3c33ecad86f04fb466ee9dfb2a08f15f7f8cc8f6268304137ebd39eac2218aca
31+
image: "{{ .Values.pebble.openssl.repository }}:{{ .Values.pebble.openssl.tag }}"
4432
volumeMounts:
4533
- name: pebble-config-and-tls-root
4634
mountPath: /input
@@ -50,17 +38,9 @@ spec:
5038
- name: pebble-temp-tls-leaf
5139
mountPath: /output/localhost
5240
command:
53-
# Avoid "open localhost/key.pem: file exists" as happen if the
54-
# container restarts for some reason.
5541
- sh
56-
- -c
57-
- >
58-
[ -e localhost/key.pem ] || exec
59-
minica
60-
-ca-cert /input/root-cert.pem
61-
-ca-key /input/root-key.pem
62-
-domains {{ include "pebble.domains" . | quote }}
63-
-ip-addresses 127.0.0.1
42+
- /input/certificate.sh
43+
- {{ include "pebble.domains" . | quote }}
6444

6545
containers:
6646
# Pebble is the acme server, but also expose a REST API on the

pebble/values.schema.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
"type": "object",
3434
"properties": {
3535
"image": { "$ref": "#/definitions/image" },
36+
"openssl": { "$ref": "#/definitions/image" },
3637
"config": {
3738
"properties": {
3839
"pebble": {}
@@ -41,7 +42,7 @@
4142
},
4243
"env": { "$ref": "#/definitions/env" }
4344
},
44-
"required": ["config", "image"]
45+
"required": ["config", "image", "openssl"]
4546
},
4647
"coredns": {
4748
"type": "object",

pebble/values.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ pebble:
77
repository: ghcr.io/letsencrypt/pebble
88
tag: "" # default is the chart's appVersion, this is an override
99

10+
# Image for creating certificates
11+
openssl:
12+
repository: docker.io/alpine/openssl
13+
tag: "3.3.2"
14+
1015
## config ref: https://github.com/letsencrypt/pebble/blob/52b92744eaad895ac25b19dae429c0bdd134b764/cmd/pebble/main.go#L17
1116
config:
1217
pebble:

0 commit comments

Comments
 (0)