File tree Expand file tree Collapse file tree 5 files changed +261
-0
lines changed
Expand file tree Collapse file tree 5 files changed +261
-0
lines changed Original file line number Diff line number Diff line change 1+ # Build directories
2+ docker /
3+ build /
4+ bin /
5+ obj /
6+ * .tmp
7+
8+ # Version control
9+ .git /
10+ .gitignore
11+ .gitmodules
12+ .gitattributes
13+
14+ # IDE and editor files
15+ .vscode /
16+ .idea /
17+ * .swp
18+ * .swo
19+ * ~
20+
21+ # Documentation
22+ * .md
23+ LICENSE
24+ INSTALL *
25+ CHANGELOG *
26+
27+ # Temporary files
28+ * .log
29+ * .cache
30+ .cache /
31+
32+ # OS specific
33+ .DS_Store
34+ Thumbs.db
35+
36+ # Ignore everything except source code
37+ # but explicitly include what we need
38+ ! * /
39+ ! * .c
40+ ! * .h
41+ ! * .cmake
42+ ! CMakeLists.txt
43+ ! cmake /
Original file line number Diff line number Diff line change @@ -133,3 +133,64 @@ Value of this parameter can be either short name, defined in OpenSSL
133133[ RFC 4357] [ 1 ] .
134134
135135[ 1 ] :https://tools.ietf.org/html/rfc4357 " RFC 4357 "
136+
137+
138+ Docker Image Building
139+ ========================
140+
141+ Overview
142+ --------
143+
144+ This article describes how to build Docker images with a pre-built OpenSSL GOST engine for various Linux distributions.
145+
146+ Available Images
147+
148+ - alpine - Minimal image based on Alpine Linux
149+ - debian - Image based on Debian Trixie
150+
151+ Prerequisites
152+
153+ - Docker
154+ - GNU Make (optional)
155+
156+ Building with Make
157+
158+ To build a specific image:
159+
160+ $ cd docker
161+ $ make alpine
162+ $ make debian
163+
164+ This will create images tagged as ` gost-engine:<version>-<distro> ` .
165+
166+ Building without Make
167+ ---------------------
168+ To build images manually using Docker:
169+
170+ $ cd docker
171+ $ docker build -f docker/Dockerfile.alpine -t gost-engine:latest-alpine .
172+ $ docker build -f docker/Dockerfile.debian -t gost-engine:latest-debian .
173+
174+ Verification
175+ ------------
176+ After building, verify that the images work correctly:
177+
178+ $ cd docker
179+ $ docker run --rm gost-engine:latest-alpine openssl version
180+ $ docker run --rm gost-engine:latest-alpine openssl engine -t gost
181+
182+ The images include:
183+
184+ - OpenSSL with GOST engine support
185+ - gostsum and gost12sum utilities
186+ - Pre-configured openssl.cnf with GOST enabled
187+
188+ Image Contents
189+ --------------
190+ Each image contains:
191+ - OpenSSL with GOST engine
192+ - GOST cipher support
193+ - Command-line utilities
194+ - Proper CA certificates configuration
195+
196+ The images are optimized for size and include only runtime dependencies.
Original file line number Diff line number Diff line change 1+ FROM alpine:latest
2+
3+
4+ RUN apk update \
5+ && apk add --no-cache openssl \
6+ && apk add --no-cache --virtual .build-deps \
7+ cmake \
8+ make \
9+ gcc \
10+ g++ \
11+ musl-dev \
12+ openssl-dev \
13+ git \
14+ linux-headers
15+
16+ WORKDIR /usr/local/src/engine
17+
18+ COPY CMakeLists.txt .
19+ COPY *.c *.h gost.ec gostsum.1 gost12sum.1 LICENSE .
20+ COPY benchmark/ benchmark/
21+ COPY etalon/ etalon/
22+ COPY libprov/ libprov/
23+ COPY patches/ patches/
24+ COPY tcl_tests/ tcl_tests/
25+ COPY test/ test/
26+
27+ # via openssl version -a
28+ ARG OPENSSLDIR="/etc/ssl"
29+ ARG ENGINESDIR="/usr/lib/engines-3"
30+
31+
32+ RUN mkdir build \
33+ && cd build \
34+ && cmake \
35+ -DCMAKE_BUILD_TYPE=Release \
36+ -DOPENSSL_ENGINES_DIR=${ENGINESDIR} \
37+ .. \
38+ && cmake --build . --target install --config Release \
39+ && cd bin \
40+ && cp gostsum gost12sum /usr/local/bin \
41+ && rm -rf /usr/local/src/engine
42+
43+
44+ WORKDIR /
45+
46+ # Enable engine
47+ COPY example.conf "${OPENSSLDIR}/gost.cnf"
48+ RUN sed -i "s|dynamic_path\s*=.*$|dynamic_path = ${ENGINESDIR}/gost.so|" "${OPENSSLDIR}/gost.cnf" \
49+ && sed -i "11i .include ${OPENSSLDIR}/gost.cnf" "${OPENSSLDIR}/openssl.cnf"
50+
51+ RUN apk del .build-deps \
52+ && rm -rf /var/cache/apk/* \
53+ && rm -rf /usr/local/src/engine
Original file line number Diff line number Diff line change 1+ FROM debian:trixie-slim
2+
3+ RUN apt-get update && apt-get install -y \
4+ build-essential \
5+ make \
6+ cmake \
7+ openssl \
8+ libssl-dev \
9+ gcc
10+
11+ WORKDIR /usr/local/src/engine
12+
13+ COPY CMakeLists.txt .
14+ COPY *.c *.h gost.ec gostsum.1 gost12sum.1 LICENSE .
15+ COPY benchmark/ benchmark/
16+ COPY etalon/ etalon/
17+ COPY libprov/ libprov/
18+ COPY patches/ patches/
19+ COPY tcl_tests/ tcl_tests/
20+ COPY test/ test/
21+
22+ # via openssl version -a
23+ ARG OPENSSLDIR="/usr/lib/ssl"
24+ ARG ENGINESDIR="/usr/lib/x86_64-linux-gnu/engines-3"
25+
26+ RUN mkdir build \
27+ && cd build \
28+ && cmake \
29+ -DCMAKE_BUILD_TYPE=Release \
30+ -DOPENSSL_ENGINES_DIR=${ENGINESDIR} \
31+ .. \
32+ && cmake --build . --target install --config Release \
33+ && cd bin \
34+ && cp gostsum gost12sum /usr/local/bin \
35+ && rm -rf /usr/local/src/engine
36+
37+
38+ WORKDIR /
39+
40+ # Enable engine
41+ COPY example.conf "${OPENSSLDIR}/gost.cnf"
42+ RUN sed -i "s|dynamic_path\s*=.*$|dynamic_path = ${ENGINESDIR}/gost.so|" "${OPENSSLDIR}/gost.cnf" \
43+ && sed -i "11i .include ${OPENSSLDIR}/gost.cnf" "${OPENSSLDIR}/openssl.cnf"
44+
45+ RUN apt-get remove -y \
46+ build-essential \
47+ make \
48+ cmake \
49+ libssl-dev \
50+ gcc \
51+ && apt-get autoremove -y \
52+ && apt-get clean \
53+ && rm -rf /var/lib/apt/lists/*
Original file line number Diff line number Diff line change 1+
2+ OK := \e[1;32mOK\e[0m
3+ FAIL := \e[1;31mFAIL\e[0m
4+ PRINT_RESULT := echo '${OK}' || echo '${FAIL}'
5+
6+ #
7+ # for git tag used tag name as version
8+ # else version is name of branch or "unknown" if no .git repo
9+ # also you can replace VERSION value using environment variables:
10+ # VERSION=latest make help
11+ #
12+ VERSION ?= $(shell \
13+ if git describe --tags --exact-match >/dev/null 2>&1; then \
14+ git describe --tags --exact-match; \
15+ else \
16+ git branch --show-current 2>/dev/null || echo "unknown"; \
17+ fi \
18+ )
19+ DOCKER_IMAGE := gost-engine
20+
21+ RELEASES := alpine debian
22+ # rockylinux -- unsuitable version "3.2.2", but required is at least "3.4"
23+
24+ .PHONY : help $(RELEASES )
25+
26+ help :
27+ @ echo " The GOST Engine version: $( VERSION) "
28+ @ echo " Available targets: help $( RELEASES) "
29+ @ echo " --"
30+ @ echo " To build images use:"
31+ @ for r in $( RELEASES) ; do \
32+ echo " > make $$ r => $( DOCKER_IMAGE) :$( VERSION) -$$ r" ; \
33+ done
34+
35+
36+ update :
37+ git submodule update --init
38+
39+
40+
41+ $(RELEASES ) : update
42+ docker build \
43+ --file Dockerfile.$@ \
44+ --tag $(DOCKER_IMAGE ) :$(VERSION ) -$@ \
45+ ..
46+ @ echo
47+ @ echo " \e[1;37m => Checking the OpenSSL version\e[0m"
48+ @ docker run -it --rm $(DOCKER_IMAGE ) :$(VERSION ) -$@ openssl version -v
49+ @ echo " $( OK) "
50+ @ echo " \e[1;37m => Checking the GOST ciphers\e[0m"
51+ @ docker run -it --rm $(DOCKER_IMAGE ) :$(VERSION ) -$@ openssl ciphers | tr ' :' ' \n' | grep ' GOST' && $(PRINT_RESULT )
You can’t perform that action at this time.
0 commit comments