17 Commits

Author SHA1 Message Date
e8b1c433e9 testing 2022-12-19 02:25:17 -05:00
c67a39982e Option to enable websockets for the noVNC console 2022-12-06 00:15:10 -05:00
f68f57d0cf ROOT_URL should have HTTPS for the clone URL 2022-09-18 15:21:16 -04:00
b9f9b0bf3c Update TLS settings in nginx proxy 2022-08-27 18:56:12 -04:00
4f4a341b05 Add client_max_body_size for Nextcloud 2022-08-19 01:27:55 -04:00
cab6ab2d8e Strip auth header and update external config 2022-08-19 00:51:05 -04:00
95f54b7f0a Add Traefik toggles 2022-08-18 23:32:37 -04:00
7522c333da Disable Traefik LE resolver and HSTS 2022-08-18 21:53:38 -04:00
344b79e97f Add base domain to the wildcard certificate 2022-08-17 02:17:36 -04:00
e4fed78193 Remove basic auth on static nginx sites 2022-08-17 01:40:11 -04:00
85a6c3894a Add basic auth and ignore backend SSL errors 2022-08-17 01:15:15 -04:00
7677bc25fa Add WireGuard firewall rule 2022-08-13 00:19:24 -04:00
b255680a7a Use host MariaDB in Gitea container 2022-08-11 21:04:07 -04:00
9eefad0e87 Install Fail2ban IP allow list 2022-06-28 23:43:58 -04:00
8362230eb4 Add nginx proxy server 2022-06-27 20:21:25 -04:00
82df91305a Install aggressive Fail2ban jail for SSH 2022-06-18 19:47:02 -04:00
dd9f84d498 Create initial log files for fail2ban 2022-06-07 00:25:47 -04:00
34 changed files with 200 additions and 66 deletions

9
.gitignore vendored
View File

@@ -1,12 +1,3 @@
.vagrant .vagrant
.playbook .playbook
/*.yml
/*.yaml
!backup.yml
!moxie.yml
!docker.yml
!dockerbox.yml
!hypervisor.yml
!minecraft.yml
!unifi.yml
/environments/ /environments/

View File

@@ -1,25 +1,39 @@
# Project Moxie # Homelab
This repository contains Ansible to automate Debian GNU/Linux servers, deploying
server technologies that are either useful in a personal capacity or provide
educational value on automating enterprise infrastructure.
Project Moxie is a personal IT homelab project written in Ansible and executed by Jenkins. It is a growing collection of infrastructure as code (IaC) I write out of curiosity and for reference purposes, keeping a handful of beneficial projects managed and secured. Development is accomplished using Vagrant to allow easy reproducibility in an
isolated virtual environment that be ran on your local machine.
## Quick Start ## Quick Start
These steps assume a basic understanding of GNU/Linux, Hypervisors, Vagrant, and Ansible.
To configure a local virtual machine for testing, follow these simple steps.
### Prerequisites ### Prerequisites
- [Vagrant](https://developer.hashicorp.com/vagrant/docs/installation)
Vagrant and VirtualBox are used to develop Project Moxie. You will need to install these before continuing. - [Supported hypervisor](https://developer.hashicorp.com/vagrant/docs/providers)
- Ansible
### Installation ### Installation
1. Clone this repository 1. Clone this repository
``` ```
git clone https://github.com/krislamo/moxie git clone https://git.krislamo.org/kris/homelab
```
OR download from the mirror on GitHub:
```
git clone https://github.com/krislamo/homelab
``` ```
2. Set the `PLAYBOOK` environmental variable to a development playbook name in the `dev/` directory
The following `PLAYBOOK` names are available: `dockerbox`, `hypervisor`, `minecraft`, `bitwarden`, `nextcloud`, `nginx` 2. Find available playbooks for development
```
cd homelab
```
```
find dev -maxdepth 1 -name "*.yml" -exec basename {} .yml \;
```
3. Set the `PLAYBOOK` environmental variable to a value listed in the last step, e.g.,
``` ```
export PLAYBOOK=dockerbox export PLAYBOOK=dockerbox
``` ```
@@ -29,11 +43,10 @@ Vagrant and VirtualBox are used to develop Project Moxie. You will need to insta
``` ```
#### Copyright and License #### Copyright and License
Copyright (C) 2020-2021 Kris Lamoureux Copyright (C) 2020-2022 Kris Lamoureux
[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0) [![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3 of the License. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3 of the License.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

View File

@@ -5,7 +5,7 @@
- host_vars/proxy.yml - host_vars/proxy.yml
roles: roles:
- base - base
- postgresql - mariadb
- proxy - proxy
- docker - docker
- gitea - gitea

View File

@@ -20,7 +20,6 @@
- docker - docker
- traefik - traefik
- nextcloud - nextcloud
- gitea
- jenkins - jenkins
- prometheus - prometheus
- nginx - nginx

11
proxy.yml Normal file
View File

@@ -0,0 +1,11 @@
- name: Install Proxy Server
hosts: proxyhosts
become: true
roles:
- base
- jenkins
- mariadb
- proxy
- docker
- gitea
- bitwarden

1
roles/.gitignore vendored
View File

@@ -7,6 +7,7 @@
!gitea*/ !gitea*/
!jenkins*/ !jenkins*/
!libvirt*/ !libvirt*/
!mariadb*/
!minecraft*/ !minecraft*/
!nextcloud*/ !nextcloud*/
!nginx*/ !nginx*/

View File

@@ -3,6 +3,7 @@ network_type: static
allow_reboot: true allow_reboot: true
packages: packages:
- apache2-utils
- cryptsetup - cryptsetup
- curl - curl
- dnsutils - dnsutils

View File

@@ -1 +0,0 @@
deb http://deb.debian.org/debian buster-backports main

View File

@@ -13,6 +13,7 @@
loop: loop:
- aptitude - aptitude
- python3-docker - python3-docker
- python3-pymysql
- python3-psycopg2 - python3-psycopg2
- name: Create Ansible's temporary remote directory - name: Create Ansible's temporary remote directory

View File

@@ -23,6 +23,24 @@
name: ssh name: ssh
rule: limit rule: limit
- name: Remove Fail2ban defaults-debian.conf
file:
path: /etc/fail2ban/jail.d/defaults-debian.conf
state: absent
- name: Install OpenSSH's Fail2ban jail
template:
src: fail2ban-ssh.conf.j2
dest: /etc/fail2ban/jail.d/sshd.conf
notify: restart_fail2ban
- name: Install Fail2ban IP allow list
template:
src: fail2ban-allowlist.conf.j2
dest: /etc/fail2ban/jail.d/allowlist.conf
when: fail2ban_ignoreip is defined
notify: restart_fail2ban
- name: Enable firewall - name: Enable firewall
ufw: ufw:
state: enabled state: enabled

View File

@@ -27,3 +27,10 @@
name: wg-quick@wg0 name: wg-quick@wg0
state: started state: started
enabled: true enabled: true
- name: Add WireGuard firewall rule
ufw:
rule: allow
port: "{{ wireguard.listenport }}"
proto: tcp
when: wireguard.listenport is defined

View File

@@ -0,0 +1,2 @@
[DEFAULT]
ignoreip = {% for host in fail2ban_ignoreip %}{{ host }}{% if not loop.last %} {% endif %}{% endfor %}

View File

@@ -0,0 +1,3 @@
[sshd]
mode = aggressive
enabled = true

View File

@@ -1,5 +1,7 @@
bitwarden_name: bitwarden bitwarden_name: bitwarden
bitwarden_root: "/var/lib/{{ bitwarden_name }}" bitwarden_root: "/var/lib/{{ bitwarden_name }}"
bitwarden_logs_identity: "{{ bitwarden_root }}/bwdata/logs/identity/Identity"
bitwarden_logs_identity_date: "{{ ansible_date_time.year }}{{ ansible_date_time.month }}{{ ansible_date_time.day }}"
bitwarden_database: "{{ bitwarden_name }}" bitwarden_database: "{{ bitwarden_name }}"
bitwarden_realips: "172.16.0.0/12" bitwarden_realips: "172.16.0.0/12"
bitwarden_standalone: false bitwarden_standalone: false

View File

