From b601e9aa2c4fca90e11e8cc100bf6fd9a0862723 Mon Sep 17 00:00:00 2001 From: Jason Gauci Date: Fri, 14 Feb 2020 21:00:10 -0800 Subject: [PATCH 1/7] update debian build files --- deployment/debian.Dockerfile | 2 +- deployment/debian/debian_SOURCE/changelog | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/deployment/debian.Dockerfile b/deployment/debian.Dockerfile index 617e97867..abfe5b734 100644 --- a/deployment/debian.Dockerfile +++ b/deployment/debian.Dockerfile @@ -7,7 +7,7 @@ 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 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 diff --git a/deployment/debian/debian_SOURCE/changelog b/deployment/debian/debian_SOURCE/changelog index 30802b38c..5eeac1f08 100644 --- a/deployment/debian/debian_SOURCE/changelog +++ b/deployment/debian/debian_SOURCE/changelog @@ -1,3 +1,9 @@ +et (6.0.6-##DISTRO##1) ##DISTRO##; urgency=medium + + * https://github.com/MisterTea/EternalTerminal/releases/tag/et-v6.0.6 + + -- Jason Gauci Sat, 25 Jan 2020 16:36:51 -0800 + et (6.0.5-##DISTRO##2) ##DISTRO##; urgency=medium * Add arm64 build on Ubuntu From 5e9846cd84068a44794a5737f9cf514584c60366 Mon Sep 17 00:00:00 2001 From: Johan Date: Tue, 25 Feb 2020 14:39:39 +0000 Subject: [PATCH 2/7] support 'Match host' in SSH config files (#287) Currently 'Match host' is ignored in SSH options parsing, this can lead to the situation where if the next line is (for example) 'User foo', that this option gets applied globally. Fix this by treating any line that has the form of 'Match ' as ''. This way 'Match host ' gets treated as 'host '. --- src/terminal/ParseConfigFile.hpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/terminal/ParseConfigFile.hpp b/src/terminal/ParseConfigFile.hpp index 992d3e185..d244e69ab 100644 --- a/src/terminal/ParseConfigFile.hpp +++ b/src/terminal/ParseConfigFile.hpp @@ -61,6 +61,7 @@ enum ssh_config_opcode_e { SOC_UNSUPPORTED = -1, SOC_HOST, SOC_HOSTNAME, + SOC_MATCH, SOC_PORT, SOC_USERNAME, SOC_TIMEOUT, @@ -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}, @@ -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; @@ -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); From 5fe3750531f967180e60c1f9cbd8cbd2475219be Mon Sep 17 00:00:00 2001 From: SeongChan Lee Date: Tue, 25 Feb 2020 23:42:47 +0900 Subject: [PATCH 3/7] Update Debian installation instruction (#276) * Update Debian installation instruction `github.io` doesn't seem to properly serve files stored in Github LFS. It only serves LFS metadata, not the whole file. * Update Debian stretch to buster --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 3c70762d1..1f2d1a405 100644 --- a/README.md +++ b/README.md @@ -37,10 +37,10 @@ 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 From 44211c04aedb1d64f18776f2505939a951849f4a Mon Sep 17 00:00:00 2001 From: Mateus Caruccio Date: Tue, 25 Feb 2020 11:45:18 -0300 Subject: [PATCH 4/7] Docker container image [need help] (#285) * Docker container image * Add README.md; Missing sshd; --- docker/Dockerfile.client | 27 +++++++++++++++++++++++++++ docker/Dockerfile.server | 31 +++++++++++++++++++++++++++++++ docker/README.md | 36 ++++++++++++++++++++++++++++++++++++ docker/container-entrypoint | 12 ++++++++++++ 4 files changed, 106 insertions(+) create mode 100644 docker/Dockerfile.client create mode 100644 docker/Dockerfile.server create mode 100644 docker/README.md create mode 100755 docker/container-entrypoint diff --git a/docker/Dockerfile.client b/docker/Dockerfile.client new file mode 100644 index 000000000..6bfe7ab86 --- /dev/null +++ b/docker/Dockerfile.client @@ -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"] diff --git a/docker/Dockerfile.server b/docker/Dockerfile.server new file mode 100644 index 000000000..3232a72f8 --- /dev/null +++ b/docker/Dockerfile.server @@ -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"] diff --git a/docker/README.md b/docker/README.md new file mode 100644 index 000000000..0c189f048 --- /dev/null +++ b/docker/README.md @@ -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 +``` diff --git a/docker/container-entrypoint b/docker/container-entrypoint new file mode 100755 index 000000000..e4be87096 --- /dev/null +++ b/docker/container-entrypoint @@ -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 From 729394eceaa575b12c5be594380c64afebc2a071 Mon Sep 17 00:00:00 2001 From: Mateus Caruccio Date: Tue, 25 Feb 2020 13:53:05 -0300 Subject: [PATCH 5/7] Update README for CentOS 7 - Duplication and SCL (#277) * Remove duplicated install instructions for CentoOS * Add instructions to build using SCL on CentOS 7 * Remove centos7 startup notice and dup line. --- README.md | 98 ++++++++++++++++++++++++++++--------------------------- 1 file changed, 50 insertions(+), 48 deletions(-) diff --git a/README.md b/README.md index 1f2d1a405..56e1ddc32 100644 --- a/README.md +++ b/README.md @@ -46,43 +46,8 @@ For debian, use our deb repo. For buster: ### 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 @@ -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) @@ -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: @@ -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 ``` From 03bb1becea84c43b8065941e6df4190a14d44723 Mon Sep 17 00:00:00 2001 From: Jason Gauci Date: Mon, 2 Mar 2020 14:17:38 -0800 Subject: [PATCH 6/7] Update debian deployment --- deployment/debian.Dockerfile | 2 ++ deployment/debian/Vagrantfile | 12 +++++------- deployment/debian/build_all_deb.sh | 15 +++++---------- 3 files changed, 12 insertions(+), 17 deletions(-) diff --git a/deployment/debian.Dockerfile b/deployment/debian.Dockerfile index abfe5b734..f9a2372f6 100644 --- a/deployment/debian.Dockerfile +++ b/deployment/debian.Dockerfile @@ -9,6 +9,8 @@ COPY id_rsa.pub .ssh/ RUN chmod ao-rwx .ssh/id_rsa 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 RUN git config --global user.email "jgmath2000@gmail.com" diff --git a/deployment/debian/Vagrantfile b/deployment/debian/Vagrantfile index be1ae5898..94135af2e 100644 --- a/deployment/debian/Vagrantfile +++ b/deployment/debian/Vagrantfile @@ -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 @@ -97,11 +97,9 @@ max-cache-ttl 34560000" > ~/.gnupg/gpg-agent.conf git clone git@github.com: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 diff --git a/deployment/debian/build_all_deb.sh b/deployment/debian/build_all_deb.sh index 8da4c9160..687c74a76 100644 --- a/deployment/debian/build_all_deb.sh +++ b/deployment/debian/build_all_deb.sh @@ -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 From 9bffd0ca7a36fbc513c0a23b5087e0d782f79ef7 Mon Sep 17 00:00:00 2001 From: Jason Gauci Date: Mon, 2 Mar 2020 14:19:26 -0800 Subject: [PATCH 7/7] Update to 6.0.7 --- CMakeLists.txt | 2 +- deployment/debian/debian_SOURCE/changelog | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index acd3fcc2c..2cbd94588 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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/sanitizers-cmake/cmake" ${CMAKE_MODULE_PATH}) FIND_PACKAGE(Sanitizers) diff --git a/deployment/debian/debian_SOURCE/changelog b/deployment/debian/debian_SOURCE/changelog index 5eeac1f08..beaa04672 100644 --- a/deployment/debian/debian_SOURCE/changelog +++ b/deployment/debian/debian_SOURCE/changelog @@ -1,3 +1,9 @@ +et (6.0.7-##DISTRO##1) ##DISTRO##; urgency=medium + + * https://github.com/MisterTea/EternalTerminal/releases/tag/et-v6.0.7 + + -- Jason Gauci 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