Repository: syself/cluster-api-provider-hetzner
Pull request #1520 (2024-12-23 11:02:00)

:seedling: Update github-actions group
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [actions/cache](https://redirect.github.com/actions/cache) | action | digest | `1bd1e32` -> `d4323d4` |
| [actions/create-github-app-token](https://redirect.github.com/actions/create-github-app-token) | action | digest | `5d869da` -> `21cfef2` |
| [actions/download-artifact](https://redirect.github.com/actions/download-artifact) | action | digest | `fa0a91b` -> `cc20338` |
| [actions/setup-go](https://redirect.github.com/actions/setup-go) | action | minor | `v5.2.0` -> `v5.3.0` |
| [actions/setup-node](https://redirect.github.com/actions/setup-node) | action | digest | `39370e3` -> `1d0ff46` |
| [actions/upload-artifact](https://redirect.github.com/actions/upload-artifact) | action | minor | `v4.4.3` -> `v4.6.1` |
| [actions/upload-artifact](https://redirect.github.com/actions/upload-artifact) | action | digest | `b4b15b8` -> `4cec3d8` |
| [docker/build-push-action](https://redirect.github.com/docker/build-push-action) | action | digest | `48aba3b` -> `471d1dc` |
| [docker/build-push-action](https://redirect.github.com/docker/build-push-action) | action | minor | `v6.10.0` -> `v6.15.0` |
| [docker/login-action](https://redirect.github.com/docker/login-action) | action | minor | `v3.3.0` -> `v3.4.0` |
| [docker/metadata-action](https://redirect.github.com/docker/metadata-action) | action | minor | `v5.6.1` -> `v5.7.0` |
| [docker/setup-buildx-action](https://redirect.github.com/docker/setup-buildx-action) | action | digest | `6524bf6` -> `b5ca514` |
| [docker/setup-buildx-action](https://redirect.github.com/docker/setup-buildx-action) | action | minor | `v3.8.0` -> `v3.10.0` |
| [docker/setup-qemu-action](https://redirect.github.com/docker/setup-qemu-action) | action | digest | `49b3bc8` -> `2910929` |
| [sigstore/cosign-installer](https://redirect.github.com/sigstore/cosign-installer) | action | minor | `v3.7.0` -> `v3.8.1` |
| [softprops/action-gh-release](https://redirect.github.com/softprops/action-gh-release) | action | digest | `e7a8f85` -> `c95fe14` |

---

### Release Notes

<details>
<summary>actions/setup-go (actions/setup-go)</summary>

### [`v5.3.0`](https://redirect.github.com/actions/setup-go/releases/tag/v5.3.0)

[Compare Source](https://redirect.github.com/actions/setup-go/compare/v5.2.0...v5.3.0)

##### What's Changed

-   Use the new cache service: upgrade `@actions/cache` to `^4.0.0` by [@&#8203;Link-](https://redirect.github.com/Link-) in [https://github.com/actions/setup-go/pull/531](https://redirect.github.com/actions/setup-go/pull/531)
-   Configure Dependabot settings by [@&#8203;HarithaVattikuti](https://redirect.github.com/HarithaVattikuti) in [https://github.com/actions/setup-go/pull/530](https://redirect.github.com/actions/setup-go/pull/530)
-   Document update - permission section  by [@&#8203;HarithaVattikuti](https://redirect.github.com/HarithaVattikuti) in [https://github.com/actions/setup-go/pull/533](https://redirect.github.com/actions/setup-go/pull/533)
-   Bump actions/publish-immutable-action from 0.0.3 to 0.0.4 by [@&#8203;dependabot](https://redirect.github.com/dependabot) in [https://github.com/actions/setup-go/pull/534](https://redirect.github.com/actions/setup-go/pull/534)

##### New Contributors

-   [@&#8203;Link-](https://redirect.github.com/Link-) made their first contribution in [https://github.com/actions/setup-go/pull/531](https://redirect.github.com/actions/setup-go/pull/531)

**Full Changelog**: https://github.com/actions/setup-go/compare/v5...v5.3.0

</details>

<details>
<summary>actions/upload-artifact (actions/upload-artifact)</summary>

### [`v4.6.1`](https://redirect.github.com/actions/upload-artifact/releases/tag/v4.6.1)

[Compare Source](https://redirect.github.com/actions/upload-artifact/compare/v4.6.0...v4.6.1)

##### What's Changed

-   Update to use artifact 2.2.2 package by [@&#8203;yacaovsnc](https://redirect.github.com/yacaovsnc) in [https://github.com/actions/upload-artifact/pull/673](https://redirect.github.com/actions/upload-artifact/pull/673)

**Full Changelog**: https://github.com/actions/upload-artifact/compare/v4...v4.6.1

### [`v4.6.0`](https://redirect.github.com/actions/upload-artifact/releases/tag/v4.6.0)

[Compare Source](https://redirect.github.com/actions/upload-artifact/compare/v4.5.0...v4.6.0)

##### What's Changed

-   Expose env vars to control concurrency and timeout by [@&#8203;yacaovsnc](https://redirect.github.com/yacaovsnc) in [https://github.com/actions/upload-artifact/pull/662](https://redirect.github.com/actions/upload-artifact/pull/662)

**Full Changelog**: https://github.com/actions/upload-artifact/compare/v4...v4.6.0

### [`v4.5.0`](https://redirect.github.com/actions/upload-artifact/releases/tag/v4.5.0)

[Compare Source](https://redirect.github.com/actions/upload-artifact/compare/v4.4.3...v4.5.0)

##### What's Changed

-   fix: deprecated `Node.js` version in action by [@&#8203;hamirmahal](https://redirect.github.com/hamirmahal) in [https://github.com/actions/upload-artifact/pull/578](https://redirect.github.com/actions/upload-artifact/pull/578)
-   Add new `artifact-digest` output by [@&#8203;bdehamer](https://redirect.github.com/bdehamer) in [https://github.com/actions/upload-artifact/pull/656](https://redirect.github.com/actions/upload-artifact/pull/656)

##### New Contributors

-   [@&#8203;hamirmahal](https://redirect.github.com/hamirmahal) made their first contribution in [https://github.com/actions/upload-artifact/pull/578](https://redirect.github.com/actions/upload-artifact/pull/578)
-   [@&#8203;bdehamer](https://redirect.github.com/bdehamer) made their first contribution in [https://github.com/actions/upload-artifact/pull/656](https://redirect.github.com/actions/upload-artifact/pull/656)

**Full Changelog**: https://github.com/actions/upload-artifact/compare/v4.4.3...v4.5.0

</details>

<details>
<summary>docker/build-push-action (docker/build-push-action)</summary>

### [`v6.15.0`](https://redirect.github.com/docker/build-push-action/releases/tag/v6.15.0)

[Compare Source](https://redirect.github.com/docker/build-push-action/compare/v6.14.0...v6.15.0)

-   Bump [@&#8203;docker/actions-toolkit](https://redirect.github.com/docker/actions-toolkit) from 0.55.0 to 0.56.0 in [https://github.com/docker/build-push-action/pull/1330](https://redirect.github.com/docker/build-push-action/pull/1330)

**Full Changelog**: https://github.com/docker/build-push-action/compare/v6.14.0...v6.15.0

### [`v6.14.0`](https://redirect.github.com/docker/build-push-action/releases/tag/v6.14.0)

[Compare Source](https://redirect.github.com/docker/build-push-action/compare/v6.13.0...v6.14.0)

-   Bump [@&#8203;docker/actions-toolkit](https://redirect.github.com/docker/actions-toolkit) from 0.53.0 to 0.55.0 in [https://github.com/docker/build-push-action/pull/1324](https://redirect.github.com/docker/build-push-action/pull/1324)

**Full Changelog**: https://github.com/docker/build-push-action/compare/v6.13.0...v6.14.0

### [`v6.13.0`](https://redirect.github.com/docker/build-push-action/releases/tag/v6.13.0)

[Compare Source](https://redirect.github.com/docker/build-push-action/compare/v6.12.0...v6.13.0)

-   Bump [@&#8203;docker/actions-toolkit](https://redirect.github.com/docker/actions-toolkit) from 0.51.0 to 0.53.0 in [https://github.com/docker/build-push-action/pull/1308](https://redirect.github.com/docker/build-push-action/pull/1308)

**Full Changelog**: https://github.com/docker/build-push-action/compare/v6.12.0...v6.13.0

### [`v6.12.0`](https://redirect.github.com/docker/build-push-action/releases/tag/v6.12.0)

[Compare Source](https://redirect.github.com/docker/build-push-action/compare/v6.11.0...v6.12.0)

-   Bump [@&#8203;docker/actions-toolkit](https://redirect.github.com/docker/actions-toolkit) from 0.49.0 to 0.51.0 in [https://github.com/docker/build-push-action/pull/1300](https://redirect.github.com/docker/build-push-action/pull/1300)

**Full Changelog**: https://github.com/docker/build-push-action/compare/v6.11.0...v6.12.0

### [`v6.11.0`](https://redirect.github.com/docker/build-push-action/releases/tag/v6.11.0)

[Compare Source](https://redirect.github.com/docker/build-push-action/compare/v6.10.0...v6.11.0)

-   Handlebar `defaultContext` support for `build-contexts` input by [@&#8203;crazy-max](https://redirect.github.com/crazy-max) in [https://github.com/docker/build-push-action/pull/1283](https://redirect.github.com/docker/build-push-action/pull/1283)
-   Bump [@&#8203;docker/actions-toolkit](https://redirect.github.com/docker/actions-toolkit) from 0.46.0 to 0.49.0 in [https://github.com/docker/build-push-action/pull/1281](https://redirect.github.com/docker/build-push-action/pull/1281)

**Full Changelog**: https://github.com/docker/build-push-action/compare/v6.10.0...v6.11.0

</details>

<details>
<summary>docker/login-action (docker/login-action)</summary>

### [`v3.4.0`](https://redirect.github.com/docker/login-action/releases/tag/v3.4.0)

[Compare Source](https://redirect.github.com/docker/login-action/compare/v3.3.0...v3.4.0)

-   Bump [@&#8203;actions/core](https://redirect.github.com/actions/core) from 1.10.1 to 1.11.1 in [https://github.com/docker/login-action/pull/791](https://redirect.github.com/docker/login-action/pull/791)
-   Bump [@&#8203;aws-sdk/client-ecr](https://redirect.github.com/aws-sdk/client-ecr) to 3.766.0 in [https://github.com/docker/login-action/pull/789](https://redirect.github.com/docker/login-action/pull/789) [https://github.com/docker/login-action/pull/856](https://redirect.github.com/docker/login-action/pull/856)
-   Bump [@&#8203;aws-sdk/client-ecr-public](https://redirect.github.com/aws-sdk/client-ecr-public) to 3.758.0 in [https://github.com/docker/login-action/pull/789](https://redirect.github.com/docker/login-action/pull/789) [https://github.com/docker/login-action/pull/856](https://redirect.github.com/docker/login-action/pull/856)
-   Bump [@&#8203;docker/actions-toolkit](https://redirect.github.com/docker/actions-toolkit) from 0.35.0 to 0.57.0 in [https://github.com/docker/login-action/pull/801](https://redirect.github.com/docker/login-action/pull/801) [https://github.com/docker/login-action/pull/806](https://redirect.github.com/docker/login-action/pull/806) [https://github.com/docker/login-action/pull/858](https://redirect.github.com/docker/login-action/pull/858)
-   Bump cross-spawn from 7.0.3 to 7.0.6 in [https://github.com/docker/login-action/pull/814](https://redirect.github.com/docker/login-action/pull/814)
-   Bump https-proxy-agent from 7.0.5 to 7.0.6 in [https://github.com/docker/login-action/pull/823](https://redirect.github.com/docker/login-action/pull/823)
-   Bump path-to-regexp from 6.2.2 to 6.3.0 in [https://github.com/docker/login-action/pull/777](https://redirect.github.com/docker/login-action/pull/777)

**Full Changelog**: https://github.com/docker/login-action/compare/v3.3.0...v3.4.0

</details>

<details>
<summary>docker/metadata-action (docker/metadata-action)</summary>

### [`v5.7.0`](https://redirect.github.com/docker/metadata-action/releases/tag/v5.7.0)

[Compare Source](https://redirect.github.com/docker/metadata-action/compare/v5.6.1...v5.7.0)

-   Global expressions support for labels and annotations by [@&#8203;crazy-max](https://redirect.github.com/crazy-max) in [https://github.com/docker/metadata-action/pull/489](https://redirect.github.com/docker/metadata-action/pull/489)
-   Support disabling outputs as environment variables by [@&#8203;omus](https://redirect.github.com/omus) in [https://github.com/docker/metadata-action/pull/497](https://redirect.github.com/docker/metadata-action/pull/497)
-   Bump [@&#8203;docker/actions-toolkit](https://redirect.github.com/docker/actions-toolkit) from 0.44.0 to 0.56.0 in [https://github.com/docker/metadata-action/pull/507](https://redirect.github.com/docker/metadata-action/pull/507) [https://github.com/docker/metadata-action/pull/509](https://redirect.github.com/docker/metadata-action/pull/509)
-   Bump csv-parse from 5.5.6 to 5.6.0 in [https://github.com/docker/metadata-action/pull/482](https://redirect.github.com/docker/metadata-action/pull/482)
-   Bump moment-timezone from 0.5.46 to 0.5.47 in [https://github.com/docker/metadata-action/pull/501](https://redirect.github.com/docker/metadata-action/pull/501)
-   Bump semver from 7.6.3 to 7.7.1 in [https://github.com/docker/metadata-action/pull/504](https://redirect.github.com/docker/metadata-action/pull/504)

**Full Changelog**: https://github.com/docker/metadata-action/compare/v5.6.1...v5.7.0

</details>

<details>
<summary>docker/setup-buildx-action (docker/setup-buildx-action)</summary>

### [`v3.10.0`](https://redirect.github.com/docker/setup-buildx-action/releases/tag/v3.10.0)

[Compare Source](https://redirect.github.com/docker/setup-buildx-action/compare/v3.9.0...v3.10.0)

-   Bump [@&#8203;docker/actions-toolkit](https://redirect.github.com/docker/actions-toolkit) from 0.54.0 to 0.56.0 in [https://github.com/docker/setup-buildx-action/pull/408](https://redirect.github.com/docker/setup-buildx-action/pull/408)

**Full Changelog**: https://github.com/docker/setup-buildx-action/compare/v3.9.0...v3.10.0

### [`v3.9.0`](https://redirect.github.com/docker/setup-buildx-action/releases/tag/v3.9.0)

[Compare Source](https://redirect.github.com/docker/setup-buildx-action/compare/v3.8.0...v3.9.0)

-   Bump [@&#8203;docker/actions-toolkit](https://redirect.github.com/docker/actions-toolkit) from 0.48.0 to 0.54.0 in [https://github.com/docker/setup-buildx-action/pull/402](https://redirect.github.com/docker/setup-buildx-action/pull/402) [https://github.com/docker/setup-buildx-action/pull/404](https://redirect.github.com/docker/setup-buildx-action/pull/404)

**Full Changelog**: https://github.com/docker/setup-buildx-action/compare/v3.8.0...v3.9.0

</details>

<details>
<summary>sigstore/cosign-installer (sigstore/cosign-installer)</summary>

### [`v3.8.1`](https://redirect.github.com/sigstore/cosign-installer/releases/tag/v3.8.1)

[Compare Source](https://redirect.github.com/sigstore/cosign-installer/compare/v3.8.0...v3.8.1)

##### What's Changed

-   use cosign 2.4.3 and other updates by [@&#8203;cpanato](https://redirect.github.com/cpanato) in [https://github.com/sigstore/cosign-installer/pull/182](https://redirect.github.com/sigstore/cosign-installer/pull/182)

**Full Changelog**: https://github.com/sigstore/cosign-installer/compare/v3...v3.8.1

### [`v3.8.0`](https://redirect.github.com/sigstore/cosign-installer/releases/tag/v3.8.0)

[Compare Source](https://redirect.github.com/sigstore/cosign-installer/compare/v3.7.0...v3.8.0)

##### What's Changed

-   test action against all non-rc releases, verify entry in rekor log by [@&#8203;bobcallaway](https://redirect.github.com/bobcallaway) in [https://github.com/sigstore/cosign-installer/pull/179](https://redirect.github.com/sigstore/cosign-installer/pull/179)
-   bump for cosign v2.4.2 release by [@&#8203;bobcallaway](https://redirect.github.com/bobcallaway) in [https://github.com/sigstore/cosign-installer/pull/181](https://redirect.github.com/sigstore/cosign-installer/pull/181)

**Full Changelog**: https://github.com/sigstore/cosign-installer/compare/v3...v3.8.0

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "on monday" in timezone Europe/Berlin, Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

👻 **Immortal**: This PR will be recreated if closed unmerged. Get [config help](https://redirect.github.com/renovatebot/renovate/discussions) if that's undesired.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOS44Mi4yIiwidXBkYXRlZEluVmVyIjoiMzkuMjAwLjMiLCJ0YXJnZXRCcmFuY2giOiJtYWluIiwibGFiZWxzIjpbInR5cGUvbWlub3IiLCJ1cGRhdGUvZ2l0aHViLWFjdGlvbiJdfQ==-->



Patch:
diff --git a/.github/actions/manager-image/action.yaml b/.github/actions/manager-image/action.yaml
index c5ef5c10..b72765f8 100644
--- a/.github/actions/manager-image/action.yaml
+++ b/.github/actions/manager-image/action.yaml
@@ -8,10 +8,10 @@ runs:
   using: "composite"
   steps:
     - name: Set up Docker Buildx
-      uses: docker/setup-buildx-action@6524bf65af31da8d45b59e8c27de4bd072b392f5 # v3.8.0
+      uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3.10.0
 
     - name: Login to ghcr.io for CI
-      uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
+      uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0
       with:
         registry: ghcr.io
         username: ${{ github.actor }}
@@ -44,7 +44,7 @@ runs:
 
     # Import GitHub's cache build to docker cache
     - name: Copy Caph Golang cache to docker cache
-      uses: docker/build-push-action@48aba3b46d1b1fec4febb7c5d0c644b249a11355 # v6.10.0
+      uses: docker/build-push-action@471d1dc4e07e5cdedd4c2171150001c434f0b7a4 # v6.15.0
       with:
         provenance: false
         context: /tmp/.cache/caph
@@ -54,7 +54,7 @@ runs:
         target: import-cache
 
     - name: Build and push manager image
-      uses: docker/build-push-action@48aba3b46d1b1fec4febb7c5d0c644b249a11355 # v6
+      uses: docker/build-push-action@471d1dc4e07e5cdedd4c2171150001c434f0b7a4 # v6
       with:
         provenance: false
         context: .
diff --git a/.github/actions/metadata/action.yaml b/.github/actions/metadata/action.yaml
index bf951c4e..bac9663e 100644
--- a/.github/actions/metadata/action.yaml
+++ b/.github/actions/metadata/action.yaml
@@ -22,7 +22,7 @@ runs:
   steps:
     - name: Docker manager metadata
       id: meta
-      uses: docker/metadata-action@369eb591f429131d6889c46b94e711f089e6ca96 # v5.6.1
+      uses: docker/metadata-action@902fa8ec7d6ecbf8d84d538b9b233a880e428804 # v5.7.0
       with:
         images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
         flavor: ${{ inputs.metadata_flavor }}
diff --git a/.github/actions/setup-go/action.yaml b/.github/actions/setup-go/action.yaml
index 1cf5c9ec..fd3155f9 100644
--- a/.github/actions/setup-go/action.yaml
+++ b/.github/actions/setup-go/action.yaml
@@ -4,7 +4,7 @@ runs:
   using: "composite"
   steps:
     - name: Install go
-      uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0
+      uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0
       with:
         go-version-file: "go.mod"
         cache: true
@@ -15,14 +15,14 @@ runs:
         echo "go-build=$(go env GOCACHE)" >> $GITHUB_OUTPUT
         echo "go-mod=$(go env GOMODCACHE)" >> $GITHUB_OUTPUT
     - name: Go Mod Cache
-      uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4
+      uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf # v4
       with:
         path: ${{ steps.go-cache-paths.outputs.go-mod }}
         key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}
         restore-keys: |
           ${{ runner.os }}-go-mod-
     - name: Go Build Cache
-      uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4
+      uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf # v4
       with:
         path: ${{ steps.go-cache-paths.outputs.go-build }}
         key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 7002f618..df926e0e 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -33,9 +33,9 @@ jobs:
           fetch-depth: 0
       - uses: ./.github/actions/setup-go
       - name: Set up QEMU
-        uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf # v3
+        uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3
       - name: Set up Docker Buildx
-        uses: docker/setup-buildx-action@6524bf65af31da8d45b59e8c27de4bd072b392f5 # v3
+        uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3
 
       - name: Generate metadata
         id: meta
@@ -45,14 +45,14 @@ jobs:
           metadata_tags: ${{ env.metadata_tags }}
 
       - name: Login to ghcr.io for CI
-        uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
+        uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0
         with:
           registry: ghcr.io
           username: ${{ github.actor }}
           password: ${{ secrets.GITHUB_TOKEN }}
 
       - name: Install Cosign
-        uses: sigstore/cosign-installer@dc72c7d5c4d10cd6bcb8cf6e3fd625a9e5e537da # v3.7.0
+        uses: sigstore/cosign-installer@d7d6bc7722e3daa8354c50bcb52f4837da5e9b6a # v3.8.1
 
       - name: Install Bom
         shell: bash
@@ -88,7 +88,7 @@ jobs:
 
       # Import GitHub's cache build to docker cache
       - name: Copy Caph Golang cache to docker cache
-        uses: docker/build-push-action@48aba3b46d1b1fec4febb7c5d0c644b249a11355 # v6.10.0
+        uses: docker/build-push-action@471d1dc4e07e5cdedd4c2171150001c434f0b7a4 # v6.15.0
         with:
           provenance: false
           context: /tmp/.cache/caph
@@ -98,7 +98,7 @@ jobs:
           target: import-cache
 
       - name: Build and push manager image
-        uses: docker/build-push-action@48aba3b46d1b1fec4febb7c5d0c644b249a11355 # v6
+        uses: docker/build-push-action@471d1dc4e07e5cdedd4c2171150001c434f0b7a4 # v6
         id: docker_build_release
         with:
           provenance: false
@@ -141,7 +141,7 @@ jobs:
 
       # Upload artifact digests
       - name: Upload artifact digests
-        uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
+        uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1
         with:
           name: image-digest caph
           path: image-digest
@@ -150,7 +150,7 @@ jobs:
       # Store docker's golang's cache build locally only on the main branch
       - name: Store Caph Golang cache build locally
         if: ${{ steps.cache.outputs.cache-hit != 'true' }}
-        uses: docker/build-push-action@48aba3b46d1b1fec4febb7c5d0c644b249a11355 # v6.10.0
+        uses: docker/build-push-action@471d1dc4e07e5cdedd4c2171150001c434f0b7a4 # v6.15.0
         with:
           provenance: false
           context: .
diff --git a/.github/workflows/pr-verify.yml b/.github/workflows/pr-verify.yml
index 7c20643a..dd3fc597 100644
--- a/.github/workflows/pr-verify.yml
+++ b/.github/workflows/pr-verify.yml
@@ -28,7 +28,7 @@ jobs:
       - name: Verify Starlark
         run: make verify-starlark
 
-      - uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4
+      - uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4
         with:
           node-version: "18"
       - name: Install renovate
@@ -41,7 +41,7 @@ jobs:
           done
 
       - name: Generate Token
-        uses: actions/create-github-app-token@5d869da34e18e7287c1daad50e0b8ea0f506ce69 # v1
+        uses: actions/create-github-app-token@21cfef2b496dd8ef5b904c159339626a10ad380e # v1
         id: generate-token
         with:
           app-id: ${{ secrets.SYSELF_APP_ID }}
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index c23a5c45..3d6f5c2f 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -24,9 +24,9 @@ jobs:
           fetch-depth: 0
       - uses: ./.github/actions/setup-go
       - name: Set up QEMU
-        uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf # v3
+        uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3
       - name: Set up Docker Buildx
-        uses: docker/setup-buildx-action@6524bf65af31da8d45b59e8c27de4bd072b392f5 # v3
+        uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3
 
       - name: Generate metadata
         id: meta
@@ -36,14 +36,14 @@ jobs:
           metadata_tags: ${{ env.metadata_tags }}
 
       - name: Login to ghcr.io for CI
-        uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
+        uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0
         with:
           registry: ghcr.io
           username: ${{ github.actor }}
           password: ${{ secrets.GITHUB_TOKEN }}
 
       - name: Install Cosign
-        uses: sigstore/cosign-installer@dc72c7d5c4d10cd6bcb8cf6e3fd625a9e5e537da # v3.7.0
+        uses: sigstore/cosign-installer@d7d6bc7722e3daa8354c50bcb52f4837da5e9b6a # v3.8.1
 
       - name: Install Bom
         shell: bash
@@ -60,7 +60,7 @@ jobs:
           echo 'EOF' >> $GITHUB_ENV
 
       - name: Build and push manager image
-        uses: docker/build-push-action@48aba3b46d1b1fec4febb7c5d0c644b249a11355 # v6
+        uses: docker/build-push-action@471d1dc4e07e5cdedd4c2171150001c434f0b7a4 # v6
         id: docker_build_release
         with:
           provenance: false
@@ -107,7 +107,7 @@ jobs:
 
       # Upload artifact digests
       - name: Upload artifact digests
-        uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
+        uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1
         with:
           name: image-digest caph
           path: image-digest
@@ -132,7 +132,7 @@ jobs:
         with:
           fetch-depth: 0
       - name: Install go
-        uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0
+        uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0
         with:
           go-version-file: "go.mod"
           cache: true
@@ -147,7 +147,7 @@ jobs:
         run: |
           make release-notes
       - name: Release
-        uses: softprops/action-gh-release@e7a8f85e1c67a31e6ed99a94b41bd0b71bbee6b8 # v2
+        uses: softprops/action-gh-release@c95fe1489396fe8a9eb87c0abf8aa5b2ef267fda # v2
         with:
           draft: true
           files: out/*
diff --git a/.github/workflows/report-bin-size.yml b/.github/workflows/report-bin-size.yml
index e5e4d84b..26398425 100644
--- a/.github/workflows/report-bin-size.yml
+++ b/.github/workflows/report-bin-size.yml
@@ -16,7 +16,7 @@ jobs:
         run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
 
       - name: Install go
-        uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0
+        uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0
         with:
           go-version-file: "go.mod"
           cache: true
@@ -26,7 +26,7 @@ jobs:
         run: make caph report-binsize-treemap-all
 
       - name: Upload Report
-        uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
+        uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1
         with:
           name: reports-${{ github.sha }}
           path: .reports
diff --git a/.github/workflows/schedule-update-bot.yaml b/.github/workflows/schedule-update-bot.yaml
index 4c0b8121..442f5a98 100644
--- a/.github/workflows/schedule-update-bot.yaml
+++ b/.github/workflows/schedule-update-bot.yaml
@@ -33,7 +33,7 @@ jobs:
         uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
 
       - name: Generate Token
-        uses: actions/create-github-app-token@5d869da34e18e7287c1daad50e0b8ea0f506ce69 # v1
+        uses: actions/create-github-app-token@21cfef2b496dd8ef5b904c159339626a10ad380e # v1
         id: generate-token
         with:
           app-id: ${{ secrets.SYSELF_APP_ID }}
diff --git a/api/v1beta1/conditions_const.go b/api/v1beta1/conditions_const.go
index 57c9d9d2..5d4aeee4 100644
--- a/api/v1beta1/conditions_const.go
+++ b/api/v1beta1/conditions_const.go
@@ -189,14 +189,6 @@ const (
 	CheckDiskFailedReason = "CheckDiskFailed"
 )
 
-const (
-	// SSHAfterInstallImageSucceededCondition indicates that the host is reachable via ssh after installImage.
-	SSHAfterInstallImageSucceededCondition clusterv1.ConditionType = "SSHAfterInstallImageSucceeded"
-
-	// SSHAfterInstallImageFailedReason indicates that the host was not reachable via ssh.
-	SSHAfterInstallImageFailedReason = "SSHAfterInstallImageFailed"
-)
-
 const (
 	// HostAssociateSucceededCondition indicates that a host has been associated.
 	HostAssociateSucceededCondition clusterv1.ConditionType = "HostAssociateSucceeded"
diff --git a/api/v1beta1/hetznerbaremetalhost_types.go b/api/v1beta1/hetznerbaremetalhost_types.go
index 496f3fff..bd74c0f6 100644
--- a/api/v1beta1/hetznerbaremetalhost_types.go
+++ b/api/v1beta1/hetznerbaremetalhost_types.go
@@ -161,6 +161,9 @@ const (
 	// StateRegistering means we are getting hardware details.
 	StateRegistering ProvisioningState = "registering"
 
+	// StatePreProvisioning means we run the pre-provisioning-command (if given).
+	StatePreProvisioning ProvisioningState = "pre-provisioning"
+
 	// StateImageInstalling means we install a new image.
 	StateImageInstalling ProvisioningState = "image-installing"
 
diff --git a/controllers/hetznerbaremetalhost_controller.go b/controllers/hetznerbaremetalhost_controller.go
index 145b2d09..13ccfd8f 100644
--- a/controllers/hetznerbaremetalhost_controller.go
+++ b/controllers/hetznerbaremetalhost_controller.go
@@ -52,11 +52,12 @@ import (
 // HetznerBareMetalHostReconciler reconciles a HetznerBareMetalHost object.
 type HetznerBareMetalHostReconciler struct {
 	client.Client
-	RateLimitWaitTime  time.Duration
-	APIReader          client.Reader
-	RobotClientFactory robotclient.Factory
-	SSHClientFactory   sshclient.Factory
-	WatchFilterValue   string
+	RateLimitWaitTime   time.Duration
+	APIReader           client.Reader
+	RobotClientFactory  robotclient.Factory
+	SSHClientFactory    sshclient.Factory
+	WatchFilterValue    string
+	PreProvisionCommand string
 }
 
 //+kubebuilder:rbac:groups=infrastructure.cluster.x-k8s.io,resources=hetznerbaremetalhosts,verbs=get;list;watch;create;update;patch;delete
@@ -200,6 +201,7 @@ func (r *HetznerBareMetalHostReconciler) Reconcile(ctx context.Context, req ctrl
 		OSSSHSecret:             osSSHSecret,
 		RescueSSHSecret:         rescueSSHSecret,
 		SecretManager:           secretManager,
+		PreProvisionCommand:     r.PreProvisionCommand,
 	})
 	if err != nil {
 		return reconcile.Result{}, fmt.Errorf("failed to create scope: %w", err)
diff --git a/docs/README.md b/docs/README.md
index 087cb30e..ef32fee9 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -34,3 +34,4 @@ This is the official documentation of Cluster API Provider Hetzner. Before start
 - [Tilt](/docs/caph/04-developers/02-tilt.md)
 - [Releasing](/docs/caph/04-developers/03-releasing.md)
 - [Updating Kubernetes version](/docs/caph/04-developers/04-updating-kubernetes-version.md)
+- [pre-provision-command](/docs/caph/04-developers/05-pre-provision-command.md)
diff --git a/docs/caph/04-developers/05-pre-provision-command.md b/docs/caph/04-developers/05-pre-provision-command.md
new file mode 100644
index 00000000..c015eb57
--- /dev/null
+++ b/docs/caph/04-developers/05-pre-provision-command.md
@@ -0,0 +1,75 @@
+---
+title: pre-provision-command
+metatitle: Cluster API Provider Hetzner Check Bare Metal Server before Provisioning
+sidebar: pre-provision-command
+description: Documentation on the CAPH pre-provision-command.
+---
+
+The `--pre-provision-command` for the caph controller can be used to execute a custom command
+before install-image starts.
+
+This provides you a flexible way to check if the bare metal server is healthy.
+
+Example:
+
+```sh
+--pre-provision-command=/shared/my-pre-provision-command.sh
+```
+
+The script/binary will be copied into the Hetzner Rescue System and executed.
+
+If the exit code is zero, then all is fine.
+
+If the exit code is non-zero, then provisioning of that machine will be stopped.
+
+The CAPH controller runs in a Kubernetes Pod. The container of that pod needs access to the file.
+
+There are several ways to make this command available:
+
+* You could mount a configMap/secret.
+* You create a container image, and use that as init-container.
+* You build a custom image of CAPH. We do not recommend that.
+
+In this example we use an init-container to provide the script.
+
+In the directory `images/pre-provision-command/` you see these files:
+
+* my-pre-provision-command.sh: A simple Bash script which creates a message and exists with 0.
+* Dockerfile: Needed to create a container image.
+* build-and-push.sh: A script to build and upload the script to a container registry.
+
+When the container image was uploaded, you need to adapt the CAPH deployment:
+
+```yaml
+
+      # Init container, which makes the command available to caph.
+      initContainers:
+      - command:
+        - /bin/sh
+        - -c
+        - cp /my-pre-provision-command.sh /shared/
+        image: ghcr.io/syself/caph-staging:pre-provision-command
+        imagePullPolicy: Always
+        name: init-container
+        resources: {}
+        terminationMessagePath: /dev/termination-log
+        terminationMessagePolicy: File
+        volumeMounts:
+        - mountPath: /shared
+          name: shared
+
+
+      # Add this to the args of the caph container:
+        args:
+        - --pre-provision-command=/shared/my-pre-provision-command.sh
+
+        # Add this to the caph container
+        volumeMounts:
+        - mountPath: /shared
+          name: shared
+
+      # Add this after "container"
+      volumes:
+      - emptyDir: {}
+        name: shared
+```
diff --git a/go.mod b/go.mod
index 7c520e80..0eaf1506 100644
--- a/go.mod
+++ b/go.mod
@@ -4,6 +4,7 @@ go 1.22.6
 
 require (
 	github.com/blang/semver/v4 v4.0.0
+	github.com/bramvdbogaerde/go-scp v1.5.0
 	github.com/go-logr/logr v1.4.2
 	github.com/go-logr/zapr v1.3.0
 	github.com/hetznercloud/hcloud-go/v2 v2.13.1
diff --git a/go.sum b/go.sum
index 5c829868..0992db1c 100644
--- a/go.sum
+++ b/go.sum
@@ -26,6 +26,8 @@ github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
 github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
 github.com/blang/semver/v4 v4.0.0 h1:1PFHFE6yCCTv8C1TeyNNarDzntLi7wMI5i/pzqYIsAM=
 github.com/blang/semver/v4 v4.0.0/go.mod h1:IbckMUScFkM3pff0VJDNKRiT6TG/YpiHIM2yvyW5YoQ=
+github.com/bramvdbogaerde/go-scp v1.5.0 h1:a9BinAjTfQh273eh7vd3qUgmBC+bx+3TRDtkZWmIpzM=
+github.com/bramvdbogaerde/go-scp v1.5.0/go.mod h1:on2aH5AxaFb2G0N5Vsdy6B0Ml7k9HuHSwfo1y0QzAbQ=
 github.com/bwesterb/go-ristretto v1.2.0/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0=
 github.com/cenkalti/backoff/v4 v4.2.1 h1:y4OZtCnogmCPw98Zjyt5a6+QwPLGkiQsYW5oUqylYbM=
 github.com/cenkalti/backoff/v4 v4.2.1/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE=
diff --git a/hack/update-operator-dev-deployment.sh b/hack/update-operator-dev-deployment.sh
new file mode 100755
index 00000000..0e494594
--- /dev/null
+++ b/hack/update-operator-dev-deployment.sh
@@ -0,0 +1,89 @@
+#!/usr/bin/env bash
+# Copyright 2025 The Kubernetes Authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# This scripts updates the caph deployment in a mgt-cluster. Be sure to be connected to
+# a development cluster.
+# It takes the current code, creates a new image and updates the deployment.
+# By default the image will be uploaded to:
+# ghcr.io/syself/caph-staging:dev-$USER-YOUR_GIT_BRANCH
+# You can change the image path with the --image-path flag, if you want to use a different registry.
+
+# Usually it is better to write a test, than to use this script.
+
+trap 'echo "Warning: A command has failed. Exiting the script. Line was ($0:$LINENO): $(sed -n "${LINENO}p" "$0")"; exit 3' ERR
+set -Eeuo pipefail
+
+image_path="ghcr.io/syself"
+
+while [[ "$#" -gt 0 ]]; do
+    case $1 in
+    --image-path)
+        image_path="$2"
+        shift
+        ;;
+    *)
+        echo "Unknown parameter passed: $1"
+        exit 1
+        ;;
+    esac
+    shift
+done
+
+# remove trailing slash
+image_path="${image_path%/}"
+
+if ! kubectl cluster-info >/dev/null; then
+    echo
+    echo "No kubernetes cluster found."
+    echo "You can use alm to create a mgt-cluster"
+    echo "docs: https://github.com/syself/autopilot-lifecycle-manager"
+    exit 1
+fi
+
+branch=$(git branch --show-current)
+if [ "$branch" == "" ]; then
+    echo "failed to get branch name"
+    exit 1
+fi
+
+tag="dev-$USER-$branch"
+tag="$(echo -n "$tag" | tr -c 'a-zA-Z0-9_.-' '-')"
+
+image="$image_path/caph-staging:$tag"
+
+echo "Building image: $image"
+
+docker build -f images/caph/Dockerfile -t "$image" .
+
+docker push "$image"
+
+# Note: Up to now changes in the CRD are not supported by this script.
+
+kubectl scale --replicas=1 -n mgt-system deployment/caph-controller-manager
+
+kubectl set image -n mgt-system deployment/caph-controller-manager manager="$image"
+
+kubectl patch deployment -n mgt-system -p '[{"op": "replace", "path": "/spec/template/spec/containers/0/imagePullPolicy", "value": "Always"}]' --type='json' caph-controller-manager
+
+kubectl rollout restart -n mgt-system deployment caph-controller-manager
+
+trap "echo 'Interrupted! Exiting...'; exit 1" SIGINT
+
+while ! kubectl rollout status deployment --timeout=3s -n mgt-system caph-controller-manager; do
+    echo "Rollout failed"
+    kubectl events -n mgt-system | grep caph-controller-manager | tail -n 5
+    echo
+    echo
+done
diff --git a/images/pre-provision-command/Dockerfile b/images/pre-provision-command/Dockerfile
new file mode 100644
index 00000000..0d896551
--- /dev/null
+++ b/images/pre-provision-command/Dockerfile
@@ -0,0 +1,17 @@
+# Copyright 2025 The Kubernetes Authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+FROM bash
+COPY ./my-pre-provision-command.sh /my-pre-provision-command.sh
+RUN chmod +x /my-pre-provision-command.sh
diff --git a/images/pre-provision-command/build-and-push.sh b/images/pre-provision-command/build-and-push.sh
new file mode 100755
index 00000000..a5e0f20f
--- /dev/null
+++ b/images/pre-provision-command/build-and-push.sh
@@ -0,0 +1,27 @@
+#!/usr/bin/env bash
+# Copyright 2025 The Kubernetes Authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# This script builds and pushed the container image for the init-container.
+# See README.md for more information.
+
+# Bash Strict Mode: https://github.com/guettli/bash-strict-mode
+trap 'echo "Warning: A command has failed. Exiting the script. Line was ($0:$LINENO): $(sed -n "${LINENO}p" "$0")"; exit 3' ERR
+set -Eeuo pipefail
+
+DIR="$(dirname "$0")"
+
+docker build -t ghcr.io/syself/caph-staging:pre-provision-command "$DIR"
+
+docker push ghcr.io/syself/caph-staging:pre-provision-command
diff --git a/images/pre-provision-command/my-pre-provision-command.sh b/images/pre-provision-command/my-pre-provision-command.sh
new file mode 100644
index 00000000..d6a67725
--- /dev/null
+++ b/images/pre-provision-command/my-pre-provision-command.sh
@@ -0,0 +1,17 @@
+#!/usr/bin/env bash
+# Copyright 2025 The Kubernetes Authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+echo "dummy script for caph --pre-provision-command. All is fine."
+exit 0
diff --git a/main.go b/main.go
index 789cf0d2..5141f903 100644
--- a/main.go
+++ b/main.go
@@ -18,9 +18,12 @@ limitations under the License.
 package main
 
 import (
+	"errors"
 	"flag"
 	"fmt"
 	"os"
+	"path/filepath"
+	"regexp"
 	"sync"
 	"time"
 
@@ -52,6 +55,10 @@ import (
 var (
 	scheme   = runtime.NewScheme()
 	setupLog = ctrl.Log.WithName("setup")
+
+	// We do not want filenames to start with a dot or a number.
+	// Only lowercase letters are allowed.
+	preProvisionCommandRegex = regexp.MustCompile(`^[a-z][a-z0-9_.-]+[a-z0-9]$`)
 )
 
 func init() {
@@ -77,6 +84,7 @@ var (
 	logLevel                           string
 	syncPeriod                         time.Duration
 	rateLimitWaitTime                  time.Duration
+	preProvisionCommand                string
 )
 
 func main() {
@@ -96,12 +104,28 @@ func main() {
 	fs.DurationVar(&syncPeriod, "sync-period", 3*time.Minute, "The minimum interval at which watched resources are reconciled (e.g. 3m)")
 	fs.DurationVar(&rateLimitWaitTime, "rate-limit", 5*time.Minute, "The rate limiting for HCloud controller (e.g. 5m)")
 	fs.BoolVar(&hcloudclient.DebugAPICalls, "debug-hcloud-api-calls", false, "Debug all calls to the hcloud API.")
-
+	fs.StringVar(&preProvisionCommand, "pre-provision-command", "", "Command to run (in rescue-system) before installing the image on bare metal servers. You can use that to check if the machine is healthy before installing the image. If the exit value is non-zero, the machine is considered unhealthy. This command must be accessible by the controller pod. You can use an initContainer to copy the command to a shared emptyDir.")
 	pflag.CommandLine.AddGoFlagSet(flag.CommandLine)
 	pflag.Parse()
 
 	ctrl.SetLogger(utils.GetDefaultLogger(logLevel))
 
+	// If preProvisionCommand is set, check if the file exists and validate the basename.
+	if preProvisionCommand != "" {
+		baseName := filepath.Base(preProvisionCommand)
+		if !preProvisionCommandRegex.MatchString(baseName) {
+			msg := fmt.Sprintf("basename of pre-provision-command (%s) must match the regex %s", baseName, preProvisionCommandRegex.String())
+			setupLog.Error(errors.New(msg), "")
+			os.Exit(1)
+		}
+
+		_, err := os.Stat(preProvisionCommand)
+		if err != nil {
+			setupLog.Error(err, "pre-provision-command not found")
+			os.Exit(1)
+		}
+	}
+
 	var watchNamespaces map[string]cache.Config
 	if watchNamespace != "" {
 		watchNamespaces = map[string]cache.Config{
@@ -179,12 +203,13 @@ func main() {
 	}
 
 	if err = (&controllers.HetznerBareMetalHostReconciler{
-		Client:             mgr.GetClient(),
-		RobotClientFactory: robotclient.NewFactory(),
-		SSHClientFactory:   sshclient.NewFactory(),
-		APIReader:          mgr.GetAPIReader(),
-		RateLimitWaitTime:  rateLimitWaitTime,
-		WatchFilterValue:   watchFilterValue,
+		Client:              mgr.GetClient(),
+		RobotClientFactory:  robotclient.NewFactory(),
+		SSHClientFactory:    sshclient.NewFactory(),
+		APIReader:           mgr.GetAPIReader(),
+		RateLimitWaitTime:   rateLimitWaitTime,
+		WatchFilterValue:    watchFilterValue,
+		PreProvisionCommand: preProvisionCommand,
 	}).SetupWithManager(ctx, mgr, controller.Options{MaxConcurrentReconciles: hetznerBareMetalHostConcurrency}); err != nil {
 		setupLog.Error(err, "unable to create controller", "controller", "HetznerBareMetalHost")
 		os.Exit(1)
diff --git a/pkg/scope/baremetalhost.go b/pkg/scope/baremetalhost.go
index 47db535f..7aecc946 100644
--- a/pkg/scope/baremetalhost.go
+++ b/pkg/scope/baremetalhost.go
@@ -47,6 +47,7 @@ type BareMetalHostScopeParams struct {
 	OSSSHSecret             *corev1.Secret
 	RescueSSHSecret         *corev1.Secret
 	SecretManager           *secretutil.SecretManager
+	PreProvisionCommand     string
 }
 
 // NewBareMetalHostScope creates a new Scope from the supplied parameters.
@@ -91,6 +92,7 @@ func NewBareMetalHostScope(params BareMetalHostScopeParams) (*BareMetalHostScope
 		OSSSHSecret:             params.OSSSHSecret,
 		RescueSSHSecret:         params.RescueSSHSecret,
 		SecretManager:           params.SecretManager,
+		PreProvisionCommand:     params.PreProvisionCommand,
 	}, nil
 }
 
@@ -107,6 +109,7 @@ type BareMetalHostScope struct {
 	Cluster                 *clusterv1.Cluster
 	OSSSHSecret             *corev1.Secret
 	RescueSSHSecret         *corev1.Secret
+	PreProvisionCommand     string
 }
 
 // Name returns the HetznerCluster name.
diff --git a/pkg/services/baremetal/client/mocks/ssh/Client.go b/pkg/services/baremetal/client/mocks/ssh/Client.go
index 985a8012..bd444a58 100644
--- a/pkg/services/baremetal/client/mocks/ssh/Client.go
+++ b/pkg/services/baremetal/client/mocks/ssh/Client.go
@@ -490,6 +490,70 @@ func (_c *Client_ExecuteInstallImage_Call) RunAndReturn(run func(bool) sshclient
 	return _c
 }
 
+// ExecutePreProvisionCommand provides a mock function with given fields: ctx, preProvisionCommand
+func (_m *Client) ExecutePreProvisionCommand(ctx context.Context, preProvisionCommand string) (int, string, error) {
+	ret := _m.Called(ctx, preProvisionCommand)
+
+	if len(ret) == 0 {
+		panic("no return value specified for ExecutePreProvisionCommand")
+	}
+
+	var r0 int
+	var r1 string
+	var r2 error
+	if rf, ok := ret.Get(0).(func(context.Context, string) (int, string, error)); ok {
+		return rf(ctx, preProvisionCommand)
+	}
+	if rf, ok := ret.Get(0).(func(context.Context, string) int); ok {
+		r0 = rf(ctx, preProvisionCommand)
+	} else {
+		r0 = ret.Get(0).(int)
+	}
+
+	if rf, ok := ret.Get(1).(func(context.Context, string) string); ok {
+		r1 = rf(ctx, preProvisionCommand)
+	} else {
+		r1 = ret.Get(1).(string)
+	}
+
+	if rf, ok := ret.Get(2).(func(context.Context, string) error); ok {
+		r2 = rf(ctx, preProvisionCommand)
+	} else {
+		r2 = ret.Error(2)
+	}
+
+	return r0, r1, r2
+}
+
+// Client_ExecutePreProvisionCommand_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ExecutePreProvisionCommand'
+type Client_ExecutePreProvisionCommand_Call struct {
+	*mock.Call
+}
+
+// ExecutePreProvisionCommand is a helper method to define mock.On call
+//   - ctx context.Context
+//   - preProvisionCommand string
+func (_e *Client_Expecter) ExecutePreProvisionCommand(ctx interface{}, preProvisionCommand interface{}) *Client_ExecutePreProvisionCommand_Call {
+	return &Client_ExecutePreProvisionCommand_Call{Call: _e.mock.On("ExecutePreProvisionCommand", ctx, preProvisionCommand)}
+}
+
+func (_c *Client_ExecutePreProvisionCommand_Call) Run(run func(ctx context.Context, preProvisionCommand string)) *Client_ExecutePreProvisionCommand_Call {
+	_c.Call.Run(func(args mock.Arguments) {
+		run(args[0].(context.Context), args[1].(string))
+	})
+	return _c
+}
+
+func (_c *Client_ExecutePreProvisionCommand_Call) Return(exitStatus int, stdoutAndStderr string, err error) *Client_ExecutePreProvisionCommand_Call {
+	_c.Call.Return(exitStatus, stdoutAndStderr, err)
+	return _c
+}
+
+func (_c *Client_ExecutePreProvisionCommand_Call) RunAndReturn(run func(context.Context, string) (int, string, error)) *Client_ExecutePreProvisionCommand_Call {
+	_c.Call.Return(run)
+	return _c
+}
+
 // GetCloudInitOutput provides a mock function with given fields:
 func (_m *Client) GetCloudInitOutput() sshclient.Output {
 	ret := _m.Called()
diff --git a/pkg/services/baremetal/client/ssh/ssh_client.go b/pkg/services/baremetal/client/ssh/ssh_client.go
index 3cba2d60..645d07c6 100644
--- a/pkg/services/baremetal/client/ssh/ssh_client.go
+++ b/pkg/services/baremetal/client/ssh/ssh_client.go
@@ -26,11 +26,13 @@ import (
 	"errors"
 	"fmt"
 	"os"
+	"path/filepath"
 	"regexp"
 	"slices"
 	"strings"
 	"time"
 
+	scp "github.com/bramvdbogaerde/go-scp"
 	"golang.org/x/crypto/ssh"
 	ctrl "sigs.k8s.io/controller-runtime"
 )
@@ -274,6 +276,10 @@ type Client interface {
 	// CheckDisk checks the given disks via smartctl.
 	// ErrCheckDiskBrokenDisk gets returned, if a disk is broken.
 	CheckDisk(ctx context.Context, sliceOfWwns []string) (info string, err error)
+
+	// ExecutePreProvisionCommand executes a command before the provision process starts.
+	// A non-zero exit status will indicate that provisioning should not start.
+	ExecutePreProvisionCommand(ctx context.Context, preProvisionCommand string) (exitStatus int, stdoutAndStderr string, err error)
 }
 
 // Factory is the interface for creating new Client objects.
@@ -659,11 +665,11 @@ func IsTimeoutError(err error) bool {
 	return strings.Contains(err.Error(), ErrTimeout.Error())
 }
 
-func (c *sshClient) runSSH(command string) Output {
+func (c *sshClient) getSSHClient() (*ssh.Client, *ssh.ClientConfig, error) {
 	// Create the Signer for this private key.
 	signer, err := ssh.ParsePrivateKey([]byte(c.privateSSHKey))
 	if err != nil {
-		return Output{Err: fmt.Errorf("unable to parse private key: %w", err)}
+		return nil, nil, fmt.Errorf("unable to parse private key: %w", err)
 	}
 
 	config := &ssh.ClientConfig{
@@ -677,10 +683,18 @@ func (c *sshClient) runSSH(command string) Output {
 	}
 
 	// Connect to the remote server and perform the SSH handshake.
-
 	client, err := ssh.Dial("tcp", fmt.Sprintf("%s:%v", c.ip, c.port), config)
 	if err != nil {
-		return Output{Err: fmt.Errorf("failed to dial ssh. Error message: %s. DialErr: %w", err.Error(), errSSHDialFailed)}
+		return nil, nil, fmt.Errorf("failed to dial ssh. Error message: %s. DialErr: %w", err.Error(), errSSHDialFailed)
+	}
+
+	return client, config, nil
+}
+
+func (c *sshClient) runSSH(command string) Output {
+	client, _, err := c.getSSHClient()
+	if err != nil {
+		return Output{Err: err}
 	}
 	defer client.Close()
 
@@ -751,3 +765,49 @@ func removeUselessLinesFromCloudInitOutput(s string) string {
 	}
 	return strings.Join(output, "\n")
 }
+
+func (c *sshClient) ExecutePreProvisionCommand(ctx context.Context, command string) (int, string, error) {
+	client, clientConfig, err := c.getSSHClient()
+	if err != nil {
+		return 0, "", err
+	}
+	defer client.Close()
+
+	scpClient, err := scp.NewClientBySSH(client)
+	if err != nil {
+		return 0, "", fmt.Errorf("couldn't create a new scp client: %w", err)
+	}
+
+	defer scpClient.Close()
+
+	scpClient.ClientConfig = clientConfig
+	scpClient.Host = fmt.Sprintf("%s:%d", c.ip, c.port)
+
+	err = scpClient.Connect()
+	if err != nil {
+		return 0, "", fmt.Errorf("couldn't establish a connection to the remote server: %w ", err)
+	}
+
+	f, err := os.Open(command) //nolint:gosec // the variable was valided.
+	if err != nil {
+		return 0, "", fmt.Errorf("error opening file %q: %w", command, err)
+	}
+
+	baseName := filepath.Base(command)
+	dest := "/root/" + baseName
+	err = scpClient.CopyFromFile(ctx, *f, dest, "0700")
+	if err != nil {
+		return 0, "", fmt.Errorf("error copying file %q to %s:%d:%s %w", command, c.ip, c.port, dest, err)
+	}
+
+	out := c.runSSH(dest)
+	exitStatus, err := out.ExitStatus()
+	if err != nil {
+		return 0, "", fmt.Errorf("error executing %q on %s:%d: %w", dest, c.ip, c.port, err)
+	}
+
+	s := out.StdOut + "\n" + out.StdErr
+	s = strings.TrimSpace(s)
+
+	return exitStatus, s, nil
+}
diff --git a/pkg/services/baremetal/host/host.go b/pkg/services/baremetal/host/host.go
index 2d84befd..ee72cbe8 100644
--- a/pkg/services/baremetal/host/host.go
+++ b/pkg/services/baremetal/host/host.go
@@ -23,6 +23,7 @@ import (
 	"errors"
 	"fmt"
 	"os"
+	"path/filepath"
 	"reflect"
 	"slices"
 	"strconv"
@@ -579,7 +580,7 @@ func (s *Service) ensureRescueMode() error {
 }
 
 // previous: Preparing
-// next: ImageInstalling
+// next: PreProvisioning
 func (s *Service) actionRegistering(_ context.Context) actionResult {
 	markProvisionPending(s.scope.HetznerBareMetalHost, infrav1.StateRegistering)
 
@@ -706,7 +707,7 @@ func (s *Service) actionRegistering(_ context.Context) actionResult {
 
 	conditions.MarkTrue(s.scope.HetznerBareMetalHost, infrav1.RootDeviceHintsValidatedCondition)
 	s.scope.HetznerBareMetalHost.ClearError()
-	return actionComplete{} // next: ImageInstalling
+	return actionComplete{}
 }
 
 func validateRootDeviceWwnsAreSubsetOfExistingWwns(rootDeviceHints *infrav1.RootDeviceHints, storageDevices []infrav1.Storage) error {
@@ -1072,6 +1073,48 @@ func validateStdOut(stdOut string) (string, error) {
 }
 
 // previous: Registering
+// next: ImageInstalling
+func (s *Service) actionPreProvisioning(ctx context.Context) actionResult {
+	markProvisionPending(s.scope.HetznerBareMetalHost, infrav1.StatePreProvisioning)
+
+	// Ensure os ssh secret
+	sshKey, actResult := s.ensureSSHKey(s.scope.HetznerBareMetalHost.Spec.Status.SSHSpec.SecretRef, s.scope.OSSSHSecret)
+	if _, isComplete := actResult.(actionComplete); !isComplete {
+		return actResult
+	}
+	s.scope.HetznerBareMetalHost.Spec.Status.SSHStatus.OSKey = &sshKey
+
+	if s.scope.PreProvisionCommand == "" {
+		return actionComplete{}
+	}
+
+	creds := sshclient.CredentialsFromSecret(s.scope.RescueSSHSecret, s.scope.HetznerCluster.Spec.SSHKeys.RobotRescueSecretRef)
+	in := sshclient.Input{
+		PrivateKey: creds.PrivateKey,
+		Port:       rescuePort,
+		IP:         s.scope.HetznerBareMetalHost.Spec.Status.GetIPAddress(),
+	}
+	sshClient := s.scope.SSHClientFactory.NewClient(in)
+
+	exitStatus, output, err := sshClient.ExecutePreProvisionCommand(ctx, s.scope.PreProvisionCommand)
+	if err != nil {
+		return actionError{err: fmt.Errorf("failed to execute pre-provision command: %w", err)}
+	}
+
+	if exitStatus != 0 {
+		record.Warnf(s.scope.HetznerBareMetalHost, "PreProvisionCommandFailed",
+			"%s: %s", filepath.Base(s.scope.PreProvisionCommand), output)
+		s.scope.HetznerBareMetalHost.SetError(infrav1.PermanentError, output)
+		return actionStop{}
+	}
+
+	record.Eventf(s.scope.HetznerBareMetalHost, "PreProvisionCommandSucceeded",
+		"%s: %s", filepath.Base(s.scope.PreProvisionCommand), output)
+
+	return actionComplete{}
+}
+
+// previous: PreProvisioning
 // next: EnsureProvisioned
 func (s *Service) actionImageInstalling(ctx context.Context) actionResult {
 	markProvisionPending(s.scope.HetznerBareMetalHost, infrav1.StateImageInstalling)
@@ -1084,17 +1127,11 @@ func (s *Service) actionImageInstalling(ctx context.Context) actionResult {
 	}
 	sshClient := s.scope.SSHClientFactory.NewClient(in)
 
-	// Ensure os ssh secret
-	sshKey, actResult := s.ensureSSHKey(s.scope.HetznerBareMetalHost.Spec.Status.SSHSpec.SecretRef, s.scope.OSSSHSecret)
-	if _, isComplete := actResult.(actionComplete); !isComplete {
-		return actResult
-	}
-
-	s.scope.HetznerBareMetalHost.Spec.Status.SSHStatus.OSKey = &sshKey
 	state, err := sshClient.GetInstallImageState()
 	if err != nil {
 		return actionError{err: fmt.Errorf("failed to get state of installimage processes: %w", err)}
 	}
+
 	switch state {
 	case sshclient.InstallImageStateRunning:
 		s.scope.Logger.Info("installimage is still running. Checking again in some seconds.")
@@ -1338,7 +1375,7 @@ func (s *Service) actionImageInstallingFinished(_ context.Context, sshClient ssh
 
 	// clear potential errors - all done
 	s.scope.HetznerBareMetalHost.ClearError()
-	return actionComplete{} // next: ensure-provisioned
+	return actionComplete{}
 }
 
 func (s *Service) createAutoSetupInput(sshClient sshclient.Client) (autoSetupInput, actionResult) {
@@ -1577,7 +1614,7 @@ func (s *Service) actionEnsureProvisioned(_ context.Context) (ar actionResult) {
 	record.Event(s.scope.HetznerBareMetalHost, "ServerProvisioned", "server successfully provisioned")
 	conditions.MarkTrue(s.scope.HetznerBareMetalHost, infrav1.ProvisionSucceededCondition)
 	s.scope.HetznerBareMetalHost.ClearError()
-	return createEventWithCloudInitOutput(actionComplete{}) // next: actionProvisioned
+	return createEventWithCloudInitOutput(actionComplete{})
 }
 
 // handleConnectionRefused checks cloud init status via ssh to the old ssh port if the new ssh port
diff --git a/pkg/services/baremetal/host/state_machine.go b/pkg/services/baremetal/host/state_machine.go
index 96c4e23e..06064300 100644
--- a/pkg/services/baremetal/host/state_machine.go
+++ b/pkg/services/baremetal/host/state_machine.go
@@ -58,6 +58,7 @@ func (hsm *hostStateMachine) handlers() map[infrav1.ProvisioningState]stateHandl
 	return map[infrav1.ProvisioningState]stateHandler{
 		infrav1.StatePreparing:         hsm.handlePreparing,
 		infrav1.StateRegistering:       hsm.handleRegistering,
+		infrav1.StatePreProvisioning:   hsm.handlePreProvisioning,
 		infrav1.StateImageInstalling:   hsm.handleImageInstalling,
 		infrav1.StateEnsureProvisioned: hsm.handleEnsureProvisioned,
 		infrav1.StateProvisioned:       hsm.handleProvisioned,
@@ -266,8 +267,32 @@ func (hsm *hostStateMachine) handleRegistering(ctx context.Context) actionResult
 
 	actResult := hsm.reconciler.actionRegistering(ctx)
 	if _, ok := actResult.(actionComplete); ok {
+		hsm.nextState = infrav1.StatePreProvisioning
+	}
+	return actResult
+}
+
+func (hsm *hostStateMachine) handlePreProvisioning(ctx context.Context) actionResult {
+	if hsm.provisioningCancelled() {
+		hsm.nextState = infrav1.StateDeprovisioning
+		return actionComplete{}
+	}
+
+	actResult := hsm.reconciler.actionPreProvisioning(ctx)
+	switch actResult.(type) {
+	case actionComplete:
 		hsm.nextState = infrav1.StateImageInstalling
+	case actionError:
+		// re-enable rescue system. If actionPreProvisioning
+		// failed with actionError, then it is likely that
+		// the next run (without reboot) fails with this error:
+		// ERROR unmounting device(s):
+		// umount: /: target is busy.
+		// Cannot continue, device(s) seem to be in use.
+		// Please unmount used devices manually or reboot the rescue system and retry.
+		hsm.nextState = infrav1.StatePreparing
 	}
+
 	return actResult
 }
 
@@ -287,7 +312,7 @@ func (hsm *hostStateMachine) handleImageInstalling(ctx context.Context) actionRe
 		// ERROR unmounting device(s):
 		// umount: /: target is busy.
 		// Cannot continue, device(s) seem to be in use.
-		// Please unmount used devices manually or reboot the rescuesystem and retry.
+		// Please unmount used devices manually or reboot the rescue system and retry.
 		hsm.nextState = infrav1.StatePreparing
 	}
 
diff --git a/vendor/github.com/bramvdbogaerde/go-scp/.gitignore b/vendor/github.com/bramvdbogaerde/go-scp/.gitignore
new file mode 100644
index 00000000..ab27d1e8
--- /dev/null
+++ b/vendor/github.com/bramvdbogaerde/go-scp/.gitignore
@@ -0,0 +1,2 @@
+/.idea
+/vendor
\ No newline at end of file
diff --git a/vendor/github.com/bramvdbogaerde/go-scp/LICENSE.txt b/vendor/github.com/bramvdbogaerde/go-scp/LICENSE.txt
new file mode 100644
index 00000000..14e2f777
--- /dev/null
+++ b/vendor/github.com/bramvdbogaerde/go-scp/LICENSE.txt
@@ -0,0 +1,373 @@
+Mozilla Public License Version 2.0
+==================================
+
+1. Definitions
+--------------
+
+1.1. "Contributor"
+    means each individual or legal entity that creates, contributes to
+    the creation of, or owns Covered Software.
+
+1.2. "Contributor Version"
+    means the combination of the Contributions of others (if any) used
+    by a Contributor and that particular Contributor's Contribution.
+
+1.3. "Contribution"
+    means Covered Software of a particular Contributor.
+
+1.4. "Covered Software"
+    means Source Code Form to which the initial Contributor has attached
+    the notice in Exhibit A, the Executable Form of such Source Code
+    Form, and Modifications of such Source Code Form, in each case
+    including portions thereof.
+
+1.5. "Incompatible With Secondary Licenses"
+    means
+
+    (a) that the initial Contributor has attached the notice described
+        in Exhibit B to the Covered Software; or
+
+    (b) that the Covered Software was made available under the terms of
+        version 1.1 or earlier of the License, but not also under the
+        terms of a Secondary License.
+
+1.6. "Executable Form"
+    means any form of the work other than Source Code Form.
+
+1.7. "Larger Work"
+    means a work that combines Covered Software with other material, in 
+    a separate file or files, that is not Covered Software.
+
+1.8. "License"
+    means this document.
+
+1.9. "Licensable"
+    means having the right to grant, to the maximum extent possible,
+    whether at the time of the initial grant or subsequently, any and
+    all of the rights conveyed by this License.
+
+1.10. "Modifications"
+    means any of the following:
+
+    (a) any file in Source Code Form that results from an addition to,
+        deletion from, or modification of the contents of Covered
+        Software; or
+
+    (b) any new file in Source Code Form that contains any Covered
+        Software.
+
+1.11. "Patent Claims" of a Contributor
+    means any patent claim(s), including without limitation, method,
+    process, and apparatus claims, in any patent Licensable by such
+    Contributor that would be infringed, but for the grant of the
+    License, by the making, using, selling, offering for sale, having
+    made, import, or transfer of either its Contributions or its
+    Contributor Version.
+
+1.12. "Secondary License"
+    means either the GNU General Public License, Version 2.0, the GNU
+    Lesser General Public License, Version 2.1, the GNU Affero General
+    Public License, Version 3.0, or any later versions of those
+    licenses.
+
+1.13. "Source Code Form"
+    means the form of the work preferred for making modifications.
+
+1.14. "You" (or "Your")
+    means an individual or a legal entity exercising rights under this
+    License. For legal entities, "You" includes any entity that
+    controls, is controlled by, or is under common control with You. For
+    purposes of this definition, "control" means (a) the power, direct
+    or indirect, to cause the direction or management of such entity,
+    whether by contract or otherwise, or (b) ownership of more than
+    fifty percent (50%) of the outstanding shares or beneficial
+    ownership of such entity.
+
+2. License Grants and Conditions
+--------------------------------
+
+2.1. Grants
+
+Each Contributor hereby grants You a world-wide, royalty-free,
+non-exclusive license:
+
+(a) under intellectual property rights (other than patent or trademark)
+    Licensable by such Contributor to use, reproduce, make available,
+    modify, display, perform, distribute, and otherwise exploit its
+    Contributions, either on an unmodified basis, with Modifications, or
+    as part of a Larger Work; and
+
+(b) under Patent Claims of such Contributor to make, use, sell, offer
+    for sale, have made, import, and otherwise transfer either its
+    Contributions or its Contributor Version.
+
+2.2. Effective Date
+
+The licenses granted in Section 2.1 with respect to any Contribution
+become effective for each Contribution on the date the Contributor first
+distributes such Contribution.
+
+2.3. Limitations on Grant Scope
+
+The licenses granted in this Section 2 are the only rights granted under
+this License. No additional rights or licenses will be implied from the
+distribution or licensing of Covered Software under this License.
+Notwithstanding Section 2.1(b) above, no patent license is granted by a
+Contributor:
+
+(a) for any code that a Contributor has removed from Covered Software;
+    or
+
+(b) for infringements caused by: (i) Your and any other third party's
+    modifications of Covered Software, or (ii) the combination of its
+    Contributions with other software (except as part of its Contributor
+    Version); or
+
+(c) under Patent Claims infringed by Covered Software in the absence of
+    its Contributions.
+
+This License does not grant any rights in the trademarks, service marks,
+or logos of any Contributor (except as may be necessary to comply with
+the notice requirements in Section 3.4).
+
+2.4. Subsequent Licenses
+
+No Contributor makes additional grants as a result of Your choice to
+distribute the Covered Software under a subsequent version of this
+License (see Section 10.2) or under the terms of a Secondary License (if
+permitted under the terms of Section 3.3).
+
+2.5. Representation
+
+Each Contributor represents that the Contributor believes its
+Contributions are its original creation(s) or it has sufficient rights
+to grant the rights to its Contributions conveyed by this License.
+
+2.6. Fair Use
+
+This License is not intended to limit any rights You have under
+applicable copyright doctrines of fair use, fair dealing, or other
+equivalents.
+
+2.7. Conditions
+
+Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
+in Section 2.1.
+
+3. Responsibilities
+-------------------
+
+3.1. Distribution of Source Form
+
+All distribution of Covered Software in Source Code Form, including any
+Modifications that You create or to which You contribute, must be under
+the terms of this License. You must inform recipients that the Source
+Code Form of the Covered Software is governed by the terms of this
+License, and how they can obtain a copy of this License. You may not
+attempt to alter or restrict the recipients' rights in the Source Code
+Form.
+
+3.2. Distribution of Executable Form
+
+If You distribute Covered Software in Executable Form then:
+
+(a) such Covered Software must also be made available in Source Code
+    Form, as described in Section 3.1, and You must inform recipients of
+    the Executable Form how they can obtain a copy of such Source Code
+    Form by reasonable means in a timely manner, at a charge no more
+    than the cost of distribution to the recipient; and
+
+(b) You may distribute such Executable Form under the terms of this
+    License, or sublicense it under different terms, provided that the
+    license for the Executable Form does not attempt to limit or alter
+    the recipients' rights in the Source Code Form under this License.
+
+3.3. Distribution of a Larger Work
+
+You may create and distribute a Larger Work under terms of Your choice,
+provided that You also comply with the requirements of this License for
+the Covered Software. If the Larger Work is a combination of Covered
+Software with a work governed by one or more Secondary Licenses, and the
+Covered Software is not Incompatible With Secondary Licenses, this
+License permits You to additionally distribute such Covered Software
+under the terms of such Secondary License(s), so that the recipient of
+the Larger Work may, at their option, further distribute the Covered
+Software under the terms of either this License or such Secondary
+License(s).
+
+3.4. Notices
+
+You may not remove or alter the substance of any license notices
+(including copyright notices, patent notices, disclaimers of warranty,
+or limitations of liability) contained within the Source Code Form of
+the Covered Software, except that You may alter any license notices to
+the extent required to remedy known factual inaccuracies.
+
+3.5. Application of Additional Terms
+
+You may choose to offer, and to charge a fee for, warranty, support,
+indemnity or liability obligations to one or more recipients of Covered
+Software. However, You may do so only on Your own behalf, and not on
+behalf of any Contributor. You must make it absolutely clear that any
+such warranty, support, indemnity, or liability obligation is offered by
+You alone, and You hereby agree to indemnify every Contributor for any
+liability incurred by such Contributor as a result of warranty, support,
+indemnity or liability terms You offer. You may include additional
+disclaimers of warranty and limitations of liability specific to any
+jurisdiction.
+
+4. Inability to Comply Due to Statute or Regulation
+---------------------------------------------------
+
+If it is impossible for You to comply with any of the terms of this
+License with respect to some or all of the Covered Software due to
+statute, judicial order, or regulation then You must: (a) comply with
+the terms of this License to the maximum extent possible; and (b)
+describe the limitations and the code they affect. Such description must
+be placed in a text file included with all distributions of the Covered
+Software under this License. Except to the extent prohibited by statute
+or regulation, such description must be sufficiently detailed for a
+recipient of ordinary skill to be able to understand it.
+
+5. Termination
+--------------
+
+5.1. The rights granted under this License will terminate automatically
+if You fail to comply with any of its terms. However, if You become
+compliant, then the rights granted under this License from a particular
+Contributor are reinstated (a) provisionally, unless and until such
+Contributor explicitly and finally terminates Your grants, and (b) on an
+ongoing basis, if such Contributor fails to notify You of the
+non-compliance by some reasonable means prior to 60 days after You have
+come back into compliance. Moreover, Your grants from a particular
+Contributor are reinstated on an ongoing basis if such Contributor
+notifies You of the non-compliance by some reasonable means, this is the
+first time You have received notice of non-compliance with this License
+from such Contributor, and You become compliant prior to 30 days after
+Your receipt of the notice.
+
+5.2. If You initiate litigation against any entity by asserting a patent
+infringement claim (excluding declaratory judgment actions,
+counter-claims, and cross-claims) alleging that a Contributor Version
+directly or indirectly infringes any patent, then the rights granted to
+You by any and all Contributors for the Covered Software under Section
+2.1 of this License shall terminate.
+
+5.3. In the event of termination under Sections 5.1 or 5.2 above, all
+end user license agreements (excluding distributors and resellers) which
+have been validly granted by You or Your distributors under this License
+prior to termination shall survive termination.
+
+************************************************************************
+*                                                                      *
+*  6. Disclaimer of Warranty                                           *
+*  -------------------------                                           *
+*                                                                      *
+*  Covered Software is provided under this License on an "as is"       *
+*  basis, without warranty of any kind, either expressed, implied, or  *
+*  statutory, including, without limitation, warranties that the       *
+*  Covered Software is free of defects, merchantable, fit for a        *
+*  particular purpose or non-infringing. The entire risk as to the     *
+*  quality and performance of the Covered Software is with You.        *
+*  Should any Covered Software prove defective in any respect, You     *
+*  (not any Contributor) assume the cost of any necessary servicing,   *
+*  repair, or correction. This disclaimer of warranty constitutes an   *
+*  essential part of this License. No use of any Covered Software is   *
+*  authorized under this License except under this disclaimer.         *
+*                                                                      *
+************************************************************************
+
+************************************************************************
+*                                                                      *
+*  7. Limitation of Liability                                          *
+*  --------------------------                                          *
+*                                                                      *
+*  Under no circumstances and under no legal theory, whether tort      *
+*  (including negligence), contract, or otherwise, shall any           *
+*  Contributor, or anyone who distributes Covered Software as          *
+*  permitted above, be liable to You for any direct, indirect,         *
+*  special, incidental, or consequential damages of any character      *
+*  including, without limitation, damages for lost profits, loss of    *
+*  goodwill, work stoppage, computer failure or malfunction, or any    *
+*  and all other commercial damages or losses, even if such party      *
+*  shall have been informed of the possibility of such damages. This   *
+*  limitation of liability shall not apply to liability for death or   *
+*  personal injury resulting from such party's negligence to the       *
+*  extent applicable law prohibits such limitation. Some               *
+*  jurisdictions do not allow the exclusion or limitation of           *
+*  incidental or consequential damages, so this exclusion and          *
+*  limitation may not apply to You.                                    *
+*                                                                      *
+************************************************************************
+
+8. Litigation
+-------------
+
+Any litigation relating to this License may be brought only in the
+courts of a jurisdiction where the defendant maintains its principal
+place of business and such litigation shall be governed by laws of that
+jurisdiction, without reference to its conflict-of-law provisions.
+Nothing in this Section shall prevent a party's ability to bring
+cross-claims or counter-claims.
+
+9. Miscellaneous
+----------------
+
+This License represents the complete agreement concerning the subject
+matter hereof. If any provision of this License is held to be
+unenforceable, such provision shall be reformed only to the extent
+necessary to make it enforceable. Any law or regulation which provides
+that the language of a contract shall be construed against the drafter
+shall not be used to construe this License against a Contributor.
+
+10. Versions of the License
+---------------------------
+
+10.1. New Versions
+
+Mozilla Foundation is the license steward. Except as provided in Section
+10.3, no one other than the license steward has the right to modify or
+publish new versions of this License. Each version will be given a
+distinguishing version number.
+
+10.2. Effect of New Versions
+
+You may distribute the Covered Software under the terms of the version
+of the License under which You originally received the Covered Software,
+or under the terms of any subsequent version published by the license
+steward.
+
+10.3. Modified Versions
+
+If you create software not governed by this License, and you want to
+create a new license for such software, you may create and use a
+modified version of this License if you rename the license and remove
+any references to the name of the license steward (except to note that
+such modified license differs from this License).
+
+10.4. Distributing Source Code Form that is Incompatible With Secondary
+Licenses
+
+If You choose to distribute Source Code Form that is Incompatible With
+Secondary Licenses under the terms of this version of the License, the
+notice described in Exhibit B of this License must be attached.
+
+Exhibit A - Source Code Form License Notice
+-------------------------------------------
+
+  This Source Code Form is subject to the terms of the Mozilla Public
+  License, v. 2.0. If a copy of the MPL was not distributed with this
+  file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+If it is not possible or desirable to put the notice in a particular
+file, then You may include the notice in a location (such as a LICENSE
+file in a relevant directory) where a recipient would be likely to look
+for such a notice.
+
+You may add additional accurate notices of copyright ownership.
+
+Exhibit B - "Incompatible With Secondary Licenses" Notice
+---------------------------------------------------------
+
+  This Source Code Form is "Incompatible With Secondary Licenses", as
+  defined by the Mozilla Public License, v. 2.0.
diff --git a/vendor/github.com/bramvdbogaerde/go-scp/README.md b/vendor/github.com/bramvdbogaerde/go-scp/README.md
new file mode 100644
index 00000000..e37a76c1
--- /dev/null
+++ b/vendor/github.com/bramvdbogaerde/go-scp/README.md
@@ -0,0 +1,97 @@
+Copy files over SCP with Go
+=============================
+[![Go Report Card](https://goreportcard.com/badge/bramvdbogaerde/go-scp)](https://goreportcard.com/report/bramvdbogaerde/go-scp) [![](https://godoc.org/github.com/bramvdbogaerde/go-scp?status.svg)](https://godoc.org/github.com/bramvdbogaerde/go-scp)
+
+This package makes it very easy to copy files over scp in Go.
+It uses the golang.org/x/crypto/ssh package to establish a secure connection to a remote server in order to copy the files via the SCP protocol.
+
+### Example usage
+
+
+```go
+package main
+
+import (
+	"fmt"
+	scp "github.com/bramvdbogaerde/go-scp"
+	"github.com/bramvdbogaerde/go-scp/auth"
+	"golang.org/x/crypto/ssh"
+	"os"
+        "context"
+)
+
+func main() {
+	// Use SSH key authentication from the auth package
+	// we ignore the host key in this example, please change this if you use this library
+	clientConfig, _ := auth.PrivateKey("username", "/path/to/rsa/key", ssh.InsecureIgnoreHostKey())
+
+	// For other authentication methods see ssh.ClientConfig and ssh.AuthMethod
+
+	// Create a new SCP client
+	client := scp.NewClient("example.com:22", &clientConfig)
+
+	// Connect to the remote server
+	err := client.Connect()
+	if err != nil {
+		fmt.Println("Couldn't establish a connection to the remote server ", err)
+		return
+	}
+
+	// Open a file
+	f, _ := os.Open("/path/to/local/file")
+
+	// Close client connection after the file has been copied
+	defer client.Close()
+
+	// Close the file after it has been copied
+	defer f.Close()
+
+	// Finally, copy the file over
+	// Usage: CopyFromFile(context, file, remotePath, permission)
+
+        // the context can be adjusted to provide time-outs or inherit from other contexts if this is embedded in a larger application.
+	err = client.CopyFromFile(context.Background(), *f, "/home/server/test.txt", "0655")
+
+	if err != nil {
+		fmt.Println("Error while copying file ", err)
+	}
+}
+```
+
+#### Using an existing SSH connection
+
+If you have an existing established SSH connection, you can use that instead.
+
+```go
+func connectSSH() *ssh.Client {
+   // setup SSH connection
+}
+
+func main() {
+   sshClient := connectSSH()
+
+   // Create a new SCP client, note that this function might
+   // return an error, as a new SSH session is established using the existing connecton
+
+   client, err := scp.NewClientBySSH(sshClient)
+   if err != nil {
+      fmt.Println("Error creating new SSH session from existing connection", err)
+   }
+
+   /* .. same as above .. */
+}
+```
+
+#### Copying Files from Remote Server
+
+It is also possible to copy remote files using this library. 
+The usage is similar to the example at the top of this section, except that `CopyFromRemote` needsto be used instead.
+
+For a more comprehensive example, please consult the `TestDownloadFile` function in t he `tests/basic_test.go` file.
+
+### License
+
+This library is licensed under the Mozilla Public License 2.0.    
+A copy of the license is provided in the `LICENSE.txt` file.
+
+Copyright (c) 2020 Bram Vandenbogaerde
diff --git a/vendor/github.com/bramvdbogaerde/go-scp/client.go b/vendor/github.com/bramvdbogaerde/go-scp/client.go
new file mode 100644
index 00000000..bde8638c
--- /dev/null
+++ b/vendor/github.com/bramvdbogaerde/go-scp/client.go
@@ -0,0 +1,446 @@
+/* Copyright (c) 2024 Bram Vandenbogaerde And Contributors
+ * You may use, distribute or modify this code under the
+ * terms of the Mozilla Public License 2.0, which is distributed
+ * along with the source code.
+ */
+
+package scp
+
+import (
+	"bytes"
+	"context"
+	"fmt"
+	"io"
+	"io/ioutil"
+	"os"
+	"path"
+	"sync"
+	"time"
+
+	"golang.org/x/crypto/ssh"
+)
+
+// Callback for freeing managed resources
+type ICloseHandler interface {
+	Close()
+}
+
+// Close handler equivalent to a no-op. Used by default
+// when no resources have to be cleaned.
+type EmptyHandler struct{}
+
+func (EmptyHandler) Close() {}
+
+// Close handler to close an SSH client
+type CloseSSHCLient struct {
+	// Reference to the used SSH client
+	sshClient *ssh.Client
+}
+
+func (scp CloseSSHCLient) Close() {
+	scp.sshClient.Close()
+}
+
+type PassThru func(r io.Reader, total int64) io.Reader
+
+type Client struct {
+	// Host the host to connect to.
+	Host string
+
+	// ClientConfig the client config to use.
+	ClientConfig *ssh.ClientConfig
+
+	// Keep the ssh client around for generating new sessions
+	sshClient *ssh.Client
+
+	// Timeout the maximal amount of time to wait for a file transfer to complete.
+	// Deprecated: use context.Context for each function instead.
+	Timeout time.Duration
+
+	// RemoteBinary the absolute path to the remote SCP binary.
+	RemoteBinary string
+
+	// Handler called when calling `Close` to clean up any remaining
+	// resources managed by `Client`.
+	closeHandler ICloseHandler
+}
+
+// Connect connects to the remote SSH server, returns error if it couldn't establish a session to the SSH server.
+func (a *Client) Connect() error {
+	client, err := ssh.Dial("tcp", a.Host, a.ClientConfig)
+	if err != nil {
+		return err
+	}
+
+	a.sshClient = client
+	a.closeHandler = CloseSSHCLient{sshClient: client}
+	return nil
+}
+
+// Returns the underlying SSH client, this should be used carefully as
+// it will be closed by `client.Close`.
+func (a *Client) SSHClient() *ssh.Client {
+	return a.sshClient
+}
+
+// CopyFromFile copies the contents of an os.File to a remote location, it will get the length of the file by looking it up from the filesystem.
+func (a *Client) CopyFromFile(
+	ctx context.Context,
+	file os.File,
+	remotePath string,
+	permissions string,
+) error {
+	return a.CopyFromFilePassThru(ctx, file, remotePath, permissions, nil)
+}
+
+// CopyFromFilePassThru copies the contents of an os.File to a remote location, it will get the length of the file by looking it up from the filesystem.
+// Access copied bytes by providing a PassThru reader factory.
+func (a *Client) CopyFromFilePassThru(
+	ctx context.Context,
+	file os.File,
+	remotePath string,
+	permissions string,
+	passThru PassThru,
+) error {
+	stat, err := file.Stat()
+	if err != nil {
+		return fmt.Errorf("failed to stat file: %w", err)
+	}
+	return a.CopyPassThru(ctx, &file, remotePath, permissions, stat.Size(), passThru)
+}
+
+// CopyFile copies the contents of an io.Reader to a remote location, the length is determined by reading the io.Reader until EOF
+// if the file length in know in advance please use "Copy" instead.
+func (a *Client) CopyFile(
+	ctx context.Context,
+	fileReader io.Reader,
+	remotePath string,
+	permissions string,
+) error {
+	return a.CopyFilePassThru(ctx, fileReader, remotePath, permissions, nil)
+}
+
+// CopyFilePassThru copies the contents of an io.Reader to a remote location, the length is determined by reading the io.Reader until EOF
+// if the file length in know in advance please use "Copy" instead.
+// Access copied bytes by providing a PassThru reader factory.
+func (a *Client) CopyFilePassThru(
+	ctx context.Context,
+	fileReader io.Reader,
+	remotePath string,
+	permissions string,
+	passThru PassThru,
+) error {
+	contentsBytes, err := ioutil.ReadAll(fileReader)
+	if err != nil {
+		return fmt.Errorf("failed to read all data from reader: %w", err)
+	}
+	bytesReader := bytes.NewReader(contentsBytes)
+
+	return a.CopyPassThru(
+		ctx,
+		bytesReader,
+		remotePath,
+		permissions,
+		int64(len(contentsBytes)),
+		passThru,
+	)
+}
+
+// wait waits for the waitgroup for the specified max timeout.
+// Returns true if waiting timed out.
+func wait(wg *sync.WaitGroup, ctx context.Context) error {
+	c := make(chan struct{})
+	go func() {
+		defer close(c)
+		wg.Wait()
+	}()
+
+	select {
+	case <-c:
+		return nil
+
+	case <-ctx.Done():
+		return ctx.Err()
+	}
+}
+
+// checkResponse checks the response it reads from the remote, and will return a single error in case
+// of failure.
+func checkResponse(r io.Reader) error {
+	_, err := ParseResponse(r, nil)
+	if err != nil {
+		return err
+	}
+
+	return nil
+
+}
+
+// Copy copies the contents of an io.Reader to a remote location.
+func (a *Client) Copy(
+	ctx context.Context,
+	r io.Reader,
+	remotePath string,
+	permissions string,
+	size int64,
+) error {
+	return a.CopyPassThru(ctx, r, remotePath, permissions, size, nil)
+}
+
+// CopyPassThru copies the contents of an io.Reader to a remote location.
+// Access copied bytes by providing a PassThru reader factory
+func (a *Client) CopyPassThru(
+	ctx context.Context,
+	r io.Reader,
+	remotePath string,
+	permissions string,
+	size int64,
+	passThru PassThru,
+) error {
+	session, err := a.sshClient.NewSession()
+	if err != nil {
+		return fmt.Errorf("Error creating ssh session in copy to remote: %v", err)
+	}
+	defer session.Close()
+
+	stdout, err := session.StdoutPipe()
+	if err != nil {
+		return err
+	}
+	w, err := session.StdinPipe()
+	if err != nil {
+		return err
+	}
+	defer w.Close()
+
+	if passThru != nil {
+		r = passThru(r, size)
+	}
+
+	filename := path.Base(remotePath)
+
+	// Start the command first and get confirmation that it has been started
+	// before sending anything through the pipes.
+	err = session.Start(fmt.Sprintf("%s -qt %q", a.RemoteBinary, remotePath))
+	if err != nil {
+		return err
+	}
+
+	wg := sync.WaitGroup{}
+	wg.Add(2)
+
+	errCh := make(chan error, 2)
+
+	// SCP protocol and file sending
+	go func() {
+		defer wg.Done()
+		defer w.Close()
+
+		_, err = fmt.Fprintln(w, "C"+permissions, size, filename)
+		if err != nil {
+			errCh <- err
+			return
+		}
+
+		if err = checkResponse(stdout); err != nil {
+			errCh <- err
+			return
+		}
+
+		_, err = io.Copy(w, r)
+		if err != nil {
+			errCh <- err
+			return
+		}
+
+		_, err = fmt.Fprint(w, "\x00")
+		if err != nil {
+			errCh <- err
+			return
+		}
+
+		if err = checkResponse(stdout); err != nil {
+			errCh <- err
+			return
+		}
+	}()
+
+	// Wait for the process to exit
+	go func() {
+		defer wg.Done()
+		err := session.Wait()
+		if err != nil {
+			errCh <- err
+			return
+		}
+	}()
+
+	// If there is a timeout, stop the transfer if it has been exceeded
+	if a.Timeout > 0 {
+		var cancel context.CancelFunc
+		ctx, cancel = context.WithTimeout(ctx, a.Timeout)
+		defer cancel()
+	}
+
+	// Wait for one of the conditions (error/timeout/completion) to occur
+	if err := wait(&wg, ctx); err != nil {
+		return err
+	}
+
+	close(errCh)
+
+	// Collect any errors from the error channel
+	for err := range errCh {
+		if err != nil {
+			return err
+		}
+	}
+
+	return nil
+}
+
+// CopyFromRemote copies a file from the remote to the local file given by the `file`
+// parameter. Use `CopyFromRemotePassThru` if a more generic writer
+// is desired instead of writing directly to a file on the file system.
+func (a *Client) CopyFromRemote(ctx context.Context, file *os.File, remotePath string) error {
+	return a.CopyFromRemotePassThru(ctx, file, remotePath, nil)
+}
+
+// CopyFromRemotePassThru copies a file from the remote to the given writer. The passThru parameter can be used
+// to keep track of progress and how many bytes that were download from the remote.
+// `passThru` can be set to nil to disable this behaviour.
+func (a *Client) CopyFromRemotePassThru(
+	ctx context.Context,
+	w io.Writer,
+	remotePath string,
+	passThru PassThru,
+) error {
+	_, err := a.copyFromRemote(ctx, w, remotePath, passThru, false)
+
+	return err
+}
+
+// CopyFroRemoteFileInfos copies a file from the remote to a given writer and return a FileInfos struct
+// containing information about the file such as permissions, the file size, modification time and access time
+func (a *Client) CopyFromRemoteFileInfos(
+	ctx context.Context,
+	w io.Writer,
+	remotePath string,
+	passThru PassThru,
+) (*FileInfos, error) {
+	return a.copyFromRemote(ctx, w, remotePath, passThru, true)
+}
+
+func (a *Client) copyFromRemote(
+	ctx context.Context,
+	w io.Writer,
+	remotePath string,
+	passThru PassThru,
+	preserveFileTimes bool,
+) (*FileInfos, error) {
+	session, err := a.sshClient.NewSession()
+	if err != nil {
+		return nil, fmt.Errorf("Error creating ssh session in copy from remote: %v", err)
+	}
+	defer session.Close()
+
+	wg := sync.WaitGroup{}
+	errCh := make(chan error, 4)
+	var fileInfos *FileInfos
+
+	wg.Add(1)
+	go func() {
+		var err error
+
+		defer func() {
+			// NOTE: this might send an already sent error another time, but since we only receive one, this is fine. On the "happy-path" of this function, the error will be `nil` therefore completing the "err<-errCh" at the bottom of the function.
+			errCh <- err
+			// We must unblock the go routine first as we block on reading the channel later
+			wg.Done()
+
+		}()
+
+		r, err := session.StdoutPipe()
+		if err != nil {
+			errCh <- err
+			return
+		}
+
+		in, err := session.StdinPipe()
+		if err != nil {
+			errCh <- err
+			return
+		}
+		defer in.Close()
+
+		if preserveFileTimes {
+			err = session.Start(fmt.Sprintf("%s -pf %q", a.RemoteBinary, remotePath))
+		} else {
+			err = session.Start(fmt.Sprintf("%s -f %q", a.RemoteBinary, remotePath))
+		}
+		if err != nil {
+			errCh <- err
+			return
+		}
+
+		err = Ack(in)
+		if err != nil {
+			errCh <- err
+			return
+		}
+
+		fileInfo, err := ParseResponse(r, in)
+		if err != nil {
+			errCh <- err
+			return
+		}
+
+		fileInfos = fileInfo
+
+		err = Ack(in)
+		if err != nil {
+			errCh <- err
+			return
+		}
+
+		if passThru != nil {
+			r = passThru(r, fileInfo.Size)
+		}
+
+		_, err = CopyN(w, r, fileInfo.Size)
+		if err != nil {
+			errCh <- err
+			return
+		}
+
+		err = Ack(in)
+		if err != nil {
+			errCh <- err
+			return
+		}
+
+		err = session.Wait()
+		if err != nil {
+			errCh <- err
+			return
+		}
+	}()
+
+	if a.Timeout > 0 {
+		var cancel context.CancelFunc
+		ctx, cancel = context.WithTimeout(ctx, a.Timeout)
+		defer cancel()
+	}
+
+	if err := wait(&wg, ctx); err != nil {
+		return nil, err
+	}
+
+	finalErr := <-errCh
+	close(errCh)
+	return fileInfos, finalErr
+}
+
+func (a *Client) Close() {
+	a.closeHandler.Close()
+}
diff --git a/vendor/github.com/bramvdbogaerde/go-scp/configurer.go b/vendor/github.com/bramvdbogaerde/go-scp/configurer.go
new file mode 100644
index 00000000..db1d9f6b
--- /dev/null
+++ b/vendor/github.com/bramvdbogaerde/go-scp/configurer.go
@@ -0,0 +1,83 @@
+/* Copyright (c) 2020 Bram Vandenbogaerde
+ * You may use, distribute or modify this code under the
+ * terms of the Mozilla Public License 2.0, which is distributed
+ * along with the source code.
+ */
+
+package scp
+
+import (
+	"time"
+
+	"golang.org/x/crypto/ssh"
+)
+
+// ClientConfigurer a struct containing all the configuration options
+// used by an scp client.
+type ClientConfigurer struct {
+	host         string
+	clientConfig *ssh.ClientConfig
+	session      *ssh.Session
+	timeout      time.Duration
+	remoteBinary string
+	sshClient    *ssh.Client
+}
+
+// NewConfigurer creates a new client configurer.
+// It takes the required parameters: the host and the ssh.ClientConfig and
+// returns a configurer populated with the default values for the optional
+// parameters.
+//
+// These optional parameters can be set by using the methods provided on the
+// ClientConfigurer struct.
+func NewConfigurer(host string, config *ssh.ClientConfig) *ClientConfigurer {
+	return &ClientConfigurer{
+		host:         host,
+		clientConfig: config,
+		timeout:      0, // no timeout by default
+		remoteBinary: "scp",
+	}
+}
+
+// RemoteBinary sets the path of the location of the remote scp binary
+// Defaults to: /usr/bin/scp.
+func (c *ClientConfigurer) RemoteBinary(path string) *ClientConfigurer {
+	c.remoteBinary = path
+	return c
+}
+
+// Host alters the host of the client connects to.
+func (c *ClientConfigurer) Host(host string) *ClientConfigurer {
+	c.host = host
+	return c
+}
+
+// Timeout Changes the connection timeout.
+// Defaults to one minute.
+func (c *ClientConfigurer) Timeout(timeout time.Duration) *ClientConfigurer {
+	c.timeout = timeout
+	return c
+}
+
+// ClientConfig alters the ssh.ClientConfig.
+func (c *ClientConfigurer) ClientConfig(config *ssh.ClientConfig) *ClientConfigurer {
+	c.clientConfig = config
+	return c
+}
+
+func (c *ClientConfigurer) SSHClient(sshClient *ssh.Client) *ClientConfigurer {
+	c.sshClient = sshClient
+	return c
+}
+
+// Create builds a client with the configuration stored within the ClientConfigurer.
+func (c *ClientConfigurer) Create() Client {
+	return Client{
+		Host:         c.host,
+		ClientConfig: c.clientConfig,
+		Timeout:      c.timeout,
+		RemoteBinary: c.remoteBinary,
+		sshClient:    c.sshClient,
+		closeHandler: EmptyHandler{},
+	}
+}
diff --git a/vendor/github.com/bramvdbogaerde/go-scp/protocol.go b/vendor/github.com/bramvdbogaerde/go-scp/protocol.go
new file mode 100644
index 00000000..6871c29e
--- /dev/null
+++ b/vendor/github.com/bramvdbogaerde/go-scp/protocol.go
@@ -0,0 +1,206 @@
+/* Copyright (c) 2021 Bram Vandenbogaerde And Contributors
+ * You may use, distribute or modify this code under the
+ * terms of the Mozilla Public License 2.0, which is distributed
+ * along with the source code.
+ */
+
+package scp
+
+import (
+	"bufio"
+	"errors"
+	"fmt"
+	"io"
+	"strconv"
+	"strings"
+)
+
+type ResponseType = byte
+
+const (
+	Ok      ResponseType = 0
+	Warning ResponseType = 1
+	Error   ResponseType = 2
+	Create  ResponseType = 'C'
+	Time    ResponseType = 'T'
+)
+
+// ParseResponse reads from the given reader (assuming it is the output of the remote) and parses it into a Response structure.
+func ParseResponse(reader io.Reader, writer io.Writer) (*FileInfos, error) {
+	fileInfos := NewFileInfos()
+
+	buffer := make([]uint8, 1)
+	_, err := reader.Read(buffer)
+	if err != nil {
+		return fileInfos, err
+	}
+
+	responseType := buffer[0]
+	message := ""
+	if responseType > 0 {
+		bufferedReader := bufio.NewReader(reader)
+		message, err = bufferedReader.ReadString('\n')
+		if err != nil {
+			return fileInfos, err
+		}
+
+		if responseType == Warning || responseType == Error {
+			return fileInfos, errors.New(message)
+		}
+
+		// Exit early because we're only interested in the ok response
+		if responseType == Ok {
+			return fileInfos, nil
+		}
+
+		if !(responseType == Create || responseType == Time) {
+			return fileInfos, errors.New(
+				fmt.Sprintf(
+					"Message does not follow scp protocol: %s\n Cmmmm <length> <filename> or T<mtime> 0 <atime> 0",
+					message,
+				),
+			)
+		}
+
+		if responseType == Time {
+			err = ParseFileTime(message, fileInfos)
+			if err != nil {
+				return nil, err
+			}
+
+			// A custom ssh server can send both time, permissions and size information at once
+			// without needing an Ack response. Example: wish from charmbracelet while using their default scp implementation
+			// If the buffer is empty, then it's likely the default implementation for ssh, so send Ack
+			if bufferedReader.Buffered() == 0 {
+				err = Ack(writer)
+				if err != nil {
+					return fileInfos, err
+				}
+			}
+
+			message, err = bufferedReader.ReadString('\n')
+
+			if err != nil {
+				return fileInfos, err
+			}
+
+			responseType = message[0]
+		}
+
+		if responseType == Create {
+			err = ParseFileInfos(message, fileInfos)
+			if err != nil {
+				return nil, err
+			}
+		}
+	}
+
+	return fileInfos, nil
+}
+
+type FileInfos struct {
+	Message     string
+	Filename    string
+	Permissions uint32
+	Size        int64
+	Atime       int64
+	Mtime       int64
+}
+
+func NewFileInfos() *FileInfos {
+	return &FileInfos{}
+}
+
+func (fileInfos *FileInfos) Update(new *FileInfos) {
+	if new == nil {
+		return
+	}
+	if new.Filename != "" {
+		fileInfos.Filename = new.Filename
+	}
+	if new.Permissions != 0 {
+		fileInfos.Permissions = new.Permissions
+	}
+	if new.Size != 0 {
+		fileInfos.Size = new.Size
+	}
+	if new.Atime != 0 {
+		fileInfos.Atime = new.Atime
+	}
+	if new.Mtime != 0 {
+		fileInfos.Mtime = new.Mtime
+	}
+}
+
+func ParseFileInfos(message string, fileInfos *FileInfos) error {
+	processMessage := strings.ReplaceAll(message, "\n", "")
+	parts := strings.Split(processMessage, " ")
+	if len(parts) < 3 {
+		return errors.New("unable to parse Chmod protocol")
+	}
+
+	permissions, err := strconv.ParseUint(parts[0][1:], 0, 32)
+	if err != nil {
+		return err
+	}
+
+	size, err := strconv.ParseInt(parts[1], 10, 64)
+	if err != nil {
+		return err
+	}
+
+	fileInfos.Update(&FileInfos{
+		Filename:    parts[2],
+		Permissions: uint32(permissions),
+		Size:        int64(size),
+	})
+
+	return nil
+}
+
+func ParseFileTime(
+	message string,
+	fileInfos *FileInfos,
+) error {
+	processMessage := strings.ReplaceAll(message, "\n", "")
+	parts := strings.Split(processMessage, " ")
+	if len(parts) < 3 {
+		return errors.New("unable to parse Time protocol")
+	}
+
+	if len(parts[0]) != 10 {
+		return errors.New("length of ATime is not 10")
+	}
+	mTime, err := strconv.Atoi(parts[0][0:10])
+	if err != nil {
+		return errors.New("unable to parse ATime component of message")
+	}
+
+	if len(parts[2]) != 10 {
+		return errors.New("length of MTime is not 10")
+	}
+	aTime, err := strconv.Atoi(parts[2][0:10])
+	if err != nil {
+		return errors.New("unable to parse MTime component of message")
+	}
+
+	fileInfos.Update(&FileInfos{
+		Atime: int64(aTime),
+		Mtime: int64(mTime),
+	})
+	return nil
+}
+
+// Ack writes an `Ack` message to the remote, does not await its response, a seperate call to ParseResponse is
+// therefore required to check if the acknowledgement succeeded.
+func Ack(writer io.Writer) error {
+	var msg = []byte{0}
+	n, err := writer.Write(msg)
+	if err != nil {
+		return err
+	}
+	if n < len(msg) {
+		return errors.New("failed to write ack buffer")
+	}
+	return nil
+}
diff --git a/vendor/github.com/bramvdbogaerde/go-scp/scp.go b/vendor/github.com/bramvdbogaerde/go-scp/scp.go
new file mode 100644
index 00000000..837ccaa8
--- /dev/null
+++ b/vendor/github.com/bramvdbogaerde/go-scp/scp.go
@@ -0,0 +1,37 @@
+/* Copyright (c) 2021 Bram Vandenbogaerde
+ * You may use, distribute or modify this code under the
+ * terms of the Mozilla Public License 2.0, which is distributed
+ * along with the source code.
+ */
+
+// Package scp.
+// Simple scp package to copy files over SSH.
+package scp
+
+import (
+	"time"
+
+	"golang.org/x/crypto/ssh"
+)
+
+// NewClient returns a new scp.Client with provided host and ssh.clientConfig.
+func NewClient(host string, config *ssh.ClientConfig) Client {
+	return NewConfigurer(host, config).Create()
+}
+
+// NewClientWithTimeout returns a new scp.Client with provides host, ssh.ClientConfig and timeout.
+// Deprecated: provide meaningful context to each "Copy*" function instead.
+func NewClientWithTimeout(host string, config *ssh.ClientConfig, timeout time.Duration) Client {
+	return NewConfigurer(host, config).Timeout(timeout).Create()
+}
+
+// NewClientBySSH returns a new scp.Client using an already existing established SSH connection.
+func NewClientBySSH(ssh *ssh.Client) (Client, error) {
+	return NewConfigurer("", nil).SSHClient(ssh).Create(), nil
+}
+
+// NewClientBySSHWithTimeout same as NewClientWithTimeout but uses an existing SSH client.
+// Deprecated: provide meaningful context to each "Copy*" function instead.
+func NewClientBySSHWithTimeout(ssh *ssh.Client, timeout time.Duration) (Client, error) {
+	return NewConfigurer("", nil).SSHClient(ssh).Timeout(timeout).Create(), nil
+}
diff --git a/vendor/github.com/bramvdbogaerde/go-scp/utils.go b/vendor/github.com/bramvdbogaerde/go-scp/utils.go
new file mode 100644
index 00000000..447775f1
--- /dev/null
+++ b/vendor/github.com/bramvdbogaerde/go-scp/utils.go
@@ -0,0 +1,25 @@
+/* Copyright (c) 2021 Bram Vandenbogaerde And Contributors
+ * You may use, distribute or modify this code under the
+ * terms of the Mozilla Public License 2.0, which is distributed
+ * along with the source code.
+ */
+
+package scp
+
+import "io"
+
+// CopyN an adaptation of io.CopyN that keeps reading if it did not return
+// a sufficient amount of bytes.
+func CopyN(writer io.Writer, src io.Reader, size int64) (int64, error) {
+	var total int64
+	total = 0
+	for total < size {
+		n, err := io.CopyN(writer, src, size)
+		if err != nil {
+			return 0, err
+		}
+		total += n
+	}
+
+	return total, nil
+}
diff --git a/vendor/modules.txt b/vendor/modules.txt
index 6638a4e1..10fb29ac 100644
--- a/vendor/modules.txt
+++ b/vendor/modules.txt
@@ -58,6 +58,9 @@ github.com/beorn7/perks/quantile
 # github.com/blang/semver/v4 v4.0.0
 ## explicit; go 1.14
 github.com/blang/semver/v4
+# github.com/bramvdbogaerde/go-scp v1.5.0
+## explicit; go 1.21
+github.com/bramvdbogaerde/go-scp
 # github.com/cenkalti/backoff/v4 v4.2.1
 ## explicit; go 1.18
 github.com/cenkalti/backoff/v4


Test patch:
diff --git a/.github/actions/e2e/action.yaml b/.github/actions/e2e/action.yaml
index 5b1b2646..26fd151a 100644
--- a/.github/actions/e2e/action.yaml
+++ b/.github/actions/e2e/action.yaml
@@ -26,7 +26,7 @@ runs:
   using: "composite"
   steps:
     - uses: ./.github/actions/setup-go
-    - uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4
+    - uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf # v4
       with:
         path: hack/tools/bin
         key: ${{ runner.os }}-tools-bin-e2e-${{ hashFiles('Makefile') }}
@@ -34,7 +34,7 @@ runs:
           ${{ runner.os }}-tools-bin-e2e-
           ${{ runner.os }}-tools-bin-
     - name: Download artifact
-      uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4
+      uses: actions/download-artifact@cc203385981b70ca67e1cc392babf9cc229d5806 # v4
       with:
         name: test-release
         path: out
@@ -79,7 +79,7 @@ runs:
         CAPH_LATEST_VERSION: "v1.0.1"
       run: make ${{ inputs.e2e_make_target }}
     - name: Upload artifact
-      uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4
+      uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4
       if: ${{ always() }}
       with:
         name: e2e-${{ inputs.e2e_name }}
diff --git a/.github/actions/test-release/action.yaml b/.github/actions/test-release/action.yaml
index 1183e47f..aa1682af 100644
--- a/.github/actions/test-release/action.yaml
+++ b/.github/actions/test-release/action.yaml
@@ -4,7 +4,7 @@ runs:
   using: "composite"
   steps:
     - uses: ./.github/actions/setup-go
-    - uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4
+    - uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf # v4
       with:
         path: hack/tools/bin
         key: ${{ runner.os }}-tools-bin-release-${{ hashFiles('Makefile') }}
@@ -25,7 +25,7 @@ runs:
         TAG: ${{ steps.meta.outputs.version }}
       run: make test-release
     - name: Upload artifact
-      uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4
+      uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4
       with:
         name: test-release
         path: out
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 29ff349a..edc3da6b 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -40,7 +40,7 @@ jobs:
           echo name=${NAME} >> $GITHUB_OUTPUT
 
       - name: Install go
-        uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0
+        uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0
         with:
           go-version-file: "go.mod"
 
@@ -64,7 +64,7 @@ jobs:
           paths: ".coverage/junit.xml"
 
       - name: Upload Report
-        uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
+        uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1
         with:
           name: reports-${{ steps.name.outputs.name }}
           path: .reports
diff --git a/controllers/controllers_suite_test.go b/controllers/controllers_suite_test.go
index f398901e..9a9a5f54 100644
--- a/controllers/controllers_suite_test.go
+++ b/controllers/controllers_suite_test.go
@@ -88,10 +88,11 @@ var _ = BeforeSuite(func() {
 	}).SetupWithManager(ctx, testEnv.Manager, controller.Options{})).To(Succeed())
 
 	Expect((&HetznerBareMetalHostReconciler{
-		Client:             testEnv.Manager.GetClient(),
-		APIReader:          testEnv.Manager.GetAPIReader(),
-		RobotClientFactory: testEnv.RobotClientFactory,
-		SSHClientFactory:   testEnv.SSHClientFactory,
+		Client:              testEnv.Manager.GetClient(),
+		APIReader:           testEnv.Manager.GetAPIReader(),
+		RobotClientFactory:  testEnv.RobotClientFactory,
+		SSHClientFactory:    testEnv.SSHClientFactory,
+		PreProvisionCommand: "dummy-pre-provision-command",
 	}).SetupWithManager(ctx, testEnv.Manager, controller.Options{})).To(Succeed())
 
 	Expect((&HetznerBareMetalMachineReconciler{
diff --git a/controllers/hetznerbaremetalhost_controller_test.go b/controllers/hetznerbaremetalhost_controller_test.go
index 9c77fc87..8e9af73c 100644
--- a/controllers/hetznerbaremetalhost_controller_test.go
+++ b/controllers/hetznerbaremetalhost_controller_test.go
@@ -348,6 +348,9 @@ var _ = Describe("HetznerBareMetalHostReconciler", func() {
 						"should-state", infrav1.StateImageInstalling)
 					return false
 				}, 10*time.Second).Should(BeTrue())
+
+				By("Checking if pre-provision-command was executed")
+				rescueSSHClient.AssertCalled(GinkgoT(), "ExecutePreProvisionCommand", mock.Anything, mock.Anything)
 			})
 		})
 
@@ -898,6 +901,7 @@ name="eth0" model="Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express
 	sshClient.On("Reboot").Return(sshclient.Output{})
 	sshClient.On("GetCloudInitOutput").Return(sshclient.Output{StdOut: "dummy content of /var/log/cloud-init-output.log"})
 	sshClient.On("DetectLinuxOnAnotherDisk", mock.Anything).Return(sshclient.Output{})
+	sshClient.On("ExecutePreProvisionCommand", mock.Anything, mock.Anything).Return(0, "", nil)
 	sshClient.On("GetInstallImageState").Return(sshclient.InstallImageStateFinished, nil)
 	sshClient.On("GetResultOfInstallImage").Return(hostpkg.PostInstallScriptFinished, nil)
 }
diff --git a/pkg/services/baremetal/client/ssh/ssh_client_test.go b/pkg/services/baremetal/client/ssh/ssh_client_test.go
index 6281269f..8ea4aca3 100644
--- a/pkg/services/baremetal/client/ssh/ssh_client_test.go
+++ b/pkg/services/baremetal/client/ssh/ssh_client_test.go
@@ -18,8 +18,11 @@ limitations under the License.
 package sshclient
 
 import (
+	"context"
 	_ "embed"
 	"fmt"
+	"os"
+	"path/filepath"
 	"testing"
 
 	"github.com/stretchr/testify/require"
@@ -102,3 +105,24 @@ func TestOutput_String(t *testing.T) {
 		Err:    fmt.Errorf("some err"),
 	}, "mystdout. Stderr: mystderr. Err: some err")
 }
+
+func Test_ExecutePreProvisionCommand_withRealServer(t *testing.T) {
+	// This test is disabled by default because it requires a real server to be up and running.
+	// It is useful to enable it when debugging scp issues.
+	t.SkipNow()
+
+	ctx := context.Background()
+	pk, err := os.ReadFile(filepath.Join(os.Getenv("HOME"), ".ssh", "id_rsa"))
+	require.NoError(t, err)
+
+	c := sshClient{
+		privateSSHKey: string(pk),
+		ip:            "178.63.61.147",
+		port:          22,
+	}
+
+	exitStatus, output, err := c.ExecutePreProvisionCommand(ctx, "/usr/bin/hostname")
+	require.NoError(t, err)
+	require.Equal(t, 0, exitStatus)
+	require.Equal(t, "hz1", output)
+}