Skip to content

Lock down the XMRig HTTP API on Linux (restricted + localhost)#17

Open
VijitSingh97 wants to merge 1 commit into
mainfrom
fix/xmrig-api-lockdown
Open

Lock down the XMRig HTTP API on Linux (restricted + localhost)#17
VijitSingh97 wants to merge 1 commit into
mainfrom
fix/xmrig-api-lockdown

Conversation

@VijitSingh97
Copy link
Copy Markdown
Contributor

What & why

On Linux, generate_xmrig_config in rigforge.sh generated an XMRig HTTP API config that bound to 0.0.0.0 with restricted=false, while the only protection was an access token defaulting to the machine's hostname. In practice this exposed a network-reachable, unrestricted miner-control API guarded solely by a guessable token — an attacker on the network could enumerate the token and gain full control of the miner (pause/resume, reconfigure pools, etc.).

macOS already used a safe posture (restricted=true plus a non-public bind). This PR brings the Linux defaults in line with that posture:

  • HTTP_RESTRICTED="true" — the API is now read-only.
  • HTTP_HOST="127.0.0.1" — the API binds to localhost and is no longer reachable over the network.

Because the API is now localhost + restricted, it is no longer network-exposed. The existing access-token logic is preserved unchanged, and macOS behaviour is untouched. The jq config generation that consumes HTTP_RESTRICTED / HTTP_HOST / ACCESS_TOKEN continues to work as before.

Validation:

  • bash -n rigforge.sh parses cleanly.
  • shellcheck rigforge.sh introduces no new findings (only the two pre-existing info-level items remain: SC2086 on the make -j line and SC2016 on the envsubst line).

Related issue

Closes #7

🤖 Generated with Claude Code

On Linux, generate_xmrig_config previously set the XMRig HTTP API to host
0.0.0.0 with restricted=false, exposing a network-reachable, unrestricted
miner-control API guarded only by a guessable hostname-derived token.

Change the Linux defaults to match the safe macOS/template posture:
restricted=true (read-only) and bind to 127.0.0.1 (localhost). The API is
no longer network-exposed. macOS behaviour is unchanged and the existing
token logic is preserved.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Lock down the XMRig HTTP API on Linux (currently 0.0.0.0 + unrestricted + guessable token)

1 participant