1
0
Fork 0

Start work for using the go based signer

This commit is contained in:
Jan Dittberner 2021-01-04 08:11:23 +01:00
parent 5c924ee206
commit 8fca612a7d
6 changed files with 58 additions and 2 deletions

View file

@ -1 +1,2 @@
.env
**/.idea/**

3
.gitignore vendored
View file

@ -1,6 +1,7 @@
.env
.idea/
cacert-cats/
cacert-gosigner/
cacert-mgr/
cacert-software/
.env
testca/

View file

@ -6,3 +6,6 @@ checkout = git clone git+ssh://git.cacert.org/srv/git/cacert-mgr.git cacert-mgr
[cacert-software]
checkout = git clone git+ssh://git.cacert.org/srv/git/cacert-devel.git cacert-software
[cacert-gosigner]
checkout = git clone https://git.dittberner.info/jan/cacert-gosigner.git

View file

@ -108,7 +108,7 @@ services:
signer:
build:
context: .
dockerfile: signer.Dockerfile
dockerfile: gosigner.Dockerfile
environment:
SIGNER_WORKDIR: /srv/ca/work
SIGNER_CA_CONFIG: /srv/caconfig

31
docker/run-gosigner Executable file
View file

@ -0,0 +1,31 @@
#!/bin/sh
set -eu
export SERIAL_PORT=/dev/ttyUSB0
mkdir -p /srv/ca/CA/certs /srv/ca/CA/private /srv/ca/CA/newcerts
cp /srv/testca/root/ca.crt.pem /srv/ca/CA/ca.crt.pem
cp /srv/testca/root/private/ca.key.pem /srv/ca/CA/private/ca.key.pem
if [ ! -f /srv/ca/CA/index.txt ]; then cp /srv/testca/root/index.txt /srv/ca/CA/index.txt; fi
if [ ! -f /srv/ca/CA/index.txt.attr ]; then cp /srv/testca/root/index.txt.attr /srv/ca/CA/index.txt.attr; fi
if [ ! -f /srv/ca/CA/serial ]; then printf '00' >/srv/ca/CA/serial; fi
if [ ! -f /srv/ca/CA/crlnumber ]; then echo 1000 >/srv/ca/CA/crlnumber; fi
mkdir -p /srv/ca/class3/certs /srv/ca/class3/private /srv/ca/class3/newcerts /srv/ca/gpg/gpg_root_0
cp /srv/testca/class3/ca.crt.pem /srv/ca/class3/ca.crt.pem
cp /srv/testca/class3/private/ca.key.pem /srv/ca/class3/private/ca.key.pem
if [ ! -f /srv/ca/class3/index.txt ]; then cp /srv/testca/class3/index.txt /srv/ca/class3/index.txt; fi
if [ ! -f /srv/ca/class3/index.txt.attr ]; then cp /srv/testca/class3/index.txt.attr /srv/ca/class3/index.txt.attr; fi
if [ ! -f /srv/ca/class3/serial ]; then printf '00' >/srv/ca/class3/serial; fi
if [ ! -f /srv/ca/class3/crlnumber ]; then echo 1000 >/srv/ca/class3/crlnumber; fi
if [ ! -f /srv/ca/gpg/gpg_root_0/secring.gpg ]; then cp /srv/testca/gpg/gpg_root_0/secring.gpg /srv/ca/gpg/gpg_root_0/secring.gpg; fi
if [ ! -f /srv/ca/gpg/gpg_root_0/pubring.gpg ]; then cp /srv/testca/gpg/gpg_root_0/pubring.gpg /srv/ca/gpg/gpg_root_0/pubring.gpg; fi
rm -f /srv/sockets/signer
socat -d -d PTY,link=/dev/ttyUSB0 UNIX-LISTEN:/srv/sockets/signer 2>&1 &
sleep 1
cd /app/
exec ./signer

20
gosigner.Dockerfile Normal file
View file

@ -0,0 +1,20 @@
FROM golang:alpine AS builder
COPY cacert-gosigner /src/
RUN set -ex ; \
cd /src/signer ; \
go build .
FROM alpine/socat:latest
COPY --from=builder /src/signer/signer /app/
COPY docker/run-gosigner usr/local/bin/
COPY docker/signer-config/* /srv/caconfig/
COPY testca /srv/testca/
VOLUME /srv/ca
ENTRYPOINT []
CMD ["/usr/local/bin/run-gosigner"]