mirror of
https://github.com/fatedier/frp.git
synced 2026-05-15 16:15:49 -06:00
[GH-ISSUE #2470] Can check ssh connection failed in frps log? #1960
Labels
No labels
In Progress
WIP
WaitingForInfo
bug
doc
duplicate
easy
enhancement
future
help wanted
invalid
lifecycle/stale
need-issue-template
need-usage-help
no plan
proposal
pull-request
question
todo
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/frp#1960
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @MikoyChinese on GitHub (Jul 7, 2021).
Original GitHub issue: https://github.com/fatedier/frp/issues/2470
Hi,
These days I found a lot of ssh connection in my frp client, but I just obtain 127.0.0.1 connection log in my ssh log file, and I check my frp server which only can show the real ip connect but no checking it failed or not.
Here is frp server log:
Can I check if this ip try to brute-force attack my client, and use the fail2ban tool to forbiden it? If you can add the failed message in the frps log file, or show the real ip in the client log file, I think it will work well.
Thanks.
@fatedier commented on GitHub (Jul 8, 2021):
frp do not parse traffic content between your ssh server and client. So it can't judge if the connection is failed or normal closed.
@MikoyChinese commented on GitHub (Jul 8, 2021):
Or can add a flag to tell server or client, if use this module it will send the real ip for proxy, and it will show in the ssh client log, not show from 127.0.0.1, port xxx.
@fatedier commented on GitHub (Jul 8, 2021):
https://github.com/fatedier/frp#proxy-protocol
@MikoyChinese commented on GitHub (Jul 8, 2021):
For ssh, Does that mean I should add
proxy_protocol_version = v2for obtaining the real ip from frp service?@fatedier commented on GitHub (Jul 8, 2021):
Yes, you should write your own service before ssh server to parse Proxy Protocol to get real ip.
@MikoyChinese commented on GitHub (Jul 8, 2021):
Ok, I will try nginx or python to analyzethe Proxy Protocol.
@MikoyChinese commented on GitHub (Jul 8, 2021):
Hi, bro
I found the Proxy Protocol in sshd log file such like
1xx.6.xx.xx 10.0.12.11 40398 32255, what is the meaning?And I found nginx document have some variables
$proxy_protocol_addr,$proxy_protocol_port,$remote_addr,$remote_port.So,
1xx.6.xx.xx ==> remote_addr
40398 ==> remote_port
32255 ==> proxy_protocol_port
10.0.12.11 ==> proxy_protocol_addr
, am I right?
@MikoyChinese commented on GitHub (Jul 8, 2021):
I try to use nginx or other python proxy-protocol to handle the tcp connect from server to ssh client. But I only can send data to ssh port which will occur the error msg:
client sent invalid protocol identifier. For nginx it will showclient sent invalid protocol identifier "PROXY TCP4 127.0.0.1 127.0.0.1 59632 10001, for proxy-protocol, it will showclient sent invalid protocol identifier "".So how can I send tcp data to sshd? Can you show me some tips, I am going crazy.
@MikoyChinese commented on GitHub (Jul 12, 2021):
Hi, @fatedier
I have found the solution to obtain the real ip from frp by using Proxy Protocol and go-mmproxy. It's now working for linux and I have no other OS system to try.
Here are steps:
1. Frpc with proxy protocol:
In this step, you can add
proxy_protocol_versionto 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 54000, so:
FRPC config:
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 /usr/local/bin.
3. Start frp and mmproxy from systemd service:
You need to create two service file to start frp and go-mmproxy from systemd control service.
go-mmproxy.service: note:
/usr/local/bin/go-mmproxyis the path of go-mmproxy, you can change it to yours,-4 127.0.0.1:22is the ipv4 address and port you want to real forward, now it's ssh common port.-l 0.0.0.0:54000is the frpc port.frpc.service
4. Start service:
Now try you own real ip frp proxy!
@github-actions[bot] commented on GitHub (Aug 12, 2021):
Issues go stale after 30d of inactivity. Stale issues rot after an additional 7d of inactivity and eventually close.
@whosphp commented on GitHub (Oct 15, 2021):
@MikoyChinese Thank you, it work for me.