防止MPI全零侦听
- MPI初始化拉起的后台mpirun进程存在端口未认证问题,存在被攻击的风险。
规避措施:MPI启动之后添加防火墙规则,防止外部网络连接mpirun和orted(mpi内部组件)侦听的端口,运行结束后需要清理防火墙规则。
- 添加防火墙规则
```shell iptables -D INPUT -p tcp -j ${规则名} iptables -F ${规则名} iptables -X ${规则名} iptables -t filter -N ${规则名} iptables -I INPUT -p tcp -j ${规则名} iptables -t filter -I ${规则名} -i ${要限制网卡} -p tcp --dport ${要限制的端口} -j DROP ```
- 清除防火墙规则
```shell iptables -D INPUT -p tcp -j ${规则名} iptables -F ${规则名} iptables -X ${规则名}
- 添加防火墙规则
- MPI默认配置项在启动多个Python训练进程时会对0.0.0.0地址进行侦听。
父主题: 操作系统安全加固