cleanup; Readme still in WIP
This commit is contained in:
parent
321acaf85d
commit
e356e4cf16
6 changed files with 17 additions and 252 deletions
65
README.md
65
README.md
|
@ -1,15 +1,13 @@
|
|||
# `sso.base23.de` - Base23 SSO for all services
|
||||
# `sso.s1q.dev` - Base23 SSO for all services
|
||||
|
||||
[Authentik](https://goauthentik.io/) based SSO for our sevices.
|
||||
|
||||
## Table of Contents
|
||||
|
||||
- [`sso.base23.de` - Base23 SSO for all services](#ssobase23de---base23-sso-for-all-services)
|
||||
- [`sso.s1q.dev` - Base23 SSO for all services](#ssos1qdev---base23-sso-for-all-services)
|
||||
- [Table of Contents](#table-of-contents)
|
||||
- [Prerequisites](#prerequisites)
|
||||
- [Server Setup](#server-setup)
|
||||
- [Tailscale](#tailscale)
|
||||
- [Base23 Docker registry login](#base23-docker-registry-login)
|
||||
- [CrowdSec](#crowdsec)
|
||||
- [Setup CrowdSec Repo](#setup-crowdsec-repo)
|
||||
- [Install CrowdSec](#install-crowdsec)
|
||||
|
@ -25,32 +23,7 @@
|
|||
|
||||
## Prerequisites
|
||||
|
||||
### Server Setup
|
||||
|
||||
```shell
|
||||
apt update \
|
||||
&& apt upgrade -y \
|
||||
&& for pkg in docker.io docker-doc docker-compose podman-docker containerd runc; do sudo apt remove $pkg; done \
|
||||
&& apt install ca-certificates curl \
|
||||
&& install -m 0755 -d /etc/apt/keyrings \
|
||||
&& curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc \
|
||||
&& chmod a+r /etc/apt/keyrings/docker.asc \
|
||||
&& echo \
|
||||
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian \
|
||||
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
|
||||
tee /etc/apt/sources.list.d/docker.list > /dev/null \
|
||||
&& apt update \
|
||||
&& apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin \
|
||||
&& mkdir -p /var/lib/apps \
|
||||
&& ln -s /var/lib/apps \
|
||||
&& apt install -y git vim \
|
||||
&& TEMP_DIR=$(mktemp -d) \
|
||||
&& curl -fsSL https://github.com/go-acme/lego/releases/download/v4.20.2/lego_v4.20.2_linux_amd64.tar.gz -o ${TEMP_DIR}/lego_v4.20.2_linux_amd64.tar.gz \
|
||||
&& tar xzvf ${TEMP_DIR}/lego_v4.20.2_linux_amd64.tar.gz --directory=${TEMP_DIR} \
|
||||
&& install -m 755 -o root -g root "${TEMP_DIR}/lego" "/usr/local/bin" \
|
||||
&& rm -rf ${TEMP_DIR} \
|
||||
&& unset TEMP_DIR
|
||||
```
|
||||
- dokploy
|
||||
|
||||
### Tailscale
|
||||
|
||||
|
@ -61,18 +34,12 @@ printf "Enter preauthkey for Tailscale: " \
|
|||
&& 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 \
|
||||
&& tailscale up --login-server https://vpn.s1q.dev --authkey ${TAILSCALE_PREAUTHKEY} \
|
||||
&& sleep 2 \
|
||||
&& tailscale status \
|
||||
&& unset TAILSCALE_PREAUTHKEY
|
||||
```
|
||||
|
||||
### Base23 Docker registry login
|
||||
|
||||
```shell
|
||||
docker login -u gitlab+deploy-token-5 registry.git.base23.de
|
||||
```
|
||||
|
||||
### CrowdSec
|
||||
|
||||
#### Setup CrowdSec Repo
|
||||
|
@ -116,9 +83,9 @@ systemctl restart crowdsec; systemctl status crowdsec.service
|
|||
Whitelist Tailscale IPs:
|
||||
|
||||
```shell
|
||||
cat << EOF > /etc/crowdsec/parsers/s02-enrich/01-base23-tailscale.yaml \
|
||||
cat << EOF > /etc/crowdsec/parsers/s02-enrich/01-s1q-dev-tailscale.yaml \
|
||||
&& systemctl restart crowdsec; journalctl -xef -u crowdsec.service
|
||||
name: base23/tailscale ## Must be unqiue
|
||||
name: s1q-dev/tailscale ## Must be unqiue
|
||||
description: "Whitelist events from Tailscale Subnet"
|
||||
whitelist:
|
||||
reason: "Tailscale clients"
|
||||
|
@ -127,18 +94,18 @@ whitelist:
|
|||
EOF
|
||||
```
|
||||
|
||||
Whitelist our current Public IPs:
|
||||
Whitelist my current Public IPs:
|
||||
|
||||
```shell
|
||||
mkdir -p /etc/crowdsec/postoverflows/s01-whitelist/ \
|
||||
&& cat << EOF > /etc/crowdsec/postoverflows/s01-whitelist/01-base23-public-ips.yaml \
|
||||
&& cat << EOF > /etc/crowdsec/postoverflows/s01-whitelist/01-s1q-dev-public-ips.yaml \
|
||||
&& crowdsec -t && systemctl restart crowdsec; systemctl status crowdsec.service
|
||||
name: base23/public-ips ## Must be unqiue
|
||||
description: "Whitelist events from base23 public IPs"
|
||||
name: s1q-dev/public-ips ## Must be unqiue
|
||||
description: "Whitelist events from s1q-dev public IPs"
|
||||
whitelist:
|
||||
reason: "Base23 Public IPs"
|
||||
reason: "s1q-dev Public IPs"
|
||||
expression:
|
||||
- evt.Overflow.Alert.Source.IP in LookupHost("asterix.ddns.base23.de")
|
||||
- evt.Overflow.Alert.Source.IP in LookupHost("r3w.de")
|
||||
EOF
|
||||
```
|
||||
|
||||
|
@ -151,8 +118,8 @@ cscli collections install firix/authentik \
|
|||
---
|
||||
source: docker
|
||||
container_name_regexp:
|
||||
- sso-base23-de-server-*
|
||||
- sso-base23-de-worker-*
|
||||
- sso-s1q-dev-de-server-*
|
||||
- sso-s1q-dev-de-worker-*
|
||||
labels:
|
||||
type: authentik
|
||||
EOF
|
||||
|
@ -177,8 +144,8 @@ Setup notifications:
|
|||
|
||||
```shell
|
||||
cd /root/apps \
|
||||
&& git clone ssh://git@git.base23.de:222/base23/sso.base23.de.git \
|
||||
&& cd sso.base23.de \
|
||||
&& git clone ssh://git@git.base23.de:222/base23/sso.s1q.dev.git \
|
||||
&& cd sso.s1q.dev \
|
||||
&& ./scripts/init.sh
|
||||
```
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue