Local firewall¶
The iptables package is installed by default with CyberElements. It allows local
network filtering to be put in place on each server, in addition to (never as a replacement
for) the perimeter filtering equipment already in place.
On the Edge Gateway, the simplified profile of R37 applies.
Information
The closest ANSSI reference on this subject is the technical note DAT-NT-006/ANSSI/SDE/NP "Recommandations pour la définition d'une politique de filtrage réseau d'un pare-feu". The principle adopted in this guide is the positive security model: inbound flows must be limited to the needs explicitly identified. For the Edge Gateway, a simplified profile allowing outbound flows is offered in R37 so as to cover published resources without maintaining a port list specific to each deployment; that trade-off is documented explicitly.
Summary¶
| # | Recommendation | Edge Gateway |
|---|---|---|
| R35 | Filtering principle and positive security model | |
| R37 | Simplified profile for the Edge Gateway | |
| R38 | Persistence of rules at startup | |
| R40 | Disabling IPv6 when it is not needed | |
| R41 | Verification, audit and monitoring of rules |
R35. Filtering principle and positive security model¶
Applies to: Edge Gateway
The local filtering policy must follow the principle of least privilege. Inbound, any flow not explicitly authorised must be rejected.
On the Edge Gateway, the simplified profile described in R37 is a deliberate exception: outbound flows are allowed so as to permit access to published resources, while inbound connections remain blocked apart from SSH administration.
Filtering must be stateful (connection tracking) so as to allow packets belonging to a legitimately established or related connection, without opening a specific rule for each return flow.
Warning!
Configuring a local firewall can cause an immediate loss of connectivity if something goes wrong. Every change must be prepared from a console access or a fallback administration session, tested before being made persistent, then checked after a reboot.
R37. Simplified profile for the Edge Gateway¶
Applies to: Edge Gateway
The Edge Gateway must initiate connections towards the Mediation Controller and towards the published resources of the information system. As the nature and ports of those resources vary from one deployment to another, a simplified profile may be used: all outbound flows are allowed, while inbound connections are denied apart from SSH administration access from an explicitly authorised network.
Warning!
This profile is suitable only where the Edge Gateway needs no inbound flow
other than SSH administration access. If agent mode is used, or if direct access to
resources is enabled, additional inbound rules must be added before the COMMIT line.
Those openings must be limited to the ports required and, where possible, to the authorised IP
addresses or network ranges only. Otherwise, the features concerned will not work. Routed flows
may also require the FORWARD chain to be adapted.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | |
The value <ADMIN_NETWORK/CIDR> must be replaced with the administration address or subnet actually
authorised. Opening the SSH port to all networks is not recommended.
Test then apply the policy:
1 2 3 | |
R38. Persistence of rules at startup¶
Applies to: Edge Gateway
Once the rule set has been validated, it must be loaded automatically at every startup. The
recommended mechanism is iptables-persistent, which relies on netfilter-persistent to load and
save the Netfilter configuration.
1 2 3 4 | |
Warning!
Persistence must only be enabled once the rule set has been functionally validated. After a full reboot, check that the expected policy is indeed loaded and that the administration and production functions remain operational.
1 | |
R40. Disabling IPv6 when it is not needed¶
Applies to: Edge Gateway
The iptables rules presented in this chapter cover IPv4 traffic. To prevent a service from
being reachable over IPv6 without an equivalent filtering policy, the reference profile
recommends disabling IPv6 where that protocol is not used in the architecture.
Create a dedicated sysctl file:
1 2 3 4 | |
Apply and check the configuration:
1 2 3 4 | |
Warning!
If IPv6 is explicitly required by the architecture, it must not be disabled. In that case, an equivalent IPv6 filtering policy must be defined and tested: IPv4 filtering alone does not protect IPv6 flows.
Classification
To be validated: IPv6 coverage of the filtering (ip6tables).
See the Classification of recommendations appendix.
R41. Verification, audit and monitoring of rules¶
Applies to: Edge Gateway
The active rules and their counters can be consulted with:
1 2 | |
It is recommended to check periodically that the counters of the ACCEPT rules evolve as
expected and that the rules logging rejected packets do not report an abnormal volume. The active
rules must be compared against the expected flow matrix for the server's role.
1 | |
Every rule added, modified or removed must be documented: purpose, direction of the flow, protocol, port, source, destination, date and person behind the change. After any significant update of CyberElements or of the system, check that the persistent rules remain consistent with the services actually in use.
Information
fail2ban can insert and remove IP banning rules dynamically. Those rules must be taken into account during audits so as to tell the firewall's static policy apart from the temporary rules generated by the protection mechanisms.