[译文] 如何为 PostgreSQL 和 TimescaleDB 配置 SELinux

数据是公司重要的资产,因此您应该考虑数据库中的所有安全因素,以确保其尽可能安全。基于 RedHat 的操作系统上的一项重要安全功能是 SELinux。在这篇文章中,我们将看到这个特性是什么,以及如何为PostgreSQL和TimescaleDB数据库配置它。

什么是 SELinux?

Security-Enhanced Linux (SELinux) 是 Linux 系统的一种安全架构,允许管理员更好地控制谁可以访问系统。它使用安全策略定义系统上的应用程序、进程和文件的访问控制,这是一组告诉 SELinux 可以访问什么的规则。

当称为主体的应用程序或进程发出访问对象(如文件)的请求时,SELinux 会检查访问向量缓存 (AVC),其中为主体和对象缓存了权限。如果 SELinux 无法根据缓存的权限做出访问决策,它会将请求发送到安全服务器。安全服务器检查应用程序或进程和文件的安全上下文。从 SELinux 策略数据库应用安全上下文,并授予或拒绝权限。

有不同的方法来配置它。您可以查看/etc/selinux/config中的主要 SELinux 配置文件,以了解它当前的配置方式。

$ cat /etc/selinux/config<font></font> # This file controls the state of SELinux on the system.<font></font> # SELINUX= can take one of these three values:<font></font> # enforcing - SELinux security policy is enforced.<font></font> # permissive - SELinux prints warnings instead of enforcing.<font></font> # disabled - No SELinux policy is loaded.<font></font> SELINUX=enforcing<font></font> # SELINUXTYPE= can take one of these three values:<font></font> # targeted - Targeted processes are protected,<font></font> # minimum - Modification of targeted policy. Only selected processes are protected.<font></font> # mls - Multi Level Security protection.<font></font> SELINUXTYPE=targeted

相关文章