mirror of
https://github.com/TecharoHQ/anubis.git
synced 2026-04-15 21:04:56 +00:00
fix(data): add ruleset to explicitly allow Docker / OCI clients
Fixes #1252 This is technically a regression as these clients used to work in Anubis v1.22.0, however it is allowable to make this opt-in as most websites do not expect to be serving Docker / OCI registry client traffic. Signed-off-by: Xe Iaso <me@xeiaso.net>
This commit is contained in:
1
.github/workflows/smoke-tests.yml
vendored
1
.github/workflows/smoke-tests.yml
vendored
@@ -15,6 +15,7 @@ jobs:
|
|||||||
matrix:
|
matrix:
|
||||||
test:
|
test:
|
||||||
- default-config-macro
|
- default-config-macro
|
||||||
|
- docker-registry
|
||||||
- double_slash
|
- double_slash
|
||||||
- forced-language
|
- forced-language
|
||||||
- git-clone
|
- git-clone
|
||||||
|
|||||||
25
data/clients/docker-client.yaml
Normal file
25
data/clients/docker-client.yaml
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
- name: allow-docker-client
|
||||||
|
action: ALLOW
|
||||||
|
expression:
|
||||||
|
all:
|
||||||
|
- path.startsWith("/v2/")
|
||||||
|
- userAgent.contains("docker/")
|
||||||
|
- userAgent.contains("git-commit/")
|
||||||
|
- '"Accept" in headers'
|
||||||
|
- headers["Accept"].contains("vnd.docker.distribution")
|
||||||
|
- '"Baggage" in headers'
|
||||||
|
- headers["Baggage"].contains("trigger")
|
||||||
|
|
||||||
|
- name: allow-crane-client
|
||||||
|
action: ALLOW
|
||||||
|
expression:
|
||||||
|
all:
|
||||||
|
- userAgent.contains("crane/")
|
||||||
|
- userAgent.contains("go-containerregistry/")
|
||||||
|
|
||||||
|
- name: allow-docker-distribution-api-client
|
||||||
|
action: ALLOW
|
||||||
|
expression:
|
||||||
|
all:
|
||||||
|
- '"Docker-Distribution-Api-Version" in headers'
|
||||||
|
- '!(userAgent.contains("Mozilla"))'
|
||||||
@@ -16,6 +16,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
- Fix `SERVE_ROBOTS_TXT` setting file after the double slash fix broke it.
|
- Fix `SERVE_ROBOTS_TXT` setting file after the double slash fix broke it.
|
||||||
- Remove the default configuration rule to block Tencent cloud. If users see abuse from Tencent cloud IP ranges, please contact abuse@tencent.com and mention that you are using Anubis to protect your services. Please include source IP address, source port, timestamp, target IP address, target port, request headers (including the User-Agent header), and target endpoints/patterns.
|
- Remove the default configuration rule to block Tencent cloud. If users see abuse from Tencent cloud IP ranges, please contact abuse@tencent.com and mention that you are using Anubis to protect your services. Please include source IP address, source port, timestamp, target IP address, target port, request headers (including the User-Agent header), and target endpoints/patterns.
|
||||||
|
|
||||||
|
### Potentially breaking changes
|
||||||
|
|
||||||
|
#### Docker / OCI registry clients
|
||||||
|
|
||||||
|
Anubis v1.23.0 accidentally blocked Docker / OCI registry clients. In order to explicitly allow them, add an import for `(data)/clients/docker-client.yaml`:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
bots:
|
||||||
|
- import: (data)/meta/default-config.yaml
|
||||||
|
- import: (data)/clients/docker-client.yaml
|
||||||
|
```
|
||||||
|
|
||||||
|
This is technically a regression as these clients used to work in Anubis v1.22.0, however it is allowable to make this opt-in as most websites do not expect to be serving Docker / OCI registry client traffic.
|
||||||
|
|
||||||
## v1.23.0: Lyse Hext
|
## v1.23.0: Lyse Hext
|
||||||
|
|
||||||
- Add default tencent cloud DENY rule.
|
- Add default tencent cloud DENY rule.
|
||||||
|
|||||||
7
test/docker-registry/anubis.yaml
Normal file
7
test/docker-registry/anubis.yaml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
bots:
|
||||||
|
- import: (data)/meta/default-config.yaml
|
||||||
|
- import: (data)/clients/docker-client.yaml
|
||||||
|
|
||||||
|
status_codes:
|
||||||
|
CHALLENGE: 200
|
||||||
|
DENY: 403
|
||||||
30
test/docker-registry/docker-compose.yaml
Normal file
30
test/docker-registry/docker-compose.yaml
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
services:
|
||||||
|
registry:
|
||||||
|
image: distribution/distribution:edge
|
||||||
|
restart: always
|
||||||
|
|
||||||
|
relayd:
|
||||||
|
image: ghcr.io/xe/x/relayd
|
||||||
|
pull_policy: always
|
||||||
|
environment:
|
||||||
|
CERT_DIR: /etc/techaro/pki/registry.local.cetacean.club
|
||||||
|
CERT_FNAME: cert.pem
|
||||||
|
KEY_FNAME: key.pem
|
||||||
|
PROXY_TO: http://anubis:3000
|
||||||
|
ports:
|
||||||
|
- 3004:3004
|
||||||
|
volumes:
|
||||||
|
- ../pki/registry.local.cetacean.club:/etc/techaro/pki/registry.local.cetacean.club
|
||||||
|
|
||||||
|
anubis:
|
||||||
|
image: ko.local/anubis
|
||||||
|
restart: always
|
||||||
|
environment:
|
||||||
|
BIND: ":3000"
|
||||||
|
TARGET: http://registry:5000
|
||||||
|
POLICY_FNAME: /etc/techaro/anubis.yaml
|
||||||
|
USE_REMOTE_ADDRESS: "true"
|
||||||
|
ports:
|
||||||
|
- 3000
|
||||||
|
volumes:
|
||||||
|
- ./anubis.yaml:/etc/techaro/anubis.yaml
|
||||||
24
test/docker-registry/test.sh
Executable file
24
test/docker-registry/test.sh
Executable file
@@ -0,0 +1,24 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
source ../lib/lib.sh
|
||||||
|
|
||||||
|
build_anubis_ko
|
||||||
|
|
||||||
|
function cleanup() {
|
||||||
|
docker compose down
|
||||||
|
}
|
||||||
|
|
||||||
|
trap cleanup EXIT SIGINT
|
||||||
|
|
||||||
|
mint_cert registry.local.cetacean.club
|
||||||
|
|
||||||
|
docker compose up -d
|
||||||
|
|
||||||
|
backoff-retry skopeo \
|
||||||
|
--insecure-policy \
|
||||||
|
copy \
|
||||||
|
--dest-tls-verify=false \
|
||||||
|
docker://hello-world \
|
||||||
|
docker://registry.local.cetacean.club:3004/hello-world
|
||||||
2
test/docker-registry/var/.gitignore
vendored
Normal file
2
test/docker-registry/var/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
*
|
||||||
|
!.gitignore
|
||||||
Reference in New Issue
Block a user