[Private cloud] Windows IIS builds webdav service to realize public network file sharing "intranet penetration"

foreword

There are three commonly used file sharing: FTP, Samba, and WebDAV. Although FTP is simple, convenient and easy to deploy, it has low transmission efficiency and poor security, so it is not recommended to use at present. SMB uses port 445. For security reasons, port 445 may be blocked, so the application of SMB in the intranet will be limited.

WebDAV is an HTTP-based sharing protocol, users can use user names and passwords to access storage resources, and multiple users can share files. Moreover, on Windows, we can enable and build webdav through the IIS service that comes with the system, and do intranet penetration, realize file sharing under the public network, and build private cloud services.

This article uses WIN10 Professional Edition.
insert image description here

video tutorial

https://www.bilibili.com/video/BV15G4y1S7Ud/?spm_id_from=333.999.0.0

1. Install the necessary WebDav components for IIS

1.1 Open the control panel, change the view mode to 类别enter——程序启用或关闭Windows功能

20221117175936

IIS管理控制台1.2 Check , Windows身份验证, 管理服务, WebDAV发布and in Internet Information Services (IIS) 目录浏览, and then confirm the installation.

20230206140351

1.3 After the installation is complete, find and open it in "Windows Administrative Tools" IIS管理器.

20221117175949

1.4 On the website, right click添加网站

20221117175954

1.5 Give the network a name, and choose a physical path. Here, I named it webdav, path selection: D:\WebDav (choose the file path you want to share), port number, we set it to 8090

20221117180000

1.6 Select the webdav site and enter itsWebDAV创作规则

20221117180007

1.7 Enabling authoring rules

20221117180012

1.8 Add creation rules

20221117180018

20221117180023

1.9 Select the webdav site and enter身份认证

20221117180028

1.10 enable 基本身份验证, disable Windows身份验证,匿名身份验证

20230206140528

1.11 Select "webdav" and enter目录浏览

20221117180040

1.12 click启用

20221117180046

1.13 Restart the webdav site

20221117180051

2. LAN browser access test

In the browser, enter http://127.0.0.1:8090/ to access the file content in the WebDav service.

20230403131542

Enter the Windows account password to log in

20230403131613

3. cpolar intranet penetration

After the test is successfully accessed in the LAN, then use cpolar to penetrate the internal network and publish it to the public network, so that you can also access the webdav service of your home/company outside the home and share files without public network IP or Set up your router.

3.1 Install cpolar intranet penetration

cpolar official website: https://www.cpolar.com/

Register an account on the cpolar official website, and download and install the windows version of the client

20230403132314

3.2 Log in to the cpolar web UI management interface

After the cpolar intranet penetration installation is completed, open the browser to access 127.0.0.1:9200, and log in with the cpolar email account.

20221117180109

3.2 Create a tunnel

After logging in to the cpolar web UI management interface, click Tunnel Management on the left - Create Tunnel, let's create a tunnel to map the local webdav service to the public network.

20221117180114

  • 隧道名称: Can be customized, be careful not to duplicate the existing tunnel name
  • 协议: select tcp protocol
  • 本地地址:8090
  • 端口类型: First select a random ephemeral port by default
  • 地区: Select by default or other regions of China can also be selected

click创建

20221117180119

3.3 Get the public network address

After the tunnel is successfully created, click on the status on the left - online tunnel list, we can see that a TCP random tunnel has been generated, copy it, and then test the remote access to the public network.

20221117180125

4. Public network remote access

4.1 Browser access test

We paste the tunnel address in the browser, because it is accessed from the external network, the account and password will be prompted for authentication. We use the windows account and password to log in.

20221117180132

4.2 Mapping local drive letter access

Before the application, we need to modify the registry first. We need to modify the registry to make WIN10 support both http and https, otherwise the WebDAV network drive cannot be mapped. Because if WebDAV is not https, win10 cannot add it by default, and only supports https by default.

Click the start menu bar in the lower left corner, right click and run

1675667778844

Enter regedit, click OK to open the Registry Editor

