Skip to content

Commit

Permalink
Merge branch 'master' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
MisterTea committed Mar 2, 2020
2 parents 934835d + 9bffd0c commit 726c34b
Show file tree
Hide file tree
Showing 11 changed files with 194 additions and 72 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cmake_minimum_required (VERSION 3.0.2)
project (EternalTCP VERSION 6.0.6)
project (EternalTCP VERSION 6.0.7)

SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/external_imported/sanitizers-cmake/cmake" ${CMAKE_MODULE_PATH})
FIND_PACKAGE(Sanitizers)
Expand Down
104 changes: 53 additions & 51 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,52 +37,17 @@ Once built, the binary only requires `libgflags-dev` and `libprotobuf-dev`.

### Debian

For debian, use our deb repo. For stretch:
For debian, use our deb repo. For buster:

echo "deb https://mistertea.github.io/debian-et/debian-source/ stretch main" | sudo tee -a /etc/apt/sources.list
curl -sS https://mistertea.github.io/debian-et/et.gpg | sudo apt-key add -
echo "deb https://github.com/MisterTea/debian-et/raw/master/debian-source/ buster main" | sudo tee -a /etc/apt/sources.list
curl -sS https://github.com/MisterTea/debian-et/raw/master/et.gpg | sudo apt-key add -
sudo apt update
sudo apt install et


### CentOS 7
_Note: As of April 2019, the service does not start on CentOS 7, see [#182](https://github.com/MisterTea/EternalTerminal/issues/182)_

Install dependencies:
```
sudo yum -y install epel-release
sudo yum install cmake3
sudo yum install boost-devel libsodium-devel ncurses-devel protobuf-devel \
protobuf-compiler cmake gflags-devel protobuf-lite-devel
```

Download and install from source:
```
git clone --recurse-submodules https://github.com/MisterTea/EternalTerminal.git
cd EternalTerminal
mkdir build
cd build
cmake3 ../
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:
Open up /etc/systemd/system/et.service in an editor.
Correct the ExectStart line to have the correct path to the etserver binary (see [#180](https://github.com/MisterTea/EternalTerminal/issues/180)).

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

Start the et service:

```
sudo systemctl enable et.service
sudo systemctl start et.service
```
Up to the present day the only way to install is to [build from source](#centos-7).


### FreeBSD
Expand Down Expand Up @@ -149,7 +114,6 @@ 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 if necessary.
```
et hostname (etserver running on default port 2022, username is the same as current)
Expand Down Expand Up @@ -200,21 +164,14 @@ cmake ../
make
```

### Debian/Ubuntu/CentOS
### Debian/Ubuntu

Grab the deps and then follow this process:

Debian/Ubuntu Dependencies:
```
sudo apt install libboost-dev libsodium-dev libncurses5-dev libprotobuf-dev protobuf-compiler cmake libgflags-dev libutempter-dev cmake git
```

CentOS/RHEL Dependencies:
```
sudo yum -y install epel-release
sudo yum install cmake3
sudo yum install boost-devel libsodium-devel ncurses-devel protobuf-devel \
protobuf-compiler cmake gflags-devel
sudo apt install libboost-dev libsodium-dev libncurses5-dev \
libprotobuf-dev protobuf-compiler cmake libgflags-dev libutempter-dev cmake git
```

Source and setup:
Expand All @@ -229,11 +186,56 @@ make
sudo make install
```

Copy config file, the service and enable it:
### CentOS 7

Install dependencies:
```
sudo yum install epel-release
sudo yum install cmake3 boost-devel libsodium-devel ncurses-devel protobuf-devel \
protobuf-compiler gflags-devel protobuf-lite-devel
```

Install scl dependencies
```
sudo yum install centos-release-scl
sudo yum install devtoolset-8
```

Download and install from source ([see #238 for details](https://github.com/MisterTea/EternalTerminal/issues/238)):
```
git clone --recurse-submodules https://github.com/MisterTea/EternalTerminal.git
cd EternalTerminal
mkdir build
cd build
scl enable devtoolset-8 'cmake3 ../'
scl enable devtoolset-8 '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](https://github.com/MisterTea/EternalTerminal/issues/180) for details).

```
sudo sed -ie "s|ExecStart=.*[[: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 --daemon --cfgfile=/etc/et.cfg

Reload systemd configs:

```
sudo systemctl daemon-reload
```

Start the et service:

```
sudo systemctl enable et.service
sudo systemctl start et.service
```
Expand Down
4 changes: 3 additions & 1 deletion deployment/debian.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ RUN mkdir .ssh
COPY id_rsa .ssh/
COPY id_rsa.pub .ssh/
RUN chmod ao-rwx .ssh/id_rsa
COPY ubuntu/debian_SOURCE ./debian_SOURCE
COPY debian/debian_SOURCE ./debian_SOURCE

RUN echo "For debian, docker doesn't work with pbuilder. Use vagrant" && exit 1

RUN apt update && apt upgrade -y && apt install -y build-essential git devscripts aptly dput jq libsodium-dev libprotobuf-dev protobuf-compiler cmake libutempter-dev debhelper dh-systemd pbuilder ubuntu-dev-tools

Expand Down
12 changes: 5 additions & 7 deletions deployment/debian/Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ Vagrant.configure("2") do |config|
config.ssh.shell = "sh"

config.vm.provider "virtualbox" do |v|
v.memory = 2048
v.cpus = 8
v.memory = 4096
v.cpus = 4
end

# Disable automatic box update checking. If you disable this, then
Expand Down Expand Up @@ -97,11 +97,9 @@ max-cache-ttl 34560000" > ~/.gnupg/gpg-agent.conf
git clone [email protected]:MisterTea/debian-et.git
for distro in `distro-info --supported | grep -v experimental`; do
pbuilder-dist ${distro} i386 create --debootstrapopts --variant=buildd
pbuilder-dist ${distro} amd64 create --debootstrapopts --variant=buildd
pbuilder-dist ${distro} armhf create --debootstrapopts --variant=buildd
pbuilder-dist ${distro} armel create --debootstrapopts --variant=buildd
pbuilder-dist ${distro} arm64 create --debootstrapopts --variant=buildd
for ARCH in amd64 i386 armhf armel arm64; do
pbuilder-dist ${distro} ${ARCH} create --debootstrapopts --variant=buildd
done
aptly repo create -distribution=${distro} -component=main et-${distro}
done
Expand Down
15 changes: 5 additions & 10 deletions deployment/debian/build_all_deb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,11 @@ for distro in `distro-info --supported | grep -v experimental | grep -v sid`; do
pushd EternalTerminal
debuild -S
popd
pbuilder-dist ${distro} amd64 update
pbuilder-dist ${distro} amd64 build *.dsc
pbuilder-dist ${distro} i386 update
pbuilder-dist ${distro} i386 build *.dsc
pbuilder-dist ${distro} armhf update
pbuilder-dist ${distro} armhf build *.dsc
pbuilder-dist ${distro} armel update
pbuilder-dist ${distro} armel build *.dsc
pbuilder-dist ${distro} arm64 update
pbuilder-dist ${distro} arm64 build *.dsc
for ARCH in amd64 i386 armhf armel arm64
do
pbuilder-dist ${distro} ${ARCH} update
pbuilder-dist ${distro} ${ARCH} build *.dsc
done

aptly repo add -force-replace=true et-${distro} ~/pbuilder/${distro}*_result/*.deb
aptly publish drop ${distro} || true
Expand Down
12 changes: 12 additions & 0 deletions deployment/debian/debian_SOURCE/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
et (6.0.7-##DISTRO##1) ##DISTRO##; urgency=medium

* https://github.com/MisterTea/EternalTerminal/releases/tag/et-v6.0.7

-- Jason Gauci <[email protected]> Mon, 3 Mar 2020 16:36:51 -0800

et (6.0.6-##DISTRO##1) ##DISTRO##; urgency=medium

* https://github.com/MisterTea/EternalTerminal/releases/tag/et-v6.0.6

-- Jason Gauci <[email protected]> Sat, 25 Jan 2020 16:36:51 -0800

et (6.0.5-##DISTRO##2) ##DISTRO##; urgency=medium

* Add arm64 build on Ubuntu
Expand Down
27 changes: 27 additions & 0 deletions docker/Dockerfile.client
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
FROM centos:7 as base

ENV BUILD_REPOS="epel-release centos-release-scl" \
BUILD_DEPS="cmake3 boost-devel libsodium-devel ncurses-devel protobuf-devel \
protobuf-compiler gflags-devel protobuf-lite-devel git devtoolset-8"

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-8 'cmake3 ../'" && \
bash -c "scl enable devtoolset-8 'make -j $(grep ^processor /proc/cpuinfo |wc -l) && make install'"

FROM centos:7

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

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

ENTRYPOINT ["/bin/container-entrypoint", "client"]
31 changes: 31 additions & 0 deletions docker/Dockerfile.server
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
FROM centos:7 as base

ENV BUILD_REPOS="epel-release centos-release-scl" \
BUILD_DEPS="cmake3 boost-devel libsodium-devel ncurses-devel protobuf-devel \
protobuf-compiler gflags-devel protobuf-lite-devel git devtoolset-8"

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-8 'cmake3 ../'" && \
bash -c "scl enable devtoolset-8 'make -j $(grep ^processor /proc/cpuinfo |wc -l) && make install'"

FROM centos:7

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

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

EXPOSE 2022 2222

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

CMD ["--cfgfile=/etc/et.cfg"]
36 changes: 36 additions & 0 deletions docker/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Docker container for et-server

## Build

```
$ make
$ docker images |grep et-.*
et-client latest 54c495fe34dc 11 minutes ago 422MB
et-server latest 1bf233faf414 11 minutes ago 425MB
```

## Run


```
$ 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
```

## Notice

- Both ports 2022 and 2222 must be open at the server host (per example above);
- The container starts an sshd server to initiate et-server's handshake.
- You ssh client must be able to connect to container's sshd, not host's sshd;
- Running `ssh -p 2222 user@host` must work out-of-the box;
- Tip: add below to your client's `~/.ssh/config`:

```
Host myhost
Port 2222
```
12 changes: 12 additions & 0 deletions docker/container-entrypoint
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

set -x

if [ "$1" == server ]; then
/usr/sbin/sshd
shift
exec etserver --logtostdout -v 1 "$@"
else
shift
exec et "$@"
fi
11 changes: 9 additions & 2 deletions src/terminal/ParseConfigFile.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ enum ssh_config_opcode_e {
SOC_UNSUPPORTED = -1,
SOC_HOST,
SOC_HOSTNAME,
SOC_MATCH,
SOC_PORT,
SOC_USERNAME,
SOC_TIMEOUT,
Expand Down Expand Up @@ -142,6 +143,7 @@ struct ssh_config_keyword_table_s {
static struct ssh_config_keyword_table_s ssh_config_keyword_table[] = {
{"host", SOC_HOST},
{"hostname", SOC_HOSTNAME},
{"match", SOC_MATCH},
{"port", SOC_PORT},
{"user", SOC_USERNAME},
{"connecttimeout", SOC_TIMEOUT},
Expand Down Expand Up @@ -1174,8 +1176,8 @@ static int ssh_config_parse_line(const char *targethost, struct Options *options
}

opcode = ssh_config_get_opcode(keyword);
if (*parsing == 1 && opcode != SOC_HOST && opcode != SOC_UNSUPPORTED &&
opcode != SOC_INCLUDE) {
if (*parsing == 1 && opcode != SOC_HOST && opcode != SOC_MATCH &&
opcode != SOC_UNSUPPORTED && opcode != SOC_INCLUDE) {
if (seen[opcode] != 0) {
SAFE_FREE(x);
return 0;
Expand Down Expand Up @@ -1225,6 +1227,11 @@ static int ssh_config_parse_line(const char *targethost, struct Options *options
free(z);
}
break;
case SOC_MATCH:
i = ssh_config_parse_line(targethost, options, s, count, parsing, seen);
SAFE_FREE(x);
return i;
break;
case SOC_PORT:
if (options->port == 0) {
p = ssh_config_get_str_tok(&s, NULL);
Expand Down

0 comments on commit 726c34b

Please sign in to comment.