mirror of
https://github.com/telekom-security/tpotce.git
synced 2025-07-07 00:04:22 +00:00
Comment out Port(s) in sshd_config to avoid port conflicts when multiple SSH Port definitions present (#1809)
- Comment out Port(s) in sshd_config to avoid port conflicts when multiple SSH Port definitions present - Resolve duplication issue for repeatedly running the install playbook - Avoid accidental uncommenting of Port 22
This commit is contained in:
parent
6faf600d40
commit
8e79c596f3
2 changed files with 30 additions and 0 deletions
|
@ -478,6 +478,21 @@
|
|||
tags:
|
||||
- "Ubuntu"
|
||||
|
||||
- name: Comment out Port(s) in sshd_config, can cause port conflicts on deploy (AlmaLinux, Debian, Fedora, openSUSE Tumbleweed, Raspbian, Rocky, Ubuntu)
|
||||
ansible.builtin.replace:
|
||||
path: /etc/ssh/sshd_config
|
||||
regexp: '^(Port (?!64295$)[0-9]+)'
|
||||
replace: '# \1'
|
||||
when: ansible_distribution in ["AlmaLinux", "Debian", "Fedora", "openSUSE Tumbleweed", "Raspbian", "Rocky", "Ubuntu"]
|
||||
tags:
|
||||
- "AlmaLinux"
|
||||
- "Debian"
|
||||
- "Fedora"
|
||||
- "openSUSE Tumbleweed"
|
||||
- "Raspbian"
|
||||
- "Rocky"
|
||||
- "Ubuntu"
|
||||
|
||||
- name: Change SSH Port to 64295 (AlmaLinux, Debian, Fedora, Raspbian, Rocky, Ubuntu)
|
||||
lineinfile:
|
||||
path: /etc/ssh/sshd_config
|
||||
|
|
|
@ -215,6 +215,21 @@
|
|||
- "Rocky"
|
||||
- "Ubuntu"
|
||||
|
||||
- name: Revert Comment out Port(s) in sshd_config, can cause port conflicts on deploy (AlmaLinux, Debian, Fedora, openSUSE Tumbleweed, Raspbian, Rocky, Ubuntu)
|
||||
ansible.builtin.replace:
|
||||
path: /etc/ssh/sshd_config
|
||||
regexp: '^# (Port (?!22$)[0-9]+)'
|
||||
replace: '\1'
|
||||
when: ansible_distribution in ["AlmaLinux", "Debian", "Fedora", "openSUSE Tumbleweed", "Raspbian", "Rocky", "Ubuntu"]
|
||||
tags:
|
||||
- "AlmaLinux"
|
||||
- "Debian"
|
||||
- "Fedora"
|
||||
- "openSUSE Tumbleweed"
|
||||
- "Raspbian"
|
||||
- "Rocky"
|
||||
- "Ubuntu"
|
||||
|
||||
- name: Remove vm.max_map_count setting (All)
|
||||
lineinfile:
|
||||
path: /etc/sysctl.conf
|
||||
|
|
Loading…
Reference in a new issue