Coder Social home page Coder Social logo

mistertea / eternalterminal Goto Github PK

View Code? Open in Web Editor NEW
2.9K 34.0 166.0 44.88 MB

Re-Connectable secure remote shell

Home Page: https://mistertea.github.io/EternalTerminal/

License: Apache License 2.0

CMake 7.84% C++ 88.89% Shell 2.84% Dockerfile 0.43%
ssh remote-shell terminal tmux mosh

eternalterminal's Introduction

Eternal Terminal

Eternal Terminal is a remote shell that automatically reconnects without interrupting the session.

Website: https://mistertea.github.io/EternalTerminal/.

Integration tests

Circle: CircleCI

Linux: Linux CI

Packaging status

Packaging status

Installing

macOS

The easiest way to install is using Homebrew:

brew install MisterTea/et/et

Then if you want a daemon to launch etserver on every boot:

On m1 (Apple Silicon) Macs:

sudo sed 's:/usr/local/bin/etserver:/opt/homebrew/bin/etserver:g' ../init/launchd/homebrew.mxcl.et.plist | sudo tee /Library/LaunchDaemons/homebrew.mxcl.et.plist
sudo launchctl load -w /Library/LaunchDaemons/homebrew.mxcl.et.plist

On x86 Macs:

sudo cp ../init/launchd/homebrew.mxcl.et.plist /Library/LaunchDaemons/homebrew.mxcl.et.plist
sudo launchctl load -w /Library/LaunchDaemons/homebrew.mxcl.et.plist

Alternatively, a package is available in MacPorts:

sudo port install et

Ubuntu

For Ubuntu, use our PPA:

sudo add-apt-repository ppa:jgmath2000/et
sudo apt-get update
sudo apt-get install et

Or see "Debian/Ubuntu" below to install and build from source (e.g., for ARM).

Debian

For debian, use our deb repo. For buster:

echo "deb https://github.com/MisterTea/debian-et/raw/master/debian-source/ buster main" | sudo tee -a /etc/apt/sources.list.d/et.list
curl -sSL https://github.com/MisterTea/debian-et/raw/master/et.gpg | sudo tee /etc/apt/trusted.gpg.d/et.gpg >/dev/null
sudo apt update
sudo apt install et

CentOS 7

Up to the present day the only way to install is to build from source.

CentOS 8

sudo dnf install epel-release
sudo dnf install et

FreeBSD

On FreeBSD, use:

pkg install eternalterminal

Fedora (version 29 and later):

sudo dnf install et

openSUSE

zypper ar -f obs://network
zypper ref
zypper in EternalTerminal

Other Linux

Install dependencies:

  • Fedora (tested on 25):

    sudo dnf install boost-devel libsodium-devel protobuf-devel \
    	protobuf-compiler cmake gflags-devel libcurl-devel
    
  • Gentoo:

    sudo emerge dev-libs/boost dev-libs/libsodium \
    	dev-libs/protobuf dev-util/cmake dev-cpp/gflags
    

Download and install from source:

git clone --recurse-submodules https://github.com/MisterTea/EternalTerminal.git
cd EternalTerminal
mkdir build
cd build
cmake ../
make
sudo make install

Windows

Eternal Terminal works under WSL (Windows Subsystem for Linux). Follow the ubuntu instructions.

Docker Image

See docker/README.md

Verifying

Verify that the client is installed correctly by looking for the et executable: which et.

Verify that the server is installed correctly by checking the service status: systemctl status et. On some operating systems, you may need to enable and start the service manually: sudo systemctl enable --now et.

You are ready to start using ET!

Configuring

If you'd like to modify the server settings (e.g. to change the listening port), edit /etc/et.cfg.

Using

ET uses ssh for handshaking and encryption, so you must be able to ssh into the machine from the client. Make sure that you can ssh user@hostname.

ET uses TCP, so you need an open port on your server. By default, it uses 2022.

Once you have an open port, the syntax is similar to ssh. Username is default to the current username starting the et process, use -u or user@ to specify a different if necessary.

et hostname (etserver running on default port 2022, username is the same as current)
et user@hostname:8000 (etserver running on port 8000, different user)

You can specify a jumphost and the port et is running on jumphost using -jumphost and -jport. If no -jport is given, et will try to connect to default port 2022.

et hostname -jumphost jump_hostname (etserver running on port 2022 on both hostname and jumphost)
et hostname:8888 -jumphost jump_hostname -jport 9999

Additional arguments that et accept are port forwarding pairs with option -t "18000:8000, 18001-18003:8001-8003", a command to run immediately after the connection is setup through -c.

Starting from the latest release, et supports parsing both user-specific and system-wide ssh config file. The config file is required when your sshd on server/jumphost is listening on a port which is not 22. Here is an example ssh config file showing how to setup when

  • there is a jumphost in the middle
  • sshd is listening on a port which is not 22
  • connecting to a different username other than current one.
Host dev
  HostName 192.168.1.1
  User fred
  Port 5555
  ProxyJump [email protected]:22

With the ssh config file set as above, you can simply call et with

et dev (etserver running on port 2022 on both hostname and jumphost)
et dev:8000 -jport 9000 (etserver running on port 9000 on jumphost)

Building from Source

macOS

To build Eternal Terminal on Mac, the easiest way is to grab dependencies with Homebrew:

brew install --only-dependencies MisterTea/et/et
git clone --recurse-submodules https://github.com/MisterTea/EternalTerminal.git
cd EternalTerminal
mkdir build
cd build
# Add if it doesn't work on Apple Silicon but should work without it
if [[ $(uname -a | grep 'arm\|aarch64') ]]; then export VCPKG_FORCE_SYSTEM_BINARIES=1; fi
cmake ../
make && sudo make install

