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:
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
|
- name: set hostkeys according to openssh-version if openssh >= 5.3
|
||||||
set_fact:
|
set_fact:
|
||||||
ssh_host_key_files:
|
ssh_host_key_files:
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ ssh_host_keys_dir: '/etc/ssh'
|
|||||||
sshd_service_name: sshd
|
sshd_service_name: sshd
|
||||||
ssh_owner: root
|
ssh_owner: root
|
||||||
ssh_group: root
|
ssh_group: root
|
||||||
|
ssh_host_keys_owner: 'root'
|
||||||
|
ssh_host_keys_group: 'root'
|
||||||
|
|
||||||
# true if SSH support Kerberos
|
# true if SSH support Kerberos
|
||||||
ssh_kerberos_support: true
|
ssh_kerberos_support: true
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ ssh_host_keys_dir: '/etc/ssh'
|
|||||||
sshd_service_name: ssh
|
sshd_service_name: ssh
|
||||||
ssh_owner: root
|
ssh_owner: root
|
||||||
ssh_group: root
|
ssh_group: root
|
||||||
|
ssh_host_keys_owner: 'root'
|
||||||
|
ssh_host_keys_group: 'root'
|
||||||
ssh_selinux_packages:
|
ssh_selinux_packages:
|
||||||
- policycoreutils-python
|
- policycoreutils-python
|
||||||
- checkpolicy
|
- checkpolicy
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ ssh_host_keys_dir: '/etc/ssh'
|
|||||||
sshd_service_name: sshd
|
sshd_service_name: sshd
|
||||||
ssh_owner: root
|
ssh_owner: root
|
||||||
ssh_group: root
|
ssh_group: root
|
||||||
|
ssh_host_keys_owner: 'root'
|
||||||
|
ssh_host_keys_group: 'ssh_keys'
|
||||||
ssh_selinux_packages:
|
ssh_selinux_packages:
|
||||||
- python3-policycoreutils
|
- python3-policycoreutils
|
||||||
- checkpolicy
|
- checkpolicy
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ ssh_host_keys_dir: '/etc/ssh'
|
|||||||
sshd_service_name: sshd
|
sshd_service_name: sshd
|
||||||
ssh_owner: root
|
ssh_owner: root
|
||||||
ssh_group: wheel
|
ssh_group: wheel
|
||||||
|
ssh_host_keys_owner: 'root'
|
||||||
|
ssh_host_keys_group: 'root'
|
||||||
|
|
||||||
# true if SSH support Kerberos
|
# true if SSH support Kerberos
|
||||||
ssh_kerberos_support: true
|
ssh_kerberos_support: true
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ ssh_host_keys_dir: '/etc/ssh'
|
|||||||
sshd_service_name: sshd
|
sshd_service_name: sshd
|
||||||
ssh_owner: root
|
ssh_owner: root
|
||||||
ssh_group: wheel
|
ssh_group: wheel
|
||||||
|
ssh_host_keys_owner: 'root'
|
||||||
|
ssh_host_keys_group: 'root'
|
||||||
|
|
||||||
# true if SSH support Kerberos
|
# true if SSH support Kerberos
|
||||||
ssh_kerberos_support: false
|
ssh_kerberos_support: false
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ ssh_host_keys_dir: '/etc/ssh'
|
|||||||
sshd_service_name: sshd
|
sshd_service_name: sshd
|
||||||
ssh_owner: root
|
ssh_owner: root
|
||||||
ssh_group: root
|
ssh_group: root
|
||||||
|
ssh_host_keys_owner: 'root'
|
||||||
|
ssh_host_keys_group: 'ssh_keys'
|
||||||
ssh_selinux_packages:
|
ssh_selinux_packages:
|
||||||
- policycoreutils-python
|
- policycoreutils-python
|
||||||
- checkpolicy
|
- checkpolicy
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ ssh_host_keys_dir: '/etc/ssh'
|
|||||||
sshd_service_name: sshd
|
sshd_service_name: sshd
|
||||||
ssh_owner: root
|
ssh_owner: root
|
||||||
ssh_group: root
|
ssh_group: root
|
||||||
|
ssh_host_keys_owner: 'root'
|
||||||
|
ssh_host_keys_group: 'ssh_keys'
|
||||||
ssh_selinux_packages:
|
ssh_selinux_packages:
|
||||||
- python3-policycoreutils
|
- python3-policycoreutils
|
||||||
- checkpolicy
|
- checkpolicy
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ ssh_host_keys_dir: '/var/ssh'
|
|||||||
sshd_service_name: ssh
|
sshd_service_name: ssh
|
||||||
ssh_owner: root
|
ssh_owner: root
|
||||||
ssh_group: root
|
ssh_group: root
|
||||||
|
ssh_host_keys_owner: 'root'
|
||||||
|
ssh_host_keys_group: 'root'
|
||||||
|
|
||||||
# true if SSH support Kerberos
|
# true if SSH support Kerberos
|
||||||
ssh_kerberos_support: true
|
ssh_kerberos_support: true
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ ssh_host_keys_dir: '/etc/ssh'
|
|||||||
sshd_service_name: sshd
|
sshd_service_name: sshd
|
||||||
ssh_owner: root
|
ssh_owner: root
|
||||||
ssh_group: root
|
ssh_group: root
|
||||||
|
ssh_host_keys_owner: 'root'
|
||||||
|
ssh_host_keys_group: 'root'
|
||||||
|
|
||||||
# true if SSH support Kerberos
|
# true if SSH support Kerberos
|
||||||
ssh_kerberos_support: true
|
ssh_kerberos_support: true
|
||||||
|
|||||||
Reference in new issue
Block a user