介绍
Artillery 是基于 Linux 的系统的多用途防御工具,包括蜂蜜的功能,操作系统硬化,文件系统监控和实时威胁分析. 它本身为您的系统提供了一定数量的安全性,但它旨在作为多层安全计划的一部分使用,并与 Web 应用程序防火墙(如 ModSecurity)玩得很好。
炮兵的一些最有用的功能是蜂蜜罐,文件系统监控和实时威胁分析方面,所以本文将主要集中在这些方面。蜂蜜罐旨在用一些最常受到攻击的端口,如SSH,MSSQL,RPC/SMB等响应端口和漏洞扫描器。
文件系统监控通过积极监控通常针对的目录进行更改(/tmp, /var/www)和监控攻击者非常重要的文件(/etc/passwd, /etc/shadow/, ~/.ssh/authorized_keys)来工作。
将 Artillery 区分于许多其他防御工具的更有趣的功能之一是Artillery Threat Intelligence Feed
,它将IP地址和有关已知攻击者的信息合并到一个中央源,然后可以由任何运行 Artillery 的机器使用,以实时检测和禁止已知攻击者从您的服务器上。
下载和安装炮兵
下载 Artillery 需要 git 安装在您的服务器上. 如果它目前没有安装,您将需要通过您的分布包管理器来安装它。
1apt-get update && apt-get install git
在 git 安装完成后,我们现在已经准备好克隆 Artillery 包。
1git clone https://github.com/trustedsec/artillery/ artillery/
现在我们可以进入炮兵目录并启动安装程序。
1cd /artillery
2./setup.py
在安装过程中,您将收到三条提示,需要 y/n 答案。继续,并对每个答案回答是的。 请注意,在安装结束时,您可能会遇到一个错误,即 /var/artillery/database/temp.database 不存在。
1mkdir /var/artillery/database
2touch /var/artillery/database/temp.database
3service artillery restart
配置炮兵
我们现在有一个功能性安装的炮兵. 在盒子之外,炮兵是预先配置的典型的Linux安装,但它是强烈建议定制的配置,以满足您的个人VPS的需求。
使用 nano 打开 config 文件。
1nano /var/artillery/config
更改以下行允许对自定义目录进行文件系统监控:
1MONITOR_FOLDERS=”/var/www”,”/etc”
只需添加任何您希望在/etc
后进行监控的目录,例如,如果您想监控 /root,则会添加/root
。
1MONITOR_FOLDERS=”/var/www”,”/etc”,”/root”
EXCLUDE 条目允许您指定不应该监控的文件或文件,例如,如果您不希望 /etc/passwd 被监控,则将其更改如下:
1EXCLUDE=/etc/passwd
您也可以按需要列出 IP 地址,这是有用的,如果你是访问虚拟服务器的团队的一部分,你不想让任何人被禁止,因为没有输入正确的 SSH 密码 4 次. 建议至少列出自己的 IP 地址,如果你计划运行自动端口或漏洞扫描器,因为这样做会导致禁令,你将不再能够连接。
1WHITELIST_IP=127.0.0.1,localhost,xxx.xxx.xxx.xxx <-Replace the x's with your IP address.
此外,您可以指定蜂蜜罐应将其报告为开放的端口。如前所述,蜂蜜罐默认配置为在最常受到攻击的端口上生成蜂蜜罐,但如果您觉得有必要,您可以通过添加单独的入口添加额外的端口。
1PORTS="135,445,22,1433,3389,8080,21,5900,25,53,110,1723,1337,10000,5800,44443"
两
1PORTS="135,445,22,1433,3389,8080,21,5900,25,53,110,1723,1337,10000,5800,44443,1024"
建议通过更改 auto_update 值为 On 来启用自动更新。
1AUTO_UPDATE=ON
默认情况下,Artillery 配置为试图缓解对端口 80 (http) 和 443 (https) 的 DoS (服务拒绝) 攻击,如果您的滴滴在其他端口(8080,8180,10000)上运行 Web 服务,您也可以通过添加端口来启用 DoS 保护。
1ANTI_DOS_PORTS=80,443,8080,8180,10000
如果您想要禁用 DoS 保护,只需将 ANTI_DOS 值更改为关闭。
1ANTI_DOS=ON
维护炮兵
Artillery 旨在在安装后作为服务运行,在安装过程中,Artillery 会自动启动,因此无需重新启动服务器。
炮弹将在您的滴滴的每一次重新启动时启动,在背景中提供持续的保护。
与Apache相似,可以通过运行以下命令来启动和重新启动炮兵作为一个服务:
1service artillery start # <-Starts the service.
2service artillery restart # <-Restarts the service.
您还可以通过下列方式检查 Artillery with ps aux 和 top 的当前系统资源使用情况:
请注意,进程ID炮兵正在运行。
1ps aux | grep artillery
用 Artillery 的进程 ID 取代 PID。
1top -p PID
2~~~~
3
4It is important to note that if a user fails to supply a correct SSH password 4 times in a row, they will be banned and can no longer connect to the server. If this happens and an authorized user has been banned, Artillery includes a script to reset bans. The script usage is:
5
6Move to the artillery directory
CD / Var / 炮兵
1Replace the x's with the ip of the banned user.
./reset-bans.py xxx.xxx.xxx.xxx
1We should now have a working installation of Artillery configured to your needs. Artillery is light on system resources so should not need to upgrade CPU/Memory on your droplet to accommodate it. Also note that for the sake of brevity we did not cover every entry in the config file; instead we covered the most common and important entries. Feel free to experiment and see what configuration options work best for you.
2
3<div class="author">Submitted by: <a
4href="https://twitter.com/Su1ph3r">Paul White</div>