Skip to content

Allow setting a different port for the client and the server #240

Open
@zedtux

Description

@zedtux

Is your feature request related to a problem? Please describe.
I have changed the ports attribute in order to avoid attackers to find it to easily but this cookbook change both the server and client config.
This makes any commands, depending on ssh, to use the server port as client so that a git ls-remote command fails because of the client Port config which isn't 22 anymore.

Describe the solution you'd like
In order to avoid a breaking change, the default['ssh-hardening']['ssh']['ports'] Array should allow integers and Hashes, so that both should work, with the Hash one allowing to tell a port for the sever, and a port for the client like that:

default['ssh-hardening']['ssh']['ports'] = [
  { server: 12345, client: 54321 }
]

or to tell only the sever or the client port:

default['ssh-hardening']['ssh']['ports'] = [
  { server: 12345 }
]

Implementing this is easy and gives flexibility to the operator to configure SSH.

Describe alternatives you've considered

A workaround is to create a file ~/.ssh/config containing Port 22.

Additional context

In my case, I'm deploying a Rails app with Capistrano which first tries the git ls-remote [email protected]:group/project.git and it fails.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions