Skip to content

Commit

Permalink
Merge pull request #5 from erikmagkekse/feature/wildcard-identities
Browse files Browse the repository at this point in the history
Added Wildcard option for ZITI_IDENTITIES
  • Loading branch information
erikmagkekse authored Dec 5, 2024
2 parents f856d04 + 95003b7 commit dc6dd61
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 14 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.10.15-slim
FROM python:3-slim-bookworm

# Arguments
ENV USER=appuser
Expand Down
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,17 @@ docker pull docker.io/erikmagkekse/ziti-edge-proxy:main
[DockerHub](https://hub.docker.com/r/erikmagkekse/ziti-edge-proxy)

### Environment variables
| Variable | Default Value | Usage |
| ---------------- | ----------------- | ----------------------------------------------------------- |
| PROXY_HOST | 127.0.0.1 | Where the SOCKS5 server should be attached |
| SOCKS_ENABLED | true | Enables SOCKS5 Server |
| HTTP_ENABLED | true | Enables HTTP Server |
| SOCKS_PORT | 1080 | Default port of the SOCKS5 server |
| HTTP_PORT | 8080 | Default port of the HTTP proxy server |
| PROXY_USERNAME | user | Username for the SOCKS5 server |
| PROXY_PASSWORD | password | Password for the SOCKS5 Server |
| *ZITI_IDENTITIES | *empty* | List of used Ziti identities, separated by semicolon |
| *ZITI_IDENTITY | *empty* | A Base64 encoded string of a single identity JSON |
| Variable | Default Value | Usage |
| ---------------- | ----------------- | ------------------------------------------------------------------------------------ |
| PROXY_HOST | 127.0.0.1 | Where the SOCKS5 server should be attached |
| SOCKS_ENABLED | true | Enables SOCKS5 Server |
| HTTP_ENABLED | true | Enables HTTP Server |
| SOCKS_PORT | 1080 | Default port of the SOCKS5 server |
| HTTP_PORT | 8080 | Default port of the HTTP proxy server |
| PROXY_USERNAME | user | Username for the SOCKS5 server |
| PROXY_PASSWORD | password | Password for the SOCKS5 Server |
| *ZITI_IDENTITIES | *empty* | List of used Ziti identities, separated by semicolon, can be also a wildcard. |
| *ZITI_IDENTITY | *empty* | A Base64 encoded string of a single identity JSON |

\*Only one of these can be used at a time and is not optional. If you use ZITI_IDENTITY, it will decode the identity JSON to "/app/identity.json" and update the var ZITI_IDENTITIES to point to the file.

Expand Down
2 changes: 1 addition & 1 deletion VERSION.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v0.2-alpha
v0.3-alpha
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ services:
PROXY_PASSWORD: 1234
ZITI_IDENTITIES: /app/identity.json
volumes:
- "../identity.json:/app/identity.json"
- "../identity.json:/app/identity.json"
27 changes: 27 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,33 @@ if [[ -n "$ZITI_IDENTITY" ]]; then
echo "Error: Failed to decode and create identity file."
exit 1
fi
else
echo "ZITI_IDENTITY not detected. Checking ZITI_IDENTITIES for configuration..."

if [[ -z "$ZITI_IDENTITIES" ]]; then
echo "Error: ZITI_IDENTITIES is not set. Please configure it as a file pattern."
exit 1
fi

dir=$(dirname "$ZITI_IDENTITIES")
pattern=$(basename "$ZITI_IDENTITIES")

if [[ ! -d "$dir" ]]; then
echo "Error: Directory $dir does not exist."
exit 1
fi

echo "Scanning for files matching: $ZITI_IDENTITIES"

files=$(find "$dir" -maxdepth 1 -name "$pattern" -type f,l 2>/dev/null | tr '\n' ',' | sed 's/,$//')

if [[ -n "$files" ]]; then
export ZITI_IDENTITIES="$files"
echo "ZITI_IDENTITIES updated to: $ZITI_IDENTITIES"
else
echo "Error: No files found matching the pattern: $ZITI_IDENTITIES"
exit 1
fi
fi

exec "$@"

0 comments on commit dc6dd61

Please sign in to comment.