Skip to content
This repository was archived by the owner on Dec 26, 2020. It is now read-only.

Commit 7e14a43

Browse files
committed
Merge pull request #34 from hardening-io/separate_ssh_ports
Separate ssh client and server ports. Fix #33
2 parents 9502103 + ef8c4ad commit 7e14a43

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

roles/ansible-ssh-hardening/defaults/main.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,11 @@ ssh_server_weak_kex: false # sshd
2020
# If true, password login is allowed. For sshd, it is always set to no password login.
2121
ssh_client_password_login: false # ssh
2222

23-
# ports to which ssh-server should listen to and ssh-client should connect to
24-
ssh_ports: ['22'] # sshd + ssh
23+
# ports to which ssh-server should listen to
24+
ssh_server_ports: ['22'] # sshd
25+
26+
# ports to which ssh-client should connect to
27+
ssh_client_ports: ['22'] # ssh
2528

2629
# one or more ip addresses, to which ssh-server should listen to. Default is empty, but should be configured for security reasons!
2730
ssh_listen_to: ['0.0.0.0'] # sshd

roles/ansible-ssh-hardening/templates/openssh.conf.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Host {{host}}
1616
{% endfor %}
1717

1818
# The port at the destination should be defined
19-
{% for port in ssh_ports -%}
19+
{% for port in ssh_client_ports -%}
2020
Port {{port}}
2121
{% endfor %}
2222

roles/ansible-ssh-hardening/templates/opensshd.conf.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
PermitRootLogin {{ 'without-password' if ssh_allow_root_with_key else 'no' }}
1313

1414
# Define which port sshd should listen to. Default to `22`.
15-
{% for port in ssh_ports -%}
15+
{% for port in ssh_server_ports -%}
1616
Port {{port}}
1717
{% endfor %}
1818

0 commit comments

Comments
 (0)