生成证书
NGROK_DOMAIN="qianrushi.org"
openssl genrsa -out base.key 2048
openssl req -new -x509 -nodes -key base.key -days 10000 -subj "/CN=$NGROK_DOMAIN" -out base.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 base.pem -CAkey base.key -CAcreateserial -days 10000 -out server.crt
cp base.pem assets/client/tls/ngrokroot.crt
cp server.crt /root/ngrok/assets/client/tls/snakeoilca.crt
sudo GOOS=linux GOARCH=arm make release-server release-client
sudo GOOS=linux GOARCH=amd64 make release-server release-client
服务端 supervisor脚本
[program:ngrok]
command=/usr/local/bin/ngrokd -tlsKey="/usr/local/ngrok/keys/server.key" -log-level=INFO -tlsCrt="/usr/local/ngrok/keys/server.crt" -domain="qianrushi.org" -httpAddr=":30001" -httpsAddr=""
autostart=true
autorestart=true
user=root
客户端 ngrok.yml
tCrtPaths: "/usr/local/ngrok/certs/ngrokroot.crt"
server_addr: "qianrushi.org:4443"
trust_host_root_certs: false
tunnels:
ssh:
remote_port: 60000
proto:
tcp: 22
web:
subdomain: "search"
proto:
http: localhost:80
客户端 supervisor 脚本
[program:ngrok]
command=/usr/local/bin/ngrok -config=/usr/local/ngrok/conf.d/ngrok.yml start ssh
autostart=true
autorestart=true
user=root