FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

fix(go.d/fail2ban): move fail2ban socket path into ndsudo by ilyam8 · Pull Request #22745 · netdata/netdata · GitHub

fix(go.d/fail2ban): move fail2ban socket path into ndsudo - #22745

Merged
ilyam8 merged 1 commit into
netdata:masterfrom
ilyam8:fix/fail2ban-ndsudo-socket-path
Jun 16, 2026
Merged

fix(go.d/fail2ban): move fail2ban socket path into ndsudo#22745
ilyam8 merged 1 commit into
netdata:masterfrom
ilyam8:fix/fail2ban-ndsudo-socket-path

Conversation

ilyam8 commented Jun 16, 2026
edited by cubic-dev-ai Bot
Loading

Copy link
Copy Markdown
Member
Summary
Test Plan
Additional Information
For users: How does this change affect me?

Summary by cubic

Move the Fail2ban Docker socket path into ndsudo and stop passing it from the go.d collector. This centralizes configuration, reduces duplication, and avoids mismatches in containers.

  • Refactors
    • ndsudo: hardcodes Fail2ban socket path /host/var/run/fail2ban/fail2ban.sock for fail2ban-client-status-socket and fail2ban-client-status-jail-socket.
    • go.d Fail2ban exec: removes --socket_path usage and constant; calls the socket variants only when running in Docker.
    • Adds tests to verify ndsudo receives the expected arguments for host and Docker calls (status and jail status).

Written for commit b5a0ed5. Summary will update on new commits.

ilyam8 requested a review from thiagoftsm as a code owner June 16, 2026 13:27
ilyam8 requested review from Copilot and removed request for thiagoftsm June 16, 2026 13:27
github-actions Bot added area/collectors Everything related to data collection collectors/go.d area/go labels Jun 16, 2026

Copy link
Copy Markdown

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Pull request overview

This PR centralizes the Fail2ban socket path used when the Agent runs inside Docker by moving it into ndsudo, so the go.d Fail2ban collector no longer passes the socket path as an argument.

Changes:

  • go.d Fail2ban exec: stop passing --socket_path when running in Docker and call the socket-specific ndsudo commands directly.
  • ndsudo: hardcode the Docker socket path for the fail2ban-client-*-socket command variants.
  • Add a Linux-only unit test to verify the exact ndsudo argument vector for host vs Docker status/jail-status calls.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
src/go/plugin/go.d/collector/fail2ban/exec.go Removes per-collector Docker socket path argument passing and relies on socket-specific ndsudo commands.
src/go/plugin/go.d/collector/fail2ban/exec_test.go Adds tests that stub ndsudo to assert the collector calls it with the expected arguments.
src/collectors/utils/ndsudo.c Moves the Docker socket path into ndsudo by hardcoding it into Fail2ban socket command templates.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

No issues found across 3 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.
Architecture diagram
sequenceDiagram
    participant GC as Go Collector (fail2ban)
    participant ND as ndsudo
    participant FB as fail2ban-client
    participant SK as fail2ban.sock (Docker)
    participant FS as fail2ban-server

    Note over GC,FS: Fail2ban Socket Path Centralized in ndsudo

    alt Host Mode
        GC->>ND: execute("fail2ban-client-status")
        ND->>FB: fail2ban-client status
        FB->>FS: Query status
        FS-->>FB: Status response
        FB-->>ND: stdout
        ND-->>GC: []byte
    else Docker Mode (isInsideDocker=true)
        GC->>ND: execute("fail2ban-client-status-socket")
        ND->>SK: -s /host/var/run/fail2ban/fail2ban.sock status
        SK->>FB: Read socket
        FB->>FS: Query status via socket
        FS-->>FB: Status response
        FB-->>SK: stdout
        SK-->>ND: Socket response
        ND-->>GC: []byte
    end

    alt Host Mode (jail)
        GC->>ND: execute("fail2ban-client-status-jail", "--jail", jail)
        ND->>FB: fail2ban-client status <jail>
        FB->>FS: Query jail status
        FS-->>FB: Jail status response
        FB-->>ND: stdout
        ND-->>GC: []byte
    else Docker Mode (isInsideDocker=true, jail)
        GC->>ND: execute("fail2ban-client-status-jail-socket", "--jail", jail)
        ND->>SK: -s /host/var/run/fail2ban/fail2ban.sock status <jail>
        SK->>FB: Read socket
        FB->>FS: Query jail status via socket
        FS-->>FB: Jail status response
        FB-->>SK: stdout
        SK-->>ND: Socket response
        ND-->>GC: []byte
    end
Loading

Re-trigger cubic

ilyam8 enabled auto-merge (squash) June 16, 2026 13:33
ilyam8 merged commit 6a96484 into netdata:master Jun 16, 2026
154 of 157 checks passed
ilyam8 deleted the fix/fail2ban-ndsudo-socket-path branch June 16, 2026 20:47
stelfrag pushed a commit to stelfrag/netdata that referenced this pull request Jun 22, 2026
stelfrag mentioned this pull request Jun 22, 2026
Ferroin pushed a commit that referenced this pull request Jul 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/collectors Everything related to data collection area/go collectors/go.d

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants


Back | FazBrowse Home | New Git URL