Skip to content

Commit

Permalink
Merge branch 'master' into patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
bryant1410 authored Nov 25, 2024
2 parents 20bd8e8 + 120b8cb commit d475f52
Show file tree
Hide file tree
Showing 10 changed files with 143 additions and 90 deletions.
8 changes: 7 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -635,8 +635,14 @@ set(CPACK_PACKAGE_VERSION_PATCH ${PROJECT_VERSION_PATCH})
set(CPACK_PACKAGE_INSTALL_DIRECTORY "EternalTerminal")
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")

SET(CPACK_GENERATOR "STGZ;TGZ;TZ;DEB")
if(NOT CPACK_GENERATOR)
SET(CPACK_GENERATOR "STGZ;TGZ;TZ;DEB")
endif()
SET(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CMAKE_SOURCE_DIR}/debian/postinst;${CMAKE_SOURCE_DIR}/debian/postrm;${CMAKE_SOURCE_DIR}/debian/prerm")
SET(CPACK_INSTALLED_DIRECTORIES "${CMAKE_SOURCE_DIR}/systemctl;/lib/systemd/system" "${CMAKE_SOURCE_DIR}/etc;/etc")
SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "Unmaintained")
SET(CPACK_DEBIAN_PACKAGE_DEPENDS "libprotobuf-dev, libc6 (>= 2.34), libgcc-s1 (>= 3.3.1), libstdc++6 (>= 12), libutempter0 (>= 1.1.5)")
SET(CPACK_DEBIAN_PACKAGE_SUGGESTS "systemd")

# This must always be last!
include(CPack)
70 changes: 39 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ The easiest way to install is using Homebrew:
brew install MisterTea/et/et
```

If the install fails on including csignal, see https://github.com/MisterTea/EternalTerminal/issues/662#issuecomment-2408889829

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

On m1 (Apple Silicon) Macs:
Expand All @@ -41,7 +43,6 @@ sudo cp ../init/launchd/homebrew.mxcl.et.plist /Library/LaunchDaemons/homebrew.m
sudo launchctl load -w /Library/LaunchDaemons/homebrew.mxcl.et.plist
```


Alternatively, a package is available in MacPorts:

```bash
Expand All @@ -60,14 +61,14 @@ 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:
For Debian, use our deb repo:

```bash
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
echo "deb [signed-by=/etc/apt/keyrings/et.gpg] https://mistertea.github.io/debian-et/debian-source/ $(grep VERSION_CODENAME /etc/os-release | cut -d= -f2) main" | sudo tee -a /etc/apt/sources.list.d/et.list
sudo mkdir -m 0755 -p /etc/apt/keyrings # only if you're using Debian 11 or older
curl -sSL https://github.com/MisterTea/debian-et/raw/master/et.gpg | sudo tee /etc/apt/keyrings/et.gpg >/dev/null
sudo apt update
sudo apt install et
```
Expand All @@ -84,6 +85,7 @@ sudo dnf install et
```

### FreeBSD

On FreeBSD, use:

```bash
Expand All @@ -108,14 +110,14 @@ zypper in EternalTerminal

Install dependencies:

* Fedora (tested on 25):
- Fedora (tested on 25):

```bash
sudo dnf install boost-devel libsodium-devel protobuf-devel \
protobuf-compiler cmake gflags-devel libcurl-devel
```

* Gentoo:
- Gentoo:

```bash
sudo emerge dev-libs/boost dev-libs/libsodium \
Expand All @@ -125,7 +127,7 @@ Install dependencies:
Download and install from source:

```bash
git clone --recurse-submodules https://github.com/MisterTea/EternalTerminal.git
git clone --recurse-submodules --depth 1 https://github.com/MisterTea/EternalTerminal.git
cd EternalTerminal
mkdir build
cd build
Expand All @@ -136,7 +138,7 @@ sudo make install

### Windows

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

### Docker Image

Expand All @@ -146,7 +148,7 @@ See [docker/README.md](docker/)

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`.
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!

Expand All @@ -160,21 +162,27 @@ ET uses ssh for handshaking and encryption, so you must be able to ssh into the

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 one if necessary.

```bash
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.

```bash
et hostname --jumphost jump_hostname (etserver running on port 2022 on both hostname and jumphost)
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 accepts are port forwarding pairs with option `-t "18000:8000, 18001-18003:8001-8003"`, a command to run immediately after the connection is set up through `-c`.

Starting from the latest release, et supports parsing both user-specific and system-wide ssh config files.
The config file is required when your sshd on server/jumphost is listening on a port that is not 22.
Here is an example SSH config file showing how to set up when
Additional arguments that et accepts 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 files.
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 that is not 22
- connecting to a different username other than the current one.
Expand All @@ -201,18 +209,16 @@ et dev:8000 -jport 9000 (etserver running on port 9000 on jumphost)
To build Eternal Terminal on Mac, the easiest way is to grab dependencies with Homebrew:

```bash
brew install --only-dependencies MisterTea/et/et
git clone --recurse-submodules https://github.com/MisterTea/EternalTerminal.git
brew install autoconf automake libtool
git clone --recurse-submodules --depth 1 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
make -j$(nproc) && sudo make install
```

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

```bash
Expand All @@ -227,32 +233,31 @@ Grab the deps and then follow this process.
Debian/Ubuntu Dependencies:

```bash
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
sudo apt install libsodium-dev autoconf libtool \
libprotobuf-dev protobuf-compiler libutempter-dev libcurl4-openssl-dev \
build-essential ninja-build cmake git zip pkg-config
```

Fetch source, build and install:

```bash
git clone --recurse-submodules https://github.com/MisterTea/EternalTerminal.git
git clone --recurse-submodules --depth 1 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
cmake -DCPACK_GENERATOR=DEB ../
make -j$(nproc) package
sudo dpkg --install *.deb
sudo cp ../etc/et.cfg /etc/
```

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

Disable et server by `sudo systemctl disable --now et`

### CentOS 7

Install dependencies:
```bash
sudo yum install epel-release
sudo yum install cmake3 boost-devel libsodium-devel protobuf-devel \
Expand All @@ -261,14 +266,16 @@ sudo yum install cmake3 boost-devel libsodium-devel protobuf-devel \
```

Install scl dependencies

```bash
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](https://github.com/MisterTea/EternalTerminal/issues/238)):

```bash
git clone --recurse-submodules https://github.com/MisterTea/EternalTerminal.git
git clone --recurse-submodules --depth 1 https://github.com/MisterTea/EternalTerminal.git
cd EternalTerminal
mkdir build
cd build
Expand All @@ -292,6 +299,7 @@ sudo sed -ie "s|ExecStart=[^[:space:]]*[[:space:]]|ExecStart=$(which etserver) |

Alternatively, 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
```
Expand Down
32 changes: 32 additions & 0 deletions debian/postinst
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/sh
set -e
# Automatically added by dh_installsystemd/13.6ubuntu1
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
# This will only remove masks created by d-s-h on package removal.
deb-systemd-helper unmask 'et.service' >/dev/null || true

# was-enabled defaults to true, so new installations run enable.
if deb-systemd-helper --quiet was-enabled 'et.service'; then
# Enables the unit on first installation, creates new
# symlinks on upgrades if the unit file has changed.
deb-systemd-helper enable 'et.service' >/dev/null || true
else
# Update the statefile to add new symlinks (if any), which need to be
# cleaned up on purge. Also remove old symlinks.
deb-systemd-helper update-state 'et.service' >/dev/null || true
fi
fi
# End automatically added section
# Automatically added by dh_installsystemd/13.6ubuntu1
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
if [ -d /run/systemd/system ]; then
systemctl --system daemon-reload >/dev/null || true
if [ -n "$2" ]; then
_dh_action=restart
else
_dh_action=start
fi
deb-systemd-invoke $_dh_action 'et.service' >/dev/null || true
fi
fi
# End automatically added section
21 changes: 21 additions & 0 deletions debian/postrm
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/sh
set -e
# Automatically added by dh_installsystemd/13.6ubuntu1
if [ "$1" = remove ] && [ -d /run/systemd/system ] ; then
systemctl --system daemon-reload >/dev/null || true
fi
# End automatically added section
# Automatically added by dh_installsystemd/13.6ubuntu1
if [ "$1" = "remove" ]; then
if [ -x "/usr/bin/deb-systemd-helper" ]; then
deb-systemd-helper mask 'et.service' >/dev/null || true
fi
fi

if [ "$1" = "purge" ]; then
if [ -x "/usr/bin/deb-systemd-helper" ]; then
deb-systemd-helper purge 'et.service' >/dev/null || true
deb-systemd-helper unmask 'et.service' >/dev/null || true
fi
fi
# End automatically added section
7 changes: 7 additions & 0 deletions debian/prerm
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/sh
set -e
# Automatically added by dh_installsystemd/13.6ubuntu1
if [ -z "${DPKG_ROOT:-}" ] && [ "$1" = remove ] && [ -d /run/systemd/system ] ; then
deb-systemd-invoke stop 'et.service' >/dev/null || true
fi
# End automatically added section
41 changes: 15 additions & 26 deletions docker/Dockerfile.client
Original file line number Diff line number Diff line change
@@ -1,30 +1,19 @@
FROM centos:8 as base
FROM debian:bookworm-slim

# Use ADD to avoid having to install curl
ADD --chmod=644 https://github.com/MisterTea/debian-et/raw/master/et.gpg /etc/apt/trusted.gpg.d/et.gpg

# Use a run cache to speed up rebuilding and avoid having to remove the cache when we're done
RUN --mount=type=cache,mode=0755,target=/var/lib/apt/lists,sharing=locked \
--mount=type=cache,mode=0755,target=/var/cache/apt,sharing=locked \
rm -f /etc/apt/apt.conf.d/docker-clean && \
echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache && \
apt-get update -qq && \
apt-get install -y ca-certificates && \
echo "deb https://github.com/MisterTea/debian-et/raw/master/debian-source/ bookworm main" > /etc/apt/sources.list.d/et.list && \
apt-get update -qq && \
apt-get install -y et openssh-server

ENV BUILD_REPOS="epel-release centos-release-scl" \
BUILD_DEPS="cmake3 boost-devel libsodium-devel protobuf-devel \
protobuf-compiler gflags-devel protobuf-lite-devel git \
perl-IPC-Cmd perl-Data-Dumper libunwind-devel libutempter-devel \
devtoolset-11 devtoolset-11-libatomic-devel rh-git227"


WORKDIR /

RUN yum install -y $BUILD_REPOS && \
yum install -y $BUILD_DEPS && \
git clone --recurse-submodules https://github.com/MisterTea/EternalTerminal.git && \
cd EternalTerminal && \
mkdir build && \
cd build && \
bash -c "scl enable devtoolset-11 rh-git227 'cmake3 ../'" && \
bash -c "scl enable devtoolset-11 'make -j $(grep ^processor /proc/cpuinfo |wc -l) && make install'"

FROM centos:8

RUN yum install -y epel-release && \
yum install -y protobuf-lite libsodium libatomic libunwind

COPY --from=base /usr/bin/etserver /usr/bin/etterminal /usr/bin/htm /usr/bin/htmd /usr/bin/
COPY --from=base /EternalTerminal/etc/et.cfg /etc/et.cfg
COPY --chmod=755 container-entrypoint /bin/container-entrypoint

ENTRYPOINT ["/bin/container-entrypoint", "client"]
45 changes: 15 additions & 30 deletions docker/Dockerfile.server
Original file line number Diff line number Diff line change
@@ -1,34 +1,19 @@
FROM centos:8 as base
FROM debian:bookworm-slim

# Use ADD to avoid having to install curl
ADD --chmod=644 https://github.com/MisterTea/debian-et/raw/master/et.gpg /etc/apt/trusted.gpg.d/et.gpg

# Use a run cache to speed up rebuilding and avoid having to remove the cache when we're done
RUN --mount=type=cache,mode=0755,target=/var/lib/apt/lists,sharing=locked \
--mount=type=cache,mode=0755,target=/var/cache/apt,sharing=locked \
rm -f /etc/apt/apt.conf.d/docker-clean && \
echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache && \
apt-get update -qq && \
apt-get install -y ca-certificates && \
echo "deb https://github.com/MisterTea/debian-et/raw/master/debian-source/ bookworm main" > /etc/apt/sources.list.d/et.list && \
apt-get update -qq && \
apt-get install -y et openssh-server

ENV BUILD_REPOS="epel-release centos-release-scl" \
BUILD_DEPS="cmake3 boost-devel libsodium-devel protobuf-devel \
protobuf-compiler gflags-devel protobuf-lite-devel git \
perl-IPC-Cmd perl-Data-Dumper libunwind-devel libutempter-devel \
devtoolset-11 devtoolset-11-libatomic-devel rh-git227"


WORKDIR /

RUN yum install -y $BUILD_REPOS && \
yum install -y $BUILD_DEPS && \
git clone --recurse-submodules https://github.com/MisterTea/EternalTerminal.git && \
cd EternalTerminal && \
mkdir build && \
cd build && \
bash -c "scl enable devtoolset-11 rh-git227 'cmake3 ../'" && \
bash -c "scl enable devtoolset-11 'make -j $(grep ^processor /proc/cpuinfo |wc -l) && make install'"

FROM centos:8

RUN yum install -y epel-release && \
yum install -y protobuf-lite libsodium openssh-server libatomic libunwind

COPY --from=base /usr/bin/etserver /usr/bin/etterminal /usr/bin/htm /usr/bin/htmd /usr/bin/
COPY --from=base /EternalTerminal/etc/et.cfg /etc/et.cfg
COPY --chmod=755 container-entrypoint /bin/container-entrypoint

EXPOSE 2022 2222

ENTRYPOINT ["/bin/container-entrypoint", "server"]

CMD ["--cfgfile=/etc/et.cfg"]
5 changes: 5 additions & 0 deletions docker/container-entrypoint
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
set -x

if [ "$1" == server ]; then
if [ ! -d /run/sshd ]; then
mkdir /run/sshd
chmod 0755 /run/sshd
fi

/usr/sbin/sshd
shift
exec etserver --logtostdout -v 1 "$@"
Expand Down
Loading

0 comments on commit d475f52

Please sign in to comment.