To run an et server for testing, run ./etserver. To run an et server daemon persistently across reboots:

sudo cp ../init/launchd/homebrew.mxcl.et.plist /Library/LaunchDaemons
sudo launchctl load -w /Library/LaunchDaemons/homebrew.mxcl.et.plist

Debian/Ubuntu

Grab the deps and then follow this process.

Debian/Ubuntu Dependencies:

sudo apt install libboost-dev libsodium-dev \
	libprotobuf-dev protobuf-compiler libgflags-dev libutempter-dev libcurl4-openssl-dev \
    build-essential ninja-build cmake git zip

Fetch source, build and install:

git clone --recurse-submodules https://github.com/MisterTea/EternalTerminal.git
cd EternalTerminal
mkdir build
cd build
# For ARM (including OS/X with apple silicon):
if [[ $(uname -a | grep 'arm\|aarch64') ]]; then export VCPKG_FORCE_SYSTEM_BINARIES=1; fi
cmake ../
make package
sudo dpkg --install *.deb
sudo cp ../etc/et.cfg /etc/

Once built, the binary only requires libgflags-dev and libprotobuf-dev.

CentOS 7

Install dependencies:

sudo yum install epel-release
sudo yum install cmake3 boost-devel libsodium-devel protobuf-devel \
     protobuf-compiler gflags-devel protobuf-lite-devel libcurl-devel \
     perl-IPC-Cmd perl-Data-Dumper libunwind-devel libutempter-devel

Install scl dependencies

sudo yum install centos-release-scl
sudo yum install devtoolset-11 devtoolset-11-libatomic-devel rh-git227

