Compare commits
14 Commits
4a871cbdd4
...
master
Author | SHA1 | Date | |
---|---|---|---|
1572aabe53 | |||
7346be9df6 | |||
6b254cc1d7 | |||
290736a056 | |||
87b7db4235 | |||
ddcb565e2f | |||
a247c7edd6 | |||
221c7339e2 | |||
41be82c923 | |||
a0cdaf5428 | |||
23289409a8 | |||
66dde247d7 | |||
9fa52aec35 | |||
fe46e4cc7e |
@ -2,7 +2,7 @@
|
|||||||
title: PlutoSDR
|
title: PlutoSDR
|
||||||
description: Primeros pasos con el PlutoSDR
|
description: Primeros pasos con el PlutoSDR
|
||||||
published: true
|
published: true
|
||||||
date: 2019-06-19T20:14:02.288Z
|
date: 2020-04-19T03:27:22.422Z
|
||||||
tags:
|
tags:
|
||||||
---
|
---
|
||||||
|
|
153
es/traefik.md
Normal file
153
es/traefik.md
Normal file
@ -0,0 +1,153 @@
|
|||||||
|
---
|
||||||
|
title: Traefik v2
|
||||||
|
description: Routing seguro para tus aplicaciones en containers usando Traefik v2 con Let's Encrypt
|
||||||
|
published: true
|
||||||
|
date: 2020-04-19T03:25:17.168Z
|
||||||
|
tags:
|
||||||
|
---
|
||||||
|
|
||||||
|
# Configurar traefik v2 para routing seguro como proxy reverso con HTTPS
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
## Introducción
|
||||||
|
|
||||||
|
Una configuración robusta de proxy inverso es crítica para cualquier configuración selfhosted que tenga elementos expuestos a través de internet. Si bien los servicios de proxy inverso se utilizan a menudo por razones de equilibrio de carga y seguridad, la mayoría de los propietarios de servidores domésticos los utilizan para enrutar las solicitudes dirigidas a diferentes dominios o subdominios a diferentes hosts o servicios internos. En mi caso puedes ver todos mis servicios en https://server.crstian.me/.
|
||||||
|
|
||||||
|
En esto post vamos a ver como configurar Traefik como proxy inverso como por ejemplo [NGINX](https://www.nginx.com/).
|
||||||
|
|
||||||
|
Vamos a ver como hacer routing de forma segura a peticiones dirigidas a un subdominio que apunte a un puero específico de un container, todo ello a través de forma segura mediante HTTPS.
|
||||||
|
|
||||||
|
## ¿Qué es un proxy inverso?
|
||||||
|
|
||||||
|
Un proxy inverso es un tipo de servidor proxy que recupera recursos en nombre de un cliente desde uno o más servidores. Estos recursos son entonces regresados al cliente como si se originaran en el propio servidor Web.
|
||||||
|
|
||||||
|
Lo que explicado de una forma más vulgar sería en nuestro caso acceder a distintos servicios que tenemos de forma local pero desde el exterior y que en este caso Traefik haga el trabajo de routing y dependiendo el subdominio nos lleve a un servicio u otro.
|
||||||
|

|
||||||
|
|
||||||
|
### Balanceo de carga
|
||||||
|
|
||||||
|
Un proxy inverso puede distribuir la carga de solicitudes entrantes a varios servidores, con cada servidor ejecutando su propia área de aplicación.
|
||||||
|
|
||||||
|
Los proxies inversos proporcionan una capa adicional de seguridad al no revelar nunca la dirección IP del servidor backend que realmente maneja las solicitudes. Esto significa que los atacantes normalmente sólo podrán atacar a los propios servidores proxy inversos.
|
||||||
|
|
||||||
|
### Encriptación SSL
|
||||||
|
|
||||||
|
Un proxy inverso lo podemos configurar con encriptación SSL para poder generar certificados automaticamente para cada ruta con [Let's Encrypt](https://letsencrypt.org/es/).
|
||||||
|
|
||||||
|
## Configurar Traefik v2
|
||||||
|
|
||||||
|
En nuestro caso vamos a levantarlo con un [docker-compose.yml](https://docs.docker.com/compose/)
|
||||||
|
|
||||||
|
```
|
||||||
|
version: '3.7'
|
||||||
|
|
||||||
|
services:
|
||||||
|
traefik:
|
||||||
|
image: traefik:latest
|
||||||
|
network_mode: host
|
||||||
|
volumes:
|
||||||
|
- ./config/:/etc/traefik/
|
||||||
|
- /var/run/docker.sock:/var/run/docker.sock
|
||||||
|
```
|
||||||
|
Ahora vamos a configurar Traefik con su archivo de configuración traefik.toml.
|
||||||
|
|
||||||
|
```
|
||||||
|
api:
|
||||||
|
dashboard: true
|
||||||
|
|
||||||
|
entryPoints:
|
||||||
|
web:
|
||||||
|
address: ":80"
|
||||||
|
web-secure:
|
||||||
|
address: ":443"
|
||||||
|
|
||||||
|
providers:
|
||||||
|
docker:
|
||||||
|
endpoint: "unix:///var/run/docker.sock"
|
||||||
|
exposedByDefault: false
|
||||||
|
file:
|
||||||
|
filename: /etc/traefik/config.yml
|
||||||
|
watch: true
|
||||||
|
|
||||||
|
certificatesResolvers:
|
||||||
|
default:
|
||||||
|
acme:
|
||||||
|
email: your email
|
||||||
|
storage: /etc/traefik/acme/acme.json
|
||||||
|
tlsChallenge: {}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Integración con Docker
|
||||||
|
|
||||||
|
Traefik utiliza la API de cada [proveedor](https://docs.traefik.io/providers/overview/) para encontrar información de routing y configurarse en función a ello.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
### Puntos de entrada
|
||||||
|
|
||||||
|
Los puntos de entrada simplemente definen los puertos en los que Traefik escuchará para recibir los paquetes. Aquí se configuran dos puntos de entrada, web y websecure para los puertos 80 y 443.
|
||||||
|
|
||||||
|
## Configuración de los containers
|
||||||
|
|
||||||
|
El último paso para exponer nuestro container usando Traefik es añadir algunas etiquetas Docker que permitirán a Traefik encontrarlo.
|
||||||
|
|
||||||
|
Estas son las etiquetas necesarias:
|
||||||
|
|
||||||
|
```
|
||||||
|
labels:
|
||||||
|
- traefik.enable=true
|
||||||
|
- traefik.http.routers.yourservicename.entryPoints=web-secure
|
||||||
|
- traefik.http.routers.yourservicename.rule=Host(`subdomain.your.domain`)
|
||||||
|
- traefik.http.routers.yourservicename.tls=true
|
||||||
|
- traefik.http.routers.yourservicename.middlewares=user:password
|
||||||
|
- traefik.http.services.yourservicename.loadbalancer.server.port=serviceport
|
||||||
|
```
|
||||||
|
- `yourservicename` tenemos que cambiarlo por el nombre de nuestra aplicación, por ejemplo `netdata`
|
||||||
|
|
||||||
|
- `subdomain.your.domain` tenemos que cambiarlo por nuestro subdominio que queremos que apunte a nuestra aplicación, por ejemplo `netdata.crstian.me`
|
||||||
|
|
||||||
|
- `serviceport` aquí tenemos que cambiarlo por el puerto que use nuestro servicio
|
||||||
|
|
||||||
|
- `user:password` en caso de que queramos ponerle usuario y contraseña para entrar a ese servicio debemos usar usuario y contraseña como si fuera htaccess
|
||||||
|
|
||||||
|
|
||||||
|
Un ejemplo de un servicio que tengo corriendo en mi servidor con su docker-compose.yml
|
||||||
|
|
||||||
|
```
|
||||||
|
version: '3'
|
||||||
|
services:
|
||||||
|
caddy:
|
||||||
|
image: abiosoft/caddy
|
||||||
|
volumes:
|
||||||
|
- '/storage/shared:/srv'
|
||||||
|
labels:
|
||||||
|
- traefik.enable=true
|
||||||
|
- traefik.http.routers.caddy.entryPoints=web-secure
|
||||||
|
- traefik.http.routers.caddy.rule=Host(`downloads.crstian.me`)
|
||||||
|
- traefik.http.routers.caddy.tls.certresolver=default
|
||||||
|
- traefik.http.services.caddy.loadbalancer.server.port=2015
|
||||||
|
- traefik.http.routers.caddy.middlewares=torrent
|
||||||
|
- traefik.http.middlewares.torrent.basicAuth.users=mypasswordbro
|
||||||
|
restart: unless-stopped
|
||||||
|
```
|
||||||
|
## Traefik Dashboard
|
||||||
|
|
||||||
|
Por último vamos a configurar dentro del propio traefik para que podamos acceder a su dashboard mediante un subdominio.
|
||||||
|
|
||||||
|
Dentro del archivo config.yml tenemos que tener lo siguiente:
|
||||||
|
|
||||||
|
```
|
||||||
|
traefik:
|
||||||
|
rule: Host(`traefik.crstian.me`)
|
||||||
|
entryPoints:
|
||||||
|
- "web-secure"
|
||||||
|
service: api@internal
|
||||||
|
middlewares:
|
||||||
|
- auth
|
||||||
|
tls:
|
||||||
|
certResolver: default
|
||||||
|
```
|
||||||
|
Nos deberá mostrar este dashboard
|
||||||
|
|
||||||
|

|
@ -2,7 +2,7 @@
|
|||||||
title: Nextcloud & Collabora
|
title: Nextcloud & Collabora
|
||||||
description: How to configure a properly working setup using Traefik
|
description: How to configure a properly working setup using Traefik
|
||||||
published: true
|
published: true
|
||||||
date: 2020-02-04T21:43:55.169Z
|
date: 2020-05-07T11:33:22.135Z
|
||||||
tags:
|
tags:
|
||||||
---
|
---
|
||||||
|
|
||||||
@ -10,69 +10,91 @@ tags:
|
|||||||
|
|
||||||
Our setup relies heavily on `traefik` and won't work without it. See our traefik configuration page on how to prepare your system to accept this configuration.
|
Our setup relies heavily on `traefik` and won't work without it. See our traefik configuration page on how to prepare your system to accept this configuration.
|
||||||
|
|
||||||
> This configuration hasn't been updated to Traefik v2 yet
|
|
||||||
{.is-warning}
|
|
||||||
|
|
||||||
|
|
||||||
# docker-compose.yml
|
# docker-compose.yml
|
||||||
|
|
||||||
```
|
```
|
||||||
version: '3.7'
|
version: '3'
|
||||||
|
|
||||||
services:
|
services:
|
||||||
|
|
||||||
nextcloud:
|
nginx:
|
||||||
image: nextcloud:16
|
image: nginx:alpine
|
||||||
|
restart: unless-stopped
|
||||||
|
volumes:
|
||||||
|
- ./nginx.conf:/etc/nginx/nginx.conf
|
||||||
|
- ./nextcloud:/var/www/html
|
||||||
|
labels:
|
||||||
|
- traefik.enable=true
|
||||||
|
- traefik.http.routers.cloud.entryPoints=web-secure
|
||||||
|
- traefik.http.routers.cloud.rule=Host(`cloud.fosc.space`)
|
||||||
|
- traefik.http.routers.cloud.tls.certresolver=default
|
||||||
|
- traefik.http.routers.cloud.middlewares=cloud@docker
|
||||||
|
- traefik.http.middlewares.cloud.headers.customFrameOptionsValue=SAMEORIGIN
|
||||||
|
- traefik.http.middlewares.cloud.headers.framedeny=true
|
||||||
|
- traefik.http.middlewares.cloud.headers.sslredirect=true
|
||||||
|
- traefik.http.middlewares.cloud.headers.stsSeconds=15552000
|
||||||
depends_on:
|
depends_on:
|
||||||
- postgres
|
- fpm
|
||||||
- collabora
|
|
||||||
- redis
|
fpm:
|
||||||
|
image: nextcloud
|
||||||
|
restart: unless-stopped
|
||||||
volumes:
|
volumes:
|
||||||
- ./nextcloud:/var/www/html
|
- ./nextcloud:/var/www/html
|
||||||
restart: unless-stopped
|
|
||||||
environment:
|
environment:
|
||||||
- NEXTCLOUD_TRUSTED_DOMAINS=cloud.fosc.space
|
- NEXTCLOUD_TRUSTED_DOMAINS=cloud.fosc.space
|
||||||
- POSTGRES_HOST=postgres
|
|
||||||
- POSTGRES_USER=postgres
|
|
||||||
- POSTGRES_PASSWORD=aaaaaaaaaaaaa
|
|
||||||
- POSTGRES_DB=nextcloud
|
|
||||||
- REDIS_HOST=redis
|
- REDIS_HOST=redis
|
||||||
labels:
|
- MYSQL_HOST=mariadb
|
||||||
- "traefik.frontend.rule=Host:cloud.fosc.space"
|
- MYSQL_USER=nextcloud
|
||||||
- "traefik.frontend.headers.STSSeconds=15552000"
|
- MYSQL_PASSWORD=hunter2
|
||||||
- "traefik.frontend.redirect.regex=https://(.*)/.well-known/(card|cal)dav"
|
- MYSQL_DATABASE=nextcloud
|
||||||
- "traefik.frontend.redirect.replacement=https://$$1/remote.php/dav/"
|
- NEXTCLOUD_ADMIN_USER=admin
|
||||||
- "traefik.frontend.redirect.permanent=true"
|
- NEXTCLOUD_ADMIN_PASSWORD=hunter2
|
||||||
|
depends_on:
|
||||||
|
- mariadb
|
||||||
|
- redis
|
||||||
|
- cron
|
||||||
|
|
||||||
postgres:
|
mariadb:
|
||||||
image: postgres:alpine
|
image: mariadb
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
environment:
|
environment:
|
||||||
- POSTGRES_USER=postgres
|
- MYSQL_ROOT_PASSWORD=hunter2
|
||||||
- POSTGRES_PASSWORD=aaaaaaaaaaaaa
|
- MYSQL_USER=nextcloud
|
||||||
|
- MYSQL_PASSWORD=hunter2
|
||||||
|
- MYSQL_DATABASE=nextcloud
|
||||||
volumes:
|
volumes:
|
||||||
- ./db:/var/lib/postgresql/data
|
- ./db:/var/lib/mysql
|
||||||
labels:
|
|
||||||
- traefik.enable=false
|
|
||||||
|
|
||||||
collabora:
|
collabora:
|
||||||
image: collabora/code
|
image: collabora/code
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
environment:
|
environment:
|
||||||
- username=admin
|
- username=admin
|
||||||
- password=eeeeeeeeeeeee
|
- password=hunter3
|
||||||
- DONT_GEN_SSL_CERT=true
|
- DONT_GEN_SSL_CERT=true
|
||||||
- "domain=cloud\\.fosc\\.space"
|
- "domain=cloud\\.fosc\\.space"
|
||||||
- "extra_params=--o:ssl.enable=false --o:ssl.termination=true --o:storage.wopi.host[0]=::ffff:[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+ --o:net.post_allow.host[0]=::ffff:[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+ --o:storage.wopi.host[1]=[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+ --o:net.post_allow.host[1]=[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+ --o:storage.wopi.host[2]=cloud.fosc.space"
|
- "extra_params=--o:ssl.enable=false --o:ssl.termination=true --o:storage.wopi.host[0]=::ffff:[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+ --o:net.post_allow.host[0]=::ffff:[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+ --o:storage.wopi.host[1]=[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+ --o:net.post_allow.host[1]=[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+ --o:storage.wopi.host[2]=cloud.fosc.space"
|
||||||
labels:
|
labels:
|
||||||
- "traefik.frontend.rule=Host:collabora.fosc.space"
|
- traefik.enable=true
|
||||||
- "traefik.port=9980"
|
- traefik.http.routers.coll.entryPoints=web-secure
|
||||||
|
- traefik.http.routers.coll.rule=Host(`collabora.fosc.space`)
|
||||||
|
- traefik.http.routers.coll.tls.certresolver=default
|
||||||
|
- traefik.http.services.coll.loadbalancer.server.port=9980
|
||||||
|
|
||||||
redis:
|
redis:
|
||||||
image: redis
|
image: redis:alpine
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
labels:
|
|
||||||
- traefik.enable=false
|
cron:
|
||||||
|
image: nextcloud
|
||||||
|
restart: always
|
||||||
|
volumes:
|
||||||
|
- ./nextcloud:/var/www/html
|
||||||
|
entrypoint: /cron.sh
|
||||||
|
depends_on:
|
||||||
|
- mariadb
|
||||||
|
- redis
|
||||||
```
|
```
|
||||||
|
|
||||||
# Nextcloud configuration
|
# Nextcloud configuration
|
||||||
@ -83,12 +105,6 @@ Once everything is up and running, install the Collabora plugin for Nextcloud an
|
|||||||
{.is-info}
|
{.is-info}
|
||||||
|
|
||||||
# Quirks
|
# Quirks
|
||||||
> Due to issues within Nextcloud 16, the installer cannot initialize its database properly in postgres. This setup requires a workaround for a first start, a pre existing database, or another database engine.
|
> To get rid of the secure proxy warning, add a `NEXTCLOUD_TRUSTED_PROXIES` entry to Nextcloud's config.php with your host's hostname or IP address. For some reason, this configuration is not exposed via environment variables and cannot be fixed from docker-compose.
|
||||||
|
|
||||||
|
|
||||||
> The Collabora container is extremely slow to start and seems to work about only half the time. If stuff isn't working, just restart it once or twice. Eventually it will work.
|
|
||||||
|
|
||||||
>This configuration is 100% working and any attempt at touching it will just make it worse.
|
|
||||||
{.is-warning}
|
|
||||||
|
|
||||||
|
|
||||||
|
21
services.md
21
services.md
@ -2,10 +2,14 @@
|
|||||||
title: Services
|
title: Services
|
||||||
description: FOSC as a service, or FAAS
|
description: FOSC as a service, or FAAS
|
||||||
published: true
|
published: true
|
||||||
date: 2019-10-05T22:29:44.614Z
|
date: 2020-04-30T22:06:46.253Z
|
||||||
tags:
|
tags:
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
||||||
|
> View them all in a beautiful form at [services.fosc.space](https://services.fosc.space)
|
||||||
|
{.is-success}
|
||||||
|
|
||||||
# Publicly accessible services
|
# Publicly accessible services
|
||||||
> Anyone can see (some of) the content stored here, as a member you have full access
|
> Anyone can see (some of) the content stored here, as a member you have full access
|
||||||
{.is-info}
|
{.is-info}
|
||||||
@ -79,14 +83,23 @@ Sometimes you forget
|
|||||||
{.is-info}
|
{.is-info}
|
||||||
|
|
||||||
### Minecraft servers
|
### Minecraft servers
|
||||||
|
|
||||||
|
###### Vanilla
|
||||||
`fosc.space`
|
`fosc.space`
|
||||||
`fosc.space:25566`
|
###### FTB Revelations
|
||||||
`fosc.space:25567`
|
`ftb.fosc.space`
|
||||||
|
###### Roguelike Adventures and Dungeons
|
||||||
|
`adventure.fosc.space`
|
||||||
|
###### RLCraft
|
||||||
|
`rlcraft.fosc.space`
|
||||||
|
|
||||||
### Minecraft Bedrock server
|
### Minecraft Bedrock server
|
||||||
`fosc.space`
|
`fosc.space`
|
||||||
|
|
||||||
### Factorio server
|
### CSGO Server
|
||||||
|
`fosc.space`
|
||||||
|
|
||||||
|
### Starbound Server
|
||||||
`fosc.space`
|
`fosc.space`
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user