diff --git a/Dockerfile b/Dockerfile index 0c6afc3..0ef6617 100644 --- a/Dockerfile +++ b/Dockerfile @@ -30,6 +30,7 @@ RUN \ /tmp/* ENV ALLOW_ARCHIVE=0 \ + ALLOW_ATTACH=0 \ ALLOW_CHANGES=0 \ ALLOW_EXPORT=0 \ ALLOW_LOGS=0 \ diff --git a/Dockerfile.aarch64 b/Dockerfile.aarch64 index 0c6afc3..0ef6617 100644 --- a/Dockerfile.aarch64 +++ b/Dockerfile.aarch64 @@ -30,6 +30,7 @@ RUN \ /tmp/* ENV ALLOW_ARCHIVE=0 \ + ALLOW_ATTACH=0 \ ALLOW_CHANGES=0 \ ALLOW_EXPORT=0 \ ALLOW_LOGS=0 \ diff --git a/Dockerfile.riscv64 b/Dockerfile.riscv64 index 0c6afc3..0ef6617 100644 --- a/Dockerfile.riscv64 +++ b/Dockerfile.riscv64 @@ -30,6 +30,7 @@ RUN \ /tmp/* ENV ALLOW_ARCHIVE=0 \ + ALLOW_ATTACH=0 \ ALLOW_CHANGES=0 \ ALLOW_EXPORT=0 \ ALLOW_LOGS=0 \ diff --git a/readme-vars.yml b/readme-vars.yml index d52b2a9..0caa036 100644 --- a/readme-vars.yml +++ b/readme-vars.yml @@ -158,6 +158,7 @@ full_custom_readme: | container_name: socket-proxy environment: - ALLOW_ARCHIVE=0 #optional + - ALLOW_ATTACH=0 #optional - ALLOW_CHANGES=0 #optional - ALLOW_EXPORT=0 #optional - ALLOW_LOGS=0 #optional @@ -224,6 +225,7 @@ full_custom_readme: | docker run -d \ --name=socket-proxy \ -e ALLOW_ARCHIVE=0 `#optional` \ + -e ALLOW_ATTACH=0 `#optional` \ -e ALLOW_CHANGES=0 `#optional` \ -e ALLOW_EXPORT=0 `#optional` \ -e ALLOW_LOGS=0 `#optional` \ @@ -290,6 +292,7 @@ full_custom_readme: | | Parameter | Function | | :----: | --- | | `-e ALLOW_ARCHIVE=0` | `(/libpod)?/(containers∣pods)/{id}/archive` | + | `-e ALLOW_ATTACH=0` | `(/libpod)?/containers/{id}/attach` and `/attach/ws`, whatever `POST` is set to | | `-e AUTH=0` | `/auth` | | `-e BUILD=0` | `/build` | | `-e COMMIT=0` | `/commit` | @@ -471,6 +474,7 @@ full_custom_readme: | ## Versions + * **22.11.26:** - Add `ALLOW_ATTACH`; container attach is now denied by default, also with `POST=1`. * **05.10.26:** - Add `TIMEOUT_CLIENT` & `TIMEOUT_SERVER` options. * **18.08.26:** - Add `ALLOW_ARCHIVE`, `ALLOW_CHANGES`, `ALLOW_EXPORT`, `ALLOW_LOGS`, `ALLOW_TOP` options. * **15.06.26:** - Rebase to Alpine 3.24. diff --git a/root/templates/haproxy.cfg b/root/templates/haproxy.cfg index 1932e16..7ba91ed 100644 --- a/root/templates/haproxy.cfg +++ b/root/templates/haproxy.cfg @@ -29,6 +29,7 @@ frontend proxy bind @@BIND_PROTO@@ acl allow_archive env(ALLOW_ARCHIVE) -m bool + acl allow_attach env(ALLOW_ATTACH) -m bool acl allow_change env(ALLOW_CHANGES) -m bool acl allow_export env(ALLOW_EXPORT) -m bool acl allow_logs env(ALLOW_LOGS) -m bool @@ -37,6 +38,7 @@ frontend proxy acl allow_exec env(EXEC) -m bool http-request deny if { path,url_dec -m reg -i ^(/v[\d\.]+)?(/libpod)?/(containers|pods)/[a-zA-Z0-9_.-]+/(archive) } !allow_archive + http-request deny if { path,url_dec -m reg -i ^(/v[\d\.]+)?(/libpod)?/containers/[a-zA-Z0-9_.-]+/(attach) } !allow_attach http-request deny if { path,url_dec -m reg -i ^(/v[\d\.]+)?(/libpod)?/(containers|pods)/[a-zA-Z0-9_.-]+/(change) } !allow_change http-request deny if { path,url_dec -m reg -i ^(/v[\d\.]+)?(/libpod)?/(containers|pods)/[a-zA-Z0-9_.-]+/(export) } !allow_export http-request deny if { path,url_dec -m reg -i ^(/v[\d\.]+)?(/libpod)?/(containers|pods)/[a-zA-Z0-9_.-]+/(logs) } !allow_logs