From 252a77ce086785214a25757567808fbb0f157c36 Mon Sep 17 00:00:00 2001 From: surtur Date: Thu, 4 Mar 2021 13:16:53 +0100 Subject: [PATCH] initial commit --- README.md | 31 +++++++++++++++++++++++++++++++ docker-compose.yml | 21 +++++++++++++++++++++ example.tmate.conf | 4 ++++ tmate.service | 11 +++++++++++ 4 files changed, 67 insertions(+) create mode 100644 README.md create mode 100644 docker-compose.yml create mode 100644 example.tmate.conf create mode 100644 tmate.service diff --git a/README.md b/README.md new file mode 100644 index 0000000..7c08d31 --- /dev/null +++ b/README.md @@ -0,0 +1,31 @@ +# tmate + +this repo holds +* `docker-compose.yml` for our instance of [tmate](https://tmate.io) +* `systemd` unit file to easily start/stop/manage the service +* example tmate config to let clients make use of our instance + +> Note: commands below are to be run from the project folder + +#### server-side setup + +```sh +mkdir -pv /etc/tmate +cp -v docker-compose.yml /etc/tmate/ +cp -v tmate.service /etc/systemd/system/ +systemctl daemon-reload +systemctl enable --now tmate.service +``` + +#### tmate client setup + +```sh +if [ ! -f $HOME/.tmate.conf ]; then + cp -v example.tmate.conf $HOME/.tmate.conf +else + printf " * file \"$HOME/.tmate.conf\" already present, not doing anything\n" +fi +``` + +after you've got the config in place (and tmate installed locally), run `tmate` + diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..3921288 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,21 @@ +--- +version: '3.4' + +services: + tmate-server: + image: tmate/tmate-ssh-server:latest + ports: + - 2200:2200 + volumes: + - /etc/ssh/ssh_host_ed25519_key:/ssh/ssh_host_ed25519_key:ro + - /etc/ssh/ssh_host_rsa_key:/ssh/ssh_host_rsa_key:ro + networks: + - default + restart: always + environment: + SSH_KEYS_PATH: /ssh + SSH_HOSTNAME: dotya.ml + SSH_PORT_LISTEN: 2200 + cap_add: + - SYS_ADMIN + diff --git a/example.tmate.conf b/example.tmate.conf new file mode 100644 index 0000000..65ebf4b --- /dev/null +++ b/example.tmate.conf @@ -0,0 +1,4 @@ +set -g tmate-server-host "dotya.ml" +set -g tmate-server-port 2200 +set -g tmate-server-rsa-fingerprint "SHA256:2t/JTS5p/AGee3mj3DRCWVhnGAjxC67akaG+qE9J4cU" +set -g tmate-server-ed25519-fingerprint "SHA256:i6DvPgfdDa9vafcCYdsleV1v5P2WFPHrNt/eJWL1KTo" diff --git a/tmate.service b/tmate.service new file mode 100644 index 0000000..3a685f3 --- /dev/null +++ b/tmate.service @@ -0,0 +1,11 @@ +[Unit] +Description=tmate server +After=docker.service + +[Service] +Restart=always +ExecStart=/usr/bin/docker-compose -f /etc/tmate/docker-compose.yml up +ExecStop=/usr/bin/docker-compose -f /etc/tmate/docker-compose.yml stop + +[Install] +WantedBy=multi-user.target