Download and install from source (see #238 for details):

git clone --recurse-submodules https://github.com/MisterTea/EternalTerminal.git
cd EternalTerminal
mkdir build
cd build
scl enable devtoolset-11 rh-git227 'cmake3 ../'
scl enable devtoolset-11 'make && sudo make install'
sudo cp ../systemctl/et.service /etc/systemd/system/
sudo cp ../etc/et.cfg /etc/

Find the actual location of et:

which etserver

Correct the service file (see #180 for details).

sudo sed -ie "s|ExecStart=[^[:space:]]*[[:space:]]|ExecStart=$(which etserver) |" /etc/systemd/system/et.service

Alternativelly, open the file /etc/systemd/system/et.service in an editor and correct the ExectStart=... line to point to the correct path of the etserver binary.

 ExecStart=/usr/local/bin/etserver --cfgfile=/etc/et.cfg

Reload systemd configs:

sudo systemctl daemon-reload

Start the et service:

sudo systemctl enable --now et.service

Building using Docker

Builder Dockerfiles are located at deployment/. Supported OSes: CentOS 8, openSUSE and Ubuntu.

Reporting issues

If you have any problems with installation or usage, please file an issue on github.

Developers

eternalterminal's People

Contributors

ailzhang avatar albusshin avatar begui avatar caruccio avatar cgull avatar ctsrc avatar dandv avatar dgentry avatar divinity76 avatar foriequal0 avatar infokiller avatar jacke avatar jshort avatar jubalh avatar jwmcglynn avatar kyungminlee avatar mbtamuli avatar michaelbuckley avatar michel-slm avatar migelo avatar mistertea avatar razum2um avatar samuela avatar sjincho avatar supersandro2000 avatar telser avatar thalamus avatar tiktuk avatar traceyc77 avatar wez avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

eternalterminal's Issues

Connection attempt fails silently (Mac -> Ubuntu 16.04)

I installed et on Mac (OSX 10.12 Sierra) by brew, and on the server (Ubuntu 16.04) by apt-get. When I connect "et user@server" I get an immediate silent fail. Addind the "-v" flag does not give verbose messages.

On the server side, if I try running "etserver" I get this error message:

E0904 12:28:29.360836 12291 UnixSocketHandler.cpp:256] Error binding 2/1/6: 98 Address already in use
Error binding 2/1/6: 98 Address already in use

Too many logs at /tmp, can't disable them

Hello! I have noticed there are tens of /tmp/etserver* files in the server, and tens of /tmp/etclient* in the client. I tried running et -l=/dev/null, but it makes no difference.

Since ET has been working mostly OK, I would like to disable logs on both the server and client!

usage

How do you disconnect from the session without killing it?

Issue with connection

I was piqued by this app after being let down by Mosh's lack of scrollback ability, so I decided to try it out.

Well, unfortunately I'm not able to connect with the server. I'm able to authenticate, but the session closes right afterwards without an error. I'm able to manually start etclient and etserver and make a connection, but it seems that using et to do it the proper way always ends with it closing without an error. Using the -v flag returns the following (truncated to the last few lines):

Authenticated to *** ([***]:22).
debug1: channel 0: new [client-session]
debug1: Requesting [email protected]
debug1: Entering interactive session.
debug1: pledge: network
debug1: client_input_global_request: rtype [email protected] want_reply 0
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug1: channel 0: free: client-session, nchannels 1
debug1: fd 0 clearing O_NONBLOCK
debug1: fd 1 clearing O_NONBLOCK
Transferred: sent 3488, received 2680 bytes, in 0.0 seconds
Bytes per second: sent 70035.9, received 53812.0
debug1: Exit status 0

Any ideas what could be wrong? I'm using archlinux. It could be possible I'm missing a dependency but I'm not sure which.

Does not work for Ubuntu 16.04.2

Installed on Mac and on Ubuntu 16.04.2 and could not connect from Mac to Ubuntu. I got hung terminals which I closed.

If on Ubuntu, could connect to the same machine at localhost but it was very slow.

Not able to install on Ubuntu zesty(17.04)

I am running Ubuntu 17.04

When I try to install, I get this error.

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 et : Depends: libprotobuf9v5 but it is not installable
E: Unable to correct problems, you have held broken packages.

It seems libprotobuf9v5 is only available for Ubuntu Xenial (16.04).

done <<< "$ET_SERVER_COMMANDS"

When I try to connect to a remote Ubuntu server, I always get

Expected a string, but instead found a redirection
fish: done <<< "$ET_SERVER_COMMANDS"

I installed it on my Mac view Homebrew. The remote server is Ubuntu 16.04 (armhf). There are no pre-built arm binaries, so I cloned the Git repo and ran cmake / make / make install.

Compile fails with error: ‘gflags’ has not been declared when compiling from source

I'm trying to compile et on Debian (3.16.39-1).

I got most of the way by installing a few libs:

apt-get install libboost-all-dev libgoogle-glog-dev libprotobuf-dev libsodium-dev protobuf-compiler

Now make just fails like this:

[ 95%] Building CXX object CMakeFiles/etclient.dir/terminal/TerminalClient.cpp.o
In file included from /home/tuk/EternalTCP/terminal/TerminalClient.cpp:5:0:
/home/tuk/EternalTCP/terminal/NCursesOverlay.hpp: In member function ‘int et::NCursesOverlay::cols()’:
/home/tuk/EternalTCP/terminal/NCursesOverlay.hpp:44:9: warning: variable ‘rows’ set but not used [-Wunused-but-set-variable]
     int rows, cols;
         ^
/home/tuk/EternalTCP/terminal/TerminalClient.cpp: In function ‘int main(int, char**)’:
/home/tuk/EternalTCP/terminal/TerminalClient.cpp:36:3: error: ‘gflags’ has not been declared
   gflags::ParseCommandLineFlags(&argc, &argv, true);
   ^
/home/tuk/EternalTCP/terminal/TerminalClient.cpp:174:9: warning: unused variable ‘bitsSet’ [-Wunused-variable]
     int bitsSet = select(maxfd + 1, &rfd, NULL, NULL, &tv);
         ^
CMakeFiles/etclient.dir/build.make:54: recipe for target 'CMakeFiles/etclient.dir/terminal/TerminalClient.cpp.o' failed
make[2]: *** [CMakeFiles/etclient.dir/terminal/TerminalClient.cpp.o] Error 1
CMakeFiles/Makefile2:131: recipe for target 'CMakeFiles/etclient.dir/all' failed
make[1]: *** [CMakeFiles/etclient.dir/all] Error 2
Makefile:117: recipe for target 'all' failed
make: *** [all] Error 2

Any ideas?

Add option to enable disconnect notifications

ET used to notify people on disconnect but this was disabled since it caused issues with "tmux -CC". This issue is to add that back as an option for people who do not use tmux control mode

Can't connect to etserver built on CentOS 7 from OS X

I believe I have everything setup correctly I can connect to an etserver instance installed on an Ubuntu server via the ppa from a client installed from brew on OS X but I can't connect to an etserver instance built on CentOS 7

cmake ../
-- The C compiler identification is GNU 4.8.5
-- The CXX compiler identification is GNU 4.8.5
-- Check for working C compiler: /bin/cc
-- Check for working C compiler: /bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /bin/c++
-- Check for working CXX compiler: /bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Looking for include file pthread.h
-- Looking for include file pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Found Glog: /usr/include
-- Found glog    (include: /usr/include, library: /usr/lib64/libglog.so)
-- Found GFLAGS: /usr/include
-- Found PROTOBUF: /usr/lib64/libprotobuf.so
CMake Warning (dev) at CMakeLists.txt:29 (find_package):
  Syntax Warning in cmake code at

    /home/<username>/EternalTCP-et-v3.1.1/cmake/FindSodium.cmake:76:53

  A future version of CMake may treat unquoted argument:

    [=[

  as an opening long bracket.  Double-quote the argument.
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Found sodium: /usr/lib64/libsodium.so
-- Found PkgConfig: /bin/pkg-config (found version "0.27.1")
-- checking for module 'libselinux'
--   found libselinux, version 2.5
-- Found SELinux: /usr/include
-- Configuring done
-- Generating done
-- Build files have been written to: /home/<username>/EternalTCP-et-v3.1.1/build
$ make
[  4%] Running C++ protocol buffer compiler on proto/ET.proto
Scanning dependencies of target EternalTCP-static
[  8%] Building CXX object CMakeFiles/EternalTCP-static.dir/src/BackedReader.cpp.o
[ 13%] Building CXX object CMakeFiles/EternalTCP-static.dir/src/BackedWriter.cpp.o
[ 17%] Building CXX object CMakeFiles/EternalTCP-static.dir/src/ClientConnection.cpp.o
[ 21%] Building CXX object CMakeFiles/EternalTCP-static.dir/src/Connection.cpp.o
[ 26%] Building CXX object CMakeFiles/EternalTCP-static.dir/src/CryptoHandler.cpp.o
[ 30%] Building CXX object CMakeFiles/EternalTCP-static.dir/src/FakeSocketHandler.cpp.o
[ 34%] Building CXX object CMakeFiles/EternalTCP-static.dir/src/FlakyFakeSocketHandler.cpp.o
[ 39%] Building CXX object CMakeFiles/EternalTCP-static.dir/src/ServerClientConnection.cpp.o
[ 43%] Building CXX object CMakeFiles/EternalTCP-static.dir/src/ServerConnection.cpp.o
[ 47%] Building CXX object CMakeFiles/EternalTCP-static.dir/src/SocketHandler.cpp.o
[ 52%] Building CXX object CMakeFiles/EternalTCP-static.dir/src/UnixSocketHandler.cpp.o
[ 56%] Building CXX object CMakeFiles/EternalTCP-static.dir/ET.pb.cc.o
Linking CXX static library libEternalTCP-static.a
[ 56%] Built target EternalTCP-static
[ 60%] Running C++ protocol buffer compiler on proto/ETerminal.proto
Scanning dependencies of target TerminalCommon
[ 65%] Building CXX object CMakeFiles/TerminalCommon.dir/terminal/SystemUtils.cpp.o
[ 69%] Building CXX object CMakeFiles/TerminalCommon.dir/terminal/SocketUtils.cpp.o
[ 73%] Building CXX object CMakeFiles/TerminalCommon.dir/terminal/IdPasskeyHandler.cpp.o
[ 78%] Building CXX object CMakeFiles/TerminalCommon.dir/ETerminal.pb.cc.o
Linking CXX static library libTerminalCommon.a
[ 78%] Built target TerminalCommon
Scanning dependencies of target etclient
[ 82%] Building CXX object CMakeFiles/etclient.dir/terminal/TerminalClient.cpp.o
[ 86%] Building CXX object CMakeFiles/etclient.dir/terminal/PortForwardClientRouter.cpp.o
[ 91%] Building CXX object CMakeFiles/etclient.dir/terminal/PortForwardClientListener.cpp.o
Linking CXX executable etclient
[ 91%] Built target etclient
Scanning dependencies of target etserver
[ 95%] Building CXX object CMakeFiles/etserver.dir/terminal/TerminalServer.cpp.o
[100%] Building CXX object CMakeFiles/etserver.dir/terminal/PortForwardServerHandler.cpp.o
Linking CXX executable etserver
[100%] Built target etserver
$ sudo make install
[ 56%] Built target EternalTCP-static
[ 78%] Built target TerminalCommon
[ 91%] Built target etclient
[100%] Built target etserver
Install the project...
-- Install configuration: ""
-- Installing: /usr/local/bin/etserver
-- Installing: /usr/local/bin/etclient
-- Installing: /usr/local/bin/et

server

~  EternalTCP-et-v3.1.1  build  etserver
Waiting for a connection...
Credentials from SO_PEERCRED: pid=22698, euid=0, egid=0
Waiting for a connection...
pty opened 10
E0722 15:52:25.308373 22703 Connection.cpp:103] Tried to close a dead socket
E0722 15:52:26.205015 22685 ServerConnection.cpp:62] Got a client that we have no key for
Credentials from SO_PEERCRED: pid=22728, euid=0, egid=0
Waiting for a connection...
pty opened 13
E0722 15:52:56.493669 22732 Connection.cpp:103] Tried to close a dead socket
E0722 15:52:57.384106 22685 ServerConnection.cpp:62] Got a client that we have no key for
Credentials from SO_PEERCRED: pid=22777, euid=0, egid=0
Waiting for a connection...
pty opened 14
E0722 15:53:15.549537 22780 Connection.cpp:103] Tried to close a dead socket
E0722 15:53:16.537562 22685 ServerConnection.cpp:62] Got a client that we have no key for
Credentials from SO_PEERCRED: pid=22811, euid=0, egid=0
Waiting for a connection...
pty opened 15
E0722 15:54:12.834552 22814 Connection.cpp:103] Tried to close a dead socket
E0722 15:54:13.721647 22685 ServerConnection.cpp:62] Got a client that we have no key for

client

et root@<servername>
F0722 15:54:12.721895 22813 TerminalServer.cpp:354] Error: (22): Invalid argument
*** Check failure stack trace: ***
    @     0x7fce434e9e6d  (unknown)
    @     0x7fce434ebced  (unknown)
    @     0x7fce434e9a5c  (unknown)
    @     0x7fce434ec63e  (unknown)
    @           0x470a2f  startTerminal()
    @           0x472913  TerminalServerHandler::newClient()
    @           0x494f5a  et::ServerConnection::clientHandler()
    @           0x4948e0  et::ServerConnection::run()
    @           0x4717b6  main
    @     0x7fce41e61b35  __libc_start_main
    @           0x46e6c9  (unknown)
Session terminated

logs

et root@<servername>
F0722 15:54:12.721895 22813 TerminalServer.cpp:354] Error: (22): Invalid argument
*** Check failure stack trace: ***
    @     0x7fce434e9e6d  (unknown)
    @     0x7fce434ebced  (unknown)
    @     0x7fce434e9a5c  (unknown)
    @     0x7fce434ec63e  (unknown)
    @           0x470a2f  startTerminal()
    @           0x472913  TerminalServerHandler::newClient()
    @           0x494f5a  et::ServerConnection::clientHandler()
    @           0x4948e0  et::ServerConnection::run()
    @           0x4717b6  main
    @     0x7fce41e61b35  __libc_start_main
    @           0x46e6c9  (unknown)
Session terminated cat /tmp/etclient.INFO
Log file created at: 2017/07/22 15:53:14
Running on machine: <clientName>
Log line format: [IWEF]mmdd hh:mm:ss.uuuuuu threadid file:line] msg
I0722 15:53:14.432402 3413267392 TerminalClient.cpp:54] ID PASSKEY: <redacted>
I0722 15:53:14.433262 3413267392 TerminalClient.cpp:84] Sending command to set terminal to screen-256color
I0722 15:53:14.587086 3413267392 UnixSocketHandler.cpp:146] Connected to server: <servername> using fd 6
I0722 15:53:15.609870 3413267392 Connection.cpp:33] Closing socket because 32 Broken pipe
I0722 15:53:15.609946 3413267392 ClientConnection.cpp:61] Closing socket
I0722 15:53:15.610018 3413267392 ClientConnection.cpp:71] Socket closed.  Starting new reconnect thread
I0722 15:53:15.610159 46899200 ClientConnection.cpp:88] Trying to reconnect to <servername>:2022
I0722 15:53:15.776744 46899200 UnixSocketHandler.cpp:146] Connected to server: <servername> using fd 6
I0722 15:53:16.596808 46899200 ClientConnection.cpp:98] Got response with status: 3 3
I0722 15:53:16.596856 46899200 ClientConnection.cpp:100] Got invalid key on reconnect, assume that server has terminated the session.
E0722 15:53:17.598309 3413267392 Connection.cpp:103] Tried to close a dead socket
I0722 15:53:17.599061 3413267392 TerminalClient.cpp:335] Client derefernced

server log

cat /tmp/etserver.INFO                                                                                                                                                                                                                                                                                         130
Log file created at: 2017/07/22 15:52:19
Running on machine: <servername>
Log line format: [IWEF]mmdd hh:mm:ss.uuuuuu threadid file:line] msg
I0722 15:52:19.008271 22685 TerminalServer.cpp:485] Creating server
I0722 15:52:19.008550 22686 IdPasskeyHandler.cpp:71] Listening to id/key FIFO
I0722 15:52:19.008576 22685 UnixSocketHandler.cpp:272] Listening on 0.0.0.0:2022/2/1/6
I0722 15:52:19.008601 22685 UnixSocketHandler.cpp:272] Listening on 0.0.0.0:2022/10/1/6
I0722 15:52:24.321892 22686 IdPasskeyHandler.cpp:79] Connected
I0722 15:52:25.009268 22685 ServerConnection.cpp:60] Got client with id: <redacted>
I0722 15:52:25.009335 22685 ServerConnection.cpp:78] New client.  Setting up connection
F0722 15:52:25.205276 22702 TerminalServer.cpp:354] Error: (22): Invalid argument
I0722 15:52:25.308257 22703 TerminalServer.cpp:145] Terminal session ended
I0722 15:52:25.308326 22703 Connection.cpp:161] Shutting down connection
E0722 15:52:25.308373 22703 Connection.cpp:103] Tried to close a dead socket
I0722 15:52:26.204989 22685 ServerConnection.cpp:60] Got client with id: <redacted>
E0722 15:52:26.205015 22685 ServerConnection.cpp:62] Got a client that we have no key for
I0722 15:52:55.133281 22686 IdPasskeyHandler.cpp:79] Connected
I0722 15:52:56.207880 22685 ServerConnection.cpp:60] Got client with id: <redacted>
I0722 15:52:56.207934 22685 ServerConnection.cpp:78] New client.  Setting up connection
F0722 15:52:56.384354 22731 TerminalServer.cpp:354] Error: (22): Invalid argument
I0722 15:52:56.493558 22732 TerminalServer.cpp:145] Terminal session ended
I0722 15:52:56.493624 22732 Connection.cpp:161] Shutting down connection
E0722 15:52:56.493669 22732 Connection.cpp:103] Tried to close a dead socket
I0722 15:52:57.384080 22685 ServerConnection.cpp:60] Got client with id: <redacted>
E0722 15:52:57.384106 22685 ServerConnection.cpp:62] Got a client that we have no key for
I0722 15:53:14.349783 22686 IdPasskeyHandler.cpp:79] Connected
I0722 15:53:15.385886 22685 ServerConnection.cpp:60] Got client with id: <redacted>
I0722 15:53:15.385932 22685 ServerConnection.cpp:78] New client.  Setting up connection
F0722 15:53:15.537825 22779 TerminalServer.cpp:354] Error: (22): Invalid argument
I0722 15:53:15.549455 22780 TerminalServer.cpp:145] Terminal session ended
I0722 15:53:15.549501 22780 Connection.cpp:161] Shutting down connection
E0722 15:53:15.549537 22780 Connection.cpp:103] Tried to close a dead socket
I0722 15:53:16.537533 22685 ServerConnection.cpp:60] Got client with id: <redacted>
E0722 15:53:16.537562 22685 ServerConnection.cpp:62] Got a client that we have no key for
I0722 15:54:11.502912 22686 IdPasskeyHandler.cpp:79] Connected
I0722 15:54:12.542783 22685 ServerConnection.cpp:60] Got client with id: <redacted>
I0722 15:54:12.542839 22685 ServerConnection.cpp:78] New client.  Setting up connection
F0722 15:54:12.721895 22813 TerminalServer.cpp:354] Error: (22): Invalid argument
I0722 15:54:12.834424 22814 TerminalServer.cpp:145] Terminal session ended
I0722 15:54:12.834504 22814 Connection.cpp:161] Shutting down connection
E0722 15:54:12.834552 22814 Connection.cpp:103] Tried to close a dead socket
I0722 15:54:13.721611 22685 ServerConnection.cpp:60] Got client with id: <redacted>
E0722 15:54:13.721647 22685 ServerConnection.cpp:62] Got a client that we have no key for

l

If you have set up ET correctly and are having an issue connecting/maintaining a session, please consider running in verbose mode and adding client & server logs to your issue.

To run in verbose mode, pass the -v flag to et.

To collect logs, run the following on your client:

tar -cvzPhf /tmp/etclientLogs.tar.gz /tmp/etclient_err /tmp/etclient.INFO

Then run this on your server:

tar -cvzPhf /tmp/etserverLogs.tar.gz /tmp/etserver_err /tmp/etserver.INFO

The logs will contain the IP addresses & username of the client and server, but will not contain any of the data transmitted.

If you are experiencing a crash, please also post a backtrace. To do this, replace this line in your et script:

CLIENT_BINARY="etclient"

