使用Fail2Ban阻止VPS被攻击

发表评论 阅读评论

Fail2Ban是一个入侵防御软件框架,可以保护计算机服务器免受暴力攻击。最常见的用法是防止暴力破解ssh登陆密码/密钥。

起因

前几天我的VPS被攻击了,CPU占用很高,网络流量也很多,导致服务商直接将我的网络给断开,并提醒我需要处理,简单查看后发现是被攻击了,我也不会处理这种事,只好备份数据并重装系统,由于公司需要加班,所以前后也处理了好几天,本来不知道有Fail2Ban这个程序,服务商给推荐了该程序,这里赞下我的服务商Linode

安装

大多数linux发行系统都可以直接安装,例如Ubuntu执行下面的命令就可以了。

apt install fail2ban

可能是我一开始用的源码安装,卸载后再用上面的命令导致配置文件丢失,只好再次用源码安装。 这里是Fail2Ban的源码https://github.com/fail2ban/fail2ban

使用git安装也很方便,由于我默认是python3,所以不想再安装python2,所以需要安装python3的一些组件。

apt install 2to3
apt install python3-pip
pip3 install pyinotify
git clone https://github.com/fail2ban/fail2ban.git
cd fail2ban
./fail2ban-2to3
sudo python setup.py install
fail2ban-client version

配置

如果是sshd服务的话,配置比较简单

cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local

修改文件 /etc/fail2ban/jail.local

找到 sshd,并添加 enabled = true

[sshd]
enabled = true
filter = sshd
port    = ssh
logpath = %(sshd_log)s
backend = auto

开机自启动

cp files/debian-initd /etc/init.d/fail2ban
update-rc.d fail2ban defaults
service fail2ban start

使用结果

使用了几天Fail2Ban后,发现了好多攻击者,不停的尝试使用不同的用户名来登陆我的VPS,看来安全工作还是需要搞起来。

标签: , ,

  1. Williamnic | #1
  2. ArthurShuct | #2

    Has it ever happened that your credit report unexpectedly “declares” you dead? Facing an erroneous death marker in your TransUnion credit report can be a significant ordeal for anyone. This mistake not only creates a sense of anxiety and stress but can also have long-term consequences for your financial life, affecting your ability to obtain loans, insurance, and even employment.

    Understanding the Seriousness of the Situation
    The erroneous listing of you as deceased in TransUnion’s databases is not just a small oversight. It’s a mistake that can block your access to the most critical financial tools and services. It’s crucial to realize that behind this “digital” problem lie real-life inconveniences and obstacles, such as issues with the social security administration death index and wrongful denial of coverage.

    Overview of Statistics
    Let’s consider some statistics that illustrate the prevalence of the problem. For instance, credit bureau reports deceased and social security administration death notification errors occur frequently. Experian death notification and Equifax death notice errors are also common.

    These figures underscore the importance of timely detecting and correcting such errors. If you find your credit report says I am deceased or your credit report shows deceased, immediate action is required.

    Why Choose Our Law Firm
    Choosing our company to solve your problem with your credit report is a choice in favor of professionalism and reliability. Thanks to deep knowledge of the FCRA law and experience in handling similar cases, we offer you the following benefits:

    No expenses for you: the costs of our services are borne by the respondent.
    Hundreds of satisfied clients and million-dollar compensations confirm our effectiveness.
    Full service from interacting with credit bureaus to protecting your interests.
    Examples of Problems Faced by People
    Mistakenly reported as deceased TransUnion – denials of credit and financial services.
    Credit report is showing deceased TransUnion – problems with insurance applications and insurance company refusal to pay.
    Flagging TransUnion account as deceased – difficulties with employment due to background check errors.
    TransUnion deceased alert – inability to sign financial contracts, leading to insurance claim denial and long-term care claim lawyer consultations.

    These issues not only create financial and emotional difficulties but also undermine your trust in the credit monitoring system. When errors like a deceased indicator on credit report occur, it's essential to have an experienced insurance attorney on your side to navigate the complexities.

    Have you been mistakenly reported as deceased on credit report? Are you dealing with a social security number reported as deceased or credit report deceased errors? Our firm specializes in resolving these issues, ensuring your records are corrected swiftly. Contact us to enforce insurance promises and get your financial life back on track.

    If your credit report says I am deceased, don't wait. Our experienced team can help you prove you are not deceased and address inaccuracies such as deceased indicator meaning and credit bureau reports deceased. Trust us to handle your case with the dedication of a skilled insurance lawyer.

    https://bucceri-pincus.com/experian-deceased-alert-showing-deceased/

  1. 本文目前尚无任何 trackbacks 和 pingbacks.
回到顶部