Set-OPS — moteur d'ecosystemes numeriques souverains (Alliance Boreale)

This commit is contained in:
Alliance Boreale 2026-06-24 20:17:46 -04:00
commit 3dd3f43ad8
308 changed files with 13649 additions and 0 deletions

View file

@ -0,0 +1,3 @@
# Rôle nftables_baseline
Prépare nftables. Désactivé par défaut dans le template.

View file

@ -0,0 +1,10 @@
---
nftables_baseline_enabled: false
nftables_baseline_allow_ssh: true
nftables_baseline_allow_icmp: true
nftables_baseline_input_policy: "drop"
nftables_baseline_forward_policy: "drop"
nftables_baseline_output_policy: "accept"
nftables_baseline_ssh_port: 22
nftables_baseline_extra_tcp_ports: []
nftables_baseline_extra_udp_ports: []

View file

@ -0,0 +1,4 @@
---
- name: Reload nftables
ansible.builtin.command: nft -f /etc/nftables.conf
changed_when: true

View file

@ -0,0 +1,30 @@
---
- name: Installer nftables
ansible.builtin.apt:
name: nftables
state: present
- name: Déployer la configuration nftables Set-OPS
ansible.builtin.template:
src: nftables.conf.j2
dest: /etc/nftables.conf
owner: root
group: root
mode: "0644"
notify: Reload nftables
when: nftables_baseline_enabled | bool
- name: Activer nftables si demandé
ansible.builtin.systemd:
name: nftables
enabled: true
state: started
when: nftables_baseline_enabled | bool
- name: Désactiver nftables si demandé
ansible.builtin.systemd:
name: nftables
enabled: false
state: stopped
when: not (nftables_baseline_enabled | bool)
failed_when: false

View file

@ -0,0 +1,39 @@
#!/usr/sbin/nft -f
# Managed by Ansible — Set-OPS
flush ruleset
table inet setops_filter {
chain input {
type filter hook input priority 0; policy {{ nftables_baseline_input_policy }};
iif "lo" accept
ct state established,related accept
ct state invalid drop
{% if nftables_baseline_allow_icmp | bool %}
ip protocol icmp accept
ip6 nexthdr icmpv6 accept
{% endif %}
{% if nftables_baseline_allow_ssh | bool %}
tcp dport {{ nftables_baseline_ssh_port }} accept
{% endif %}
{% for port in nftables_baseline_extra_tcp_ports %}
tcp dport {{ port }} accept
{% endfor %}
{% for port in nftables_baseline_extra_udp_ports %}
udp dport {{ port }} accept
{% endfor %}
}
chain forward {
type filter hook forward priority 0; policy {{ nftables_baseline_forward_policy }};
}
chain output {
type filter hook output priority 0; policy {{ nftables_baseline_output_policy }};
}
}