to this:

CLIENT_BINARY="lldb -- etclient"

then rerun with lldb and when it crashes, type "bt" to give me the stack trace. If you are running the client under linux, replace with:

CLIENT_BINARY="gdb --args etclient"

tmux control center support in VTE

I have EternalTCP 3.0.2 installed on a CentOS server of mine and on my Arch laptop, using the source archive from the Github release page. After establishing a connection, I can successfully run tmux attach, but with the normal tmux restrictions and no scrollback. But if I run tmux -CC attach, I get nothing at all and the terminal hangs until I press Enter. Running tmux -C attach gives only this:

$ tmux -C attach
%begin 1494607734 1 0
%end 1494607734 1 0
%session-changed $0 0

There's absolutely nothing in the logs on either client or server. After some discussion, it looks like tmux's control center mode is only supported in iTerm on OS X. Having support for VTE-based terminals on Linux would be fantastic.

Multiple et connections

Before I start attaching any logs as if there were a bug, let me first ask if this ticket should be a feature request:
Should it currently be possible to connect from a client to a server multiple times with et?

I connect from my laptop to a desktop/VM located in my work office to do most of my work (hence things like mosh/et being so useful as I roam with my laptop) and in doing so I open a lot of shells to the remote machine. But currently if I open a second et connection my first connection exits.

et seg faults on network disconnect

Hey ET!

I'm a heavy mosh user, but would love to move to something that let's me maintain native scroolback, so I'm a big fan of this project.

I built if from source today (to get around the bugs that have been fixed since the last deb was built) but have run into an issue with network disconnects.
The scenario is as follows:

Successful connection with et:

niko@mexico:~$ et niko@cartagena
preexec - timestamp: Tue Mar 14 17:31:17 PDT 2017 - et niko@cartagena - 2698
postexec - exit code: 0, elapsed time: s -  - 16139
niko@cartagena:~$ echo foo
preexec - timestamp: Tue Mar 14 17:31:23 PDT 2017 - echo foo - 16139
foo
postexec - exit code: 0, elapsed time: .002s - echo foo - 16139

Then on my client machine I kill the network connection to see that et reconnects after it's connected again:

niko@mexico:/tmp/et/EternalTCP-master/build$ nmcli dev disconnect eth0
preexec - timestamp: Tue Mar 14 17:31:44 PDT 2017 - nmcli dev disconnect eth0 - 8119
Device 'eth0' successfully disconnected.
postexec - exit code: 0, elapsed time: .223s - nmcli dev disconnect eth0 - 8119

But before I connect again, probably ~5-10s after I kill my network connection, et seg faults:

niko@cartagena:~$ /usr/local/bin/et: line 116: 10749 Segmentation fault      (core dumped) $CLIENT_BINARY --passkeyfile="$TMPFILE" $VERBOSITY --host="$HOSTNAME" --port="$PORT" --log_dir="$LOG_DIR" 2> /tmp/et_err
                                                                                            postexec - exit code: 139, elapsed time: 43.515s - et niko@cartagena - 2698
                                                niko@mexico:~$ 

client and server logs attached.

[NOTE: the provided tar commands need a -P if you want to not call them from the /tmp dir, and -h to follow the symlinks which the etserver.INFO/etclient.INFO files are]

etclientLogs.tar.gz
etserverLogs.tar.gz

Keep up the good work!

Consider UDP Support

Love the idea, Mosh is really unusable for me because of the no scrollback.

However, one of the great things about Mosh for me is the UDP support.

Certain countries (read between the lines..) rate limit / throttle SSH traffic because it is useful for firewall evasion.. To the point where if I do a certain amount of traffic over SSH to a box, all packets on any protocol to that IP get delayed in a kind of backoff algorithm.

Mosh was great, because the UDP traffic really isn't counted by a stateful firewall, and there's no session to send reset packets to... so it really flew under the radar and made my life a lot easier.

I definitely see the advantage of only supporting TCP, but would it be possible to get an option for both?

et not using ~/.ssh/config file

It appears that et is not using the config file at least for the hostname to username mapping that is present in the config file, possibly for other settings also (since why would only this setting be omitted)

Missing XDG_RUNTIME_DIR

(as discussed)

ssh $SERVER
$ echo $XDG_RUNTIME_DIR
/run/user/12345

but

et $SERVER
$ echo $XDG_RUNTIME_DIR

This var should have been set by (I think) logind and fundamental things like systemctl --user depend on it.

Support multiple connections on a single port

Hi,

I have the et server running on my remote host and can ssh into it (passwordless) without problems. However, if I try to run:

et username@host I get a permission denied.

The log file shows the following:

usr/local/bin/et: line 116: 5272 Segmentation fault: 11 $CLIENT_BINARY --passkeyfile="$TMPFILE" $VERBOSITY --host="$HOSTNAME" --port="$PORT" --log_dir="$LOG_DIR" 2> /tmp/et_err

I tried to run et -v, but there is no such verbose flag (no verbose mode showing when running with --help flag)

failure to connect

Recently et began failing to connect. After authenticating over ssh I started getting the error
Could not make initial connection to nresare.sb.facebook.com: Could not connect to host when invoking et -v nresare.sb.facebook.com:8080.

What I have done to attempt to resolve the situation:

  • Ran 'brew upgrade et'. This compiled and installed version 3.0.0
  • Verified that a recent version of eternalterminal was installed on the server side:
    rpm -q eternalterminal outputs eternalterminal-3.0.2-1.el7.centos.x86_64
  • After re-running after upgrade the failure now looks like this:
