当前位置:网站首页>A complete detailed tutorial on building intranet penetration ngrok (with pictures and truth)
A complete detailed tutorial on building intranet penetration ngrok (with pictures and truth)
2022-08-03 17:09:00 【InfoQ】
准备工作(In fact, it is also a hard condition):
工具:
安装:
1.git安装
# 安装git
yum -y install zlib-devel openssl-devel perl hg cpio expat-devel gettext-devel curl curl-devel perl-ExtUtils-MakeMaker hg wget gcc gcc-c++
2.安装go

tar -zxvf go1.12.4.linux-amd64.tar.gz /usr/local/
# goThe command needs to do a soft link to/usr/bin
ln -s /usr/local/go/bin/* /usr/bin/
export GOROOT=/usr/local/go
export GOPATH=$HOME/go
export PATH=$PATH:$GOROOT/bin
source /etc/profile
go version

go env

3.安装ngrok
cd /usr/local/
//ngrok下载地址
git clone https://github.com/inconshreveable/ngrok.git

export GOPATH=/usr/local/ngrok/
#Write your own domain name here,不要前缀,比如www.abc.club 填写abc.club (域名已备案)
export NGROK_DOMAIN="abc.club"
4.生成ngrokcertificate and overwrite the original certificate
cd /usr/local/ngrok
openssl genrsa -out rootCA.key 2048
openssl req -x509 -new -nodes -key rootCA.key -subj "/CN=$NGROK_DOMAIN" -days 5000 -out rootCA.pem
openssl genrsa -out server.key 2048
openssl req -new -key server.key -subj "/CN=$NGROK_DOMAIN" -out server.csr
openssl x509 -req -in server.csr -CA rootCA.pem -CAkey rootCA.key -CAcreateserial -out server.crt -days 5000
cp rootCA.pem assets/client/tls/ngrokroot.crt
cp server.crt assets/server/tls/snakeoil.crt
cp server.key assets/server/tls/snakeoil.key
生成服务端
cd /usr/local/ngrok/
GOOS=linux GOARCH=amd64 make release-server

生成客户端
cd /usr/local/ngrok/
GOOS=windows GOARCH=amd64 make release-client

#Linux 平台 32 位系统:GOOS=linux GOARCH=386
#Linux 平台 64 位系统:GOOS=linux GOARCH=amd64
#Windows 平台 32 位系统:GOOS=windows GOARCH=386
#Windows 平台 64 位系统:GOOS=windows GOARCH=amd64
#MAC 平台 32 位系统:GOOS=darwin GOARCH=386
#MAC 平台 64 位系统:GOOS=darwin GOARCH=amd64
#ARM 平台:GOOS=linux GOARCH=arm
服务端的启动
./bin/ngrokd -tlsKey=server.key -tlsCrt=server.crt -domain="abc.club" -httpAddr=":80" -httpsAddr=":443" -tunnelAddr=":4443"
参数说明:
#-domain 访问ngrokIt is the set service address when generating the certificate
#-httpAddr http协议端口 默认为80
#-httpsAddr https协议端口 默认为443
#-tunnelAddr 通道端口 默认4443

Mapping settings for second-level domain names

客户端的启动
server_addr: "abc.club:4443"
trust_host_root_certs: false
ngrok -config=./ngrok.cfg -subdomain=test 8080
#参数说明
ngrok.cfg 刚才新建的文件
-subdomain=test test:The penetrated domain name prefix
8080 :Passthrough domain name mapping port


@echo OFF
color 0a
Title boom Ngrok启动工具
Mode con cols=109 lines=30
:START
set /p clientid= 请输入前缀:
echo.
set /p port= 请输入端口:
echo.
ngrok -config=ngrok.cfg -subdomain %clientid% %port%
PAUSE
goto TUNNEL
图形界面

将ngrok设置为系统服务 并且开机自启
vim /etc/rc.d/init.d/ngrok
#!/bin/bash
#chkconfig: - 99 01
#description:ngrok
case "$1" in
start)
echo "start ngrok service.."
cd /usr/local/ngrok/
setsid ./bin/ngrokd -tlsKey=server.key -tlsCrt=server.crt -domain="abc.club" -httpAddr=":80" -httpsAddr=":443" -tunnelAddr=":4443"
;;
*)
exit 1
;;
esac
###参数说明:
### cd /usr/local/ngrok/:进入ngrok目录
### setsid:Start without this The result closes the window Found that the service stopped Plus it's easy to use now
### setsid ./bin/ngrokd -tlsKey=server.key -tlsCrt=server.crt -domain="abc.club" -httpAddr=":80" -httpsAddr=":443" -tunnelAddr=":4443" :启动ngrok服务端命令
chmod 755 ngrok
chkconfig --add ngrok
chkconfig

service ngrok start
systemctl enable ngrok.service //加入开机启动
systemctl daemon-reload //重新加载配置文件
注意事项

边栏推荐
- C专家编程 第3章 分析C语言的声明 3.7 typedef struct foo{... foo;}的含义
- 关于oracle表空间在线碎片整理
- J9货币论:数字经济为全球经济复苏注入力量
- ICDAR比赛技术分享
- C专家编程 第2章 这不是Bug,而是语言特性 2.2 多做之过
- J9数字虚拟论:元宇宙的潜力:一股推动社会进步的力量
- 【技术白皮书】第一章:OCR智能文字识别新发展——深度学习的文本信息抽取
- B站回应HR称核心用户是Loser;微博回应宕机原因;Go 1.19 正式发布|极客头条
- security加密解密
- error:Illegal instruction (core dumped),离线下载安装这个other版本numpy
猜你喜欢

deepstresam的插件配置说明,通过配置osd,设置字体的背景为透明

JS 字符串转 GBK 编码超精简实现

组件通信-父传子组件通信

【技术白皮书】第一章:OCR智能文字识别新发展——深度学习的文本信息抽取

C专家编程 第3章 分析C语言的声明 3.7 typedef struct foo{... foo;}的含义

【目标检测】Focal Loss for Dense Object Detection

C专家编程 第1章 C:穿越时空的迷雾 1.9 阅读ANSI C标准,寻找乐趣和裨益

TiKV & TiFlash 加速复杂业务查询丨TiFlash 应用实践
![[Unity Starter Plan] Making RubyAdventure01 - Player Creation & Movement](/img/e9/9bba4f7ecee81ae7ce7e492b54ee11.png)
[Unity Starter Plan] Making RubyAdventure01 - Player Creation & Movement

基于DMS的数仓智能运维服务,知多少?
随机推荐
出海,是泡泡玛特的“解药”吗?
C专家编程 第1章 C:穿越时空的迷雾 1.6 它很棒,但它符合标准吗
面试突击:什么是粘包和半包?怎么解决?
401. Binary Watch
SwinIR实战:如何使用SwinIR和预训练模型实现图片的超分
附录A 程序员工作面试的秘密
Components of communication - the drop-down menu
通用型安全监测数据管理系统
设置海思芯片MMZ内存、OS内存详解
九种方法!教你如何读取resources目录下的文件路径
383. Ransom Note
LeetCode·72.编辑距离·动态规划
“LaMDA 存在种族歧视,谷歌的 AI 伦理不过是‘遮羞布’!”
数据万象内容审核 — 共建安全互联网,专项开展“清朗”直播整治行动
TiKV & TiFlash 加速复杂业务查询丨TiFlash 应用实践
LeetCode·899.有序队列·最小表示法
SwinIR实战:详细记录SwinIR的训练过程
node连接mongoose数据库流程
C专家编程 第3章 分析C语言的声明 3.7 typedef struct foo{... foo;}的含义
【AppCube】零代码小课堂开课啦