Skip to content

Commit

Permalink
CI: Increase sshd MaxAuthRetries to 50 on macOS runners
Browse files Browse the repository at this point in the history
  • Loading branch information
moreati committed Nov 7, 2024
1 parent 8cfcb66 commit 3a1b5ec
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .ci/localhost_ansible_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@
subprocess.check_call('sudo chmod 700 ~root/.ssh', shell=True)
subprocess.check_call('sudo chmod 600 ~root/.ssh/authorized_keys', shell=True)

os.chdir(IMAGE_PREP_DIR)
ci_lib.run("ansible-playbook -c local -i localhost, macos_localhost.yml")

if os.path.expanduser('~mitogen__user1') == '~mitogen__user1':
os.chdir(IMAGE_PREP_DIR)
ci_lib.run("ansible-playbook -c local -i localhost, _user_accounts.yml")
Expand Down
7 changes: 7 additions & 0 deletions tests/image_prep/macos_localhost.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
- name: Configure macOS
hosts: all
gather_facts: true
strategy: mitogen_free
become: true
roles:
- role: sshd
2 changes: 2 additions & 0 deletions tests/image_prep/roles/sshd/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
sshd_config_file: /etc/ssh/sshd_config

sshd_config__max_auth_tries: 50
13 changes: 13 additions & 0 deletions tests/image_prep/roles/sshd/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,20 @@
loop:
- line: Banner /etc/ssh/banner.txt
regexp: '^#? *Banner.*'
- line: MaxAuthTries {{ sshd_config__max_auth_tries }}
regexp: '^#? *MaxAuthTries.*'
- line: PermitRootLogin yes
regexp: '.*PermitRootLogin.*'
loop_control:
label: "{{ item.line }}"
register: configure_sshd_result

- name: Restart sshd
shell: |
launchctl unload /System/Library/LaunchDaemons/ssh.plist
wait 5
launchctl load -w /System/Library/LaunchDaemons/ssh.plist
changed_when: true
when:
- ansible_facts.distribution == "MacOSX"
- configure_sshd_result is changed

0 comments on commit 3a1b5ec

Please sign in to comment.