> Source: https://docs.cyberelements.io/saas/pt/Security/MonitoringTools/

# Monitoring tools

This chapter presents a **non-exhaustive** list of additional tools for maintaining and monitoring CyberElements servers. `debsums` and AIDE, also tools of that family, are covered in [System integrity](https://docs.cyberelements.io/saas/pt/Security/SystemHardening/SystemIntegrity/) and are not repeated here.

> **Information**
>
> No ANSSI-BP-028 recommendation names these tools specifically, except `auditd` ([R71](#r71)), which directly overlaps recommendations R30 to R44 (accountability, sudo) and R71 to R73 (logging) already cited in this guide. The other tools in this chapter belong to **complementary operational good practice** rather than to an explicit ANSSI requirement.

## Summary

| # | Recommendation | Edge Gateway |
|---|---|---|
| [**R68**](#r68) | arpwatch: monitoring of local ARP activity | ✅ |
| [**R69**](#r69) | acct: accounting of connections and commands | ✅ |
| [**R70**](#r70) | sysstat: system performance statistics | ✅ |
| [**R71**](#r71) | auditd: audit of the Linux kernel subsystem | ✅ |
| [**R72**](#r72) | Lynis: periodic configuration audit | ✅ |
| [**R73**](#r73) | ClamAV: antivirus (to be validated depending on usage) | ✅ |

## R68. arpwatch: monitoring of local ARP activity

**Applies to**: Edge Gateway ✅

`arpwatch` monitors ARP activity on the local network by checking the correspondence between IP addresses and MAC addresses, which makes it possible to detect **ARP spoofing** attacks. It builds its reference database in `/var/lib/arpwatch`.

```
1
2
3
```

See `/etc/arpwatch/README` and the package manual for how to interpret the alerts.

## R69. acct: accounting of connections and commands

**Applies to**: Edge Gateway ✅

`acct` provides statistics on users' **connection time** (*login accounting*) and on the **commands executed** (*process accounting*).

```
1
```

- `ac`: login/logout statistics;
- `lastcomm`: commands previously executed by a user;
- `accton`: start/stop accounting;
- `sa`: summary of the commands executed;
- `last` / `lastb`: most recent authenticated users (successful / failed).

## R70. sysstat: system performance statistics

**Applies to**: Edge Gateway ✅

`sysstat` bundles performance tracking utilities (`sar`, `iostat`, `mpstat`, `pidstat`, `sadf`, `nfsiostat`, `cifsiostat`), useful for **establishing a baseline** of normal operation and detecting drift.

```
1
```

Enable collection, in `/etc/default/sysstat`:

```
1
```

The default collection interval (10 minutes) can be tightened in `/etc/cron.d/sysstat`, for instance every 2 minutes:

```
1
```

```
1
```

## R71. auditd: audit of the Linux kernel subsystem

**Applies to**: Edge Gateway ✅

`auditd` stores and allows searching of the records generated by the Linux kernel audit subsystem: access to and modification of sensitive files, system calls, commands executed by users, sensitive configurations.

It is **the most structuring tool of this chapter**, and the one that most directly overlaps the ANSSI-BP-028 recommendations on accountability and logging (R30 to R44, R71 to R73).

```
1
```

> **Warning!**
>
> This rule set generates a **significant volume of logs**, to be anticipated in the storage sizing covered in [Centralised logging](https://docs.cyberelements.io/saas/pt/Security/CentralizedLogging/). The last line (`-e 2`) makes the configuration **immutable until the next reboot**: any subsequent change to the rules requires restarting the service, or even the server (worth bearing in mind before applying it in production).

> **Warning!**
>
> A watch rule (`-w`) pointing at a **non-existent path** makes the loading of the rules file fail and can prevent the following rules from being applied, including the final lock (`-e 2`). The set below has been stripped of the paths belonging to components absent from the CyberElements OVAs (local mail, `stunnel`, files inherited from SysV/upstart) and adapted to the distribution's current locations (`/etc/modprobe.d/`, `/etc/audit/plugins.d/`). After any adaptation, check that loading is complete with `augenrules --check` then `auditctl -l`.

File `/etc/audit/rules.d/audit.rules`:

**Base configuration**

```
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
```

> **Information**
>
> For readability, this rule set does not duplicate each system call rule for the 32-bit architecture (`arch=b32`): Debian no longer supports i386 as a standard architecture, and a minimal amd64 virtual machine runs no 32-bit process. If a specific need exists (32-bit libraries or binaries installed), the corresponding `b32` rules can be duplicated identically, replacing `arch=b64` with `arch=b32`.

**File system and boot**

```
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
```

**Scheduled tasks**

```
1
2
3
```

> **Information**
>
> This group of rules directly overlaps [R17](https://docs.cyberelements.io/saas/pt/Security/SystemHardening/SystemIntegrity/#r17) (scheduled tasks): `auditd` traces here the **changes to cron configuration**, whereas R17 deals with the **regular review** of its content.

**Accounts, authentication and privilege escalation**

```
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
```

> **Information**
>
> This group overlaps [R8 and R9](https://docs.cyberelements.io/saas/pt/Security/SystemHardening/SystemAccounts/#r8) (accounts and sudo) as well as [R26 and R27](https://docs.cyberelements.io/saas/pt/Security/Ssh/#r26) (access control and key authentication): `auditd` provides the **traceability of changes** here, where those chapters define the **policy** itself. The file `/var/log/sudo.log` is the one configured in R9; `/var/run/faillock/` replaces the former `/var/log/faillog`, obsolete since the move to `pam_faillock` (R10).

**Traceability of privileged commands and denied accesses**

```
1
2
3
4
5
```

> **Information**
>
> That last rule can be extended to other sensitive directories (`/bin`, `/home`, `/sbin`, `/srv`, `/usr/bin`, `/usr/local/bin`, `/var`…) depending on context; it is **deliberately not generalised** to the whole system by default, because it then generates a large volume of events unrelated to any malicious attempt: the normal access controls of an unprivileged account.

**Additions from the OpenSCAP report (ANSSI-BP-028 R73 coverage)**

Of the 44 individual controls attached to R73 (`auditd`) failing in the OpenSCAP report (profile `anssi_bp28_enhanced`) analysed ahead of this work, the rule set above, inherited from the previous guide, covered only a small part. The following categories close most of that gap.

```
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
```

> **Warning!**
>
> The **`audit_rules_media_export`** control (data export to removable media) has not been included: CyberElements servers are deployed as virtual machines **with no removable media exposed** by design.

```
1
2
```

Applying and checking:

```
1
2
3
4
```

## R72. Lynis: periodic configuration audit

**Applies to**: Edge Gateway ✅

Lynis is an audit tool **run on demand**, not a permanent agent: it analyses the system's configuration at a given moment and produces a hardening report with a score and improvement leads.

```
1
2
```

> **Information**
>
> This tool fits naturally into the logic of **regular configuration auditing**: it can be run after each application of this guide on a server, then periodically, so as to detect **configuration drift over time** rather than to replace the recommendations themselves.

## R73. ClamAV: antivirus (to be validated depending on usage)

**Applies to**: Edge Gateway ✅

ClamAV is an antivirus engine able to scan files on demand or on access.

```
1
2
3
```

> **Warning!**
>
> Its usefulness **depends directly on the server's actual role** rather than being uniform across the architecture. On an Edge Gateway whose published resources include file transfer or SMB sharing, scanning the files passing through becomes relevant. Classified **to be validated** against the resources actually published, rather than recommended uniformly (see [Classification of recommendations](https://docs.cyberelements.io/saas/pt/Security/Classification/#reserved-or-to-be-validated)).
