31 Commits
Author SHA1 Message Date
socat-proxy-ci 417fe18fe8 Bump build version to 1.1.5 [skip ci] 2026-11-22 10:45:00 +00:00
Djeex 9d86f1d6f0 Pin alpine Docker tag to f59abe6 (#19)
CI / build-and-scan (push) Successful in 1m10s
Co-authored-by: Djeex <[email protected]>
2026-11-22 11:44:02 +01:00
Djeex 79495d2a30 Run the shared publish action in dry-run before publishing (#18)
CI / build-and-scan (push) Successful in 1m0s
Co-authored-by: Djeex <[email protected]>
2026-11-22 11:36:39 +01:00
Djeex 3503227234 Merge pull request 'Run the weekly scan on Saturday' (#16) from ci-align into main
CI / build-and-scan (push) Successful in 1m52s
2026-11-21 23:48:39 +01:00
Djeex 49c1ac8239 Run the weekly scan on Saturday
CI / build-and-scan (pull_request) Successful in 53s
2026-11-21 22:31:35 +00:00
Djeex b3dc6e33d1 Use the shared Renovate preset (#15)
CI / build-and-scan (push) Successful in 1m55s
## Summary
- `renovate.json` now only extends `local>labeex/renovateex`, the shared preset that holds the settings common to the 9 repositories.
- Pilot for the migration: the behaviour must stay exactly the same.

## Test plan
- [x] Resolved Renovate config compared before/after: no rule lost, same order, only rules for managers this repo does not use are added
- [x] Renovate simulation before/after: same 13 dependencies, same updates
- [x] Package rule decisions (automerge, release age, labels, digest pinning) compared for every dependency and update type: identical
- [ ] CI green on this PR
- [ ] After merge and a Renovate run: Dependency Dashboard identical to the one before, no config error issue

Reviewed-on: #15
Co-authored-by: Djeex <[email protected]>
2026-11-21 22:05:29 +01:00
Djeex 2610857d48 Update aquasec/trivy Docker tag to v0.76.2 (#13)
CI / build-and-scan (push) Successful in 1m46s
This PR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [aquasec/trivy](https://www.aquasec.com/products/trivy/) ([source](https://github.com/aquasecurity/trivy)) | minor | `0.74.0` → `0.76.2` |

---

### Release Notes

<details>
<summary>aquasecurity/trivy (aquasec/trivy)</summary>

### [`v0.76.2`](https://github.com/aquasecurity/trivy/releases/tag/v0.76.2)

[Compare Source](https://github.com/aquasecurity/trivy/compare/v0.76.1...v0.76.2)

#### 🔐 Security update 🛡️

Trivy v0.76.2 bundles several security fixes:

- Official container images are rebuilt on Alpine 3.24.3, which fixes `musl`/`musl-utils` (CVE-2026-107891), and the build picks up fixed `libcurl` (24 CVEs, including HIGH CVE-2026-92392) and `brotli-libs` (CVE-2026-111497) from the `v3.24` package repository.
- `golang.org/x/net` is bumped to v0.62.0, fixing two vulnerabilities in `golang.org/x/net/html`: CVE-2026-78661 (quadratic complexity when coalescing text nodes) and CVE-2026-97045 (missing ancestor namespace check when rendering raw text).
- `github.com/go-jose/go-jose/v4` is bumped to v4.1.6, fixing [GHSA-mgcc-cww5-fp2q](https://github.com/go-jose/go-jose/security/advisories/GHSA-mgcc-cww5-fp2q).

We recommend upgrading to v0.76.2 and redeploying container images to apply these updates.

#### Changelog

- [`3f6334d`](https://github.com/aquasecurity/trivy/commit/3f6334d223b52188324af3b9923b4249cd206652) release: v0.76.2 \[release/v0.76] ([#&#8203;11552](https://github.com/aquasecurity/trivy/issues/11552))
- [`1cabe83`](https://github.com/aquasecurity/trivy/commit/1cabe83c11ffed6e984ab46be8886e1e01516ead) fix(deps): bump golang.org/x/net from 0.61.0 to 0.62.0 \[backport: release/v0.76] ([#&#8203;11554](https://github.com/aquasecurity/trivy/issues/11554))
- [`be08de4`](https://github.com/aquasecurity/trivy/commit/be08de47d0d76fca7e992c0f47fbcf7853f8a713) chore(deps): bump the common group across 1 directory with 14 updates \[backport: release/v0.76] ([#&#8203;11555](https://github.com/aquasecurity/trivy/issues/11555))
- [`a8537d3`](https://github.com/aquasecurity/trivy/commit/a8537d389cbd0fa215eddfddc27150fc7bc82a6c) fix(deps): bump github.com/go-jose/go-jose/v4 from 4.1.5 to 4.1.6 \[backport: release/v0.76] ([#&#8203;11553](https://github.com/aquasecurity/trivy/issues/11553))
- [`ae26b88`](https://github.com/aquasecurity/trivy/commit/ae26b88c3b3c380808e767dfb63f9b8dcd5f64fd) fix(deps): bump alpine to 3.24.3 in container images \[backport: release/v0.76] ([#&#8203;11551](https://github.com/aquasecurity/trivy/issues/11551))

### [`v0.76.1`](https://github.com/aquasecurity/trivy/releases/tag/v0.76.1)

[Compare Source](https://github.com/aquasecurity/trivy/compare/v0.76.0...v0.76.1)

#### 🔐 Security update: eMudhra CA incident 🛡️

Trivy v0.76.1 includes mitigations for the [eMudhra intermediate CA key compromise](https://blog.cloudflare.com/emudhra-certificate-compromise/).

- Official binaries are built with Go 1.27.3, which includes the certificate distrust mitigation tracked as [CVE-2026-111943](https://go.dev/issue/82345).
- Official container images include an updated Alpine CA trust store that rejects the affected certificate chains.

We recommend upgrading to v0.76.1 and redeploying container images to apply these updates. If you build Trivy from source, use Go 1.27.3 or later and keep your runtime CA trust store up to date.

#### Changelog

- [`e713f67`](https://github.com/aquasecurity/trivy/commit/e713f67f7d54decdcd9b3132c9751833dcced698) release: v0.76.1 \[release/v0.76] ([#&#8203;11445](https://github.com/aquasecurity/trivy/issues/11445))
- [`6647bd6`](https://github.com/aquasecurity/trivy/commit/6647bd6ec5924087956285b773b8cae10508736e) fix(deps): bump the aws group across 1 directory with 6 updates \[backport: release/v0.76] ([#&#8203;11446](https://github.com/aquasecurity/trivy/issues/11446))
- [`e0964c9`](https://github.com/aquasecurity/trivy/commit/e0964c97819b1d6a45b7e0426803745f173fc550) fix(deps): bump the docker group with 3 updates \[backport: release/v0.76] ([#&#8203;11443](https://github.com/aquasecurity/trivy/issues/11443))
- [`992c360`](https://github.com/aquasecurity/trivy/commit/992c360c33d9f9627bb24c1fe3f20815110c88e5) fix(deps): bump the common group with 3 updates \[backport: release/v0.76] ([#&#8203;11442](https://github.com/aquasecurity/trivy/issues/11442))

### [`v0.76.0`](https://github.com/aquasecurity/trivy/blob/HEAD/CHANGELOG.md#0760-2026-10-14)

[Compare Source](https://github.com/aquasecurity/trivy/compare/v0.75.0...v0.76.0)

##### Features

- **crypto:** distinguish DSA algorithms by L and N ([#&#8203;11366](https://github.com/aquasecurity/trivy/issues/11366)) ([bcc9bd4](https://github.com/aquasecurity/trivy/commit/bcc9bd47fa67dd251312d0b361fa568a108f0cac))
- **crypto:** report nominal security levels of algorithms ([#&#8203;11369](https://github.com/aquasecurity/trivy/issues/11369)) ([a67baa8](https://github.com/aquasecurity/trivy/commit/a67baa8d36f5307d5f9fbdfd9bc9977bf74228a7))
- **echo:** support Echo Maven and npm package scanning ([#&#8203;10883](https://github.com/aquasecurity/trivy/issues/10883)) ([7c1b1fa](https://github.com/aquasecurity/trivy/commit/7c1b1fa19f1628132a9e8377fed127682500d87d))
- **vuln:** extend RapidFort scanner to Debian, Oracle, Rocky, Alma, and Amazon ([#&#8203;11285](https://github.com/aquasecurity/trivy/issues/11285)) ([aaebec6](https://github.com/aquasecurity/trivy/commit/aaebec6cf772111b2bd1dca221e0c36e0a952817))

##### Bug Fixes

- **echo:** match +echo.N local segment anywhere in pip versions ([#&#8203;11367](https://github.com/aquasecurity/trivy/issues/11367)) ([bfb43a4](https://github.com/aquasecurity/trivy/commit/bfb43a49642fbdf60f5e794bba5982fdaa433136))
- **php:** keep dependency edges to packages named like PHP extensions ([#&#8203;11051](https://github.com/aquasecurity/trivy/issues/11051)) ([0900c7e](https://github.com/aquasecurity/trivy/commit/0900c7eb5a29f1169a3fdabd6ce4b45da2271400))
- **vex:** avoid panic on CSAF advisory without a CVE ([#&#8203;10990](https://github.com/aquasecurity/trivy/issues/10990)) ([431288f](https://github.com/aquasecurity/trivy/commit/431288f897ff543f19c49274dcc1df1a3bef8664))

### [`v0.75.0`](https://github.com/aquasecurity/trivy/blob/HEAD/CHANGELOG.md#0750-2026-10-01)

[Compare Source](https://github.com/aquasecurity/trivy/compare/v0.74.0...v0.75.0)

##### ⚠ BREAKING CHANGES

- **report:** remove getHostByName from templates ([#&#8203;11206](https://github.com/aquasecurity/trivy/issues/11206))

##### Features

- add cryptographic asset model and parser ([#&#8203;10970](https://github.com/aquasecurity/trivy/issues/10970)) ([64e1715](https://github.com/aquasecurity/trivy/commit/64e17158b838f3154be3c75cd4799d058143ea92))
- **cli:** allow disabling configuration files with empty paths ([#&#8203;11210](https://github.com/aquasecurity/trivy/issues/11210)) ([5f00edd](https://github.com/aquasecurity/trivy/commit/5f00edd05931cb8034242668e3951aa9aa723db1))
- **crypto:** add analyzer and pass assets to the scan report ([#&#8203;11104](https://github.com/aquasecurity/trivy/issues/11104)) ([fb7ad28](https://github.com/aquasecurity/trivy/commit/fb7ad289bdf017e697d7633942774d2c91f7f298))
- **crypto:** add the crypto scanner to the image command ([#&#8203;11144](https://github.com/aquasecurity/trivy/issues/11144)) ([dc9a384](https://github.com/aquasecurity/trivy/commit/dc9a38453595894876b4c2290d3c61279da44c5d))
- **crypto:** describe ML-DSA keys and signature algorithms ([#&#8203;11137](https://github.com/aquasecurity/trivy/issues/11137)) ([20c3c35](https://github.com/aquasecurity/trivy/commit/20c3c3520b01a0083e6155e5e547f803d41ddfd8))
- **crypto:** describe parsed material as cryptographic assets ([#&#8203;11092](https://github.com/aquasecurity/trivy/issues/11092)) ([7d0a892](https://github.com/aquasecurity/trivy/commit/7d0a892930369a387c31c68f4390131be0741022))
- **crypto:** output cryptographic assets in CycloneDX ([#&#8203;11125](https://github.com/aquasecurity/trivy/issues/11125)) ([3897d5c](https://github.com/aquasecurity/trivy/commit/3897d5c35e2dfa4d8d0ed15bf958fe5e943a91b4))
- **crypto:** transfer cryptographic assets in client/server mode ([#&#8203;11141](https://github.com/aquasecurity/trivy/issues/11141)) ([4128b7f](https://github.com/aquasecurity/trivy/commit/4128b7f4ece535c1c0ca60ee5766f5016efd65e0))
- **echo:** add vulnerability detection for Echo-patched Python packages ([#&#8203;10555](https://github.com/aquasecurity/trivy/issues/10555)) ([98787b8](https://github.com/aquasecurity/trivy/commit/98787b870c109531416cea6019a9b55af224a101))

##### Bug Fixes

- avoid panics on malformed dependency files and version-less Amazon Linux release ([#&#8203;10996](https://github.com/aquasecurity/trivy/issues/10996)) ([ef28d95](https://github.com/aquasecurity/trivy/commit/ef28d95fea53a7456ec631635ef8556861faee8a))
- correct grammar and typos in user-facing error messages ([#&#8203;11211](https://github.com/aquasecurity/trivy/issues/11211)) ([a8c8409](https://github.com/aquasecurity/trivy/commit/a8c8409ef130b617524f71a12f6faa4cb44a04ab))
- correct grammar and typos in user-facing error messages and CLI flags ([#&#8203;11281](https://github.com/aquasecurity/trivy/issues/11281)) ([5ba5be0](https://github.com/aquasecurity/trivy/commit/5ba5be055fb0ad060403100c54b2aecae62c7e9e))
- **crypto:** read RSA private keys without validating their math ([#&#8203;11319](https://github.com/aquasecurity/trivy/issues/11319)) ([3683d7d](https://github.com/aquasecurity/trivy/commit/3683d7d497b60084057f8b332176a32b75cb473a))
- **go:** honor go directive when merging go.sum ([#&#8203;11169](https://github.com/aquasecurity/trivy/issues/11169)) ([71190a6](https://github.com/aquasecurity/trivy/commit/71190a68a9108aefa7131ad4249fa077e3d09816))
- **go:** restore stdlib version parsing for vendor-patched Go toolchains ([#&#8203;11119](https://github.com/aquasecurity/trivy/issues/11119)) ([a851889](https://github.com/aquasecurity/trivy/commit/a851889c930eb8a604dec96ad9a783d75e2b6ac6))
- **license:** report unparsable license names with UNKNOWN severity ([#&#8203;11254](https://github.com/aquasecurity/trivy/issues/11254)) ([7b598ab](https://github.com/aquasecurity/trivy/commit/7b598ab7a97bd01c4ad1ab1f80c23a2574915410))
- **license:** use canonical SPDX casing for license.id ([#&#8203;11165](https://github.com/aquasecurity/trivy/issues/11165)) ([89d3acf](https://github.com/aquasecurity/trivy/commit/89d3acfce93a34e2120dbff0f71c947aadce4c83))
- **misconf:** report correct line numbers in multi-document manifests ([#&#8203;11207](https://github.com/aquasecurity/trivy/issues/11207)) ([4eac9a0](https://github.com/aquasecurity/trivy/commit/4eac9a04f2c2b3ae990b9b361d14b65103278c7b))
- **nodejs:** support boolean resolved field in package-lock.json ([#&#8203;11156](https://github.com/aquasecurity/trivy/issues/11156)) ([a2474b8](https://github.com/aquasecurity/trivy/commit/a2474b8410166610633adc7a5a20be1618c63c19))
- **os:** keep the fullest OS version when merging analyzer results ([#&#8203;11039](https://github.com/aquasecurity/trivy/issues/11039)) ([0afeae0](https://github.com/aquasecurity/trivy/commit/0afeae01abcf4a4d6a1538a716a81dae7e2c203f))
- **purl:** classify julia, bottlerocket and centos stream packages ([#&#8203;11326](https://github.com/aquasecurity/trivy/issues/11326)) ([3a1b311](https://github.com/aquasecurity/trivy/commit/3a1b311e63a1b64ab3221bf52683581b77187198))
- **python:** skip pip requirement lines with malformed extras brackets ([#&#8203;11300](https://github.com/aquasecurity/trivy/issues/11300)) ([7e71d21](https://github.com/aquasecurity/trivy/commit/7e71d211f51f2599af7ded5fbfad96b50430446e))
- **python:** support uv workspace lockfiles ([#&#8203;10553](https://github.com/aquasecurity/trivy/issues/10553)) ([a072319](https://github.com/aquasecurity/trivy/commit/a072319acd27e4ef85d73ff7b4c980b5e0646671))
- **report:** remove getHostByName from templates ([#&#8203;11206](https://github.com/aquasecurity/trivy/issues/11206)) ([9b2b830](https://github.com/aquasecurity/trivy/commit/9b2b830877a78ab77999a9fe2c4526b8cd4b922a))
- **repo:** strip credentials from remote repository URL in artifact name ([#&#8203;11213](https://github.com/aquasecurity/trivy/issues/11213)) ([c961eeb](https://github.com/aquasecurity/trivy/commit/c961eebeab1fa21330792abfc818236867e6e5ac))
- **sbom:** skip null entries in SPDX file and package arrays ([#&#8203;11101](https://github.com/aquasecurity/trivy/issues/11101)) ([0aaaa71](https://github.com/aquasecurity/trivy/commit/0aaaa7174d978e04d75d39a9494ff5b0245cdc53))
- **server:** propagate package modularity label, build info and installed files ([#&#8203;11188](https://github.com/aquasecurity/trivy/issues/11188)) ([bf9f5b7](https://github.com/aquasecurity/trivy/commit/bf9f5b781ec7128e145367c8b5f9890117471fff))
- set locations for JSON values sharing a line ([#&#8203;11231](https://github.com/aquasecurity/trivy/issues/11231)) ([e5b5a3a](https://github.com/aquasecurity/trivy/commit/e5b5a3ac5876550eff50b1e14949589d91e01976))
- **terraform:** do not override --skip-files with --skip-dirs ([#&#8203;11191](https://github.com/aquasecurity/trivy/issues/11191)) ([1c8c54f](https://github.com/aquasecurity/trivy/commit/1c8c54fe9e2d18411cd997d5009a7771730f1481))
- **vex:** avoid panic on CSAF relationships without a sub-component ([#&#8203;11067](https://github.com/aquasecurity/trivy/issues/11067)) ([ae561f8](https://github.com/aquasecurity/trivy/commit/ae561f8cca36b4b11434b0a6d171b39ec1ad871e))

##### Performance Improvements

- avoid regrowing the buffer when reading a cached file ([#&#8203;11134](https://github.com/aquasecurity/trivy/issues/11134)) ([25521f4](https://github.com/aquasecurity/trivy/commit/25521f48ea415d3886d5f5cdc820937b25fb302d))
- **crypto:** report repeated x509 material once per file ([#&#8203;11263](https://github.com/aquasecurity/trivy/issues/11263)) ([f6423f6](https://github.com/aquasecurity/trivy/commit/f6423f6053ddbba178f99e1e8878ba1a46bb5d80))
- reuse one JSON unmarshaler per document ([#&#8203;11232](https://github.com/aquasecurity/trivy/issues/11232)) ([e97dfcc](https://github.com/aquasecurity/trivy/commit/e97dfcc1bd777cdc85a2aedb52b761ea543b9ae0))
- **secret:** avoid cloning the logger for every rule ([#&#8203;11133](https://github.com/aquasecurity/trivy/issues/11133)) ([ab3cf86](https://github.com/aquasecurity/trivy/commit/ab3cf8625cf461e5471259e50681d230017b2b65))
- **secret:** replace per-rule keyword search with one Aho-Corasick pass ([#&#8203;11179](https://github.com/aquasecurity/trivy/issues/11179)) ([f372e56](https://github.com/aquasecurity/trivy/commit/f372e564e5ad6d02bf820a90b477913f827e5a1e))
- take JSON line numbers from decoder offsets ([#&#8203;11233](https://github.com/aquasecurity/trivy/issues/11233)) ([7e21433](https://github.com/aquasecurity/trivy/commit/7e21433cb3cdb61118cc7d1704446541f35e8396))

</details>

---

### Configuration

📅 **Schedule**: (in timezone Europe/Paris)

- Branch creation
  - At any time (no schedule defined)
- 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.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Mend Renovate CLI](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0NC4yNTcuOSIsInVwZGF0ZWRJblZlciI6IjQ0LjI1Ny45IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJib3QiLCJtaW5vciJdfQ==-->

Reviewed-on: https://git.djeex.fr/Djeex/socat-proxy/pulls/13
Co-authored-by: Djeex <[email protected]>
2026-11-21 19:44:40 +01:00
Djeex ec64cc6508 Track CI tool images with Renovate (#12)
CI / build-and-scan (push) Successful in 53s
## Summary
- Custom Renovate manager for the CI tool images pinned in `docker run`/`docker create` commands (Trivy, gitleaks, hadolint), which the default managers do not detect.
- Renovate will now open PRs to bump them; they are not automerged.

## Test plan
- [ ] CI green on this PR
- [ ] After merge, Renovate opens a PR bumping Trivy
- [ ] That PR passes CI before merging

Reviewed-on: #12
Co-authored-by: Djeex <[email protected]>
2026-11-21 18:46:52 +01:00
Djeex bedba358ae Pin image digests and add minimum release age (#11)
CI / build-and-scan (push) Successful in 2m0s
## Summary
- `docker:pinDigests`: Renovate pins image digests and opens digest PRs when a base image is rebuilt.
- `minimumReleaseAge`: 3 days.
- Automerge for `pin` and `digest` updates.

## Test plan
- [ ] CI green on this PR
- [ ] After merge, Renovate opens a pin PR for the Dockerfile digests
- [ ] That PR automerges once CI passes

Reviewed-on: #11
Co-authored-by: Djeex <[email protected]>
2026-11-21 18:20:43 +01:00
socat-proxy-ci 38d5901112 Bump build version to 1.1.4 [skip ci] 2026-11-06 04:07:16 +00:00
Djeex 1037c2114b Update alpine Docker tag to v3.24.4
CI / build-and-scan (pull_request) Successful in 57s
CI / build-and-scan (push) Successful in 1m0s
2026-11-06 04:01:32 +00:00
socat-proxy-ci 64b8a919e8 Bump build version to 1.1.3 [skip ci] 2026-10-23 03:10:50 +00:00
Djeex 007b2f490e Update alpine Docker tag to v3.24.3
CI / build-and-scan (pull_request) Successful in 55s
CI / build-and-scan (push) Successful in 1m34s
2026-10-23 03:01:19 +00:00
socat-proxy-ci 21146660de Bump build version to 1.1.2 [skip ci] 2026-09-21 03:06:31 +00:00
Djeex 70cf2b51c5 Update alpine Docker tag to v3.24.2
CI / build-and-scan (pull_request) Successful in 1m6s
CI / build-and-scan (push) Failing after 51s
2026-09-21 03:04:29 +00:00
socat-proxy-ci fc06ff4886 Bump build version to 1.1.1 [skip ci] 2026-08-26 14:38:43 +00:00
Djeex 93fe213c18 Fix flaky unit test on merge-triggered CI runs (#7)
CI / build-and-scan (push) Successful in 2m24s
- entrypoint.sh: bound the target connectivity check with `-w 2` (the only unbounded step in the startup path)
- tests/entrypoint.bats: widen wait_for_log's budget from 5s to 10s

Merge-triggered runs land on a colder runner (Docker cache evicted by other repos' scheduled jobs since the PR was last tested) than PR-check runs, and the first backgrounded entrypoint.sh in the suite was occasionally landing just past the old 5s window — always passed on rerun once warm.
2026-08-26 16:36:39 +02:00
Djeex 348d39192b CI/CD hardening: lint, secret scan, coverage gate, auto CVE-fix PRs, GHCR + GitHub mirror publishing (#6) [skip ci]
- release changelog: commits rendered as description (link), divider lines dropped
- gitleaks secret scan and hadolint on every push/PR
- ruff lint/format gate (Python repos) with a pytest --cov-fail-under gate
- scheduled CRITICAL Trivy failures attempt an apk upgrade rebuild and open a follow-up PR if it clears the finding, instead of just failing red
- images also published to ghcr.io/djeex/<repo>
- a matching GitHub Release is created on the GitHub mirror, with a notice pointing back to this repo as the source of truth
2026-08-26 16:30:56 +02:00
Djeex 71ba8a73fc Merge pull request 'Release notes: list commits instead of changed files' (#5) from dev-v1.1 into main
Reviewed-on: #5
2026-08-23 23:35:40 +02:00
Djeex e196e61941 Link each commit in the release changelog to its own commit page
COMMIT_LIST only rendered the bare subject line per commit, with no
way to jump to that specific commit — only the triggering commit
(Source:) had a link. Each line now reads
"- [<short-sha>](<repo>/commit/<sha>) <subject>", matching the same
link style already used for Source.
2026-08-23 23:22:44 +02:00
Djeex 6e923d3f32 Release notes: list commits instead of changed files 2026-08-23 23:22:44 +02:00
Djeex f8fd388ade Merge pull request 'Run as non-root by default via PUID/PGID' (#4) from dev-v1.1 into main
Reviewed-on: #4
2026-08-23 15:18:11 +02:00
Djeex 0cc1b3cb37 Run as non-root by default via PUID/PGID 2026-08-23 15:10:17 +02:00
socat-proxy-ci a8ce9a5d1a Bump build version to 1.0.1 [skip ci] 2026-08-22 22:13:27 +00:00
Djeex 7e614803aa Merge pull request 'Update alpine Docker tag to v3.24.1' (#2) from renovate/alpine-3.x into main
Reviewed-on: #2
2026-08-23 00:08:24 +02:00
Djeex 09fb0c0b43 Update alpine Docker tag to v3.24.1 2026-08-22 22:05:22 +00:00
Djeex c6d525fec8 Merge pull request 'Dev ci' (#1) from dev-ci into main
Reviewed-on: #1
2026-08-23 00:04:45 +02:00
Djeex cf45734fc0 Add Renovate config
Same policy as adguard-cidre: patch-level Dockerfile bumps automerge,
minor/major get a labeled PR, vulnerability alerts labeled bug. No
pip_requirements rule — this repo has no Python dependencies to manage.

Still needed on the Gitea/Renovate side (manual, not done here):
uncomment socat-proxy in the shared ~/renovate/config.js repositories
array on stockeex, and create the bot/major/minor/bug labels in this
repo's Issues → Labels (Renovate silently drops labels that don't
already exist).
2026-08-23 00:02:11 +02:00
Djeex 387c551c41 Add Gitea Actions CI workflow
Adapted from adguard-cidre's pipeline: build, syntax smoke-test, bats
unit tests, shellcheck lint, Trivy critical/high scans, then on push to
main a versioned publish (VERSION auto-bump, :latest/:X.Y/:X.Y.Z tags
retagged from the already-scanned image, and a categorized Gitea
Release). Requires the REGISTRY_TOKEN and CI_PUSH_TOKEN repo secrets
and branch protection on main (not yet configured on the Gitea side).
2026-08-22 23:50:47 +02:00
Djeex 56daf61290 Multi-stage Dockerfile: pin base image, add test/lint stages
Pin alpine:latest to the full patch-level tag alpine:3.22.1 so Renovate
can classify patch/minor/major bumps on it. Add a `test` stage (bats)
and a `lint` stage (shellcheck, severity=error) that build from `base`
before ENTRYPOINT is set, so CI can run them without an --entrypoint
override. A trailing `FROM base` keeps the lean prod image as the
default `docker build .` target despite the extra stages.
2026-08-22 23:50:40 +02:00
Djeex 59be656047 Add bats test suite for entrypoint.sh
Covers env-var validation, socket path preparation, target connectivity
messaging, DEBUG_LEVEL to socat-flag mapping, and graceful shutdown vs.
crash detection — run against the real socat/nc binaries rather than
mocks, since UNIX-LISTEN binds without needing the TCP target reachable.
2026-08-22 23:50:32 +02:00
9 changed files with 324 additions and 102 deletions

No files matched your search

+2
View File
@@ -1,3 +1,5 @@
PUID=1000 # User id the process runs as
PGID=1000 # Group id the process runs as
TARGET_HOST= # Target hostname/IP to proxy to
TARGET_PORT= # Target port to proxy to
UNIX_SOCKET_NAME= # Name of the socket file
+130 -9
View File
@@ -6,7 +6,8 @@ on:
pull_request:
branches: [main]
schedule:
- cron: "0 6 * * 1"
# Saturday 05:00 UTC: 06:00 in Paris in winter, 07:00 in summer (Gitea runs cron in UTC).
- cron: "0 5 * * 6"
jobs:
build-and-scan:
@@ -18,6 +19,30 @@ jobs:
fetch-depth: 0
persist-credentials: false
- name: Get shared actions
uses: actions/checkout@v7
with:
repository: labeex/cicdeex
ref: 1.0.0
token: ${{ secrets.CICDEEX_TOKEN }}
path: .cicdeex
persist-credentials: false
- name: Scan for secrets
run: |
# docker cp, not a build COPY: a repo's own .dockerignore (e.g. one that
# excludes .git for prod builds) would otherwise silently give an empty,
# falsely-clean scan.
CID=$(docker create zricethezav/gitleaks:v8.30.1 detect --source=/repo --no-banner -v)
docker cp . "$CID:/repo"
docker start -a "$CID"
STATUS=$?
docker rm "$CID" > /dev/null
exit $STATUS
- name: Lint Dockerfile with hadolint
run: docker run --rm -i hadolint/hadolint:v2.15.1-alpine hadolint --failure-threshold error - < Dockerfile
- name: Build Docker image
run: docker build -t socat-proxy:ci .
@@ -33,28 +58,85 @@ jobs:
run: docker build --target lint -t socat-proxy:lint .
- name: Scan with Trivy (critical - blocking)
id: trivy_critical
continue-on-error: true
run: |
docker run --rm \
-e DOCKER_HOST=tcp://dockerhost:2375 \
--add-host=dockerhost:host-gateway \
aquasec/trivy:0.74.0 image --exit-code 1 --severity CRITICAL socat-proxy:ci
aquasec/trivy:0.76.2 image --exit-code 1 --severity CRITICAL socat-proxy:ci
- name: Handle CRITICAL findings
if: steps.trivy_critical.outcome == 'failure'
run: |
if [ "${{ github.event_name }}" != "schedule" ]; then
echo "::error::CRITICAL vulnerabilities found, failing the build."
exit 1
fi
echo "Scheduled scan found CRITICAL vulnerabilities — attempting an automatic apk upgrade + rescan."
sed -i '/^FROM .* AS base$/a RUN apk upgrade --no-cache' Dockerfile
docker build -t socat-proxy:remediated .
if docker run --rm \
-e DOCKER_HOST=tcp://dockerhost:2375 \
--add-host=dockerhost:host-gateway \
aquasec/trivy:0.76.2 image --exit-code 1 --severity CRITICAL socat-proxy:remediated; then
echo "apk upgrade clears the CRITICAL finding(s) — opening a PR for review."
BRANCH="auto/cve-fix-$(date +%Y%m%d)-$(echo "${{ github.sha }}" | cut -c1-7)"
git config user.name "socat-proxy-ci"
git config user.email "[email protected]"
git checkout -b "$BRANCH"
git add Dockerfile
git commit -m "Auto-remediate CRITICAL CVE via apk upgrade"
git config --unset-all http.https://git.djeex.fr/.extraheader || true
git push "https://Djeex:${{ secrets.CI_PUSH_TOKEN }}@git.djeex.fr/Djeex/socat-proxy.git" "HEAD:$BRANCH"
PR_JSON=$(curl -s -X POST \
-H "Authorization: token ${{ secrets.CI_PUSH_TOKEN }}" \
-H "Content-Type: application/json" \
-d "$(jq -n --arg head "$BRANCH" '{title: "🔒 Auto: remediate CRITICAL CVE via apk upgrade", head: $head, base: "main", body: "Opened automatically by the scheduled CVE scan. An `apk upgrade --no-cache` cleared the CRITICAL Trivy finding(s) in a rebuild — review the diff and merge to publish the fix."}')" \
"https://git.djeex.fr/api/v1/repos/Djeex/socat-proxy/pulls")
echo "PR API response: $(echo "$PR_JSON" | jq -r '.html_url // .message // "unknown"')"
else
echo "::error::apk upgrade does not clear the CRITICAL finding(s) — no automatic fix available, needs manual review."
exit 1
fi
- name: Scan with Trivy (high - informative)
run: |
docker run --rm \
-e DOCKER_HOST=tcp://dockerhost:2375 \
--add-host=dockerhost:host-gateway \
aquasec/trivy:0.74.0 image --exit-code 0 --severity HIGH socat-proxy:ci
aquasec/trivy:0.76.2 image --exit-code 0 --severity HIGH socat-proxy:ci
# Pilot: the shared publish action in dry-run, before the real publish,
# to compare its output with what the step below really does.
- name: Publish dry-run (cicdeex pilot)
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
continue-on-error: true
uses: ./.cicdeex/publish
with:
image: socat-proxy:ci
paths: '^(Dockerfile|entrypoint\.sh|VERSION)$'
push-token: ${{ secrets.CI_PUSH_TOKEN }}
registry-token: ${{ secrets.REGISTRY_TOKEN }}
github-mirror: "true"
github-token: ${{ secrets.GH_TOKEN }}
dry-run: "true"
- name: Publish tagged image
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
run: |
BEFORE="${{ github.event.before }}"
if [ -n "$BEFORE" ] && [ "$BEFORE" != "0000000000000000000000000000000000000000" ] && git cat-file -e "$BEFORE" 2>/dev/null; then
CHANGED=$(git diff --name-only "$BEFORE" "${{ github.sha }}")
BASE_REF="$BEFORE"
else
CHANGED=$(git diff --name-only HEAD~1 HEAD)
BASE_REF="HEAD~1"
fi
CHANGED=$(git diff --name-only "$BASE_REF" "${{ github.sha }}")
echo "Changed files:"
echo "$CHANGED"
@@ -102,6 +184,16 @@ jobs:
docker push "$IMAGE:$MINOR_TAG"
docker push "$IMAGE:$VERSION"
GHCR_IMAGE=ghcr.io/djeex/socat-proxy
echo "${{ secrets.GH_TOKEN }}" | docker login ghcr.io -u Djeex --password-stdin
docker tag socat-proxy:ci "$GHCR_IMAGE:latest"
docker tag socat-proxy:ci "$GHCR_IMAGE:$MINOR_TAG"
docker tag socat-proxy:ci "$GHCR_IMAGE:$VERSION"
docker push "$GHCR_IMAGE:latest"
docker push "$GHCR_IMAGE:$MINOR_TAG"
docker push "$GHCR_IMAGE:$VERSION"
TRIGGER_MSG=$(git log -1 --format=%s "${{ github.sha }}")
PR_NUM=$(echo "$TRIGGER_MSG" | grep -oE '#[0-9]+' | head -1 | tr -d '#' || true)
@@ -127,9 +219,9 @@ jobs:
fi
fi
CHANGED_LIST=$(echo "$CHANGED" | sed 's/^/- /')
REPO_URL="https://git.djeex.fr/Djeex/socat-proxy"
COMMIT_LIST=$(git log --no-merges --format="- %s ([%h](${REPO_URL}/commit/%H))" "$BASE_REF".."${{ github.sha }}")
SHORT_SHA=$(echo "${{ github.sha }}" | cut -c1-7)
SOURCE_LINE="[${SHORT_SHA}](${REPO_URL}/commit/${{ github.sha }})"
if [ -n "$PR_NUM" ]; then
@@ -145,8 +237,8 @@ jobs:
**Source:** ${SOURCE_LINE}
**Image:** \`${IMAGE}:${VERSION}\`
**Changed files:**
${CHANGED_LIST}
**Commits:**
${COMMIT_LIST}
EOF
)
@@ -161,3 +253,32 @@ jobs:
-H "Content-Type: application/json" \
-d "$JSON_PAYLOAD" \
"https://git.djeex.fr/api/v1/repos/Djeex/socat-proxy/releases"
MIRROR_NOTICE="_This github repo is a mirror of https://git.djeex.fr/Djeex/socat-proxy. You'll find full package, PR, history and release note there._"
GH_BODY=$(printf '%s\n\n%s' "$MIRROR_NOTICE" "$BODY")
GH_JSON_PAYLOAD=$(jq -n \
--arg tag "$VERSION" \
--arg name "$VERSION" \
--arg body "$GH_BODY" \
--arg sha "${{ github.sha }}" \
'{tag_name: $tag, name: $name, target_commitish: $sha, body: $body}')
GH_STATUS=0
for i in 1 2 3 4 5; do
GH_STATUS=$(curl -s -o /tmp/gh_release.json -w "%{http_code}" -X POST \
-H "Authorization: Bearer ${{ secrets.GH_TOKEN }}" \
-H "Accept: application/vnd.github+json" \
-H "Content-Type: application/json" \
-d "$GH_JSON_PAYLOAD" \
"https://api.github.com/repos/Djeex/socat-proxy/releases")
if [ "$GH_STATUS" = "201" ]; then
break
fi
echo "GitHub Release attempt $i failed (HTTP $GH_STATUS) — mirror may not have synced this commit yet, retrying in 15s..."
sleep 15
done
echo "GitHub Release API response: $GH_STATUS"
if [ "$GH_STATUS" != "201" ]; then
cat /tmp/gh_release.json 2>/dev/null || true
fi
+2 -2
View File
@@ -1,6 +1,6 @@
FROM alpine:3.24.1 AS base
FROM alpine:3.24.4@sha256:f59abe656b692d901e184be3445e084786602108599d2a51d229c0f5a48c71bf AS base
RUN apk add --no-cache socat netcat-openbsd \
RUN apk add --no-cache socat netcat-openbsd su-exec \
&& rm -rf /var/cache/apk/* /tmp/*
COPY entrypoint.sh VERSION /
+8
View File
@@ -46,6 +46,8 @@ Proxy Docker socket from a docker proxy to a container in host mode without dire
| Variable | Default | Description | Example |
|----------|---------|-------------|---------|
| `PUID` | `911` | User ID the process runs as (drops root at startup) | `1000` |
| `PGID` | `911` | Group ID the process runs as | `1000` |
| `TARGET_HOST` | - | Target hostname/IP to proxy to | `socket-proxy-beszel` |
| `TARGET_PORT` | - | Target port to proxy to | `2375` |
| `UNIX_SOCKET_NAME` | - | Name of the socket file | `docker.sock` |
@@ -59,6 +61,8 @@ Proxy Docker socket from a docker proxy to a container in host mode without dire
1. Create a `.env` file with your configuration:
```bash
PUID=1000 #user id the process runs as
PGID=1000 #group id the process runs as
TARGET_HOST= #your target host
TARGET_PORT= #your target host port
UNIX_SOCKET_NAME= #your socket file name
@@ -73,6 +77,8 @@ services:
socat-proxy:
image: git.djeex.fr/djeex/socat-proxy:latest
environment:
- PUID=${PUID}
- PGID=${PGID}
- TARGET_HOST=${TARGET_HOST}
- TARGET_PORT=${TARGET_PORT}
- UNIX_SOCKET_NAME=${UNIX_SOCKET_NAME}
@@ -94,6 +100,8 @@ docker compose up -d
```bash
docker run -d \
--name socat-proxy \
-e PUID=1000 #user id the process runs as \
-e PGID=1000 #group id the process runs as \
-e TARGET_HOST= #your target host \
-e TARGET_PORT= #your target host port \
-e UNIX_SOCKET_NAME= #your socket file name \
+1 -1
View File
@@ -1 +1 @@
1.0.1
1.1.5
+2
View File
@@ -3,6 +3,8 @@ services:
socat-proxy:
build: .
environment:
- PUID=${PUID}
- PGID=${PGID}
- TARGET_HOST=${TARGET_HOST}
- TARGET_PORT=${TARGET_PORT}
- UNIX_SOCKET_NAME=${UNIX_SOCKET_NAME}
+124 -66
View File
@@ -4,6 +4,52 @@ set -e
CYAN="\033[1;36m"
NC="\033[0m"
log() { echo "$(date '+%Y-%m-%d %H:%M:%S') $*"; }
fail() { echo "$(date '+%Y-%m-%d %H:%M:%S') [!] $*" >&2; exit 1; }
print_banner() {
version=$(cat VERSION 2>/dev/null || echo "unknown")
title="Socat Proxy - Version ${version}"
lines="Source: https://git.djeex.fr/Djeex/socat-proxy
Mirror: https://github.com/Djeex/socat-proxy"
width=${#title}
old_ifs=$IFS
IFS='
'
for l in $lines; do
[ ${#l} -gt "$width" ] && width=${#l}
done
IFS=$old_ifs
width=$((width + 2))
border=""
i=0
while [ "$i" -lt "$width" ]; do
border="${border}─"
i=$((i + 1))
done
printf "${CYAN}╭%s╮${NC}\n" "$border"
total_pad=$((width - ${#title}))
left=$((total_pad / 2))
right=$((total_pad - left))
printf "${CYAN}│${NC}%*s%s%*s${CYAN}│${NC}\n" "$left" "" "$title" "$right" ""
printf "${CYAN}├%s┤${NC}\n" "$border"
IFS='
'
for l in $lines; do
printf "${CYAN}│${NC} %-*s${CYAN}│${NC}\n" "$((width - 1))" "$l"
done
IFS=$old_ifs
printf "${CYAN}╰%s╯${NC}\n" "$border"
}
print_banner
DEBUG_LEVEL=${DEBUG_LEVEL:-1}
UNIX_SOCKET_PATH=${UNIX_SOCKET_PATH%/}
HOST_SOCKET_PATH=${HOST_SOCKET_PATH%/}
@@ -11,107 +57,116 @@ HOST_SOCKET_PATH=${HOST_SOCKET_PATH%/}
FULL_HOST_SOCKET_PATH="$HOST_SOCKET_PATH/$UNIX_SOCKET_NAME"
FULL_UNIX_SOCKET_PATH="$UNIX_SOCKET_PATH/$UNIX_SOCKET_NAME"
VERSION=$(cat VERSION)
echo -e "${CYAN}╭────────────────────────────────────────────────╮${NC}"
echo -e "${CYAN}│${NC} Socat-proxy - Version ${VERSION}${NC} ${CYAN}│${NC}"
echo -e "${CYAN}├────────────────────────────────────────────────┤${NC}"
echo -e "${CYAN}│${NC} Source: https://git.djeex.fr/Djeex/socat-proxy ${CYAN}│${NC}"
echo -e "${CYAN}│${NC} Mirror: https://github.com/Djeex/socat-proxy ${CYAN}│${NC}"
echo -e "${CYAN}╰────────────────────────────────────────────────╯${NC}"
# Validate required environment variables
if [ -z "$TARGET_HOST" ]; then
echo "[✗] TARGET_HOST environment variable is required"
exit 1
fi
[ -n "$TARGET_HOST" ] || fail "TARGET_HOST environment variable is required"
[ -n "$TARGET_PORT" ] || fail "TARGET_PORT environment variable is required"
[ -n "$UNIX_SOCKET_NAME" ] || fail "UNIX_SOCKET_NAME environment variable is required"
[ -n "$UNIX_SOCKET_PATH" ] || fail "UNIX_SOCKET_PATH environment variable is required"
[ -n "$HOST_SOCKET_PATH" ] || fail "HOST_SOCKET_PATH environment variable is required"
if [ -z "$TARGET_PORT" ]; then
echo "[✗] TARGET_PORT environment variable is required"
exit 1
fi
PUID=${PUID:-911}
PGID=${PGID:-911}
if [ -z "$UNIX_SOCKET_NAME" ]; then
echo "[✗] UNIX_SOCKET_NAME environment variable is required"
exit 1
fi
case "$PGID" in
''|*[!0-9]*) fail "PGID '$PGID' is not a valid numeric group id." ;;
esac
case "$PUID" in
''|*[!0-9]*) fail "PUID '$PUID' is not a valid numeric user id." ;;
esac
if [ -z "$UNIX_SOCKET_PATH" ]; then
echo "[✗] UNIX_SOCKET_PATH environment variable is required"
exit 1
fi
log "[i] Requested PUID=$PUID, PGID=$PGID"
if [ -z "$HOST_SOCKET_PATH" ]; then
echo "[✗] HOST_SOCKET_PATH environment variable is required"
exit 1
log "[~] Checking group for GID $PGID..."
GROUP_NAME=$(getent group "$PGID" | cut -d: -f1 || true)
if [ -z "$GROUP_NAME" ]; then
log "[→] No existing group with GID $PGID, creating 'appgroup'."
addgroup -g "$PGID" appgroup || fail "Failed to create group with GID $PGID (addgroup exited $?)."
GROUP_NAME=appgroup
else
log "[i] Reusing existing group '$GROUP_NAME' (GID $PGID)."
fi
log "[✓] Group ready: $GROUP_NAME"
echo "[~] Starting socat proxy..."
echo "[i] TCP target: $TARGET_HOST:$TARGET_PORT"
echo "[i] HOST path: $HOST_SOCKET_PATH"
echo "[i] Full host socket path: $FULL_HOST_SOCKET_PATH"
echo "[i] Full socket path: $FULL_UNIX_SOCKET_PATH"
log "[~] Checking user for UID $PUID..."
USER_NAME=$(getent passwd "$PUID" | cut -d: -f1 || true)
if [ -z "$USER_NAME" ]; then
log "[→] No existing user with UID $PUID, creating 'appuser'."
adduser -D -u "$PUID" -G "$GROUP_NAME" appuser || fail "Failed to create user with UID $PUID (adduser exited $?)."
USER_NAME=appuser
else
log "[i] Reusing existing user '$USER_NAME' (UID $PUID)."
fi
log "[✓] User ready: $USER_NAME"
log "[~] Starting socat proxy..."
log "[i] TCP target: $TARGET_HOST:$TARGET_PORT"
log "[i] HOST path: $HOST_SOCKET_PATH"
log "[i] Full host socket path: $FULL_HOST_SOCKET_PATH"
log "[i] Full socket path: $FULL_UNIX_SOCKET_PATH"
# Check if socket file/folder exists and handle it
if [ -e "$FULL_UNIX_SOCKET_PATH" ]; then
echo "[~] Socket file/folder $FULL_UNIX_SOCKET_PATH exists, removing it..."
log "[~] Socket file/folder $FULL_UNIX_SOCKET_PATH exists, removing it..."
if rm -rf "$FULL_UNIX_SOCKET_PATH"; then
echo "[✓] Removed existing socket $FULL_UNIX_SOCKET_PATH"
log "[✓] Removed existing socket $FULL_UNIX_SOCKET_PATH"
else
echo "[✗] Failed to remove existing socket $FULL_UNIX_SOCKET_PATH"
exit 1
fail "Failed to remove existing socket $FULL_UNIX_SOCKET_PATH"
fi
fi
echo "[~] Creating socket directory structure..."
log "[~] Creating socket directory structure..."
# Create directory if needed
if mkdir -p "$UNIX_SOCKET_PATH"; then
echo "[✓] Created directory $UNIX_SOCKET_PATH"
log "[✓] Created directory $UNIX_SOCKET_PATH"
else
echo "[✗] Failed to create directory $UNIX_SOCKET_PATH"
exit 1
fail "Failed to create directory $UNIX_SOCKET_PATH"
fi
echo "[~] Creating socket with netcat..."
# Grant the target user write access to the socket directory so the
# su-exec'd socat process below can create the socket file in it.
log "[~] Setting ownership of $UNIX_SOCKET_PATH to $USER_NAME:$GROUP_NAME..."
chown "$USER_NAME:$GROUP_NAME" "$UNIX_SOCKET_PATH" || fail "chown on $UNIX_SOCKET_PATH failed — check that the host directory permissions allow it."
log "[✓] Ownership set on $UNIX_SOCKET_PATH"
log "[~] Preparing socket path..."
# Create socket file by touching it, then remove it (this creates the path but leaves it clean for socat)
touch "$FULL_UNIX_SOCKET_PATH"
rm "$FULL_UNIX_SOCKET_PATH"
echo "[✓] Socket path prepared at $FULL_UNIX_SOCKET_PATH"
log "[✓] Socket path prepared at $FULL_UNIX_SOCKET_PATH"
# Debug: Check if socket file exists and its permissions
if [ -S "$FULL_UNIX_SOCKET_PATH" ]; then
echo "[✓] Socket file exists and is a socket"
log "[✓] Socket file exists and is a socket"
ls -la "$FULL_UNIX_SOCKET_PATH"
else
echo "[!] Socket file does not exist or is not a socket"
log "[!] Socket file does not exist or is not a socket"
ls -la "$UNIX_SOCKET_PATH"
fi
echo "[~] Testing connection to target..."
log "[~] Testing connection to target..."
# Test if we can reach the target before starting socat
if ! nc -z "$TARGET_HOST" "$TARGET_PORT" 2>/dev/null; then
echo "[!] Cannot connect to $TARGET_HOST:$TARGET_PORT - socat will retry automatically"
if ! nc -z -w 2 "$TARGET_HOST" "$TARGET_PORT" 2>/dev/null; then
log "[!] Cannot connect to $TARGET_HOST:$TARGET_PORT - socat will retry automatically"
else
echo "[✓] Connection to $TARGET_HOST:$TARGET_PORT is working"
log "[✓] Connection to $TARGET_HOST:$TARGET_PORT is working"
fi
# Signal handler for graceful shutdown
cleanup() {
echo "[!] Received SIGTERM, shutting down gracefully..."
if [ ! -z "$SOCAT_PID" ]; then
echo "[~] Stopping socat process (PID: $SOCAT_PID)..."
log "[!] Received SIGTERM, shutting down gracefully..."
if [ -n "$SOCAT_PID" ]; then
log "[~] Stopping socat process (PID: $SOCAT_PID)..."
kill "$SOCAT_PID" 2>/dev/null || true
wait "$SOCAT_PID" 2>/dev/null || true
fi
echo "[~] Cleanup completed, exiting..."
log "[~] Cleanup completed, exiting..."
exit 0
}
# Set up signal trap
trap cleanup SIGTERM SIGINT
echo "[~] Starting socat proxy..."
log "[~] Starting socat proxy..."
# Start socat with configurable verbosity
DEBUG_FLAGS=""
if [ "$DEBUG_LEVEL" -eq 1 ]; then
@@ -122,25 +177,29 @@ elif [ "$DEBUG_LEVEL" -eq 3 ]; then
DEBUG_FLAGS="-d -d -d"
fi
echo "[i] Using debug level: $DEBUG_LEVEL ($DEBUG_FLAGS)"
log "[i] Using debug level: $DEBUG_LEVEL ($DEBUG_FLAGS)"
if socat $DEBUG_FLAGS UNIX-LISTEN:$FULL_UNIX_SOCKET_PATH,fork,unlink-early TCP:$TARGET_HOST:$TARGET_PORT & then
# mode=666 keeps the socket connectable from another container's UID
# regardless of PUID/PGID here — see project notes on the socket
# permission trade-off (this proxy's own threat model is the host/network
# boundary, not multi-tenant isolation between containers on the same host).
log "[→] Dropping privileges to $USER_NAME:$GROUP_NAME and starting socat"
if su-exec "$USER_NAME:$GROUP_NAME" socat $DEBUG_FLAGS UNIX-LISTEN:$FULL_UNIX_SOCKET_PATH,fork,unlink-early,mode=666 TCP:$TARGET_HOST:$TARGET_PORT & then
SOCAT_PID=$!
echo "[✓] Socat started with PID: $SOCAT_PID"
echo "[i] Socat command: socat -d -d UNIX-LISTEN:$FULL_UNIX_SOCKET_PATH,fork,unlink-early TCP:$TARGET_HOST:$TARGET_PORT"
echo "[~] Container is ready and running..."
log "[✓] Socat started with PID: $SOCAT_PID"
log "[i] Socat command: socat $DEBUG_FLAGS UNIX-LISTEN:$FULL_UNIX_SOCKET_PATH,fork,unlink-early,mode=666 TCP:$TARGET_HOST:$TARGET_PORT"
log "[~] Container is ready and running..."
# Debug: Check socket after socat starts
sleep 2
if [ -S "$FULL_UNIX_SOCKET_PATH" ]; then
echo "[✓] Socat socket is active"
log "[✓] Socat socket is active"
ls -la "$FULL_UNIX_SOCKET_PATH"
else
echo "[!] Socat socket not found"
log "[!] Socat socket not found"
fi
else
echo "[✗] Failed to start socat proxy"
exit 1
fail "Failed to start socat proxy"
fi
# Keep the script alive and wait for socat process
@@ -148,5 +207,4 @@ while kill -0 "$SOCAT_PID" 2>/dev/null; do
sleep 1
done
echo "[✗] Socat process has stopped"
exit 1
fail "Socat process has stopped"
+1 -22
View File
@@ -1,25 +1,4 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": ["config:recommended"],
"timezone": "Europe/Paris",
"labels": ["bot"],
"packageRules": [
{
"matchManagers": ["dockerfile"],
"matchUpdateTypes": ["patch"],
"automerge": true
},
{
"matchUpdateTypes": ["major"],
"addLabels": ["major"]
},
{
"matchUpdateTypes": ["minor"],
"addLabels": ["minor"]
}
],
"vulnerabilityAlerts": {
"enabled": true,
"addLabels": ["bug"]
}
"extends": ["local>labeex/renovateex"]
}
+54 -2
View File
@@ -15,6 +15,11 @@
setup() {
TEST_DIR="$(mktemp -d)"
# mktemp defaults to 700 (root-only traversal); a real bind-mounted host
# directory is typically world-traversable, so match that here — otherwise
# the non-root user entrypoint.sh drops to can't even reach its own
# (correctly chowned) socket subdirectory.
chmod 755 "$TEST_DIR"
cp "$BATS_TEST_DIRNAME/../entrypoint.sh" "$TEST_DIR/"
cp "$BATS_TEST_DIRNAME/../VERSION" "$TEST_DIR/"
chmod +x "$TEST_DIR/entrypoint.sh"
@@ -36,7 +41,9 @@ teardown() {
run_entrypoint_bg() {
LOG="$TEST_DIR/out.log"
( cd "$TEST_DIR" && exec ./entrypoint.sh >"$LOG" 2>&1 ) &
# Invoked via the absolute path (not a bare `./entrypoint.sh`) so its
# /proc cmdline actually contains $TEST_DIR for entrypoint_pid() to match.
( cd "$TEST_DIR" && exec "$TEST_DIR/entrypoint.sh" >"$LOG" 2>&1 ) &
disown 2>/dev/null || true
}
@@ -51,7 +58,11 @@ socat_pid() {
wait_for_log() {
pattern="$1"
tries=0
while [ "$tries" -lt 20 ]; do
# 40 * 0.25s = 10s — merge-triggered runs can land on a cold runner
# (evicted Docker cache, first container start), pushing the very first
# backgrounded entrypoint.sh past a tighter budget even though nothing's
# actually wrong; a rerun on a warm runner always passes.
while [ "$tries" -lt 40 ]; do
grep -qE "$pattern" "$LOG" 2>/dev/null && return 0
tries=$((tries + 1))
sleep 0.25
@@ -106,6 +117,47 @@ wait_for_pid_gone() {
[[ "$output" == *"HOST_SOCKET_PATH environment variable is required"* ]]
}
# ---- PUID/PGID privilege dropping ------------------------------------------
@test "fails when PUID is not numeric" {
export PUID=abc
run "$TEST_DIR/entrypoint.sh"
[ "$status" -eq 1 ]
[[ "$output" == *"PUID 'abc' is not a valid numeric user id."* ]]
}
@test "fails when PGID is not numeric" {
export PGID=abc
run "$TEST_DIR/entrypoint.sh"
[ "$status" -eq 1 ]
[[ "$output" == *"PGID 'abc' is not a valid numeric group id."* ]]
}
@test "creates appuser/appgroup at the default 911 PUID/PGID and owns the socket dir" {
run_entrypoint_bg
wait_for_log "Socat socket is active|Socat socket not found"
grep -q "No existing group with GID 911, creating 'appgroup'" "$LOG"
grep -q "No existing user with UID 911, creating 'appuser'" "$LOG"
owner="$(stat -c '%U:%G' "$UNIX_SOCKET_PATH")"
[ "$owner" = "appuser:appgroup" ]
}
@test "reuses an existing user/group instead of creating one" {
export PUID=0
export PGID=0
run_entrypoint_bg
wait_for_log "Socat socket is active|Socat socket not found"
grep -q "Reusing existing group 'root' (GID 0)" "$LOG"
grep -q "Reusing existing user 'root' (UID 0)" "$LOG"
}
@test "creates the socket with mode 666 so other-UID consumers can connect" {
run_entrypoint_bg
wait_for_log "Socat socket is active|Socat socket not found"
mode="$(stat -c '%a' "$UNIX_SOCKET_PATH/$UNIX_SOCKET_NAME")"
[ "$mode" = "666" ]
}
@test "prints the version banner from the VERSION file" {
echo "9.9.9" > "$TEST_DIR/VERSION"
run_entrypoint_bg