-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ Provide nginx proxy for mitre endpoints
- Loading branch information
Showing
4 changed files
with
29 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/bin/sh | ||
|
||
# Skip creating proxy file if no proxies are configured | ||
if [ -z "$OSIM_NGINX_PROXY_MITRE" ]; then | ||
exit 0; | ||
fi | ||
|
||
# Get proxy certificate | ||
curl --xattr "$OSIM_NGINX_PROXY_CA" -o /tmp/Proxy-CA.crt | ||
|
||
# Ensure no trailing slash in variable, so no duplicate trailing slash is added in proxy_pass | ||
OSIM_NGINX_PROXY_MITRE="${OSIM_NGINX_PROXY_MITRE%/}" | ||
|
||
echo resolver "$(awk -v ORS=' ' '$1=="nameserver" {print $2}' /etc/resolv.conf)" ";" >/etc/nginx/conf.d/resolvers.conf | ||
|
||
# Add MITRE reverse proxy endpoint | ||
cat <<EOF >/tmp/osim-nginx-proxy.conf | ||
location /proxy/mitre/ { | ||
# Trailing slash in proxy_pass strips the location directive prefix from the downstream URL | ||
proxy_pass ${OSIM_NGINX_PROXY_MITRE}/; | ||
proxy_http_version 1.1; | ||
} | ||
EOF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters