Skip to content

Commit

Permalink
feat(ssh): allow configuring MaxSessions
Browse files Browse the repository at this point in the history
  • Loading branch information
lrsksr committed Feb 29, 2024
1 parent b8af3d5 commit f204f30
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions roles/ssh/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,24 @@
notify: "reload sshd"
tags: ["prepare", "prepare-sshd"]

- name: "Set maximum number of open sessions permitted per network connection"
ansible.builtin.lineinfile:
<<: *sshd_config_args
regexp: "^#?MaxSessions"
line: "MaxSessions {{ sshd_config_max_sessions }}"
when: "sshd_config_max_sessions is defined"
notify: "reload sshd"
tags: ["prepare", "prepare-sshd"]

- name: "Unset maximum number of open sessions permitted per network connection"
ansible.builtin.lineinfile:
<<: *sshd_config_args
regexp: "^#?MaxSessions"
line: "#MaxSessions 10"
when: "sshd_config_max_sessions is not defined"
notify: "reload sshd"
tags: ["prepare", "prepare-sshd"]

- name: "Only allow SSHv2"
ansible.builtin.lineinfile:
<<: *sshd_config_args
Expand Down

0 comments on commit f204f30

Please sign in to comment.