Regenerate RSA key with size 4096 bits (#376)

* regenerate RSA key with size 4096 bits

Signed-off-by: Sina Tak Tehrani <[email protected]>

* fixed lint problem

Signed-off-by: Sina Tak Tehrani <[email protected]>

* fixed E301 lint error

Signed-off-by: Sina Tak Tehrani <[email protected]>

* added host keys related vars

Signed-off-by: Sina Tak Tehrani <[email protected]>

* used openssh_keypair module

Signed-off-by: Sina Tak Tehrani <[email protected]>

* changed RSA private key mode to 0640

Signed-off-by: Sina Tak Tehrani <[email protected]>

* specified condition to prevent wrong file mode on debian-based OS

Signed-off-by: Sina Tak Tehrani <[email protected]>
This commit is contained in:
Sina Tak Tehrani authored and GitHub committed 2021-01-21 13:38:48 +01:00
1 parent f010b9a17e
commit ef31838fa2
10 files changed
+37

No files matched your search

@@ -1,4 +1,23 @@
---
- name: replace default 2048 bits RSA keypair with 4096 bits keypair
openssh_keypair:
state: present
type: rsa
size: 4096
path: "{{ ssh_host_keys_dir }}/ssh_host_rsa_key"
force: false
regenerate: partial_idempotence
# In RHEL and Fedora, the 'ssh_keys' group is the group owner of the host private SSH keys.
# Since the openssh_keypair module needs to read the key to provide idempotency, we need to set ownership and group based on specific OS vars.
- name: change host private key ownership, group and permissions
file:
path: "{{ ssh_host_keys_dir }}/ssh_host_rsa_key"
owner: "{{ ssh_host_keys_owner }}"
group: "{{ ssh_host_keys_group }}"
mode: "0640"
when: "ansible_facts.distribution in ['CentOS', 'OracleLinux', 'RedHat']"
- name: set hostkeys according to openssh-version if openssh >= 5.3
set_fact:
ssh_host_key_files:
+2
View File
@@ -4,6 +4,8 @@ ssh_host_keys_dir: '/etc/ssh'
sshd_service_name: sshd
ssh_owner: root
ssh_group: root
ssh_host_keys_owner: 'root'
ssh_host_keys_group: 'root'
# true if SSH support Kerberos
ssh_kerberos_support: true
+2
View File
@@ -4,6 +4,8 @@ ssh_host_keys_dir: '/etc/ssh'
sshd_service_name: ssh
ssh_owner: root
ssh_group: root
ssh_host_keys_owner: 'root'
ssh_host_keys_group: 'root'
ssh_selinux_packages:
- policycoreutils-python
- checkpolicy
+2
View File
@@ -4,6 +4,8 @@ ssh_host_keys_dir: '/etc/ssh'
sshd_service_name: sshd
ssh_owner: root
ssh_group: root
ssh_host_keys_owner: 'root'
ssh_host_keys_group: 'ssh_keys'
ssh_selinux_packages:
- python3-policycoreutils
- checkpolicy
+2
View File
@@ -4,6 +4,8 @@ ssh_host_keys_dir: '/etc/ssh'
sshd_service_name: sshd
ssh_owner: root
ssh_group: wheel
ssh_host_keys_owner: 'root'
ssh_host_keys_group: 'root'
# true if SSH support Kerberos
ssh_kerberos_support: true
+2
View File
@@ -4,6 +4,8 @@ ssh_host_keys_dir: '/etc/ssh'
sshd_service_name: sshd
ssh_owner: root
ssh_group: wheel
ssh_host_keys_owner: 'root'
ssh_host_keys_group: 'root'
# true if SSH support Kerberos
ssh_kerberos_support: false
+2
View File
@@ -4,6 +4,8 @@ ssh_host_keys_dir: '/etc/ssh'
sshd_service_name: sshd
ssh_owner: root
ssh_group: root
ssh_host_keys_owner: 'root'
ssh_host_keys_group: 'ssh_keys'
ssh_selinux_packages:
- policycoreutils-python
- checkpolicy
+2
View File
@@ -4,6 +4,8 @@ ssh_host_keys_dir: '/etc/ssh'
sshd_service_name: sshd
ssh_owner: root
ssh_group: root
ssh_host_keys_owner: 'root'
ssh_host_keys_group: 'ssh_keys'
ssh_selinux_packages:
- python3-policycoreutils
- checkpolicy
+2
View File
@@ -4,6 +4,8 @@ ssh_host_keys_dir: '/var/ssh'
sshd_service_name: ssh
ssh_owner: root
ssh_group: root
ssh_host_keys_owner: 'root'
ssh_host_keys_group: 'root'
# true if SSH support Kerberos
ssh_kerberos_support: true
+2
View File
@@ -4,6 +4,8 @@ ssh_host_keys_dir: '/etc/ssh'
sshd_service_name: sshd
ssh_owner: root
ssh_group: root
ssh_host_keys_owner: 'root'
ssh_host_keys_group: 'root'
# true if SSH support Kerberos
ssh_kerberos_support: true