FastTunnel/README.md

131 lines
5.6 KiB
Markdown
Raw Normal View History

2020-01-02 22:23:19 +08:00
<p align="center"><img src="images/logo.png" width="150" align=center /></p>
2020-01-02 13:06:51 +08:00
2020-09-22 15:31:32 +08:00
## FastTunnel
2020-09-29 17:06:42 +08:00
[![License](https://img.shields.io/badge/license-Apache%202-green.svg)](https://www.apache.org/licenses/LICENSE-2.0)
[![Build status](https://github.com/anjoy8/blog.core/workflows/.NET%20Core/badge.svg)](https://github.com/SpringHgui/FastTunnel/actions)
[![CircleCI](https://circleci.com/gh/SpringHgui/FastTunnel.svg?style=svg)](https://circleci.com/gh/SpringHgui/FastTunnel)
[![Nuget](https://img.shields.io/nuget/v/FastTunnel.Core)](https://www.nuget.org/packages/FastTunnel.Core/)
[![Nuget](https://img.shields.io/nuget/dt/FastTunnel.Core)](https://www.nuget.org/packages/FastTunnel.Core/)
2020-04-23 23:04:00 +08:00
[README](README.md) | [中文文档](README_zh.md)
2020-07-01 18:02:31 +08:00
***
2020-09-29 23:24:37 +08:00
The penetration platform developed based on this framework, if you need intranet penetration, you can register and use it directly, eliminating the cost of building and maintaining yourself.
But do not use this service for important items.
2020-07-01 18:06:05 +08:00
2020-09-29 23:24:37 +08:00
Penetration platform: https://suidao.io
2020-07-01 18:06:05 +08:00
2020-09-29 23:24:37 +08:00
Platform source code[FastTunnel.SuiDao](https://github.com/SpringHgui/FastTunnel.SuiDao)
2020-11-11 18:23:13 +08:00
**If helpful, click on ⭐Star to support this project, please submit an issue if you have needs and bugs, and welcome coder to PR**
2020-07-01 18:02:31 +08:00
***
2020-05-20 20:41:15 +08:00
## What is FastTunnel
2020-09-29 23:24:37 +08:00
- FastTunnel is a high-performance cross-platform intranet penetration tool. With it, you can expose intranet services to the public network for yourself or anyone to access.
- Unlike other penetration tools, the FastTunnel project is committed to creating an easy-to-extensible and easy-to-maintain intranet penetration framework.
- You can build your own penetration application by referencing the nuget package of FastTunnel.Cored, and target the business extension functions you need.
2020-04-23 23:04:00 +08:00
2020-05-20 20:59:56 +08:00
## What can FastTunel do
2020-09-29 23:24:37 +08:00
- [x] Remote intranet computer Windows/Linux/Mac
- [x] Use a custom domain name to access intranet web services (usually used for WeChat development)
- [x] Port forwarding/port mapping, access services provided by any port on the intranet mysql, redis, ftp, etc.
- [ ] p2p penetration
- [x] Support binding multiple domain names to access intranet services
- [x] Support domain name whitelist restriction
- [x] Support client identity verification
2019-12-16 15:22:20 +08:00
2020-05-20 22:24:40 +08:00
## Quickstart
2020-09-29 23:24:37 +08:00
1. Download the corresponding program on the [releases](https://github.com/SpringHgui/FastTunnel/releases) page
2. Modify the client and server configuration files according to your needs`appsettings.json`
3. Run FastTunnel.Server
4. Run FastTunnel.Cient
2020-04-09 14:10:34 +08:00
2020-05-20 21:02:04 +08:00
## Run on Linux/Mac os
2020-04-09 14:10:34 +08:00
#### Windows
2020-09-29 23:24:37 +08:00
Double click directly `FastTunnel.Client.exe` to run
2020-04-09 14:10:34 +08:00
#### Linux
2020-04-23 23:04:00 +08:00
`chmod +x FastTunnel.Client`
2020-07-21 16:29:11 +08:00
`./FastTunnel.Client`
2020-04-09 14:10:34 +08:00
#### Mac
2020-09-29 23:24:37 +08:00
click directly `FastTunnel.Client` to run
2019-12-16 15:22:20 +08:00
2020-09-29 23:24:37 +08:00
## Configuration example
### 1. Use a custom domain name to access intranet web services
- For example, you have a server with a public IP address of `110.110.110.110`, and you have a domain name with a top-level domain name of `abc.com`, you want to visit a website on the intranet by visiting `test.abc.com`
- You need to add a DNS resolution for the domain name address, the type is `A`, the name is `*`, and the ipv4 address is `110.110.110.110`, so that all domain names of `*.abc.com` will point to `110.110.110.110`s server, because the default http port of `FastTunnel` is 1270, so you need to visit`http://test.abc.com:1270`
- #### If you don't want to bring the port number every time you visit, you can use `nginx` forwarding.
2020-04-26 17:29:41 +08:00
```
http {
2020-09-29 23:24:37 +08:00
# add resolver
2020-04-26 17:29:41 +08:00
resolver 8.8.8.8;
2020-09-29 23:24:37 +08:00
# set *.abc.com to 1270 port
2020-04-26 17:29:41 +08:00
server {
server_name *.abc.com;
location / {
proxy_pass http://$host:1270;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
# 可选
error_log /var/log/nginx/error_ft.log error;
}
}
```
2020-09-29 23:24:37 +08:00
- If the domain name configured on the server is `ft.suidao.io`, then access the local site through the subdomain name `test.ft.suidao.io:1270`, the IIS configuration is as follows:
2020-02-28 12:07:27 +08:00
![img1](images/iis-web.png)
2019-12-16 15:22:20 +08:00
2020-09-29 23:24:37 +08:00
### 2. Remote intranet computer Windows/Linux/Mac
2019-12-21 14:28:15 +08:00
2020-09-29 23:24:37 +08:00
The client configuration is as follows, there are two hosts in the intranet, and the ip is as follows:
2019-12-29 18:56:10 +08:00
appsettings.json
2019-12-20 22:24:40 +08:00
```
"ClientSettings": {
"Common": {
"ServerAddr": "xxx.xxx.xxx.xxx",
"ServerPort": 1271
},
"SSH": [
{
2020-09-29 23:24:37 +08:00
"LocalIp": "192.168.0.100", // linux pc
"LocalPort": 22, // ssh default port
2019-12-20 22:24:40 +08:00
"RemotePort": 12701
},
{
2020-09-29 23:24:37 +08:00
"LocalIp": "192.168.0.101", // windows pc
"LocalPort": 3389, // windows default port for Remote
2019-12-20 22:24:40 +08:00
"RemotePort": 12702
}
]
}
```
2020-09-29 23:24:37 +08:00
#### remote intranet linux host by ssh (ip:192.168.0.100)
2019-12-21 14:28:15 +08:00
2020-09-29 23:24:37 +08:00
Assuming that the user name of the intranet host is root, the server ip is x.x.x.x, and the two hosts that access the intranet are as follows
2019-12-20 22:24:40 +08:00
```
ssh -oPort=12701 root@x.x.x.x
```
2020-09-29 23:24:37 +08:00
#### remote desktop Windows host by mstsc (ip:192.168.0.101)
#### Controlled terminal setting
- Open cmd and enter the command `sysdm.cpl` in the pop-up dialog box and select Allow remote connection to this computer
2019-12-21 14:50:33 +08:00
![img1](images/setallow.png)
2020-09-29 23:24:37 +08:00
#### Control terminal settings
- Open cmd and enter the command `mstsc`, open the remote dialog box, enter `x.x.x.x:12701` in the computer input box of the dialog box, and then specify the user name and password to remote the windows host of the intranet
2019-12-21 14:50:33 +08:00
![img1](images/remote.png)
2020-04-09 14:17:17 +08:00
2020-09-29 23:24:37 +08:00
## Development/PR
2020-08-02 11:50:12 +08:00
- install `vs2019`
2020-09-29 23:24:37 +08:00
- install `dotnetcore runtime&sdk 3.1` and higher
2020-08-02 12:20:45 +08:00
- add `test.test.cc 127.0.0.1` in host file
2020-08-02 11:50:12 +08:00
- run fasttunnel.server
- run fasttunnel.client
2019-12-16 15:22:20 +08:00
2020-04-23 23:15:20 +08:00
## License
2019-12-17 10:32:55 +08:00
Apache License 2.0