Grsecurity 的用户组加固

Grsecurity提供了基于GID,UID的执行控制(TPE)和网络控制,可以让指定用户组的用户无法执行非root所有的可执行文件,或者禁止建立监听端口或者出站连接等,可以加固服务器,防止漏洞被利用。

我是这样使用的,如果有更好的方法或者哪里不妥的话欢迎拍砖讨论。

 

UID是在内核中设置好的,根据内核config来建立用户组:

groupadd -g 65532 tpe

groupadd -g 65531 nonet

groupadd -g 65530 noclient

groupadd -g 65529 noserver

useradd -g tpe -s /sbin/nologin -u 65532 tpe

useradd -g nonet -s /sbin/nologin -u 65531 nonet

useradd -g noclient -s /sbin/nologin -u 65531 noclient

useradd -g noclient -s /sbin/nologin -u 65530 noclient

useradd -g noserver -s /sbin/nologin -u 65529 noserver

useradd -g nonet -s /sbin/nologin -u 65528 nonet-tpe

useradd -g noclient -s /sbin/nologin -u 65527 noclient-tpe

useradd -g noserver -s /sbin/nologin -u 65526 noserver-tpe

usermod -a -G tpe noclient-tpe

usermod -a -G tpe noserver-tpe

usermod -a -G tpe nonet-tpe

让特定程序以特定身份运行,比如php的用户名就叫php:

Leave a Reply

Your email address will not be published. Required fields are marked *