Skip to content

Add Hetzner Object Storage bucket-cataloger module (#1876)#3073

Open
ChrisJr404 wants to merge 1 commit intoblacklanternsecurity:devfrom
ChrisJr404:feat/bucket-hetzner-1876
Open

Add Hetzner Object Storage bucket-cataloger module (#1876)#3073
ChrisJr404 wants to merge 1 commit intoblacklanternsecurity:devfrom
ChrisJr404:feat/bucket-hetzner-1876

Conversation

@ChrisJr404
Copy link
Copy Markdown

Summary

Closes #1876 ("Module TODO: Hetzner Buckets", filed by @TheTechromancer).

Hetzner offers S3-compatible Object Storage at three locations (Falkenstein fsn1, Nuremberg nbg1, Helsinki hel1), addressed at https://<bucket>.<location>.your-objectstorage.com/. cloudcheck already ships a Hetzner provider, so this PR just plugs a new bucket_hetzner module into the existing bucket_template.

Module

bbot/modules/bucket_hetzner.py — same shape as bucket_digitalocean.py:

  • regions = ['fsn1', 'nbg1', 'hel1'] — all three Hetzner Object Storage locations documented here.
  • base_domains = ['your-objectstorage.com']
  • supports_open_check = True (S3-style ListBucketResult protocol).
  • delimiters = ('', '-') — Hetzner bucket names allow dot/hyphen/underscore ([a-z0-9][a-z0-9-_\\.]{1,61}[a-z0-9] per cloudcheck regex), but only the no-delimiter and single-hyphen forms are useful for permutation enum.

Tests

test_module_bucket_hetzner.py is a focused smoke test:

  • module loads without error
  • cloudcheck_provider_name == 'Hetzner', base_domains, regions match expectations
  • build_url('examplebucket', 'your-objectstorage.com', 'fsn1') returns 'https://examplebucket.fsn1.your-objectstorage.com/'
  • the cloudcheck Hetzner provider is reachable from the module instance
$ pytest bbot/test/test_step_2/module_tests/test_module_bucket_hetzner.py
1 passed in 2.42s

Note for the maintainer

I started by extending `Bucket_Amazon_Base` like the other bucket tests, but the shared base depends on the cloudcheck provider regex separating bucket name and host into two groups. The current cloudcheck Hetzner regex matches `.your-objectstorage.com` without a region segment, so a fixture URL of `.fsn1.your-objectstorage.com` (which is what real Hetzner buckets look like) gets parsed with bucket-name = `.fsn1`, and the bucket-template's brute force then explodes the storage-bucket count past the asserts in the shared base test. Two ways to handle that down the road:

  1. Extend the cloudcheck Hetzner regex to capture region as a separate group, then fold this test into the shared base, OR
  2. Keep this minimal smoke-test shape and rely on the broader bucket_template tests for the cross-region brute-force coverage.

Happy to do (1) as a follow-up MR against blacklanternsecurity/cloudcheck if you'd prefer that path before this lands.

…ity#1876)

Closes blacklanternsecurity#1876.

Hetzner offers S3-compatible Object Storage at three locations (Falkenstein
fsn1, Nuremberg nbg1, Helsinki hel1), addressed at
https://<bucket>.<location>.your-objectstorage.com/. cloudcheck already
ships a Hetzner provider, so this just plugs a new bucket_hetzner module
into the existing bucket_template:

- regions = ['fsn1', 'nbg1', 'hel1'] - all three Object Storage locations
  documented at https://docs.hetzner.com/storage/object-storage/overview/
- base_domains = ['your-objectstorage.com']
- supports_open_check = True (S3 list-bucket protocol)

Adds a focused smoke test verifying the module wires up to the cloudcheck
Hetzner provider and emits the documented URL shape. The shared
Bucket_Amazon_Base inherited test pattern depends on the cloudcheck regex
capturing bucket + host as separate groups, but Hetzner's current
cloudcheck regex matches <bucket>.your-objectstorage.com without a region
segment - so the smoke-test layout is used here until the cloudcheck
regex is region-aware.
@TheTechromancer
Copy link
Copy Markdown
Collaborator

@ChrisJr404 Thanks for doing this!! I'll see about updating the regexes on the cloudcheck side, then circle back around.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants