You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
serverAddr = "<your frp server>"
serverPort = <frp server port>
user = "<your user name>"
log.to= "<log file path>"
log.level = "debug"
log.maxDays = 2
auth.method = "token"
auth.token = "<token>"
[[proxies]]
name = "ssh-go-mmproxy"
type = "tcp"
localIP = "127.0.0.1"
localPort = 12222
remotePort = 12345
transport.proxyProtocolVersion = "v2"
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 listen 12222 and forward to 22 which is the ssh port.
go-mmproxy.service
[Unit]
Description=go-mmproxy
After=network.target
[Service]
Type=simple
LimitNOFILE=65535
ExecStartPost=/sbin/ip rule add from 127.0.0.1/8 iif lo table 123
ExecStartPost=/sbin/ip route add local 0.0.0.0/0 dev lo table 123
ExecStart=/home/ubuntu/frp/go-mmproxy -4 127.0.0.1:22 -l 127.0.0.1:12222
ExecStopPost=/sbin/ip rule del from 127.0.0.1/8 iif lo table 123
ExecStopPost=/sbin/ip route del local 0.0.0.0/0 dev lo table 123
Restart=on-failure
RestartSec=10s
[Install]
WantedBy=multi-user.target
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/fail2ban
[sshd]
# To use more aggressive sshd modes set filter parameter "mode" in jail.local:
# normal (default), ddos, extra or aggressive (combines all).
# See "tests/files/logs/sshd" or "filter.d/sshd.conf" for usage example and details.
#mode = normal
enabled = true
port = ssh
logpath = %(sshd_log)s
backend = %(sshd_backend)s
maxretry = 5
findtime = 600
bantime.increment = true
bantime.factor = 2
bantime = 300
bantime.overalljails = true
bantime.rndtime = 300
The 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:
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.
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: