Update setup hardening on local
This commit is contained in:
108
hardening.yml
108
hardening.yml
@@ -1,31 +1,14 @@
|
||||
- hosts: test
|
||||
vars:
|
||||
ansible_user: vagrant
|
||||
ansible_password: vagrant
|
||||
management_user_list:
|
||||
- name: admin
|
||||
shell: '/bin/bash'
|
||||
authorized_keys:
|
||||
- key: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQClVS1uxDfwS6OusQ4qgcZ6hBc8YRBE8MyXu0sUfGN7S3itjI3W2ixD18v80el8dVQVR12jCY0ueavgoV1cHrfGWkFoLKi+QrA4MuSNUChj0NBbyLTmdwPvne8LRv3ttCbRSJ/6bIEveX8y/7kGn/R1NDFlfE6b5R8ersBUKCQM6YxblAkv/XH8cJlQXhr1nLhVOl/ae+Q/pTCbgioB8qrmGEuMvOLmavcFf7IJbJcSgeiXSOnyIRl2n64X6lbRK+MRZ61pF6vAOXA+Ixyt/fAbO7sjqU0+cEhU5Br5/VcqG4Bc5nhWimtXIHPry3aLV5PtN6K9/i3eA5F6Jpa82JzmUMEbWSBIga02yIw9GjRyAI6ccH/kJGuB6QN5/YwGHpOF2f0FGiEAbUz41mLngN3SsXL1pdV2hT3x56/GIcGe6p/f1cytwVCyOaE7W87B05w5JYb1sSFj6QuGW0rHWfnHT5SY87Mk/H8VgZPaPbm+hSjLIQRAmUYQR+Rub1o9bXE= stephane"
|
||||
exclusive: yes
|
||||
sudo:
|
||||
hosts: ALL
|
||||
as: ALL
|
||||
commands: ALL
|
||||
nopasswd: ALL
|
||||
netbird_setup_key: 26659E99-DED1-4ED4-B2D0-C0CC1246EFAE
|
||||
netbird_register: true
|
||||
node_exporter_tls_server_config:
|
||||
cert_file: /etc/node_exporter/tls.cert
|
||||
key_file: /etc/node_exporter/tls.key
|
||||
node_exporter_basic_auth_users:
|
||||
randomuser: examplepassword
|
||||
node_exporter_web_listen_address: 192.168.0.20:9100
|
||||
# vars:
|
||||
become: true
|
||||
gather_facts: true
|
||||
|
||||
pre_tasks:
|
||||
|
||||
- name: Set hostname
|
||||
ansible.builtin.hostname:
|
||||
name: "{{ ansible_hostname }}"
|
||||
|
||||
- name: Create node_exporter cert dir
|
||||
file:
|
||||
path: "{{ item }}"
|
||||
@@ -35,18 +18,18 @@
|
||||
loop:
|
||||
- /etc/node_exporter
|
||||
|
||||
- name: Generate an OpenSSL private key with the default values (4096 bits, RSA) and a passphrase
|
||||
- name: Generate an OpenSSL private key with the default values (4096 bits, RSA)
|
||||
community.crypto.openssl_privatekey:
|
||||
path: /etc/node_exporter/tls.key
|
||||
mode: 0644
|
||||
|
||||
# /etc/node_exporter# chmod 644 tls.key
|
||||
|
||||
- name: Generate an OpenSSL Certificate Signing Request with a passphrase protected private key
|
||||
- name: Generate an OpenSSL Certificate Signing Request
|
||||
community.crypto.openssl_csr:
|
||||
path: /etc/node_exporter/tls.csr
|
||||
privatekey_path: /etc/node_exporter/tls.key
|
||||
common_name: www.ansible.com
|
||||
common_name: "{{ ansible_hostname }}.netbird.cloud"
|
||||
|
||||
- name: Generate a Self Signed OpenSSL certificate
|
||||
community.crypto.x509_certificate:
|
||||
@@ -61,19 +44,64 @@
|
||||
#||-----> GPG error: https://pkgs.netbird.io/debian stable InRelease: The following signatures couldn't be verified because the public key is not available
|
||||
|
||||
roles:
|
||||
# - robertdebock.update
|
||||
# - devsec.hardening.os_hardening
|
||||
# - devsec.hardening.ssh_hardening
|
||||
# - maxlareo.rkhunter
|
||||
# - maxlareo.chkrootkit
|
||||
# - robertdebock.auditd
|
||||
# - geerlingguy.firewall
|
||||
# - grog.management-user
|
||||
# - GROG.user
|
||||
# - GROG.authorized-key
|
||||
# - GROG.sudo
|
||||
# - ansible_unattended_upgrades
|
||||
# - dominion_solutions.netbird.netbird
|
||||
# - buluma.lynis
|
||||
- prometheus.prometheus.node_exporter
|
||||
- robertdebock.update
|
||||
- devsec.hardening.os_hardening
|
||||
- devsec.hardening.ssh_hardening
|
||||
- maxlareo.rkhunter
|
||||
- maxlareo.chkrootkit
|
||||
- robertdebock.auditd
|
||||
- geerlingguy.firewall
|
||||
- grog.management-user
|
||||
- GROG.user
|
||||
- GROG.authorized-key
|
||||
- GROG.sudo
|
||||
- ansible_unattended_upgrades
|
||||
- dominion_solutions.netbird.netbird
|
||||
- buluma.lynis
|
||||
tasks:
|
||||
- name: Retrieve private IP address netbird
|
||||
ansible.builtin.gather_facts:
|
||||
|
||||
- name: Set host_interfaces list
|
||||
ansible.builtin.set_fact:
|
||||
host_interfaces: "{{ host_interfaces + [item]}}"
|
||||
vars:
|
||||
host_interfaces: []
|
||||
loop: "{{ ansible_facts.interfaces }}"
|
||||
|
||||
- name: Set host_private_address
|
||||
ansible.builtin.set_fact:
|
||||
host_private_address: "{{ ansible_facts[item].ipv4.address }}"
|
||||
vars:
|
||||
host_private_address: ""
|
||||
when: ansible_facts[item].ipv4.address | ansible.utils.ipaddr('100.96.0.0/16')
|
||||
loop: "{{ host_interfaces }}"
|
||||
|
||||
# - name: Debug fingerprint for ALL hosts
|
||||
# debug:
|
||||
# msg: "{{ group_names }}"
|
||||
# when: group_names is search("monitoring")
|
||||
|
||||
- ansible.builtin.import_role:
|
||||
name: prometheus.prometheus.node_exporter
|
||||
|
||||
- ansible.builtin.import_role:
|
||||
name: prometheus.prometheus.prometheus
|
||||
when: group_names is search("monitoring")
|
||||
|
||||
|
||||
# - name: "Include labocbz.install_grafana"
|
||||
# tags:
|
||||
# - test
|
||||
# vars:
|
||||
# install_grafana__protocol: "https"
|
||||
# install_grafana__http_addr: "{{ host_private_address }}"
|
||||
# install_grafana__domain: "{{ ansible_hostname }}.netbird.cloud"
|
||||
# inv_install_grafana__cert_file: /etc/node_exporter/tls.cert
|
||||
# inv_install_grafana__cert_key: /etc/node_exporter/tls.key
|
||||
|
||||
# ansible.builtin.include_role:
|
||||
# name: ansible-role-labocbz-install-grafana
|
||||
|
||||
# - prometheus.prometheus.node_exporter
|
||||
# https://galaxy.ansible.com/ui/repo/published/prometheus/prometheus/content/role/node_exporter/
|
||||
Reference in New Issue
Block a user