Eternal Terminal (ET) Documentation

repository·master·Indexed 26 days ago

https://github.com/mistertea/eternalterminal

A remote shell that provides persistent sessions by automatically reconnecting without interrupting work when network connections are lost. It consists of the et client, the etserver daemon, and the etterminal process, using SSH for handshaking and encryption. Documentation covers installation across macOS, Ubuntu, Debian, CentOS, Fedora, openSUSE, NixOS, and FreeBSD, as well as Docker deployment, source builds, and the connection protocol.

Tokens
6.4K
Snippets
19
Records
45
Agent score
87%

What's inside Eternal Terminal

  1. Understand EternalTerminal Architecture

    master

    EternalTerminal operates using three distinct processes to provide reconnectable terminal sessions:

    1. et: The client-side process running on the local machine.
    2. etterminal: The process that runs as the user on the remote machine and hosts the actual terminal session.
    3. etserver: The server-side process that manages connections and bridges users to their terminals.

    Authentication is handled via SSH, while the etserver process provides the mechanism for session persistence and reconnection.

  2. Install Eternal Terminal on macOS

    master

    The easiest way to install the et client on macOS is via Homebrew. If you want the etserver daemon to launch automatically on every boot, you must configure the launchd plist based on your architecture (Apple Silicon vs x86). Alternatively, you can use MacPorts.

    # Using Homebrew
    brew install et
    
    # On m1 (Apple Silicon) Macs, configure daemon:
    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, configure daemon:
    sudo cp ../init/launchd/homebrew.mxcl.et.plist /Library/LaunchDaemons/homebrew.mxcl.et.plist
    sudo launchctl load -w /Library/LaunchDaemons/homebrew.mxcl.et.plist
    
    # Using MacPorts
    sudo port install et
  3. Use Reverse Port Forwarding in Eternal Terminal

    master

    Reverse port forwarding allows you to expose a port on the remote server to a port on your local client.

    Use the -r or --reversetunnel flag with the et command. The syntax is source:destination, where source is the port on the server and destination is the port on the client.

    Unix Socket Forwarding: You can forward Unix sockets by using the syntax ENV_VAR_NAME:/var/run/example.sock. This creates a temporary file on the server and forwards it to the specified path on the client, setting the path to the value of ENV_VAR_NAME on the client.

  4. Configure Eternal Terminal on NixOS using the NixOS module

    master

    To run the etserver on NixOS, import the et.nixosModules.default module. The module manages the server side by generating /etc/et.cfg, starting etserver, and optionally opening the firewall.

    Note: The module manages the server but does not add client tools (like et or htm) to your PATH. To use client tools interactively, you must also add the package to environment.systemPackages.

    {
      inputs.et.url = "github:MisterTea/EternalTerminal";
    
      outputs = { nixpkgs, et, ... }: {
        nixosConfigurations.my-host = nixpkgs.lib.nixosSystem {
          system = "x86_64-linux";
          modules = [
            et.nixosModules.default
            ({ pkgs, ... }: {
              environment.systemPackages = [
                et.packages.${pkgs.stdenv.hostPlatform.system}.default
              ];
    
              services.eternalTerminal = {
                enable = true;
                openFirewall = true;
                port = 2022;
                settings.Networking.bind_ip = "0.0.0.0";
              };
            })
          ];
        };
      };
    }
  5. Use Eternal Terminal with Nix (Local Checkout)

    master

    If you have a local checkout of the repository, you can use Nix flakes to develop or build the project. nix develop provides a shell containing the package inputs and developer tools required for CMake work on NixOS.

    nix flake show path:.
    nix develop path:.
    nix build path:. --no-link
  6. Run the et-server Docker container

    master

    Run the et-server container with the following command to map necessary ports and mount host system files required for authentication and user management.

    Requirements:

    • Ports 2022 and 2222 must be open on the server host.
    • The container starts an sshd server to initiate the et-server handshake.
    • Your SSH client must be able to connect to the container's sshd, not the host's sshd.
    • A standard SSH connection like ssh -p 2222 user@host must work successfully.
    $ docker run -it --rm -p 2022:2022 -p 2222:22 \
        -v /etc/ssh:/etc/ssh \
        -v /etc/passwd:/etc/passwd \
        -v /etc/shadow:/etc/shadow \
        -v /etc/group:/etc/group \
        -v /home:/home \
        et-server
  7. Build Eternal Terminal from source (General Linux)

    master

    To build from source on other Linux distributions, install the required dependencies (e.g., boost-devel, libsodium-devel, protobuf-devel, cmake, etc.) and follow the standard CMake build process.

    git clone --recurse-submodules --depth 1 https://github.com/MisterTea/EternalTerminal.git
    cd EternalTerminal
    mkdir build
    cd build
    cmake ../
    make
    sudo make install
  8. Install Eternal Terminal on NixOS

    master

    On NixOS, use flakes to import the bundled NixOS module. This manages the package, /etc/et.cfg, and the etserver service.

    {
      inputs.et.url = "github:MisterTea/EternalTerminal";
    
      outputs = { nixpkgs, et, ... }: {
        nixosConfigurations.my-host = nixpkgs.lib.nixosSystem {
          system = "x86_64-linux";
          modules = [
            et.nixosModules.default
            ({ ... }: {
              services.eternalTerminal = {
                enable = true;
                openFirewall = true;
                port = 2022;
                settings.Networking.bind_ip = "0.0.0.0";
              };
            })
          ];
        };
      };
    }