@@ -70,6 +70,7 @@
path: "{{ bitwarden_root }}/bwdata/config.yml" path: "{{ bitwarden_root }}/bwdata/config.yml"
line: "- {{ bitwarden_realips }}" line: "- {{ bitwarden_realips }}"
insertafter: "^real_ips" insertafter: "^real_ips"
notify: rebuild_bitwarden
- name: Install Bitwarden systemd service - name: Install Bitwarden systemd service
template: template:
@@ -78,6 +79,18 @@
register: bitwarden_systemd register: bitwarden_systemd
notify: rebuild_bitwarden notify: rebuild_bitwarden
- name: Create Bitwarden's initial logging directory
file:
path: "{{ bitwarden_logs_identity }}"
state: directory
register: bitwarden_logs
- name: Create Bitwarden's initial log file
file:
path: "{{ bitwarden_logs_identity }}/{{ bitwarden_logs_identity_date }}.txt"
state: touch
when: bitwarden_logs.changed
- name: Install Bitwarden's Fail2ban jail - name: Install Bitwarden's Fail2ban jail
template: template:
src: fail2ban-jail.conf.j2 src: fail2ban-jail.conf.j2

View File

@@ -2,7 +2,7 @@
[bitwarden] [bitwarden]
enabled = true enabled = true
filter = bitwarden filter = bitwarden
logpath = /var/lib/bitwarden/bwdata/logs/identity/Identity/* logpath = {{ bitwarden_root }}/bwdata/logs/identity/Identity/*
maxretry = 10 maxretry = 10
findtime = 3600 findtime = 3600
bantime = 900 bantime = 900

View File

@@ -5,11 +5,11 @@ gitea_webport: "3000"
gitea_ssh: "127.0.0.1:{{ gitea_sshport }}" gitea_ssh: "127.0.0.1:{{ gitea_sshport }}"
gitea_web: "127.0.0.1:{{ gitea_webport }}" gitea_web: "127.0.0.1:{{ gitea_webport }}"
gitea_volume: "{{ gitea_name }}" gitea_volume: "{{ gitea_name }}"
gitea_rooturl: "http://{{ gitea_domain }}" gitea_rooturl: "https://{{ gitea_domain }}"
gitea_signup: true gitea_signup: true
# database settings # database settings
gitea_dbtype: postgres gitea_dbtype: mysql
gitea_dbhost: host.docker.internal gitea_dbhost: host.docker.internal
gitea_dbname: "{{ gitea_name }}" gitea_dbname: "{{ gitea_name }}"
gitea_dbuser: "{{ gitea_name }}" gitea_dbuser: "{{ gitea_name }}"

View File

@@ -4,18 +4,19 @@
state: directory state: directory
- name: Create Gitea database - name: Create Gitea database
postgresql_db: mysql_db:
name: "{{ gitea_dbname }}" name: "{{ gitea_dbname }}"
become: true state: present
become_user: postgres login_unix_socket: /var/run/mysqld/mysqld.sock
- name: Create Gitea database user - name: Create Gitea database user
postgresql_user: mysql_user:
db: "{{ gitea_dbname }}"
name: "{{ gitea_dbuser }}" name: "{{ gitea_dbuser }}"
password: "{{ gitea_dbpass }}" password: "{{ gitea_dbpass }}"
become: true host: '%'
become_user: postgres state: present
priv: "{{ gitea_dbname }}.*:ALL"
login_unix_socket: /var/run/mysqld/mysqld.sock
- name: Create git user - name: Create git user
user: user:
@@ -81,6 +82,16 @@
dest: "{{ gitea_root }}/.env" dest: "{{ gitea_root }}/.env"
notify: restart_gitea notify: restart_gitea
- name: Create Gitea's logging directory
file:
name: /var/log/gitea
state: directory
- name: Create Gitea's initial log file
file:
name: /var/log/gitea/gitea.log
state: touch
- name: Install Gitea's Fail2ban filter - name: Install Gitea's Fail2ban filter
template: template:
src: fail2ban-filter.conf.j2 src: fail2ban-filter.conf.j2

View File

@@ -21,6 +21,7 @@ services:
- GITEA__database__NAME=${gitea_dbname} - GITEA__database__NAME=${gitea_dbname}
- GITEA__database__USER=${gitea_dbuser} - GITEA__database__USER=${gitea_dbuser}
- GITEA__database__PASSWD=${gitea_dbpass} - GITEA__database__PASSWD=${gitea_dbpass}
- GITEA__security__INSTALL_LOCK=true
- GITEA__security__REVERSE_PROXY_LIMIT=${gitea_proxy_limit} - GITEA__security__REVERSE_PROXY_LIMIT=${gitea_proxy_limit}
- GITEA__security__REVERSE_PROXY_TRUSTED_PROXIES=${gitea_trusted_proxies} - GITEA__security__REVERSE_PROXY_TRUSTED_PROXIES=${gitea_trusted_proxies}
- GITEA__service__DISABLE_REGISTRATION=${gitea_disable_registration} - GITEA__service__DISABLE_REGISTRATION=${gitea_disable_registration}

View File

@@ -1 +0,0 @@
deb http://ppa.launchpad.net/ansible/ansible/ubuntu trusty main

View File

@@ -1,8 +1,3 @@
- name: Install GnuPG
apt:
name: gnupg
state: present
- name: Create Jenkins user - name: Create Jenkins user
user: user:
name: "{{ jenkins_user }}" name: "{{ jenkins_user }}"
@@ -25,16 +20,6 @@
validate: "visudo -cf %s" validate: "visudo -cf %s"
mode: 0440 mode: 0440
- name: Install Ansible source
copy:
src: ansible.list
dest: /etc/apt/sources.list.d/ansible.list
- name: Add Ansible source key
apt_key:
keyserver: keyserver.ubuntu.com
id: 93C4A3FD7BB9C367
- name: Install Ansible - name: Install Ansible
apt: apt:
name: ansible name: ansible

View File

@@ -0,0 +1,3 @@
mariadb_trust:
- "172.16.0.0/12"
- "192.168.0.0/16"

View File

@@ -0,0 +1,25 @@
- name: Install MariaDB
apt:
name: mariadb-server
state: present
- name: Change the bind-address to allow Docker
lineinfile:
path: /etc/mysql/mariadb.conf.d/50-server.cnf
regex: "^bind-address"
line: "bind-address = 0.0.0.0"
register: mariadb_conf
- name: Restart MariaDB
service:
name: mariadb
state: restarted
when: mariadb_conf.changed
- name: Allow database connections
ufw:
rule: allow
port: "3306"
proto: tcp
src: "{{ item }}"
loop: "{{ mariadb_trust }}"

View File

@@ -29,9 +29,9 @@
- "{{ nginx_html }}:/usr/share/nginx/html:ro" - "{{ nginx_html }}:/usr/share/nginx/html:ro"
labels: labels:
traefik.http.routers.nginx.rule: "Host(`{{ nginx_domain }}`)" traefik.http.routers.nginx.rule: "Host(`{{ nginx_domain }}`)"
traefik.http.middlewares.nginxauth.basicauth.users: "{{ nginx_auth }}" #traefik.http.middlewares.nginxauth.basicauth.users: "{{ nginx_auth }}"
traefik.http.routers.nginx.entrypoints: websecure traefik.http.routers.nginx.entrypoints: websecure
traefik.http.routers.nginx.tls.certresolver: letsencrypt #traefik.http.routers.nginx.tls.certresolver: letsencrypt
traefik.http.routers.nginx.middlewares: "securehttps@file,nginxauth" #traefik.http.routers.nginx.middlewares: "securehttps@file,nginxauth"
traefik.docker.network: traefik traefik.docker.network: traefik
traefik.enable: "true" traefik.enable: "true"

View File

@@ -1,2 +1,5 @@
postgresql_config: /etc/postgresql/13/main/pg_hba.conf postgresql_config: /etc/postgresql/13/main/pg_hba.conf
postgresql_listen: "*" postgresql_listen: "*"
postgresql_trust:
- "172.16.0.0/12"
- "192.168.0.0/16"

View File

@@ -3,15 +3,16 @@
name: postgresql name: postgresql
state: present state: present
- name: Trust connections to PostgreSQL from Docker - name: Trust connections to PostgreSQL
postgresql_pg_hba: postgresql_pg_hba:
dest: "{{ postgresql_config }}" dest: "{{ postgresql_config }}"
contype: host contype: host
databases: all databases: all
users: all users: all
address: "172.16.0.0/12" address: "{{ item }}"
method: trust method: trust
register: postgresql_hba register: postgresql_hba
loop: "{{ postgresql_trust }}"
- name: Change PostgreSQL listen addresses - name: Change PostgreSQL listen addresses
postgresql_set: postgresql_set:
@@ -33,9 +34,10 @@
state: restarted state: restarted
when: postgresql_config.changed when: postgresql_config.changed
- name: Allow database connections from Docker - name: Allow database connections
ufw: ufw:
rule: allow rule: allow
port: "5432" port: "5432"
proto: tcp proto: tcp
src: "172.16.0.0/12" src: "{{ item }}"
loop: "{{ postgresql_trust }}"

View File

@@ -10,6 +10,11 @@
state: started state: started
enabled: true enabled: true
- name: Generate DH Parameters
openssl_dhparam:
path: /etc/ssl/dhparams.pem
size: 4096
- name: Install nginx base configuration - name: Install nginx base configuration
template: template:
src: nginx.conf.j2 src: nginx.conf.j2
@@ -78,7 +83,9 @@
--email "{{ proxy.dns_cloudflare.email }}" \ --email "{{ proxy.dns_cloudflare.email }}" \
--dns-cloudflare \ --dns-cloudflare \
--dns-cloudflare-credentials /root/.cloudflare.ini \ --dns-cloudflare-credentials /root/.cloudflare.ini \
-d "*.{{ item }}" {{ proxy.dns_cloudflare.opts | default("") }}' -d "*.{{ item }}" \
-d "{{ item }}" \
{{ proxy.dns_cloudflare.opts | default("") }}'
args: args:
creates: "/etc/letsencrypt/live/{{ item }}/fullchain.pem" creates: "/etc/letsencrypt/live/{{ item }}/fullchain.pem"
loop: "{{ proxy.dns_cloudflare.wildcard_domains }}" loop: "{{ proxy.dns_cloudflare.wildcard_domains }}"

View File

@@ -21,6 +21,14 @@ http {
keepalive_timeout 65; keepalive_timeout 65;
server_names_hash_bucket_size 128; server_names_hash_bucket_size 128;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384;
ssl_prefer_server_ciphers off;
ssl_dhparam /etc/ssl/dhparams.pem;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 1d;
ssl_session_tickets off;
include /etc/nginx/conf.d/*.conf; include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*; include /etc/nginx/sites-enabled/*;
} }

View File

@@ -1,12 +1,13 @@
server { server {
listen 80; listen 80;
listen [::]:80;
server_name {{ item.domain }}; server_name {{ item.domain }};
return 301 https://{{ item.domain }}$request_uri; return 301 https://{{ item.domain }}$request_uri;
} }
server { server {
listen 443 ssl; listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name {{ item.domain }}; server_name {{ item.domain }};
access_log /var/log/nginx/{{ item.domain }}.log main; access_log /var/log/nginx/{{ item.domain }}.log main;
{% if proxy.production is defined and proxy.production and proxy.dns_cloudflare.wildcard_domains is defined and item.tls.cert is not defined %} {% if proxy.production is defined and proxy.production and proxy.dns_cloudflare.wildcard_domains is defined and item.tls.cert is not defined %}
@@ -26,11 +27,31 @@ server {
{% else %} {% else %}
ssl_certificate /etc/ssl/certs/nginx-selfsigned.crt; ssl_certificate /etc/ssl/certs/nginx-selfsigned.crt;
ssl_certificate_key /etc/ssl/private/nginx-selfsigned.key; ssl_certificate_key /etc/ssl/private/nginx-selfsigned.key;
{% endif %}
{% if item.hsts is defined %}
add_header Strict-Transport-Security "max-age={{ item.hsts }}" always;
{% endif %}
{% if item.client_max_body_size is defined %}
client_max_body_size {{ item.client_max_body_size }};
{% endif %} {% endif %}
location / { location / {
{% if item.restrict is defined and item.restrict %}
auth_basic "{{ item.restrict_name | default('Restricted Access') }}";
auth_basic_user_file {{ item.restrict_file | default('/etc/nginx/.htpasswd') }};
proxy_set_header Authorization "";
{% endif %}
proxy_set_header Host $host; proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass {{ item.proxy_pass }}; proxy_pass {{ item.proxy_pass }};
{% if item.proxy_ssl_verify is defined and item.proxy_ssl_verify is false %}
proxy_ssl_verify off;
{% endif %}
{% if item.websockets is defined and item.websockets %}
proxy_http_version 1.1;
proxy_set_header Connection $http_connection;
proxy_set_header Origin http://$host;
proxy_set_header Upgrade $http_upgrade;
{% endif %}
} }
} }

View File

@@ -3,8 +3,10 @@ traefik_dashboard: false
traefik_root: "/opt/{{ traefik_name }}" traefik_root: "/opt/{{ traefik_name }}"
traefik_localonly: "10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16, 127.0.0.0/8" traefik_localonly: "10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16, 127.0.0.0/8"
traefik_production: false traefik_production: false
traefik_hsts_enable: false
traefik_hsts_preload: false traefik_hsts_preload: false
traefik_hsts_seconds: 0 traefik_hsts_seconds: 0
traefik_http_redirect: false
traefik_ports: traefik_ports:
- "80:80" - "80:80"
- "443:443" - "443:443"

View File

@@ -42,10 +42,10 @@
- name: traefik - name: traefik
labels: labels:
traefik.http.routers.traefik.rule: "Host(`{{ traefik_domain }}`)" traefik.http.routers.traefik.rule: "Host(`{{ traefik_domain }}`)"
traefik.http.middlewares.auth.basicauth.users: "{{ traefik_auth }}" #traefik.http.middlewares.auth.basicauth.users: "{{ traefik_auth }}"
traefik.http.middlewares.localonly.ipwhitelist.sourcerange: "{{ traefik_localonly }}" #traefik.http.middlewares.localonly.ipwhitelist.sourcerange: "{{ traefik_localonly }}"
traefik.http.routers.traefik.tls.certresolver: letsencrypt #traefik.http.routers.traefik.tls.certresolver: letsencrypt
traefik.http.routers.traefik.middlewares: "securehttps@file,auth@docker,localonly" #traefik.http.routers.traefik.middlewares: "securehttps@file,auth@docker,localonly"
traefik.http.routers.traefik.service: "api@internal" traefik.http.routers.traefik.service: "api@internal"
traefik.http.routers.traefik.entrypoints: websecure traefik.http.routers.traefik.entrypoints: websecure
traefik.http.routers.traefik.tls: "true" traefik.http.routers.traefik.tls: "true"

View File

@@ -10,10 +10,12 @@ http:
{% elif item.middlewares is defined %} {% elif item.middlewares is defined %}
middlewares: "{{ item.middlewares }}" middlewares: "{{ item.middlewares }}"
{% endif %} {% endif %}
{% if traefik_acme_email is defined %}
tls: tls:
certResolver: letsencrypt certResolver: letsencrypt
domains: domains:
- main: "{{ item.domain }}" - main: "{{ item.domain }}"
{% endif %}
entryPoints: entryPoints:
- "websecure" - "websecure"
services: services:

View File

@@ -11,6 +11,8 @@ http:
sslRedirect: true sslRedirect: true
browserXssFilter: true browserXssFilter: true
contentTypeNosniff: true contentTypeNosniff: true
{% if traefik_hsts_enable is defined and traefik_hsts_enable %}
stsPreload: {{ traefik_hsts_preload }} stsPreload: {{ traefik_hsts_preload }}
stsSeconds: {{ traefik_hsts_seconds }} stsSeconds: {{ traefik_hsts_seconds }}
{% endif %}
customFrameOptionsValue: SAMEORIGIN customFrameOptionsValue: SAMEORIGIN

View File

@@ -10,12 +10,14 @@ providers:
entrypoints: entrypoints:
web: web:
address: ':80' address: ':80'
{% if traefik_http_redirect is defined and traefik_http_redirect %}
http: http:
redirections: redirections:
entrypoint: entrypoint:
to: websecure to: websecure
scheme: https scheme: https
permanent: true permanent: true
{% endif %}
websecure: websecure:
address: ':443' address: ':443'
http: http: