跳至主要內容

frps 修改404配置信息

Change Lee...大约 1 分钟frpfrp

frp 默认开启 http/https 后,有404,或者默认页面,这也就让别人知道我们是通过 frp 来实现,这个时候如果 frp 存在漏洞则有可以被别人利用
修改 404 有两种,第一种:

修改404 配置信息,修改源码

源码文件在
frp 文件目录 pkg/util/vhost/resource.go
代码段是:

import (
	"bytes"
	"io"
	"net/http"
	"os"

	frpLog "github.com/fatedier/frp/pkg/util/log"
	"github.com/fatedier/frp/pkg/util/version"
)

var (
	NotFoundPagePath = ""
)

const (
	NotFound = `<!DOCTYPE html>
<html>
<head>
<title>Not Found</title>
<style>
    body {
        width: 35em;
        margin: 0 auto;
        font-family: Tahoma, Verdana, Arial, sans-serif;
    }
</style>
</head>
<body>
<h1>The page you requested was not found.</h1>
<p>Sorry, the page you are looking for is currently unavailable.<br/>
Please try again later.</p>
<p>The server is powered by <a href="https://github.com/fatedier/frp">frp</a>.</p>
<p><em>Faithfully yours, frp.</em></p>
</body>
</html>
`
)

var 的值,应该是可以通过配置文件中 custom_404_page 来重启定义,所以可以不修改,只修改 const 中的内容修改的和 frp 无关即可。此方法需要每次都编译二进制。

修改配置文件方式

使用配置文件,添加

custom_404_page = /etc/frp/404.html

404.html 内容如下:

<html>
<head>
<meta http-equiv="Content-Language" content="zh-CN">
<meta HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=gb2312">
<meta http-equiv="refresh" content="0.1;url=https://blogs.shuobude.top">
<title></title>
</head>
<body>
</body>
</html>
上次编辑于:
贡献者: lichangyangccm@163.com
评论
  • 按正序
  • 按倒序
  • 按热度
Powered by Waline v3.1.3