问题描述
AWS Inspector 报告:
1.6.1.6 确保不存在不受限制的守护进程
严重性
高
说明
描述 未在 SELinux 策略中定义的守护进程将继承其父进程的安全上下文。基本原理 由于守护进程是从 init 进程启动和下降的,它们将继承安全上下文标签 initrc_t 。这可能会导致意外后果,即授予进程比其所需的更多权限。
推荐 调查在审计操作期间发现的任何不受限制的守护进程。他们可能需要为他们分配现有的安全上下文或为其构建策略。
搜索不受限制的守护进程:
[root@ip-10-0-1-136 bin]# ps -eZ | egrep "initrc" | egrep -vw "tr|ps|egrep|bash|awk" | tr ':' ' ' | awk '{ 打印 $NF }'
红宝石
红宝石
我没有找到任何来自 AWS 的文件来限制 codedeploy-agent。我试图按照 AWS 的指示来限制 AWS Inspector 代理。 https://docs.aws.amazon.com/inspector/latest/userguide/inspector_installing-uninstalling-agents.html。 ls -Z 确实在 /etc/rc.d/init.d 和 /etc/init.d 中显示了 codedeploy-agent 脚本与 bin_t 域,但是 AWS Insprector 扫描仍然报告 ruby (codedeploy-agent) 一个不受限制的守护进程。
[root@ip-10-0-1-136 bin]# systemctl status codedeploy-agent.service
● codedeploy-agent.service - AWS CodeDeploy 主机代理 已加载:已加载(/usr/lib/systemd/system/codedeploy-agent.service;已启用;供应商预设:已禁用) 活动:自 UTC 时间周一 2021-05-17 15:49:43 起处于活动状态(正在运行); 7 秒前 进程:29048 ExecStop=/opt/codedeploy-agent/bin/codedeploy-agent stop (code=exited,status=0/SUCCESS) 进程:29516 ExecStart=/bin/bash -a -c [ -f /etc/profile ] && source /etc/profile; /opt/codedeploy-agent/bin/codedeploy-agent start (code=exited,status=0/SUCCESS) 主PID:29528(红宝石) CGroup:/system.slice/codedeploy-agent.service ├─29528 编码部署代理:master 29528 └─29532 codedeploy-agent: InstanceAgent::Plugins::CodeDeployPlugin::Master 29528的CommandPoller
5 月 17 日 15:49:43 ip-10-0-1-136.eu-west-1.compute.internal systemd[1]:启动 AWS CodeDeploy 主机代理... 5 月 17 日 15:49:43 ip-10-0-1-136.eu-west-1.compute.internal systemd[1]:启动 AWS CodeDeploy 主机代理。
[root@ip-10-0-1-136 bin]# ls -Z /opt/
drwxr-xr-x。 root root system_u:object_r:usr_t:s0 aws
drwxr-xr-x。 root root system_u:object_r:usr_t:s0 编码部署代理
[root@ip-10-0-1-136 bin]# ls -Z /opt/codedeploy-agent/bin/ -rwxr--r--。 root root system_u:object_r:bin_t:s0 codedeploy-agent
-rwxr--r--。 root root system_u:object_r:bin_t:s0 codedeploy-local
-rwxr--r--。 root root system_u:object_r:bin_t:s0 install
-rwxr--r--。 root root system_u:object_r:bin_t:s0 更新
[root@ip-10-0-1-136 bin]# ls /etc/rc.d/init.d/ -Z
-rwxr-xr-x。 root root system_u:object_r:bin_t:s0 awsagent -rwxr--r--。 root root system_u:object_r:bin_t:s0 codedeploy-agent
[root@ip-10-0-1-136 bin]# ls /etc/init.d/ -Z -rwxr-xr-x。 root root system_u:object_r:bin_t:s0 awsagent -rwxr--r--。 root root system_u:object_r:bin_t:s0 codedeploy-agent
更改为 bin_t 似乎不起作用 - 因为 ps -Z 仍然显示使用 initrc_t 运行的进程
[root@ip-10-0-1-136 bin]# ps -eZ | egrep "initrc" | egrep -vw "tr|ps|egrep|bash|awk" | tr ':' ' '
system_u system_r initrc_t s0 29528 ? 00 00 00 红宝石
system_u system_r initrc_t s0 29532 ? 00 00 00 红宝石
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)