Skip to content

SSH_LISTEN_HOST accepts only one address #12418

Open
@ehaupt

Description

@ehaupt
  • Gitea version (or commit ref): 1.12.2
  • Git version: 2.27.0
  • Operating system: FreeBSD 12.1-RELEASE-p7 amd64
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • Not relevant
  • Log gist:

Description

I have a host with multiple interfaces and addresses. Therefore I'd like to have the dedicated SSH daemon listen on only two particular addresses. In my case a IPv4 and a IPv6 address.

The configuration parameter SSH_LISTEN_HOST does not seem to accept more than one address and defining it on a second line will overwrite the first one.

I tried the following combinations:

Try 1:

SSH_LISTEN_PORT = 2222
SSH_LISTEN_HOST = 10.10.10.10 [2001:0db8:85a3:08d3:1319:8a2e:0370]

Result try 1:

2020/08/03 17:12:09 ...s/graceful/server.go:79:ListenAndServe() [E] Unable to GetListener: address 10.10.10.10 [2001:0db8:85a3:08d3:1319:8a2e:0370]:2222: too many colons in address
2020/08/03 17:12:09 .../ssh/ssh_graceful.go:23:listen() [F] Failed to start SSH server: address 10.10.10.10 [2001:0db8:85a3:08d3:1319:8a2e:0370]:2222: too many colons in address

Try 2:

SSH_LISTEN_PORT = 2222
SSH_LISTEN_HOST = 10.10.10.10,[2001:0db8:85a3:08d3:1319:8a2e:0370]

Result:

2020/08/03 17:13:56 ...s/graceful/server.go:79:ListenAndServe() [E] Unable to GetListener: address 10.10.10.10,[2001:0db8:85a3:08d3:1319:8a2e:0370]:2222: too many colons in address
2020/08/03 17:13:56 .../ssh/ssh_graceful.go:23:listen() [F] Failed to start SSH server: address 10.10.10.10,[2001:0db8:85a3:08d3:1319:8a2e:0370]:2222: too many colons in address

Try 3:

SSH_LISTEN_PORT = 2222
SSH_LISTEN_HOST = 10.10.10.10, [2001:0db8:85a3:08d3:1319:8a2e:0370]

Result:

2020/08/03 17:23:24 ...s/graceful/server.go:79:ListenAndServe() [E] Unable to GetListener: address 10.10.10.10, [2001:0db8:85a3:08d3:1319:8a2e:0370]:2222: too many colons in address
2020/08/03 17:23:24 .../ssh/ssh_graceful.go:23:listen() [F] Failed to start SSH server: address 10.10.10.10, [2001:0db8:85a3:08d3:1319:8a2e:0370]:2222: too many colons in address

Try 4:

SSH_LISTEN_PORT = 2222
SSH_LISTEN_HOST = 10.10.10.10; [2001:0db8:85a3:08d3:1319:8a2e:0370];

Result:
Will only listen to 10.10.10.10 but not 2001:0db8:85a3:08d3:1319:8a2e:0370


Workaround: comment SSH_LISTEN_HOST so the gitea SSH daemon will listen on every device and firewall undesired access.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type/enhancementAn improvement of existing functionalitytype/proposalThe new feature has not been accepted yet but needs to be discussed first.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions