main #31

Merged
juan merged 154 commits from main into lab 2024-10-16 15:22:43 +00:00
7 changed files with 41 additions and 23 deletions
Showing only changes of commit 921e3538cd - Show all commits

View File

@ -57,3 +57,4 @@ master_cert_content: |
vbLOVOOXArPis1naT1aW5s/At2NaNpA3a9HjauzZgfIiU+ekIWEccU0OyRGxCGA=
-----END CERTIFICATE-----
private_key_content: "{{ lookup(passbolt, 'fd-cert.pem', folder_parent_id=passbolt_folder).description }}"
vn_witness: false

View File

@ -2,6 +2,17 @@
apt:
name: "{{ fail2ban_base_packages }}"
state: present
- name: Configure sshd_config settings
copy:
dest: /etc/ssh/sshd_config.d/vn-fail2ban.conf
content: |
# Do not edit this file! Ansible will overwrite it.
SyslogFacility AUTH
owner: root
group: root
mode: u=rw,g=r,o=r
notify: restart sshd
- name: Configure fail2ban service
template:
src: jail.local

View File

@ -1,3 +1,5 @@
- import_tasks: witness.yml
tags: witness
- import_tasks: resolv.yml
tags: resolv
- import_tasks: timesync.yml

View File

@ -1,29 +1,23 @@
- name: Generate a new SSH key pair
- name: Generate SSH key pairs
openssh_keypair:
path: /etc/ssh/ssh_host_rsa_key
type: rsa
size: 4096
register: new_pair
path: "/etc/ssh/ssh_host_{{ item.type }}_key"
type: "{{ item.type }}"
force: yes
when: vn_witness
loop:
- { type: 'rsa' }
- { type: 'ecdsa' }
- { type: 'ed25519' }
register: new_pairs
notify: restart sshd
- name: Configure sshd_config settings
copy:
dest: /etc/ssh/sshd_config.d/vn-custom.conf
dest: /etc/ssh/sshd_config.d/vn-listenipv4.conf
content: |
# Do not edit this file! Ansible will overwrite it.
ListenAddress 0.0.0.0
SyslogFacility AUTH
owner: root
group: root
mode: u=rw,g=r,o=r
notify: restart sshd
- name: Delete old host SSH keys
file:
path: "{{ item }}"
state: absent
with_items:
- /etc/ssh/ssh_host_ecdsa_key
- /etc/ssh/ssh_host_ecdsa_key.pub
- /etc/ssh/ssh_host_ed25519_key
- /etc/ssh/ssh_host_ed25519_key.pub
when: new_pair is succeeded
notify: restart sshd
notify: restart sshd

View File

@ -0,0 +1,12 @@
- name: Check if witness have been generated
stat:
path: /etc/vn.witness
register: keys_generated_marker
- name: Generate variable if not exists
set_fact:
vn_witness: "{{ not keys_generated_marker.stat.exists }}"
- name: Create marker file to indicate vn happends
file:
path: /etc/vn.witness
state: touch
when: vn_witness

View File

@ -2,5 +2,3 @@
service:
name: nslcd
state: restarted
- name: pam-update-ldap
shell: pam-auth-update --enable ldap

View File

@ -11,7 +11,7 @@
mode: '0640'
notify:
- restart-nslcd
- pam-update-ldap
register: nslcd
- name: Configure nsswitch to use NSLCD
lineinfile:
dest: /etc/nsswitch.conf