Skip to content

fix: improve HAProxy PROXY protocol handling#40089

Open
fdurand wants to merge 1 commit into
cowrie:mainfrom
fdurand:fix/haproxy-output-and-connectionlost
Open

fix: improve HAProxy PROXY protocol handling#40089
fdurand wants to merge 1 commit into
cowrie:mainfrom
fdurand:fix/haproxy-output-and-connectionlost

Conversation

@fdurand

@fdurand fdurand commented Apr 30, 2026

Copy link
Copy Markdown
  • Defer cowrie.session.connect to dataReceived() so HAProxyWrappingFactory has time to parse the PROXY header and update getPeer() with the real client IP.
  • Update sshRegex in output.py to match transport names with wrapper annotations (e.g. "HoneyPotSSHTransport (HAProxyProtocolWrapper),42,x").
  • Remove duplicate self.transport.connectionLost() call that was incorrectly triggering a second connection-lost event.

  - Defer cowrie.session.connect to dataReceived() so HAProxyWrappingFactory
    has time to parse the PROXY header and update getPeer() with the real
    client IP.
  - Update sshRegex in output.py to match transport names with wrapper
    annotations (e.g. "HoneyPotSSHTransport (HAProxyProtocolWrapper),42,x").
  - Remove duplicate self.transport.connectionLost() call that was
    incorrectly triggering a second connection-lost event.
@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 complexity

Metric Results
Complexity 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@micheloosterhof

Copy link
Copy Markdown
Member

Hi! I'm a bit confused about this one, where's HAProxy being used?

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants