initial commit

This commit is contained in:
surtur 2021-03-04 13:16:53 +01:00
commit 252a77ce08
Signed by: wanderer
GPG Key ID: 19CE1EC1D9E0486D
4 changed files with 67 additions and 0 deletions

31
README.md Normal file
View File

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

21
docker-compose.yml Normal file
View File

@ -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

4
example.tmate.conf Normal file
View File

@ -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"

11
tmate.service Normal file
View File

@ -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