20230206151715

Path: Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WebClient\Parameters

20230206151833

After finding BasicAuthLevelit, right-click to modify, change the value data to 2, and click OK. After the modification is successful,重启电脑

20230206151928

Open the folder, click This Computer, click Computer at the top - Map Network Drive

20230206142254

Enter the public network address just generated by mapping the local port 8090 through cpolar. Note that it needs to be http://filled in the format

20230206152708

connecting

20230206152725

Fill in the windows account password to connect

20230206152749

The connection is successful and the resource can be directly accessed

20230206153331

4.3 Install Raidrive client

Of course, we can also use the WebDav client to set the local drive letter of the remote server virtual machine [no need to modify the registry data]. Here we use the Raidrive public account to achieve.

Raidrive client download address: https://www.raidrive.com/download

After successfully installing Raidrive, connect to the WebDav server

20221117180139

connection succeeded

20221117180146

5. Configure a fixed public network address

The current test uses a link created by a random TCP tunnel, and the generated public network address will change within 24 hours. If it needs to be used for a long time, we can configure it as a fixed public network TCP address and increase the bandwidth at the same time.

5.1 Reserve a fixed TCP port address

Configure to reserve a fixed TCP port address, you need to upgrade the cpolar package to the professional version or above to support [login cpolar官网后台- package ]

Log in to the background of the cpolar official website, click on the left 预留, let's reserve a fixed TCP port address for webdav

  • Region: Choose China or China VIP
  • Description: Remarks, which can be customized

click保留

20221129165119

After the address is reserved successfully, the system will return a fixed TCP port address and copy it down

20230206154457

5.2 Configure fixed TCP port address

Log in to the cpolar web ui management interface http://localhost:9200/隧道管理 , click —— on the left 隧道列表, find the wwebdav tunnel, and click on the right编辑

20221129165240

Modify tunnel information:

  • Port Type: Select固定TCP端口
  • Reserved TCP address: fill in the fixed TCP port address that was successfully reserved just now

click更新

20230206154609

状态After the tunnel is successfully updated, click -- on the left dashboard 在线隧道列表, and you can see that the public network address has changed to a fixed public network TCP port address.

20230206154651

6. Use a fixed public network TCP port address for remote connection

6.1 Browser access

Access the fixed public network TCP port address on the browser, and the test is normal.

20230206154757

6.2 Map local drive letter

Use a fixed public network tcp port address to connect

20230206154938

connection succeeded

20230206155115

6.3 Access via RaiDrive client

Open RaiDrive, modify the link of the previous virtual drive letter, change it to the public network TCP port address we configured successfully, and click connect.

20221201151244

book recommendation

insert image description here

[Introduction]
 Git is a tool that makes people feel easy to learn at first, but difficult to master. In addition to introducing the relevant knowledge of Git, this book also simulates various common situations to let readers know when to use which commands.
  "Git from Getting Started to Mastering" is divided into 11 chapters. Chapters 1~3 introduce the installation tools and environment. Readers who have already installed Git can start reading directly from Chapter 4. Chapter 5 introduces the basic usage of Git. Although it is not difficult, it is the basis of the entire Git system. Chapter 6 introduces the commonly used branch functions and usage scenarios in Git, and Chapters 7-9 introduce how to modify existing history records, use labels, and how to deal with other common situations.
  The previous content can be completed on your own computer, starting from Chapter 10 to introduce how to push a copy of the records in your computer to online (GitHub). *The last chapter (Chapter 11) introduces Git Flow, a development process that teams may use when developing.
  Most of the reference books or online tutorials on the market teach you how to learn Git through terminal commands, which discourages many novices who want to learn Git. In addition to teaching you how to input Git commands in the terminal window, this book is also equipped with a graphical interface tool, which eases the learning curve for readers and makes it easier for readers to get started.

Leave a message in the comment area: Life is short, I use cpolar to draw two lucky viewers.

Jingdong self-operated purchase link: click to jump

Guess you like

Origin blog.csdn.net/qq_53847859/article/details/129982070