Add Tailscale configuration

This commit is contained in:
Philip Henning 2024-12-03 17:48:02 +01:00
parent 1e210137ad
commit 71ac76ea98

View file

@ -8,6 +8,7 @@
- [Table of Contents](#table-of-contents) - [Table of Contents](#table-of-contents)
- [Prerequisites](#prerequisites) - [Prerequisites](#prerequisites)
- [Server Setup](#server-setup) - [Server Setup](#server-setup)
- [Tailscale](#tailscale)
- [Base23 Docker registry login](#base23-docker-registry-login) - [Base23 Docker registry login](#base23-docker-registry-login)
- [CrowdSec](#crowdsec) - [CrowdSec](#crowdsec)
- [Setup CrowdSec Repo](#setup-crowdsec-repo) - [Setup CrowdSec Repo](#setup-crowdsec-repo)
@ -48,6 +49,21 @@ apt update \
&& unset TEMP_DIR && unset TEMP_DIR
``` ```
### Tailscale
```shell
printf "Enter preauthkey for Tailscale: " \
&& read -rs TAILSCALE_PREAUTHKEY \
&& curl -fsSL https://pkgs.tailscale.com/stable/debian/bookworm.noarmor.gpg | sudo tee /usr/share/keyrings/tailscale-archive-keyring.gpg >/dev/null \
&& curl -fsSL https://pkgs.tailscale.com/stable/debian/bookworm.tailscale-keyring.list | sudo tee /etc/apt/sources.list.d/tailscale.list \
&& apt-get update \
&& apt-get install tailscale \
&& tailscale up --login-server https://vpn.base23.de --authkey ${TAILSCALE_PREAUTHKEY} --advertise-tags=tag:prod-servers \
&& sleep 2 \
&& tailscale status \
&& unset TAILSCALE_PREAUTHKEY
```
### Base23 Docker registry login ### Base23 Docker registry login
```shell ```shell
@ -74,10 +90,22 @@ EOF
#### Install CrowdSec #### Install CrowdSec
Install CrowdSec:
```shell ```shell
apt install -y crowdsec crowdsec-firewall-bouncer-iptables \ printf "Enter CrowdSec context: " \
&& read -rs CROWDSEC_CONTEXT \
&& apt install -y crowdsec crowdsec-firewall-bouncer-iptables \
&& cscli completion bash | tee /etc/bash_completion.d/cscli \ && cscli completion bash | tee /etc/bash_completion.d/cscli \
&& source ~/.bashrc && source ~/.bashrc \
&& cscli console enroll -e context ${CROWDSEC_CONTEXT} \
&& unset CROWDSEC_CONTEXT
```
Restart CordSec Service, after accepting the enrollment on the [CrowdSec Console](https://app.crowdsec.net/):
```shell
systemctl restart crowdsec; systemctl status crowdsec.service
``` ```
#### Configure CrowdSec #### Configure CrowdSec