Description
The rules loaded at boot by ufw (/etc/ufw/*.rules), nftables (/etc/nftables.conf) and
iptables-persistent (/etc/iptables/rules.v4, rules.v6), and the IPsec configuration
(/etc/ipsec.conf, /etc/ipsec.d/, /etc/ipsec.secrets) must belong to root and must not be
writable by other users. IPsec secrets and private keys must only be readable by root.
Each check is not applicable when its files are absent.
Rationale
These files decide what reaches the host and with which keys VPN tunnels are authenticated. A writable rules file is a firewall bypass waiting for the next reboot; a readable pre-shared key or private key lets an attacker set up a rogue tunnel endpoint.
Impact
None known. Packages create these files with stricter or equal permissions.
Setting
| Location | /etc/ufw, /etc/nftables.conf, /etc/iptables, /etc/ipsec.* |
| Recommended | Owned by root, rules at most 0644 (nftables.conf 0755), secrets and private keys 0600/0700 |
Audit
Run stat -c '%n %U:%G %a' /etc/ufw/*.rules /etc/nftables.conf /etc/iptables/rules.v* /etc/ipsec.conf /etc/ipsec.d /etc/ipsec.d/private /etc/ipsec.secrets 2>/dev/null.
Every file must be owned by root:root; ipsec.secrets at most 0600, ipsec.d/private at most
0700, nftables.conf at most 0755, the others at most 0644 (0755 for the ipsec.d directory).
Automated: every check must pass. Scanners report each check by its id.
ufw-rules
ufw rules files.
path: /etc/ufw/*.rules
owner: root
group: root
mode: '0644'
nftables-conf
nftables configuration loaded at boot.
path: /etc/nftables.conf
owner: root
group: root
mode: '0755'
iptables-rules
Rules restored by iptables-persistent.
path: /etc/iptables/rules.v*
owner: root
group: root
mode: '0644'
ipsec-conf
IPsec main configuration.
path: /etc/ipsec.conf
owner: root
group: root
mode: '0644'
ipsec-dir
IPsec configuration directory.
path: /etc/ipsec.d
owner: root
group: root
mode: '0755'
ipsec-private
IPsec private keys directory.
path: /etc/ipsec.d/private
owner: root
group: root
mode: '0700'
ipsec-secrets
IPsec pre-shared keys and private key passphrases.
path: /etc/ipsec.secrets
owner: root
group: root
mode: '0600'
Remediation
Run chown root:root on the files listed above, then chmod 600 /etc/ipsec.secrets,
chmod 700 /etc/ipsec.d/private, chmod go-w on the others.
| Restart | none |
| Disruption | none |
Rollback
Restore the previous owner and mode with chown and chmod.
ufw-rules
Generated from check ufw-rules: the engine writes the fix for every output, it sets the expected value and the check runs again after.
nftables-conf
Generated from check nftables-conf: the engine writes the fix for every output, it sets the expected value and the check runs again after.
iptables-rules
Generated from check iptables-rules: the engine writes the fix for every output, it sets the expected value and the check runs again after.
ipsec-conf
Generated from check ipsec-conf: the engine writes the fix for every output, it sets the expected value and the check runs again after.
ipsec-dir
Generated from check ipsec-dir: the engine writes the fix for every output, it sets the expected value and the check runs again after.
ipsec-private
Generated from check ipsec-private: the engine writes the fix for every output, it sets the expected value and the check runs again after.
ipsec-secrets
Generated from check ipsec-secrets: the engine writes the fix for every output, it sets the expected value and the check runs again after.
Each release turns these fixes into remediate.sh and an Ansible role per profile: dry run by default, a fix runs only when its check fails.
References
- ANSSI-BP-028 v2.0 - Recommandations de configuration d'un système GNU/Linux (R50) ANSSI, guide, accessed 2026-10-19
- ipsec.secrets(5), Ubuntu manual pages (strongSwan) Canonical, vendor-doc, accessed 2026-10-19
- ufw(8), Ubuntu manual pages Canonical, vendor-doc, accessed 2026-10-19
Mappings
| Framework | ID | Relation | Note |
|---|---|---|---|
| ANSSI-BP-028 - Recommandations de configuration d'un système GNU/Linux2.0 | R50 | partial | R50 covers every sensitive file; this control covers firewall and IPsec files. |
| NIST SP 800-53 Rev. 55.1.1 | AC-3 | related |
How this control relates to the other framework's: equivalent, stricter, looser, partial or related.
Threats mitigated
People and lifecycle
| Authors |
|
| Verified | 2026-10-19 by Sn0wAlice on 20.04, Proxmox VM, Ubuntu 20.04 cloud image, kernel 5.4.0-216-generic, BIOS boot. Passes on a fresh install (ufw rules 0640); still passes after remediation and reboot. |
| Verified | 2026-10-19 by Sn0wAlice on 22.04, Proxmox VM, Ubuntu 22.04 cloud image, kernel 5.15.0-198-generic, BIOS boot. Passes on a fresh install (ufw rules 0640, nftables.conf 0755); still passes after remediation and reboot. |
| Verified | 2026-10-19 by Sn0wAlice on 24.04, Proxmox VM, Ubuntu 24.04 cloud image, kernel 6.8.0-147-generic, BIOS boot. Passes on a fresh install (ufw rules 0640, nftables.conf 0755); a 0666 ufw rules file is reported and fixed to 0644. |
| Verified | 2026-10-19 by Sn0wAlice on 26.04, Proxmox VM, Ubuntu 26.04 cloud image, kernel 7.0.0-38-generic, BIOS boot. Passes on a fresh install (ufw rules 0640, nftables.conf 0755); a 0666 ufw rules file is reported and fixed to 0644. |
| Introduced in | v0.1.0 |
| Created, updated | 2026-10-19, 2026-10-19 |
| Translations | fr |