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

might not end up in right state if duplicates exist #13

Open
poleguy opened this issue May 18, 2021 · 0 comments
Open

might not end up in right state if duplicates exist #13

poleguy opened this issue May 18, 2021 · 0 comments

Comments

@poleguy
Copy link

poleguy commented May 18, 2021

Possibly you should update your code to first clean all duplicates:
https://stackoverflow.com/questions/65228192/ansible-disable-ssh-password-authentication

Something like:

  • name: clean duplicates
    replace:
    path: '/etc/ssh/sshd_config'
    after: 'PasswordAuthentication'
    regexp: '^(.)PasswordAuthentication(.)$'
    replace: ''

  • name: clean duplicates
    replace:
    path: '/etc/ssh/sshd_config'
    after: 'PermitEmptyPasswords'
    regexp: '^(.)PermitEmptyPasswords(.)$'
    replace: ''

  • name: clean duplicates
    replace:
    path: '/etc/ssh/sshd_config'
    after: 'PermitRootLogin'
    regexp: '^(.)PermitRootLogin(.)$'
    replace: ''

  • name: set password login no
    lineinfile:
    path: '/etc/ssh/shd_config'
    regexp: '^(.)PasswordAuthentication(.)$'
    line: 'PasswordAuthentication no'
    notify: restart sshd

  • name: Disable empty password login
    lineinfile:
    path: '/etc/ssh/shd_config'
    regexp: '^(.)PermitEmptyPasswords(.)$'
    line: 'PermitEmptyPasswords no'
    notify: restart sshd

  • name: Disable remote root login
    lineinfile:
    path: '/etc/ssh/shd_config'
    regexp: '^(.)PermitRootLogin(.)$'
    line: 'PermitRootLogin no'
    notify: restart sshd

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

No branches or pull requests

1 participant