Enhancing Data Understanding
Rocco Gagliardi
We have (securely) collected a lot of event records from sparse generators, centrally consolidated and archived in a daily rotated archive. Which measures can we take in place to protect the content of the archives?
File attributes will help. BSDs have the ability to assign extra attributes to files and directories (Linux has similar features, but who uses Linux in a secure environment? Ok! take it easy, it’s a joke… but still use OpenBSD, please). This is different from the standard Unix permissions scheme in that the attributes set on a file apply universally to all users of the system, and they affect file accesses at a much deeper level than file permissions or ACLs.
Use ls -lo
to view the attributes and use chflags
to modify them.
One useful attribute for protecting log files is append-only. When this attribute is set, the file cannot be deleted and writes are only allowed to append to the end of the file.
# chflags sappnd filename
But this is just the half of the game: root
(or a pretending one) can still remove the attribute, change the log and restore the attribute without any notice (except for the last operation: restoring the attribute).
To prevent this, you’ll need to disable the ability to remove the append-only attribute.
The BSDs accomplish this thing through the use of securelevels
. The securelevel
is a kernel variable that you can set to disallow certain functionality. Raise the securelevel
to 1
. Once the securelevel
has been set to a value greater than 0
, it cannot be lowered. By default, OpenBSD will raise the securelevel to 1
when in multiuser mode. In FreeBSD, the securelevel is –1
by default.
To change this behavior, add the following line to /etc/sysctl.conf
:
kern.securelevel=1
Be aware that adding append-only flags to your log files will most likely cause log rotation scripts to fail. However, it is a valuable enhancement of the security of your audit trail.
Basically, we want to protect log files from tampering, poisoning or forgery. This kind of techniques can be referred to as integrity verification, incontrovertible data, court admissible evidentiary data or even signed and sequenced data.
What methods can we use?
Why so serious about logfile security? If we can’t prove or at least reasonably trust our logs, we are blind. Keeping log secure and verifiable is one of the most complex part of the log management solution. Many solutions exist to address the problem but must be implemented very carefully. And the clouds does not promise anything good!
Our experts will get in contact with you!
Rocco Gagliardi
Rocco Gagliardi
Rocco Gagliardi
Rocco Gagliardi
Our experts will get in contact with you!