Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Nginx config with TLS verification #12

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion build-images.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,17 @@ set -e
images=()
repobase="${REPOBASE:-ghcr.io/nethserver}"

reponame="ldapproxy-app"
container=$(buildah from docker.io/library/nginx:1.25.3-alpine)
buildah run "${container}" /bin/sh <<'EOF'
set -e
apk add --no-cache ca-certificates
EOF
# Commit the image
buildah commit --rm "${container}" "${repobase}/${reponame}"
# Append the image URL to the images array
images+=("${repobase}/${reponame}")

reponame="ldapproxy"
container=$(buildah from scratch)

Expand All @@ -12,7 +23,7 @@ buildah add "${container}" ui /ui
buildah config \
--label='org.nethserver.tcp-ports-demand=8' \
--label='org.nethserver.flags=core_module no_data_backup' \
--label="org.nethserver.images=docker.io/library/nginx:1.25.3-alpine" \
--label="org.nethserver.images=${repobase}/ldapproxy-app:${IMAGETAG:-latest}" \
--entrypoint=/ "${container}"
buildah commit "${container}" "${repobase}/${reponame}"
images+=("${repobase}/${reponame}")
Expand Down
2 changes: 1 addition & 1 deletion imageroot/bin/update-conf
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ if ! diff -q nginx.conf ${tmpconf} ; then
--log-driver=none \
--env=NGINX_ENTRYPOINT_QUIET_LOGS=1 \
--volume=./:/srv:z \
--rm "${NGINX_IMAGE}" \
--rm "${LDAPPROXY_APP_IMAGE}" \
nginx -t -c "/srv/${tmpconf}"
mv -v ${tmpconf} nginx.conf
fi
2 changes: 1 addition & 1 deletion imageroot/systemd/user/ldapproxy.service
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ ExecStart=/usr/bin/podman run \
--network=host \
--replace --name=%N \
--volume=./nginx:/srv:z \
${NGINX_IMAGE} nginx -g "daemon off;" -c /srv/nginx.conf
${LDAPPROXY_APP_IMAGE} nginx -g "daemon off;" -c /srv/nginx.conf
ExecReload=-/usr/local/bin/runagent update-conf
ExecReload=/usr/bin/podman exec %N nginx -s reload
ExecStop=/usr/bin/podman stop --ignore --cidfile %t/ldapproxy.ctr-id -t 10
Expand Down
2 changes: 2 additions & 0 deletions imageroot/templates/nginx.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ stream {
proxy_ssl {{ 'on' if item.tls == '1' else 'off' }};
proxy_ssl_verify {{ 'on' if item.tls_verify == '1' else 'off' }};
proxy_ssl_verify_depth {{ item.tls_verify_depth | default('2') }};
proxy_ssl_trusted_certificate /etc/ssl/certs/ca-certificates.crt;
proxy_ssl_name {{ item.domain }};
}
upstream {{ item.domain | replace('.', '_') }} {
{%- for server in item.servers %}
Expand Down
Loading