Added the public keys of knox and buttercup as well
Disabled password logins to harden the system
This commit is contained in:
parent
5bea488181
commit
c478290da0
@ -59,6 +59,33 @@
|
||||
line: "{{ peitho_key }}"
|
||||
when: peithokey_test.stdout == "0"
|
||||
|
||||
- name: Check Knox public key
|
||||
shell: "grep -c \"{{ knox_key }}\" /home/pi/.ssh/authorized_keys || true"
|
||||
register: knoxkey_test
|
||||
|
||||
- name: Add Knox public key
|
||||
lineinfile:
|
||||
dest: /home/pi/.ssh/authorized_keys
|
||||
line: "{{ knox_key }}"
|
||||
when: knoxkey_test.stdout == "0"
|
||||
|
||||
- name: Check Buttercup public key
|
||||
shell: "grep -c \"{{ buttercup_key }}\" /home/pi/.ssh/authorized_keys || true"
|
||||
register: buttercupkey_test
|
||||
|
||||
- name: Add Buttercup public key
|
||||
lineinfile:
|
||||
dest: /home/pi/.ssh/authorized_keys
|
||||
line: "{{ buttercup_key }}"
|
||||
when: buttercupkey_test.stdout == "0"
|
||||
|
||||
- name: Update the sshd config file to disable password logins
|
||||
replace:
|
||||
path: /etc/ssh/sshd_config
|
||||
regexp: '(\s+)#PasswordAuthentication yes(\s+.*)?$'
|
||||
replace: "\\1PasswordAuthentication no\\2"
|
||||
backup: yes
|
||||
|
||||
- name: Check if .ssh config file exists
|
||||
stat:
|
||||
path: /home/pi/.ssh/config
|
||||
@ -93,7 +120,6 @@
|
||||
become: yes
|
||||
become_user: pi
|
||||
shell: ssh-keygen -t rsa -b 4096 -q -f /home/pi/.ssh/id_rsa -C "pi@{{ hostname }} $(date '+%Y.%m.%d')" -N ""
|
||||
# shell: ssh-keygen -t rsa -b 4096 -q -f /home/pi/.ssh/id_rsa -C "$(whoami)@$(hostname) $(date '+%Y.%m.%d')" -N ""
|
||||
|
||||
- name: Install Docker
|
||||
shell: curl -sSL https://get.docker.com | sh
|
||||
@ -136,7 +162,7 @@
|
||||
state: started
|
||||
name: knox-redis-tunnel
|
||||
|
||||
- name: install knox-redis-tunnel systemd unit file
|
||||
- name: install gotthard systemd unit file
|
||||
template:
|
||||
src: "files/gotthard.service"
|
||||
dest: "/etc/systemd/system/gotthard.service"
|
||||
|
@ -1,4 +1,6 @@
|
||||
---
|
||||
hostname: "chd3"
|
||||
ssh_port: "22447"
|
||||
hostname: "pkl3"
|
||||
ssh_port: "22243"
|
||||
peitho_key: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCrT4geK0hUTc/3NDVt0g3DZwdOg2dRq4MbNdVvmRVsJHXRXWkyehzDVTRmxxmUvPZgy20QgLcMVJWQ1128ksg7tYNcVRw7/8kV9xMmVFeHGc03H+8WltUuDrbcM5ejaIFvYgZvZpl1A7uuE8VOT6Z0LentV7VSKpmhrRsnYw3+parmjCLWSoW6HLj6L841OlF+4u07fPj92qXonqufeWvh5Fr2RF+uBkDv3Bk+Lk7ENa0GLt9zu/5zVZGynXpCIRwltxCFkLoFYEzXYxT4jGWSxZQmLizm08RFfQGlrbYx/3qUomF/A7cgpkPo8kOq4iXtc+1+1GZNKhg8356yeQonUdbZ9hUfEfgyHRGRx9x5cq588XKYy7VsYDp/08ZYB0RvvGvO4fVzmVUwrTwxQXJaKkqTMdkee11JAaDfJpfsyrAcLiD/jp2ezoJhGWJxZLZQSMLtZcyRWPw6bPT65a8MdyF3b1Mv2aOU78Gjagh7mH8DCa3ZtPglngiwjKMZTMvSavNtDEE5CUL6hE+Hsqo6RUGRnYy3VvqvBepx3+CyTwYNvg2+AuzacKjumhrxG5Ca0gyxFdHVSK0eFqsVotU7/m8yJUxSYzsyeEC/sELpj3H3JU1aaySCnW22T6b/8Fwe2Sj0YHIvNidN1K5/voxqd9WgNObdcvbOXNUfd4vAdQ== 2020.05.26 peitho"
|
||||
knox_key: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCx0VJ05IOFNJbXNZANk5JPZEaqZH5PwdpmfvLvEmOBpc/nAggukElAmzIUXxomIHNiomwCz2vdTR3iNR5wRpaQW0KpJ+bi2ErDG7DoXLozHh98UOZOnG9uSAZh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IvoNUemBr4OOgjdX3RQaeoI8pUbKr2cy9HALiGtt4sCuM9dLL6jTKpVBxks7rv1CvYqqE8/tw== tanshu@buttercup 2020.05.26"
|
||||
|
Loading…
Reference in New Issue
Block a user