/usr/local/bin/et: line 97:  3159 Abort trap: 6           $CLIENT_BINARY --idpasskeyfile="$TMPFILE" $VERBOSITY --host="$HOSTNAME" --port="$PORT" --log_dir="$LOG_DIR" 2> /tmp/etclient_err
tar -cvzPhf /tmp/etclientLogs.tar.gz /tmp/et_err /tmp/etclient.INFO
$ cat /tmp/etclient_err
F0518 15:15:26.876054 3090506688 TerminalClient.cpp:61] Invalid idPasskey id/key pair:
*** Check failure stack trace: ***
    @        0x10e4890ce  google::LogMessage::Fail()
    @        0x10e4883ad  google::LogMessage::SendToLog()
    @        0x10e488ab3  google::LogMessage::Flush()
    @        0x10e48bd03  google::LogMessageFatal::~LogMessageFatal()
    @        0x10e4893b7  google::LogMessageFatal::~LogMessageFatal()
    @        0x10e258b84  main
    @     0x7fffaf444235  start

There is no meaningful debug output that I can find on the server side.

Won't connect

I've installed it on an Ubuntu 17.04 server and Solus 2017.04.18.0
by compiling. On the server I opened port 2022 and restarted the firewall. I ran sudo etserver and the server says waiting for connection. When I run et -v www.myserver.com I'm returned to the prompt after about 7 seconds. The server returns Credentials from SO_PEERCRED: pid=10999, euid=1001, egid=1001 and then goes back to waiting for connection. The only thing that shows in etclient_err is ERROR: unknown command line flag 'log_dir' ERROR: unknown command line flag 'v'

I'm not sure what else to try. There is nothing in the journal on either system. Any ideas?

BSD/POSIXish compatibility

I have ported et to OpenBSD (which needed a few changes), but noticed some Linuxisms in the et launcher client script which break POSIX compatibility can easily be worked around by using standardized options (rather than GNU extensions), in particular, the launcher script uses "head -c" and "/bin/bash" on the remote, which are not UNIX standards.

This is easily fixed by replacing "/bin/bash" with "/bin/sh" (tested to be fine with OpenBSD ksh, at least) on line 114 (which sets SSH_OUTPUT) and by replacing head -c with "dd bs=1 count=N 2>/dev/null" in the PASSKEY_GENERATOR and ID_GENERATOR assignments.

Also, the UNIX standards only seem to require "/dev/null and /dev/console" so you cannot rely on the presence of /dev/urandom, and it is my understanding that using tr to strip non-printable characters may result in weakening the keys. It may be be safer and certainly more portable to include a CSPRNG and use a hash of the output or offer a fallback to egd. I've not done this as all systems I have available to me have /dev/urandom available.

I will clean up my changes soon and provide you the OpenBSD diff later.

High CPU Usage

I just noticed that something was using a lot of power on my MacBook Air 11" and to my surprise it was ET:

screen shot 2017-03-08 at 11 03 10

Any ideas?

Server Dynamic DNS Support

If the IP address of the server changes since the last time we connected, the new IP does not seem to get picked up.
This is especially so if I move between wireless networks where the same host may be available via different IP addresses.

What is the expected behavior of ET and can we handle the above? Thanks for looking into this

Add support for remote forwarding (reverse tunneling)

To repro (Mac only):

  1. Follow the instructions here to set up a pbcopy daemon that listens on port 2224. That article has steps for testing the daemon to make sure it is correctly receiving requests.
  2. Run EternalTerminal forwarding some port to 2224 on the local machine, e.g. et -t="2224:9999" <remote>:8080
  3. Observe wackiness.

To confirm that plain ssh works, you could run:

ssh <remote target> -R2224:localhost:2224

and try hitting the port:

echo asdf | nc -c localhost 2224

The expected behavior is that "asdf" is now copied to your system clipboard.

Debian packaging

Please package this very useful software for the Debian distribution.

Disconnecting form tmux drops into tty

Eternal Terminal does not correctly scope remote execution. In particular, compare between the following two behaviors:

  1. mosh myhost tmux attach

  2. Ctrl+B, d (detach from tmux)

  3. Mosh exits and the connection is closed - [mosh is exiting.] message also displayed.

  4. Control is returned to the machine's shell.

  5. et -c="tmux attach" myhost

  6. Ctrl+B, d (detach from tmux)

  7. tmux detaches.

  8. Control of the tty is left to myhost's shell. I am left with a remote tty and have to close that explicitly.

Ideally, upon the remote command (tmux attach in this case) terminating, ET would close the connection and return control to the host's shell as well.

Add support for agent forwarding

Passing -s "-A" to et does not forward ssh agent credentials which work otherwise. I was assuming ssh agent forwarding would work seamlessly with et?

Am I doing something wrong here?

If not, surprised this hasn't come up yet since I got here from mosh recommended by someone for exactly this purpose.

Ubuntu 14.04: unmet dependencies

All of my machines are 14.04 atm.
Which Ubuntu do I need to make EternalTCP work?

The following packages have unmet dependencies:
et : Depends: libncurses5 (>= 6) but 5.9+20140118-1ubuntu1 is to be installed
Depends: libprotobuf9v5 but it is not installable
Depends: libsodium18 (>= 0.6.0) but it is not installable
Depends: libstdc++6 (>= 5.2) but 4.8.4-2ubuntu1~14.04.3 is to be installed
Depends: libtinfo5 (>= 6) but 5.9+20140118-1ubuntu1 is to be installed
Depends: libgflags2v5 but it is not installable
Depends: libgoogle-glog0v5 but it is not installable

Improve documentation for using custom ssh commands.

My server listens on port 2222 instead of the standard 22.

mbtamuli@nyc-512mb ~ » sudo ufw status numbered
Status: active

     To                         Action      From
     --                         ------      ----
