[PR #4902] [MERGED] Fix SSH tunnel gateway binding address issue #4900 #5069

Closed
opened 2026-05-05 14:54:08 -06:00 by gitea-mirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/fatedier/frp/pull/4902
Author: @fatedier
Created: 7/28/2025
Status: Merged
Merged: 7/28/2025
Merged by: @fatedier

Base: devHead: devin/1753685736-fix-ssh-gateway-bindaddr


📝 Commits (1)

  • 42ab433 Fix SSH tunnel gateway binding address issue #4900

📊 Changes

2 files changed (+6 additions, -2 deletions)

View changed files

📝 Release.md (+5 -1)
📝 server/service.go (+1 -1)

📄 Description

WHY

Fixes #4900 where SSH tunnel gateway fails to accept external connections when proxyBindAddr is set to "127.0.0.1".

Root Cause: SSH tunnel gateway was incorrectly binding to cfg.ProxyBindAddr instead of cfg.BindAddr, causing it to only listen on localhost when proxyBindAddr = "127.0.0.1".

Solution: Changed SSH gateway initialization to use cfg.BindAddr for external accessibility while preserving proxyBindAddr functionality for actual proxy connections.

WHAT

Main Change:

  • Modified server/service.go line 265 to use cfg.BindAddr instead of cfg.ProxyBindAddr for SSH tunnel gateway binding

Supporting Changes:

  • Added debug logging to verify correct bind addresses (⚠️ Should be removed before merge)
  • Updated Release.md with fix description following project conventions

VERIFICATION

Local Testing Results:

  • SSH tunnel gateway now binds to 0.0.0.0:60000 instead of 127.0.0.1:60000 with test config:
    bindAddr = "0.0.0.0"
    proxyBindAddr = "127.0.0.1"
    sshTunnelGateway.bindPort = 60000
    
  • External connectivity test successful
  • Code builds and passes existing tests

Behavior Change:

  • Before: SSH gateway bound to proxyBindAddr, rejecting external connections when set to "127.0.0.1"
  • After: SSH gateway binds to bindAddr for external accessibility

REVIEW CHECKLIST

Critical Items:

  • Remove debug logging from server/service.go lines 265-266 before merge
  • Verify SSH tunnel gateway works with various proxyBindAddr configurations
  • Confirm proxies created through SSH tunnel gateway still respect proxyBindAddr (user requirement)
  • Test backwards compatibility with existing SSH tunnel configurations

Additional Verification:

  • SSH tunnel gateway accepts external connections when proxyBindAddr = "127.0.0.1"
  • Normal proxy functionality unaffected
  • No regression in SSH tunnel gateway core functionality

Link to Devin run: https://app.devin.ai/sessions/05cd89122d014c468428f66f349fcaa9

Requested by: @fatedier

Related Issue: #4900


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/fatedier/frp/pull/4902 **Author:** [@fatedier](https://github.com/fatedier) **Created:** 7/28/2025 **Status:** ✅ Merged **Merged:** 7/28/2025 **Merged by:** [@fatedier](https://github.com/fatedier) **Base:** `dev` ← **Head:** `devin/1753685736-fix-ssh-gateway-bindaddr` --- ### 📝 Commits (1) - [`42ab433`](https://github.com/fatedier/frp/commit/42ab43374f3c86723c8b3651ca24566049806964) Fix SSH tunnel gateway binding address issue #4900 ### 📊 Changes **2 files changed** (+6 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `Release.md` (+5 -1) 📝 `server/service.go` (+1 -1) </details> ### 📄 Description ### WHY Fixes #4900 where SSH tunnel gateway fails to accept external connections when `proxyBindAddr` is set to "127.0.0.1". **Root Cause**: SSH tunnel gateway was incorrectly binding to `cfg.ProxyBindAddr` instead of `cfg.BindAddr`, causing it to only listen on localhost when `proxyBindAddr = "127.0.0.1"`. **Solution**: Changed SSH gateway initialization to use `cfg.BindAddr` for external accessibility while preserving `proxyBindAddr` functionality for actual proxy connections. ### WHAT **Main Change:** - Modified `server/service.go` line 265 to use `cfg.BindAddr` instead of `cfg.ProxyBindAddr` for SSH tunnel gateway binding **Supporting Changes:** - Added debug logging to verify correct bind addresses (⚠️ **Should be removed before merge**) - Updated `Release.md` with fix description following project conventions ### VERIFICATION **Local Testing Results:** - ✅ SSH tunnel gateway now binds to `0.0.0.0:60000` instead of `127.0.0.1:60000` with test config: ```toml bindAddr = "0.0.0.0" proxyBindAddr = "127.0.0.1" sshTunnelGateway.bindPort = 60000 ``` - ✅ External connectivity test successful - ✅ Code builds and passes existing tests **Behavior Change:** - **Before**: SSH gateway bound to `proxyBindAddr`, rejecting external connections when set to "127.0.0.1" - **After**: SSH gateway binds to `bindAddr` for external accessibility ### REVIEW CHECKLIST **Critical Items:** - [ ] **Remove debug logging** from `server/service.go` lines 265-266 before merge - [ ] Verify SSH tunnel gateway works with various `proxyBindAddr` configurations - [ ] Confirm proxies created through SSH tunnel gateway still respect `proxyBindAddr` (user requirement) - [ ] Test backwards compatibility with existing SSH tunnel configurations **Additional Verification:** - [ ] SSH tunnel gateway accepts external connections when `proxyBindAddr = "127.0.0.1"` - [ ] Normal proxy functionality unaffected - [ ] No regression in SSH tunnel gateway core functionality --- **Link to Devin run:** https://app.devin.ai/sessions/05cd89122d014c468428f66f349fcaa9 **Requested by:** @fatedier **Related Issue:** #4900 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
gitea-mirror 2026-05-05 14:54:08 -06:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/frp#5069
No description provided.