Allow both "localhost" and empty bind spec
This commit is contained in:
parent
4d1e594a22
commit
7fd84db850
1 changed files with 2 additions and 5 deletions
7
sshd.go
7
sshd.go
|
@ -241,8 +241,8 @@ func handleTcpIpForward(client *sshClient, req *ssh.Request) (net.Listener, *bin
|
|||
log.Printf("Request to listen on %s:%d", payload.Addr, payload.Port)
|
||||
}
|
||||
|
||||
if payload.Addr != "localhost" {
|
||||
log.Printf("Payload address is not \"localhost\"")
|
||||
if payload.Addr != "localhost" && payload.Addr != "" {
|
||||
log.Printf("Payload address is not \"localhost\" or empty")
|
||||
req.Reply(false, []byte{})
|
||||
return nil, nil, fmt.Errorf("Address is not permitted")
|
||||
}
|
||||
|
@ -256,9 +256,6 @@ func handleTcpIpForward(client *sshClient, req *ssh.Request) (net.Listener, *bin
|
|||
laddr := payload.Addr
|
||||
lport := payload.Port
|
||||
|
||||
// TODO: We currently bind to localhost:port, and not to :port
|
||||
// Need to figure out what we want - perhaps just part of policy
|
||||
//bind := fmt.Sprintf(":%d", lport)
|
||||
bind := fmt.Sprintf("%s:%d", laddr, lport)
|
||||
ln, err := net.Listen("tcp", bind)
|
||||
if err != nil {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue