Centralised logging¶
This chapter covers the centralisation of logs towards a logging infrastructure (syslog server or SIEM).
The CyberElements Bastion architecture has no dedicated logging server. Centralisation is nonetheless recommended and relies on the standard rsyslog mechanisms.
The general principles of local logging (rsyslog configuration, rotation, permissions,
command histories) are covered in
System logging and time and are not repeated here.
Information
The ANSSI reference for logging architecture is the guide ANSSI-PA-012 (28/01/2022, "Recommandations de sécurité pour l'architecture d'un système de journalisation"), which replaced the 2013 technical note on the same subject. The points below refer to its content.
Summary¶
| # | Recommendation | Mediation Controller | Edge Gateway |
|---|---|---|---|
| R63 | Principle of centralisation towards the logging infrastructure | ||
| R64 | Redirection of Apache logs to syslog | ||
| R65 | Redirection of organisation logs to syslog | ||
| R66 | Reliable forwarding to the logging server | ||
| R67 | Good practices on the destination logging server |
R63. Principle of centralisation towards the logging infrastructure¶
Applies to: Mediation Controller · Edge Gateway
With no logging server supplied by the product, the logs of the Mediation Controller and of the
Edge Gateway must be forwarded by rsyslog to the logging server: transport is covered
in R66.
That forwarding natively covers the operating system logs. Two categories of events require additional configuration to reach syslog and benefit from the same forwarding:
- Apache logs, usually written to dedicated files rather than to syslog (R64);
- application events specific to organisations, generated by the product itself (R65).
Warning!
The ANSSI (PA-012, R11) points out that an intermediate logging server should not be sought at any cost: it adds complexity and can itself become a point of failure if its availability is not under control. Local retention of logs on each server is the first level of protection; centralisation towards a logging infrastructure complements it without replacing it.
R64. Redirection of Apache logs to syslog¶
Applies to: Mediation Controller · Edge Gateway
On the Mediation Controller, the Apache configuration files are generated automatically by the
hostmanager service from template files: modifying them directly risks having them overwritten
at the next generation. The template files themselves must therefore be modified, as referenced
in /etc/ipdiva/hostmanager/plugins-enabled/04webserver.load:
1 2 3 | |
Create these alternative template files by copying the originals:
1 2 3 | |
Then, in each of the copied files, replace:
1 | |
with:
1 | |
1 | |
Warning!
This restart entails an Apache restart; schedule it outside a window of critical portal activity.
Warning!
This redirection interacts directly with the fail2ban jails of
fail2ban, whose logpath entries read the files
/var/log/apache2/*error.log: once the logs are redirected to syslog, those files are no
longer written to. Both chapters must be applied in a coordinated way: adapt the logpath
entries or the rsyslog configuration, then revalidate that the jails actually trigger.
R65. Redirection of organisation logs to syslog¶
Applies to: Mediation Controller · Edge Gateway
The events of the organisations reach the local syslog of the Mediation Controller through two boxes: in the system console, Logger settings module, Allow the organizations to send their events via syslog; then, in the administration console of each organisation, General options module, Syslog frame, Send platform events via syslog (and Send video events to syslog for the session events). The product writes them to /dev/log: no network reception is involved, and no rsyslog listening has to be added.
Their forwarding to a logging server is covered in R66; the same Logger settings module also offers it, with the Send events to a remote syslog box.
Information
The systancia-auth fail2ban jail (R60) relies on the same two boxes to read the authentication failures.
R66. Reliable forwarding to the logging server¶
Applies to: Mediation Controller · Edge Gateway
The ANSSI (PA-012) recommends using a transport protocol based on TCP rather than UDP for sending logs between an emitting device and a centralisation server, so as to make the transfer reliable: unlike UDP, TCP makes it possible to detect log loss caused by a network outage rather than letting it pass silently.
Warning!
This point concerns the network transport between each server and the logging server, distinct from the local writing of the organisation events covered in R65,
whose risk of loss is very different, since no real network is crossed. The forwarding is the
integrator's responsibility: it means adding on each server an rsyslog rule such as the one
below, and allowing the corresponding flow through the firewall (see
Local firewall).
Where the configuration is accessible, a TCP-based rsyslog forwarding rule takes the following
form (to be adapted to the mechanism actually in place):
1 | |
The double @ (@@) indicates TCP transport, as opposed to a single @ for UDP.
If the flow crosses an uncontrolled network, transport encryption must be put in place (TLS for
rsyslog, or RELP with TLS), in line with the principles of PA-012.
R67. Good practices on the destination logging server¶
Applies to: Mediation Controller · Edge Gateway
The logging server is outside the scope of this guide; the principles of PA-012 are recalled here for the record.
Aggregated logs may contain confidentiality-sensitive information and should be accessible to as few users as possible. As the overall volume aggregated from several servers is generally larger than on any single server, particular attention must be paid to available disk space and to monitoring it.
- Write the logs to a dedicated partition, separate from the system one, so that filling it up does not compromise the operation of the server itself;
- structure the storage as a thematic tree (authentication, resource access, web logs…), which
rsyslogsupports natively: this makes it easier to transfer a subset of logs in bulk, for instance for a targeted investigation; - put in place a rotation policy (
logrotate) suited to the aggregated volume, distinct from the one applied to each server's local logs, which deal with far smaller volumes.
Information
The ANSSI (PA-012) also points out that the accounts with access to the centralised log consultation tool should be tied to roles defined in advance, and that the collection processes themselves should run with the minimum privileges required, a principle already applied by design to the dedicated service accounts of CyberElements Bastion.