-
Notifications
You must be signed in to change notification settings - Fork 19
Feature/99 use allow multiple times #126
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
Changes from all commits
8a32d3b
8b94aa8
e64698d
0882d69
484decb
f6fee10
4900b7c
a6187d8
381964f
caa268a
efea0f9
c62f958
3fa4eae
9a2e50e
844457f
a06be88
821fb3c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,7 +1,7 @@ | ||||||
| # socket-proxy | ||||||
|
|
||||||
| ## Latest image | ||||||
| - `wollomatic/socket-proxy:1.11.4` / `ghcr.io/wollomatic/socket-proxy:1.11.4` | ||||||
| - `wollomatic/socket-proxy:1.12.0` / `ghcr.io/wollomatic/socket-proxy:1.12.0` | ||||||
| - `wollomatic/socket-proxy:1` / `ghcr.io/wollomatic/socket-proxy:1` | ||||||
|
|
||||||
| > [!IMPORTANT] | ||||||
|
|
@@ -93,17 +93,22 @@ Use Go's regexp syntax to create the patterns for these parameters. To avoid ins | |||||
| Examples (command-line): | ||||||
| + `'-allowGET=/v1\..{1,2}/(version|containers/.*|events.*)'` could be used for allowing access to the docker socket for Traefik v2. | ||||||
| + `'-allowHEAD=.*'` allows all HEAD requests. | ||||||
| + `'-allowGET=/version -allowGET=/_ping'` use allow `GET` multiple times | ||||||
|
|
||||||
| Examples (env variables): | ||||||
| + `'SP_ALLOW_GET="/v1\..{1,2}/(version|containers/.*|events.*)"'` could be used for allowing access to the docker socket for Traefik v2. | ||||||
| + `'SP_ALLOW_HEAD=".*"'` allows all HEAD requests. | ||||||
| + `'SP_ALLOW_GET="/version" SP_ALLOW_GET_2="/_ping"'` use allow `GET` multiple times | ||||||
|
|
||||||
| For more information, refer to the [Go regexp documentation](https://golang.org/pkg/regexp/syntax/). | ||||||
|
|
||||||
| An excellent online regexp tester is [regex101.com](https://regex101.com/). | ||||||
|
|
||||||
| To determine which HTTP requests your client application uses, you could switch socket-proxy to debug log level and look at the log output while allowing all requests in a secure environment. | ||||||
|
|
||||||
| > [!NOTE] | ||||||
| > Starting with version 1.12.0, the socket-proxy can set multiple -allow* in params, environment, or docker labels. | ||||||
|
|
||||||
| #### Setting up bind mount restrictions | ||||||
|
|
||||||
| By default, socket-proxy does not restrict bind mounts. If you want to add an additional layer of security by restricting which directories can be used as bind mount sources, you can use the `-allowbindmountfrom` parameter or the `SP_ALLOWBINDMOUNTFROM` environment variable. | ||||||
|
|
@@ -135,6 +140,8 @@ services: | |||||
| - docker-proxynet # this should be only restricted to traefik and socket-proxy | ||||||
| labels: | ||||||
| - 'socket-proxy.allow.get=.*' # allow all GET requests to socket-proxy | ||||||
| - 'socket-proxy.allow.head=/version' # HEAD `/version` requests to socket-proxy | ||||||
| - 'socket-proxy.allow.head.1=/exec' # another HEAD `exec` requests to socket-proxy | ||||||
| ``` | ||||||
|
|
||||||
| When this is used, it is not necessary to specify the container in `-allowfrom` as the presence of the allowlist labels will grant corresponding access. | ||||||
|
|
@@ -235,7 +242,7 @@ socket-proxy can be configured via command-line parameters or via environment va | |||||
| | `-logjson` | `SP_LOGJSON` | (not set/false) | If set, it enables logging in JSON format. If unset, socket-proxy logs in plain text format. | | ||||||
| | `-loglevel` | `SP_LOGLEVEL` | `INFO` | Sets the log level. Accepted values are: `DEBUG`, `INFO`, `WARN`, `ERROR`. | | ||||||
| | `-proxyport` | `SP_PROXYPORT` | `2375` | Defines the TCP port the proxy listens to. | | ||||||
| | `-shutdowngracetime` | `SP_SHUTDOWNGRACETIME` | `10` | Defines the time in seconds to wait before forcing the shutdown after SIGTERM or SIGINT (socket-proxy first tries to gracefully shut down the TCP server) | | | ||||||
| | `-shutdowngracetime` | `SP_SHUTDOWNGRACETIME` | `10` | Defines the time in seconds to wait before forcing the shutdown after SIGTERM or SIGINT (socket-proxy first tries to gracefully shut down the TCP server) | | ||||||
| | `-socketpath` | `SP_SOCKETPATH` | `/var/run/docker.sock` | Specifies the UNIX socket path to connect to. By default, it connects to the Docker daemon socket. | | ||||||
| | `-stoponwatchdog` | `SP_STOPONWATCHDOG` | (not set/false) | If set, socket-proxy will be stopped if the watchdog detects that the unix socket is not available. | | ||||||
| | `-watchdoginterval` | `SP_WATCHDOGINTERVAL` | `0` | Check for socket availability every x seconds (disable checks, if not set or value is 0) | | ||||||
|
|
@@ -269,6 +276,7 @@ socket-proxy can be configured via command-line parameters or via environment va | |||||
|
|
||||||
| 1.11 - add per-container allowlists specified by Docker container labels (thanks [@amanda-wee](https://github.com/amanda-wee)) | ||||||
|
|
||||||
| 1.12 - support use of allow* multiple times in env, flag and docker labels (thanks [@qianlongzt](https://github.com/qianlongzt)) | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Polish the changelog sentence for grammar and consistency. The line is understandable, but “flag” should be plural and the phrasing can be cleaner. 📝 Suggested wording-1.12 - support use of allow* multiple times in env, flag and docker labels (thanks [`@qianlongzt`](https://github.com/qianlongzt))
+1.12 - support using `allow*` multiple times via env vars, flags, and Docker labels (thanks [`@qianlongzt`](https://github.com/qianlongzt))📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||
|
|
||||||
| ## License | ||||||
|
|
||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor: clarify the second HEAD label example.
The trailing comment "another HEAD
execrequests to socket-proxy" is missing a verb and reads awkwardly. Consider tightening to something like "allow HEAD/execrequests to socket-proxy". Also note that the prefix in the second label uses.1; depending on the label parser's prefix matching this may or may not be required to disambiguate from the first one — see the related comment ininternal/config/config.go.📝 Proposed wording
🤖 Prompt for AI Agents