Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove automatic cloud-init option allowing PasswordAuthentication #124

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

d-tork
Copy link

@d-tork d-tork commented Nov 22, 2023

fixes #117

A bug in the Ubuntu 22.04 installer generates a cloud-init config file which overwrites the PasswordAuthentication option set by this Ansible role, thus ignoring any attempt to disable it. This commit ensures that line in that file doesn't exist anymore.

Copy link

This pr has been marked 'stale' due to lack of recent activity. If there is no further activity, the issue will be closed in another 30 days. Thank you for your contribution!

Please read this blog post to see the reasons why I mark issues as stale.

@github-actions github-actions bot added the stale label Mar 22, 2024
@Yemtex
Copy link

Yemtex commented Apr 7, 2024

@geerlingguy Would it be possible to merge this PR please?

lineinfile:
dest: "{{ security_ssh_cloudinit_config_path }}"
regexp: "^PasswordAuthentication"
state: absent
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The way this is set up, it would still remove this option even if Password Auth is allowed, and it might also break on non-Ubuntu systems...

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

- name: Apply same SSH configuration to Ubuntu cloud-init SSH configuration
  lineinfile:
    dest: "{{ security_ssh_cloud_init_config_path }}"
    regexp: "^PasswordAuthentication"
    line: "PasswordAuthentication {{ security_ssh_password_authentication }}"
    state: present
    validate: 'sshd -T -f %s'
    mode: 0600
  notify: restart ssh
  when: ansible_distribution == 'Ubuntu'

Would that be a better approach?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed the Debian.yml to

---
security_ssh_config_path: /etc/ssh/sshd_config
security_ssh_config_dir_path: /etc/ssh/sshd_config.d
security_ssh_cloud_init_config_path: "{{ security_ssh_config_dir_path }}/50-cloud-init.conf"
security_sshd_name: ssh

@github-actions github-actions bot removed the stale label Apr 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Dealing with /etc/ssh/sshd_config.d/*.conf files
3 participants