역방향 에이전트 소프트웨어ngrok
4135 단어 역방향 에이전트 소프트웨어ngrok[운영 개시]
2. go 환경 구축
yum install go
3. 설치git 환경yum install git
4. ngrok 원본 얻기 원본 얻기: git clone https://github.com/inconshreveable/ngrok.git
5. 컴파일cd
cd ngrok
export NGROK_DOMAIN="ngrok.xfs.com.cn"
2). 자체 서명 ssl 인증서 생성
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 device.key 2048
openssl req -new -key device.key -subj "/CN=$NGROK_DOMAIN" -out device.csr
openssl x509 -req -in device.csr -CA rootCA.pem -CAkey rootCA.key -CAcreateserial -out device.crt -days 5000
3). 인증서 교체
\cp rootCA.pem assets/client/tls/ngrokroot.crt
\cp device.crt assets/server/tls/snakeoil.crt
\cp device.key assets/server/tls/snakeoil.key
4).변수 설정:
GOOS=linux GOARCH=amd64
32비트 시스템, GOARCH=3865).서버와 클라이언트make release-server release-client
를 컴파일한 후,ngrok 원본 코드의bin 디렉터리에 실행 가능한 두 개의 파일을 생성합니다:ngrokd,ngrok.그 중에서ngrokd는ngrok의 서버 프로그램이고,ngrok는ngrok의 클라이언트 프로그램이다.6. ngrokd 서비스 시작 및 사용 1).ngrokd 서버 임시 시작을 시작합니다.cd ngrok
bin/ngrokd -domain="ngrok.xfs.com.cn" -httpAddr=":80"
확인:
Usage of ./ngrokd:
-domain string
Domain where the tunnels are hosted (default "ngrok.com")
-httpAddr string
Public address for HTTP connections, empty string to disable (default ":80")
-httpsAddr string
Public address listening for HTTPS connections, emptry string to disable (default ":443")
-log string
Write log messages to this file. 'stdout' and 'none' have special meanings (default "stdout")
-log-level string
The level of messages to log. One of: DEBUG, INFO, WARNING, ERROR (default "DEBUG")
-tlsCrt string
Path to a TLS certificate file
-tlsKey string
Path to a TLS key file
-tunnelAddr string
Public address listening for ngrok client (default ":4443")
2). ngrokd
ngrok.cfg
server_addr: "ngrok.xfs.com:4443"
trust_host_root_certs: false
클라이언트 확인:
Options:
-authtoken string
Authentication token for identifying an ngrok.com account
-config string
Path to ngrok configuration file. (default: $HOME/.ngrok)
-hostname string
Request a custom hostname from the ngrok server. (HTTP only) (requires CNAME of your DNS)
-httpauth string
username:password HTTP basic auth creds protecting the public tunnel endpoint
-log string
Write log messages to this file. 'stdout' and 'none' have special meanings (default "none")
-log-level string
The level of messages to log. One of: DEBUG, INFO, WARNING, ERROR (default "DEBUG")
-proto string
The protocol of the traffic over the tunnel {'http', 'https', 'tcp'} (default: 'http+https') (default "http+https")
-subdomain string
Request a custom subdomain from the ngrok server. (HTTP only)
Examples:
ngrok 80
ngrok -subdomain=example 8080
ngrok -proto=tcp 22
ngrok -hostname="example.com" -httpauth="user:password" 10.0.0.1
Advanced usage: ngrok [OPTIONS] [command args] [...]
Commands:
ngrok start [tunnel] [...] Start tunnels by name from config file
ngork start-all Start all tunnels defined in config file
ngrok list List tunnel names from config file
ngrok help Print help
ngrok version Print ngrok version
Examples:
ngrok start www api blog pubsub
ngrok -log=stdout -config=ngrok.yml start ssh
ngrok start-all
ngrok version
클라이언트 프로필:
server_addr: "ngrok.xfs.com.cn:4443"
tunnels:
mstsc:
remote_port: 1494
proto:
tcp: ":1494"
web:
subdomain: citirx
proto:
http: ":8172"
윈도우즈 일괄 처리
cd %cd%
ngrok start mstsc citrix