-
-
Notifications
You must be signed in to change notification settings - Fork 13.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ban the brute-force attack ssh ip by fail2ban in frp client #4692
Comments
If you want to improve the security of your FRP server, you can use nft-blackhole to block specific countries. If your SSH service only accepts connections from your home country's IP addresses, give it a try—you'll notice how clean your host becomes. |
Thank you very much |
测试出来了一个小问题。 环境: 但是有个特殊情况,不知道是不是环境的问题导致。 就是当我在服务器A中的内网访问这个地址,就会显示内网ip。 |
Hi,
This is a tutorial about how to ban the ip whom try to brute force attack your frp client by fail2ban. update config from #2470.
requirements:
note: If you dont want to build the go-mmproxy, you can try this go-mmproxy.zip version. And for fail2ban, you can found the installation in their github project.
Here are the step:
As for me: All files will save in /home/ubuntu/frp/
1.create a frpc config file :
In this step, you can add
proxy_protocol_version
to turn on Proxy Protocol, and prepare a local port which using in go-mmproxy, not your real forward port.For example, I want to proxy my ssh 22 port with frp with proxy protocol, you need a other port such as 12222, so:
frpc.toml
2. Set up for go-mmproxy:
You can build it from go-mmproxy github main page or download the x86_64 binary which I build on my Ubuntu 20.04 with go version go1.16.5 linux/amd64 from the following url: go-mmproxy.zip, and move it to somepath where you want. For me, I move it to /home/ubuntu/frp/.
3. Create go-mmproxy service file
You need to create a
go-mmproxy.service
in/home/ubuntu/frp/
. The go-mmproxy will listen12222
and forward to22
which is the ssh port.go-mmproxy.service
4. Create frpc service file
frpc.service
If you have done, you can find in your directory, eg: /home/ubuntu/frp/:
The link the services file to /etc/systemd/system/ and enable it.
Add fail2ban
If your OS is Ubuntu, you can install it by
sudo apt install fail2ban
Here is the config(you can find the config file in /etc/fail2ban/):
create a
jail.local
file in /etc/fail2banThe you can find the remote ip in /var/log/auth.log and /var/log/fail2ban.log.
The text was updated successfully, but these errors were encountered: