sorenisanerd / gotty Goto Github PK
View Code? Open in Web Editor NEWShare your terminal as a web application
License: MIT License
Share your terminal as a web application
License: MIT License
Thanks for your helpdul project
Can we bind gotty to 2 interfaces? I dont want to bind it to 0.0.0.0 so vpn users can conect to it and I must manage firewall and etc. Can you change listen address from text to comma seprated list to bind to multiple interfaces?
gotty --version
)?1.5.0
NixOS (server, no gui), Mobile Chrome, Mobile Firefox
Selection on mobile browsers does not work on Firefox or Chrome. I'm trying to understand if this is a limitation with xterm.js or gotty. Anyone else noticed this behavior?
I wish gotty-windows. can you make it?
v1 works fine, but I prefer keeping up-to-date to avoid a more painful migration later if v1 (or, yikes, v2) become unsupported.
Please answer these quesions for a bug report. Thanks!
gotty --version
)?gotty version v1.3.0
If possible, please provide the command you ran.
If possible, please provide the output of the command and your browser's console output.
Please provide an actual usecase that requires your new feature.
See
(default = true)
Line 34 in aa86a34
and
(default = false)
Line 75 in aa86a34
gotty --help
also shows:
--enable-webgl Enable WebGL renderer (default: false) [$GOTTY_ENABLE_WEBGL]
Suggestion: either set it to false in options.go
(when it's hard to fix #15) or set it to true in README.md
(when it's easy to fix #15). Not sure how to fix the --help
prompt.
Please answer these quesions for a bug report. Thanks!
gotty --version
)?latest verision, build myself.
linux
[root@docker-desktop ~]# /usr/bin/gotty --port 9090 --address 0.0.0.0 --permit-write true --permit-arguments true ssh
2022/11/03 03:48:01 GoTTY is starting with command: true --permit-arguments true ssh
2022/11/03 03:48:01 Permitting clients to write input to the PTY.
2022/11/03 03:48:01 HTTP server is listening at: http://[::]:9090/
2022/11/03 03:48:01 Alternative URL: http://127.0.0.1:9090/
2022/11/03 03:48:01 Alternative URL: http://[::1]:9090/
2022/11/03 03:48:01 Alternative URL: http://192.168.65.3:9090/
2022/11/03 03:48:01 Alternative URL: http://[fe80::50:ff:fe00:1]:9090/
[root@docker-desktop ~]# /usr/bin/gotty --port 9090 --address 0.0.0.0 --permit-arguments true --permit-write true ssh
2022/11/03 03:48:53 GoTTY is starting with command: true --permit-write true ssh
2022/11/03 03:48:53 HTTP server is listening at: http://[::]:9090/
2022/11/03 03:48:53 Alternative URL: http://127.0.0.1:9090/
2022/11/03 03:48:53 Alternative URL: http://[::1]:9090/
2022/11/03 03:48:53 Alternative URL: http://192.168.65.3:9090/
2022/11/03 03:48:53 Alternative URL: http://[fe80::50:ff:fe00:1]:9090/
all command should output:
2022/11/03 03:48:01 Permitting clients to write input to the PTY.
The second command not enable permit-write
.
Could we use cobra as out cli library? It's more easy process command flages.
Please answer these quesions for a bug report. Thanks!
gotty --version
)?v1.3.0
Alpine Linux 3.13.5
I want to run gotty in alpine Linux, but failed.
If possible, please provide the command you ran.
./gotty -w bash
gotty run well in alpine Linux.
If possible, please provide the output of the command and your browser's console output.
./gotty: not found
Please provide an actual usecase that requires your new feature.
gotty --version
)?1.3.0
macOS 11.3 on Apple Silicon
Safari 14.1
Just run gotty with any command. Safari does not show any characters, just the background color.
Normal font rendering
Running GOTTY_ENABLE_WEBGL=0 gotty top
fixes the issue.
It seems that WebGL is enabled by default despite the documentation says WebGL is disabled by default. I am opening second issue for this - #16
gotty --version
)?gotty version v1.4.0
Ubuntu 20.04.3 LTS chrome latest
run nethogs
gotty -p 1234 sudo nethogs br0
same results as in terminal
different IP address listed on top with same bandwidth usage, which is misleading
when run gotty in alpine docker container, got the error:
./bin/gotty
sh: ./bin/gotty: not found
gotty --version
)?1.4.0
docker run -it --entrypoint sh --rm alpine:3.11
in some minimal docker image like alpine/ busybox, c lib may not installed.
hello,
excuse me if this is not the right place but I have two questions:
currently my docker entrypoint is
#!/bin/bash
PARAMS="--permit-write"
gotty $PARAMS /bin/bash
and builder
FROM golang:1.16-alpine as builder
RUN apk add --update --no-cache git
RUN go get github.com/sorenisanerd/gotty
thanks
update: I installed lrzsz on alpine, which provides these files https://pkgs.alpinelinux.org/contents?branch=edge&name=lrzsz&arch=x86&repo=testing
I tried some lsz test.txt
but I see no file dialog, in the remote web terminal:
bash-5.1# cat test.txt
wwww
bash-5.1# lsz test.txt
�*B00000000000000
and the terminal blocks
update 2:
I updated my dockerfile to ensure master version is correctly used:
FROM golang:1.18-alpine as builder
RUN apk add --update --no-cache git
RUN go install github.com/sorenisanerd/gotty@master
and file download works, nice job :)
You can create a patch from my fork here. You didn't fork from yudai/gotty so I can't send a PR with the changes.
Not a bug report, just wanted to share this code change without creating a pull request as this is potentially unsafe change to add to the code base.
master...George-NG:process-http-headers
(the specific branch is https://github.com/George-NG/gotty/tree/process-http-headers )
This would pass headers from the browser and any proxy servers (ie nginx) to the backend application in the form of env vars prefixed with HTTP_
.
I am using this for a non-publicly accessible project, where we need some headers to be sent to the backend. I have not checked about security implications at all and there is possibly a better way to do this, ie not at the time of creating the websocket and for each and every request. Since currently there is no option in the project (or I couldn't find one!) to pass headers to the backend, I thought I might share this anyway for anyone who might need something similar.
Any feedback is appreciated, as I am going to use this for the foreseeable future and don't want to leave an obvious wide open security gap in place 😅
For anyone who thinks of using this at its current state, be very careful about what you are processing and sanitize input as much as possible via a proxy in front of gotty.
It seems there was a xterm.js release 3 weeks ago - https://github.com/xtermjs/xterm.js/releases/tag/4.12.0
Currently gotty uses 4.11.0
I have a golang service that proxies to gotty. It provides authentication via an ephemeral token in a query parameter as described here. The service doesn't use HTTPS cookies for authentication, and using the built-in basic auth support for authenticating via credentials would be extra overhead due to already being logged into the system.
In the ideal case, I could specify a custom set of query string parameters - perhaps via some sort of config.js
var gotty_query_string
like here - that could be included in the query here and then added here to the open of each websocket. This would provide allow my proxy service the ability to handle authentication as is without needing to implement workarounds.
Would you be willing to accept a PR that implemented this?
gotty --version
)?1.4.0
Ubuntu 22.04, Chrome
If possible, please provide the command you ran.
./gotty -p 7681 --quiet bash
No log output
root@f33e40d1f76c:/# ./gotty -p 7681 --quiet bash
2022/08/11 01:31:33 GoTTY is starting with command: bash
2022/08/11 01:31:33 HTTP server is listening at: http://[::]:7681/
2022/08/11 01:31:33 Alternative URL: http://127.0.0.1:7681/
2022/08/11 01:31:33 Alternative URL: http://172.17.0.4:7681/
2022/08/11 01:32:03 172.17.0.1:57258 200 GET /
2022/08/11 01:32:03 172.17.0.1:57258 200 GET /css/index.css
2022/08/11 01:32:03 172.17.0.1:57262 200 GET /css/xterm_customize.css
2022/08/11 01:32:03 172.17.0.1:57264 200 GET /auth_token.js
2022/08/11 01:32:03 172.17.0.1:57268 200 GET /config.js
2022/08/11 01:32:03 172.17.0.1:57260 200 GET /css/xterm.css
2022/08/11 01:32:03 172.17.0.1:57258 200 GET /js/gotty.js
2022/08/11 01:32:03 New client connected: 172.17.0.1:57270, connections: 1/0
2022/08/11 01:32:03 172.17.0.1:57258 200 GET /manifest.json
2022/08/11 01:32:03 172.17.0.1:57260 200 GET /icon.svg
2022/08/11 01:32:03 172.17.0.1:57258 200 GET /icon_192.png
2022/08/11 01:32:03 172.17.0.1:57258 200 GET /favicon.ico
(...etc)
gotty --version
)?1.4.0
Ubuntu 22.04, Chrome
If possible, please provide the command you ran.
./gotty -p 7681 -w bash
Action | Expected Behavior |
---|---|
rz , cancel upload (close modal) |
rz exits and terminal prompt advances |
sz <filename> , click Accept |
File is transferred to browser, terminal prompt advances |
sz <filename> , click Decline |
sz exits and terminal prompt advances |
sz <filename> , close modal |
sz exits and terminal prompt advances |
If possible, please provide the output of the command and your browser's console output.
Action | Observed Behavior |
---|---|
rz , cancel upload (close modal) |
Prompt is stuck on rz waiting to receive.**B0100000023be50 |
sz <filename> , click Accept |
File is transferred to browser, terminal prompt is stuck on **B00000000000000 , JavaScript console reports errors: Uncaught PROTOCOL: Only thing after ZFIN should be “OO” (79,79), not: ... at zsession.js:563 |
sz <filename> , click Decline |
Modal displays "Skipping..." until manually closed, JavaScript console reports errors: Uncaught PROTOCOL: Only thing after ZFIN should be “OO” (79,79), not: ... , sz: skipped: <filename> is written to terminal but prompt is stuck |
sz <filename> , close modal |
Prompt is stuck on **B00000000000000 until it eventually times out |
Please answer these quesions for a bug report. Thanks!
gotty --version
)?gotty version v1.3.0
MAC OS
chrome
./gotty --path /t df -h
Please provide an actual usecase that requires your new feature.
$ go test github.com/sorenisanerd/gotty/webtty
# github.com/sorenisanerd/gotty/webtty [github.com/sorenisanerd/gotty/webtty.test]
webtty/webtty_test.go:25:16: not enough arguments in call to New
have (pipePair)
want (Master, Slave, ...Option)
webtty/webtty_test.go:42:14: dt.TTY undefined (type *WebTTY has no field or method TTY)
webtty/webtty_test.go:80:16: not enough arguments in call to New
have (pipePair)
want (Master, Slave, ...Option)
webtty/webtty_test.go:112:13: dt.TTY undefined (type *WebTTY has no field or method TTY)
FAIL github.com/sorenisanerd/gotty/webtty [build failed]
FAIL
What do I get from this version over the original version?
P.s. Although the license doesn't require you to, you should still credit http://github.com/yudai/gotty since this repo isn't a linked fork
Hi all, and thanks to the author for this wonderful project,
I wanted to used Gotty for a personal project with a basic authentication for multiple users. I found another project were this functionnality was added : https://github.com/KubeOperator/webkubectl. In this project the Gotty original code was updated to support a credential file for basic authentication for multiple users. As the project also changes many others things in the Gotty original project, i have moved only the changes concerning the multiple users authentication in another repository. I also added a DockerFile and a Helm Chart to deploy it in a containerized environment. You can see those changes in this repository : https://github.com/stevelaclasse/gotty-multi-users-Docker.
I hope it may help someone.
(This was originaly posted in the original GitHub gotty repository : yudai/gotty#342)
Pasting large blobs (1kB or thereabouts) causes the input to be truncated
For example, using a cli music player
gotty --version
)?gotty version v1.4.0
macOS Monterey 12.5
Google Chrome (Desktop) Version 103.0.5060.134 (Official Build) (x86_64)
Safari (Desktop) Version 15.6 (17613.3.9.1.5)
Safari (iPadOS 15.5)
I run spacemacs via gotty with
gotty --port 11111 --permit-write --reconnect emacsclient --tty -a ""
when I go to localhost:11111
I can successfully use emacs.
Since when I press the "option" key I want instead to send a "meta" key, I have tried using this config (and restarting gotty)
preferences {
alt_is_meta = true
}
or this config
preferences {
alt_is_meta = true
alt_is_what = "browser-key"
}
but nothing changes.
I would expect the meta key to be sent. For example, if I press for instance Option-x
, I expect emacs in the browser to recognize M-x
.
I get the option key instead. In the example above, if I press Option-x
I get the character ≈
. So I can't use most of the emacs keybinding. As a workaround I can use spacemacs and switch to evil-mode, but I would like to use the default emacs keybindings.
I'd like to be able to set the tab favicon to a custom .png
/.ico
in the .gotty
config file. You can already set the tab title, so setting the tag icon/favicon seems reasonable too. I can set it manually by using a custom index.html
, but I'd prefer to be able to do it directly from the .gotty
config file. I'd like to be able to do something like this:
favicon = "/my_favicon.png"
Can this be implemented, or, alternatively, would anyone mind if I sent a PR? I'd be willing to add this myself.
Rebuilding assets is easy enough, but it would be really handy to be able to directly manipulate the browser side of things (html, css, js/ts) without that step. An environment variable could tell gotty to ignore compiled assets and use the file system instead.
Opening gotty's URL in browser tab works fine. And it even exposes my terminal output.
But embedding Gotty URL in an HTML iframe throws CORS error. Presumably same-origin
policy error.
Is there a way to allow CORS headers in gotty?
Gotty Versions: v1.5.0.
Due to #16 , --permit-arguments has been enabled by default up until now. This is a security problem (defaults should be safe).
Use case: Suppose I want to launch a GUI from the tty I'm connected to. There are excellent SPiCE clients (e.g. https://github.com/eyeos/spice-web-client) that we can use.
We need a few things to make this work well:
This may or may not be a security concern. Let's look at three scenarios:
If we only had to worry about scenarios 1 and 2, we could simply use the "-w" flag to decide whether to allow this websockify mechanism. Because of scenario 3, it needs to be a separate flag. It should restrict the access to specific hosts/ports.
While dependabot can sometimes be a bit noisy, it forces you to consider upgrading dependencies as they update upstream, ensuring you never get into a state where upgrading is a pain because its not just one dependency.
Here is the one for the Dokku project, which has a variety of examples for usage. I'd be happy to PR a config for you if you think this would be a good idea.
Hello Soren.
Got issue compiling with several last node vesions:
cd js && \
npm install
added 249 packages, and audited 250 packages in 3s
30 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
cd js && \
npx webpack --mode=production
webpack --mode=production: --: not found
make: *** [Makefile:45: bindata/static/js/gotty.js.map] Error 127
With lower node v187.0 compilation passed allright.
Which side is erroneus?
Hello Soren.
Thanks for your work. Please point to ways on subject. It looks like those are being hardcoded at build time (when performing npx install dependencies, xterm.js, creating gotty.js) and does not apply settings from the config file at run time like font_size/font_family/color_palette_overrides as in originator's (yudai) version.
Thank You.
I don't like the default font in the terminal. I'd prefer to be able to set my own. I set the following to be my custom index.html
file:
<!doctype html>
<html>
<head>
<title>{{ .title }}</title>
<link rel="manifest" href="manifest.json">
<link rel="icon" href="favicon.ico">
<link rel="icon" href="icon.svg" type="image/svg+xml">
<link rel="stylesheet" href="./css/index.css" />
<link rel="stylesheet" href="./css/xterm.css" />
<link rel="stylesheet" href="./css/xterm_customize.css" />
<style>
canvas, div {
font-family: 'Comic Sans MS', 'Comic Sans', sans-serif !important;
color: red;
}
</style>
</head>
<body>
<div id="terminal"></div>
<script src="./auth_token.js"></script>
<script src="./config.js"></script>
<script src="./js/gotty.js"></script>
</body>
</html>
But that didn't set the font of the terminal. So, by modifying the HTML, what is the correct/working way to change the font used in the terminal.
Although, when I do that, it does set the font of the dimensions that appear for a second when I open it to be in Comic Sans. However, I'm looking to change the font of the terminal.
EDIT 1:
I tried setting the config file to the following:
title_format = "DEMO DEMO"
preferences {
font_size = 64
}
The title gets set, so I'm using the config fine, but I can't set the font size (or the font itself, either). Any ideas?
possible to add Linux arm64 (aarch64) into release build
thanks a lot
Please answer these quesions for a bug report. Thanks!
gotty --version
)?gotty version latest
Linux kaisawind-z2 5.10.42-1-MANJARO #1 SMP PREEMPT Thu Jun 3 14:37:11 UTC 2021 x86_64 GNU/Linux
Chrome Version 91.0.4472.77 (64 bit)
./gotty bash
just like ttyd, can input commands in web
only show bash, nothing can be input
./ttyd bash
works well
gotty --version
)?v1.5.0
Ubuntu 22.04.2 LTS
Google Chrome 112.0.5615.50 (Official Build) (64-bit)
I want to run gotty upon server reboot so I added the following to crontab -e
:
@reboot /root/gotty/gotty --config "/root/gotty/.gotty" tmux new -A -s gotty
the content of /root/gotty/.gotty
is:
address = "1.1.1.1"
port = "1010"
enable_tls = true
tls_crt_file = "/root/cert.crt"
tls_key_file = "/root/private.key"
enable_basic_auth = true
credential = "admin:admin"
permit_write = true
successful execution and normal operation of gotty
crontab
successfully executes and runs gotty upon reboot and I can access terminal at 1.1.1.1:1010 as usual but interpretation and handling of some key combinations are now different from what was the expected behavior.
for example: ctrl + l writes literally ^L
on the terminal rather than resetting it.
or pressing tab for completing a filename, writes literally a tab character (empty space)
Is this a bug or because of how crontab
handles the execution?
If not a bug, what is the correct procedure to run gotty upon server reboot?
Hello.
I am currently using your repository for local development. It really works very well and I appreciate it.
But at the moment I have a question, how do you debug the front-end code locally (especially js part as well as html etc) By building a separate http server, which is possible. But I don't know if it is already supported inside your code?
I would be grateful if I could get an answer from you.
It seems that the color preferences are no longer respected in 1.4.0.
I was looking through the release notes, and did not see anything to explain it.
gotty --version
)?Gotty 1.4.0 - bug exists
Gotty 1.3.0 - bug does not exist
Ubuntu 20.04
Have this file in ~/.gotty
port = 3000
term = "hterm"
preferences {
background_color = "white"
foreground_color = "black"
cursor_color = "blue"
}
and run gotty --once ls
Note: This exact same config worked in all previous Gotty versions, including 1.3.0
The terminal background color should be white.
The terminal background color was black.
brew install sorenisanerd/gotty/gotty
fails on Apple M1 Macbook:
==> Tapping sorenisanerd/gotty
Cloning into '/opt/homebrew/Library/Taps/sorenisanerd/homebrew-gotty'...
remote: Enumerating objects: 69, done.
remote: Counting objects: 100% (13/13), done.
remote: Compressing objects: 100% (8/8), done.
remote: Total 69 (delta 5), reused 13 (delta 5), pack-reused 56
Receiving objects: 100% (69/69), 8.45 KiB | 8.45 MiB/s, done.
Resolving deltas: 100% (37/37), done.
Tapped 1 formula (14 files, 16.4KB).
gotty: The intel architecture is required for this software.
Error: gotty: An unsatisfied requirement failed this build.
however, Apple has a compatibility layer called Rosetta and it can actually run x86 binaries on ARM. I assume most developers enable this.
e.g. if I do go install github.com/sorenisanerd/gotty@latest
(I think you should consider changing the command in the README to this), gotty
works just fine on my machine. So Homebrew is being extra defensive here for no reason.
Go 1.16 introduced the embed package: https://golang.org/pkg/embed/
We should use that instead of go-bindata.
It would be awesome to use gotty to access a running Docker container, like docker exec
does. Such feature allow to access a Docker without having to install and run gotty inside the container.
Hello Soren.
Please upgrade node-gyp and other modules to modern versions, otherwise it did not compile/assemble.
Thank You.
gotty --version
)?1.4.0
Ubuntu 22.04 - Docker container
I tried everything to change the font sizez and family and can't get it to work.
I managed to change the "messages" font size (the message "Connection Closed"), but not the terminal font size.
I want to be able to set the font size and family in the config file.
The font size and family cannot be modified.
GoTTY is the one that provides the shell with its environment, so that's where the TERM value has to come from. This fixes dumb terminal issues when running GoTTY from systemd.
Use case: I have a lot of scripts hanging around that glue two services together, ingest data into a database, scrape a page, etc. Usually if I want more interactivity I have to port the script to a Web server and HTML forms.
It would be great if I could instead assign a script to a URL, so that I could send a POST or GET request to a gotty URL and spawn a process with URL parameters being ported to command line arguments. This could then redirect to an ephemeral URL for the specific process, so if it takes a long time I can come back to the URL to see what the script is doing. Additionally, if the script prompts for user input, the process could just hang until I visit the URL again to type in input. This way I can periodically check in on my scripts without having to use ssh
and screen
, and automate their execution using tools like curl
or wget
.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.