扫描agent端主机配置(centos7)

背景

一般机器如果做扫描agent端,其实配置方面是有很多可优化的点,此处以centos7为例,另外一般不推荐agent装在docker中运行,进行大量扫描,坑较多。

配置

  1. 关闭selinux:vi /etc/selinux/config ,第6行改成SELINUX=disabled
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of three two values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected.
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted

改完后,必须重启机器才能生效,如下,则SELINUX已关闭在这里插入图片描述
2. 增大文件打开数限制,一般centos默认为1024或65536,对于大并发扫描完全不够
(1)vi /etc/security/limits.conf,文件末尾添加:

* soft nofile 204800
* hard nofile 204800
* soft nproc 204800
* hard nproc 204800
 
*             代表针对所有用户 
noproc     是代表最大进程数 
nofile     是代表最大文件打开数

(2)vi /etc/security/limits.d/20-nproc.conf,文件末尾添加:

* soft nproc 204800
* hard nproc 204800

(3) 如果是ssh连接目标机,重新开个窗口,输入ulimit -n,即可看到成功修改
在这里插入图片描述
3. 关闭firewalld和iptables:
systemctl stop firewalld
systemctl stop iptables
4. 卸载nf_conntrack模块,如果开着这个模块,且nf_conntrack_max数值不高的话(cat /proc/sys/net/netfilter/nf_conntrack_max查看),会导致扫描严重掉包,系统日志中会有大量记录:
在这里插入图片描述
(1)最佳解决方法:modprobe -r nf_conntrack,直接卸载该模块,如果有其它依赖模块导致卸载失败,需要手动把其它模块一一卸载:
在这里插入图片描述
(2)临时方法:调大nf_conntrack_max限制值,vi /etc/sysctl.conf,末尾增加:net.nf_conntrack_max = 100000sysctl -p保存,不建议永久使用这种方法
5. 时间同步
分布式扫描中一般会有多个agent,需要保持时间同步,可通过ntp来实现
(1)设置时区:timedatectl set-timezone Asia/Shanghai
(2)安装ntp服务:yum install ntp
(3)开启ntp同步timedatectl set-ntp true

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值