From c15cfb756cfd614e00a1635aff8d7446b90abbe8 Mon Sep 17 00:00:00 2001 From: Shuanglei Tao Date: Sun, 9 Feb 2020 16:33:17 +0800 Subject: [PATCH] Bump to 1.6.0 --- CMakeLists.txt | 2 +- README.md | 2 +- man/ttyd.1 | 26 ++++++++++++++++++++++++-- man/ttyd.man.md | 22 +++++++++++++++++++--- 4 files changed, 45 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a99f4db..8061f47 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 2.8) project(ttyd) -set(PROJECT_VERSION "1.5.2") +set(PROJECT_VERSION "1.6.0") find_package(Git) if(GIT_FOUND) diff --git a/README.md b/README.md index 832b241..e7f6a64 100644 --- a/README.md +++ b/README.md @@ -71,7 +71,7 @@ USAGE: ttyd [options] [] VERSION: - 1.5.2 + 1.6.0 OPTIONS: -p, --port Port to listen (default: 7681, use `0` for random port) diff --git a/man/ttyd.1 b/man/ttyd.1 index 9157166..a772d50 100644 --- a/man/ttyd.1 +++ b/man/ttyd.1 @@ -14,7 +14,7 @@ ttyd \- Share your terminal over the web .PP ttyd is a command\-line tool for sharing terminal over the web that runs in *nix and windows systems, with the following features: .IP \(bu 2 -Built on top of Libwebsockets with C for speed +Built on top of Libwebsockets with libuv for speed .IP \(bu 2 Fully\-featured terminal based on Xterm.js with CJK (Chinese, Japanese, Korean) and IME support .IP \(bu 2 @@ -162,7 +162,7 @@ openssl req \-new \-x509 \-days 365 \-key ca.key \-subj "/C=CN/ST=GD/L=SZ/O=Acme # server certificate (for multiple domains, change subjectAltName to: DNS:example.com,DNS:www.example.com) openssl req \-newkey rsa:2048 \-nodes \-keyout server.key \-subj "/C=CN/ST=GD/L=SZ/O=Acme, Inc./CN=localhost" \-out server.csr -openssl x509 \-req \-extfile <(printf "subjectAltName=DNS:localhost") \-days 365 \-in server.csr \-CA ca.crt \-CAkey ca.key \-CAcreateserial \-out server.crt +openssl x509 \-sha256 \-req \-extfile <(printf "subjectAltName=DNS:localhost") \-days 365 \-in server.csr \-CA ca.crt \-CAkey ca.key \-CAcreateserial \-out server.crt # client certificate (the p12/pem format may be useful for some clients) openssl req \-newkey rsa:2048 \-nodes \-keyout client.key \-subj "/C=CN/ST=GD/L=SZ/O=Acme, Inc./CN=client" \-out client.csr @@ -210,6 +210,28 @@ Sharing single docker container with multiple clients: docker run \-it \-\-rm \- Creating new docker container for each client: ttyd docker run \-it \-\-rm ubuntu. +.SH Nginx reverse proxy +.PP +Sample config to proxy ttyd under the \fB\fC/ttyd\fR path: + +.PP +.RS + +.nf +location \~ ^/ttyd(.*)$ { + proxy\_http\_version 1.1; + proxy\_set\_header Host $host; + proxy\_set\_header X\-Forwarded\-Proto $scheme; + proxy\_set\_header X\-Forwarded\-For $proxy\_add\_x\_forwarded\_for; + proxy\_set\_header Upgrade $http\_upgrade; + proxy\_set\_header Connection "upgrade"; + proxy\_pass http://127.0.0.1:7681/$1; +} + +.fi +.RE + + .SH AUTHOR .PP Shuanglei Tao Visit diff --git a/man/ttyd.man.md b/man/ttyd.man.md index 2ea3311..7d7ed29 100644 --- a/man/ttyd.man.md +++ b/man/ttyd.man.md @@ -10,7 +10,7 @@ ttyd 1 "September 2016" ttyd "User Manual" # Description ttyd is a command-line tool for sharing terminal over the web that runs in *nix and windows systems, with the following features: - - Built on top of Libwebsockets with C for speed + - Built on top of Libwebsockets with libuv for speed - Fully-featured terminal based on Xterm.js with CJK (Chinese, Japanese, Korean) and IME support - Graphical ZMODEM integration with lrzsz support - SSL support based on OpenSSL @@ -111,7 +111,7 @@ openssl req -new -x509 -days 365 -key ca.key -subj "/C=CN/ST=GD/L=SZ/O=Acme, Inc # server certificate (for multiple domains, change subjectAltName to: DNS:example.com,DNS:www.example.com) openssl req -newkey rsa:2048 -nodes -keyout server.key -subj "/C=CN/ST=GD/L=SZ/O=Acme, Inc./CN=localhost" -out server.csr -openssl x509 -req -extfile <(printf "subjectAltName=DNS:localhost") -days 365 -in server.csr -CA ca.crt -CAkey ca.key -CAcreateserial -out server.crt +openssl x509 -sha256 -req -extfile <(printf "subjectAltName=DNS:localhost") -days 365 -in server.csr -CA ca.crt -CAkey ca.key -CAcreateserial -out server.crt # client certificate (the p12/pem format may be useful for some clients) openssl req -newkey rsa:2048 -nodes -keyout client.key -subj "/C=CN/ST=GD/L=SZ/O=Acme, Inc./CN=client" -out client.csr @@ -140,5 +140,21 @@ curl --insecure --cert client.p12[:password] -v https://localhost:7681 - Sharing single docker container with multiple clients: docker run -it --rm -p 7681:7681 tsl0922/ttyd. - Creating new docker container for each client: ttyd docker run -it --rm ubuntu. +# Nginx reverse proxy + +Sample config to proxy ttyd under the `/ttyd` path: + +```nginx +location ~ ^/ttyd(.*)$ { + proxy_http_version 1.1; + proxy_set_header Host $host; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + proxy_pass http://127.0.0.1:7681/$1; +} +``` + # AUTHOR - Shuanglei Tao \ Visit https://github.com/tsl0922/ttyd to get more information and report bugs. \ No newline at end of file + Shuanglei Tao \ Visit https://github.com/tsl0922/ttyd to get more information and report bugs. -- 2.43.4