[ 1] 22                         DENY IN     Anywhere                  
[ 2] 2222                       ALLOW IN    Anywhere                  
[ 3] 2022                       ALLOW IN    Anywhere                  
[ 4] 22 (v6)                    DENY IN     Anywhere (v6)             
[ 5] 2222 (v6)                  ALLOW IN    Anywhere (v6)             
[ 6] 2022 (v6)                  ALLOW IN    Anywhere (v6)             

I opened the 2022 port for et. Still I am not able to connect. (I already have open 2222)

$ et [email protected]:2222
ssh: connect to host techfreak.ga port 22: Connection timed out
SSH handshake failed.

I can confirm it's working perfectly fine for my other server which is listening on the standard SSH port 22

Remote forward failing under ET

One of my favourite tools is rmate which can open files in TextMate 2 from an ssh session. For that to work it needs to make a remote forward. I just noticed that this fails when running under ET, even though ssh reports the forward as successful when started by ET.

(In the command below it gets the remote forward argument from ~/.ssh/config.)

$ et -s="-v host " host
…
debug1: Remote connections from LOCALHOST:52698 forwarded to local address localhost:52698
…
debug1: remote forward success for: listen 52698, connect localhost:52698
debug1: All remote forwarding requests processed
…

Trying to open a file:

$ sudo rmate file.txt
/usr/local/bin/rmate: connect: Connection refused
/usr/local/bin/rmate: line 327: /dev/tcp/localhost/52698: Connection refused
Unable to connect to TextMate on localhost:52698

Indeed, nothing is listening:

$ sudo netstat -nap | grep 52698
$

Sorry for creating so many issues, I'm just really excited to start using ET ☺️ . My dream is to get iTerm 2 with tmux -CC, rmate and ET working together and now this is the only missing part…

Comparison to similar tools?

Eternal Terminal seems similar to other projects like mosh and autossh. I think it would be helpful to have a review of the differences between these tools in the documentation.

Add support for chaining the ssh command

I can automatically reconnect to tmux with one command by using:
ssh <host> -t -- tmux -uCC new -s <session name> -AD

If we had some kind of comparable -t command to et, we could use the same alias for et.

etserver crashing on std:bad_alloc

ETserver 4.0.4 running on Ubuntu 16.04 and etclient 4.0.5 on OSX.

E1009 22:42:25.246457 16703 Connection.cpp:101] Tried to close a dead socket
E1009 22:46:45.436381 16703 Connection.cpp:101] Tried to close a dead socket
terminate called after throwing an instance of 'std::bad_alloc'
  what():  std::bad_alloc

Seems to be a fish shell issue

Expected a string, but instead found a redirection
fish: done <<< "$ET_SERVER_COMMANDS"

Setup: using ssh with a shared key from a Mac OS X Sierra installed using brew to Ubuntu server 16.04 via your ppa

Please let me know you are not able to replicate this by simply using the fish shell and I will attach the logs

Segfaults on connect from Mac to Ubuntu

Just freshly installed on my Macbook (client) and Ubuntu (server), and this is what I see when I try connect:

$ et [email protected]
[email protected]'s password:
/usr/local/bin/et: line 120: 70546 Segmentation fault: 11  $CLIENT_BINARY --
idpasskeyfile="$TMPFILE" $VERBOSITY --host="$HOSTNAME" --port="$PORT" --
log_dir="$LOG_DIR" --command="$INITIAL_COMMAND" 2> /tmp/etclient_err

SSH aliases are unknown to `et`

First, let me say that EternalTCP solves my eternal frustrations with SSH. Thank you!

The only thing that seems to be missing is the ability to specify aliases (either by using aliases in ~/.ssh/config or having a separate configuration file). I had hoped that the resolution to #31 would solve this issue, but it doesn't. I have tried the following.

In my ~/.ssh/config:

host        MYALIAS
hostname    MYHOSTNAME
user        MYUSER

NOTE: MYUSER exists as a user on both the client and server machines.

Attempted commands:
et MYUSER@MYHOSTNAME: works!
et MYHOSTNAME: works!
et MYUSER@MYALIAS: fails
et MYALIAS: fails

Error message on failure:
Could not make initial connection to MYALIAS: Could not connect to host
In the log file with -v specified:
E0809 17:12:48.327687 24144 TerminalClient.cpp:88] Connecting to server failed: Could not connect to host

I would have assumed that, since ssh is used for the initial handshake, MYALIAS would work at this point (even if it failed later). I am very interested in this functionality, so I'd be happy to contribute a PR if you want to discuss how to add it.

Confusing message about stdin

Whenever I run et it prints the message Pseudo-terminal will not be allocated because stdin is not a terminal., even though it is being run from a terminal.

Isn't that a mistake?

Cannot open your terminal '/dev/pts/3' - please check.

If you have set up ET correctly and are having an issue connecting/maintaining a session, please consider running in verbose mode and adding client & server logs to your issue.

To run in verbose mode, pass the -v flag to et.

To collect logs, run the following on your client:

tar -cvzPhf /tmp/etclientLogs.tar.gz /tmp/etclient_err /tmp/etclient.INFO

Then run this on your server:

tar -cvzPhf /tmp/etserverLogs.tar.gz /tmp/etserver_err /tmp/etserver.INFO

The logs will contain the IP addresses & username of the client and server, but will not contain any of the data transmitted.

If you are experiencing a crash, please also post a backtrace. To do this, replace this line in your et script:

CLIENT_BINARY="etclient"

to this:

CLIENT_BINARY="lldb -- etclient"

then rerun with lldb and when it crashes, type "bt" to give me the stack trace. If you are running the client under linux, replace with:

CLIENT_BINARY="gdb --args etclient"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.