Remove legacy configs

This commit is contained in:
Paul-Henri Froidmont 2021-07-15 18:00:49 +02:00
parent 1f5e31b0e8
commit 59cb6ac9b9
Signed by: phfroidmont
GPG key ID: BE948AFD7E7873BE
116 changed files with 0 additions and 4552 deletions

78
Vagrantfile vendored
View file

@ -1,78 +0,0 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
# https://docs.vagrantup.com.
# Every Vagrant development environment requires a box. You can search for
# boxes at https://vagrantcloud.com/search.
config.vm.box = "archlinux/archlinux"
# Disable automatic box update checking. If you disable this, then
# boxes will only be checked for updates when the user runs
# `vagrant box outdated`. This is not recommended.
# config.vm.box_check_update = false
# Create a forwarded port mapping which allows access to a specific port
# within the machine from a port on the host machine. In the example below,
# accessing "localhost:8080" will access port 80 on the guest machine.
# NOTE: This will enable public access to the opened port
# config.vm.network "forwarded_port", guest: 80, host: 8080
# Create a forwarded port mapping which allows access to a specific port
# within the machine from a port on the host machine and only allow access
# via 127.0.0.1 to disable public access
# config.vm.network "forwarded_port", guest: 80, host: 8080, host_ip: "127.0.0.1"
# Create a private network, which allows host-only access to the machine
# using a specific IP.
# config.vm.network "private_network", ip: "192.168.33.10"
# Create a public network, which generally matched to bridged network.
# Bridged networks make the machine appear as another physical device on
# your network.
# config.vm.network "public_network"
# Share an additional folder to the guest VM. The first argument is
# the path on the host to the actual folder. The second argument is
# the path on the guest to mount the folder. And the optional third
# argument is a set of non-required options.
# config.vm.synced_folder "../data", "/vagrant_data"
# Provider-specific configuration so you can fine-tune various
# backing providers for Vagrant. These expose provider-specific options.
# Example for VirtualBox:
#
# config.vm.provider "virtualbox" do |vb|
# # Display the VirtualBox GUI when booting the machine
# vb.gui = true
#
# # Customize the amount of memory on the VM:
# vb.memory = "1024"
# end
#
# View the documentation for the provider you are using for more
# information on available options.
# Enable provisioning with a shell script. Additional provisioners such as
# Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the
# documentation for more information about their specific syntax and use.
# config.vm.provision "shell", inline: <<-SHELL
# apt-get update
# apt-get install -y apache2
# SHELL
config.vm.network "private_network", ip: "192.168.33.10"
config.vm.provider "virtualbox" do |vb|
vb.memory = "8192"
end
config.vm.synced_folder "/mnt/borg", "/mnt/borg"
# config.vm.provision "ansible" do |ansible|
# ansible.playbook = "playbook.yml"
# end
end

View file

@ -1,37 +0,0 @@
$ORIGIN banditlair.com.
@ 3600 IN SOA ns0.online.net. hostmaster.online.net. 20190817102310 10800 3600 604800 3600
; Parent NS
@ 86400 IN NS ns0.online.net.
@ 86400 IN NS ns1.online.net.
; Custom DNS server
ns.banditlair.com. 600 IN A 144.76.18.197
ddns.banditlair.com. 3600 IN NS ns.banditlair.com.
; Main domain
@ 600 IN A 144.76.18.197
* 600 IN CNAME @
storage1 600 IN A 144.76.18.197
matrix 600 IN A 144.76.18.197
; Matrix special record
_matrix._tcp.banditlair.com. 86400 IN SRV 12 10 443 matrix.banditlair.com.
; Mail server related records
;webmail 86400 IN A 144.76.18.197
;mail 86400 IN A 78.47.38.125
;mail2 86400 IN A 144.76.18.197
@ 86400 IN MX 20 mail2.banditlair.com.
@ 86400 IN MX 12 mail.banditlair.com.
@ 600 IN TXT "v=spf1 mx -all"
_dmarc 600 IN TXT "v=DMARC1; p=none; rua=mailto:failed-dmarc@banditlair.com; ruf=mailto:dmarc@banditlair.com"
froidmont.org._report._dmarc 600 IN TXT "v=DMARC1"
falbo.fr._report._dmarc 600 IN TXT "v=DMARC1"
dkim._domainkey 600 IN TXT "v=DKIM1; k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCwDEwt+a0neFlyq7ndCj0EECUp4bsusFpL2aVzroLY5Xw9S//dYuXUp1sr/yiivS71WyNjt7tOpuonu0gGEWpc6RPyeZrzXQg+zY1k/1+cLXFMz5HmJJaAbNxK02Qn89qfk/Y3pbuJt6Y/NBQ4KVOCZQB2hCT2izVSWSkhegYTCwIDAQAB"
; Kubernetes tests
k8s 600 IN A 116.203.8.164
*.test.k8s 600 IN CNAME k8s.banditlair.com.
test.k8s 600 IN CNAME k8s.banditlair.com.
*.k8s 600 IN CNAME k8s.banditlair.com.

View file

@ -1,17 +0,0 @@
$ORIGIN falbo.fr.
@ 3600 IN SOA ns0.online.net. hostmaster.online.net. 20190128060537 10800 3600 604800 3600
; Parent NS
@ 86400 IN NS ns1.online.net.
@ 86400 IN NS ns0.online.net.
; Main domain
@ 600 IN A 144.76.18.197
* 600 IN CNAME @
; Mail server related records
@ 86400 IN MX 12 mail2.banditlair.com.
@ 86400 IN MX 12 mail.banditlair.com.
_dmarc 600 IN TXT "v=DMARC1; p=none; rua=mailto:failed-dmarc@banditlair.com; ruf=mailto:dmarc@banditlair.com"
@ 600 IN TXT "v=spf1 include:banditlair.com -all"
dkim._domainkey 600 IN TXT "v=DKIM1; k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDWJwmQoiaxKCp6Cj+rELeHicd7VD1l/Q5KKQURgt1wIAY36bwbFYeuN/+ULruJzbnoyJ63G2QttO4H6MLdVTgNRjTuixmoE5mZEAE/7BlyAfDS0MLUXyGbxD6WtGZPT6PQ1cxWp9jVvYUs/NypcRfpDu0J9IXX6+coQM5CMLLdRwIDAQAB"

View file

@ -1,17 +0,0 @@
$ORIGIN froidmont.org.
@ 3600 IN SOA ns0.online.net. hostmaster.online.net. 20190128060604 10800 3600 604800 3600
; Parent NS
@ 86400 IN NS ns0.online.net.
@ 86400 IN NS ns1.online.net.
; Main domain
@ 600 IN A 144.76.18.197
* 600 IN CNAME @
; Mail server related records
@ 86400 IN MX 20 mail2.banditlair.com.
@ 86400 IN MX 12 mail.banditlair.com.
@ 600 IN TXT "v=spf1 include:banditlair.com -all"
_dmarc 600 IN TXT "v=DMARC1; p=none; rua=mailto:failed-dmarc@banditlair.com; ruf=mailto:dmarc@banditlair.com"
dkim._domainkey 600 IN TXT "v=DKIM1; k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlBZhkvPboheAWQtlWZCJpxIsjLvMOjn9TUHpyNz/tATA4/I6m21YlXreyHVoLLkaGOS/jXx2dptU/l6C0Bu+HdhcyBqw3tOxnTwDzD07h58u1mM5L//k/F+YsD+onCWYehQpIzCeRGgNe1w4QN11im4VVoNznFPzwMLIeepbg/QIDAQAB"

View file

@ -1,10 +0,0 @@
$ORIGIN societe-de-tir-bertrix.com.
@ 3600 IN SOA ns0.online.net. hostmaster.online.net. 20191104080225 10800 3600 604800 3600
; Parent NS
@ 86400 IN NS ns0.online.net.
@ 86400 IN NS ns1.online.net.
; Main domain
@ 600 IN A 144.76.18.197
* 600 IN CNAME societe-de-tir-bertrix.com.

View file

@ -1,14 +0,0 @@
#! /bin/bash
set -e
ENVIRONMENT=$(cat .environment)
HCLOUD_TOKEN=$(cat ~/.ssh/hcloud-$ENVIRONMENT-token)
if [ -z "$HCLOUD_TOKEN" ]
then
echo "Couldn't find your hetzner cloud token in '~/.ssh/hcloud-$ENVIRONMENT-token'"
exit 1
fi
echo $HCLOUD_TOKEN

View file

@ -1,23 +0,0 @@
---
kube_network_plugin: weave
bin_dir: /usr/local/bin
kube_config_dir: /etc/kubernetes
kubelet_status_update_frequency: 4s
kube_controller_node_monitor_grace_period: 20s
kube_controller_node_monitor_period: 2s
kube_controller_pod_eviction_timeout: 30s
upstream_dns_servers:
- 213.133.98.98
- 213.133.99.99
kube_api_anonymous_auth: true
cert_manager_enabled: true
ingress_nginx_enabled: true
dashboard_enabled: false
helm_enabled: false
metrics_server_enabled: true
enable_nodelocaldns: true
docker_dns_servers_strict: false

View file

@ -1,2 +0,0 @@
---
ip: 192.168.1.{{ 0 +(inventory_hostname|regex_replace('\D+','')|int) }}

View file

@ -1,2 +0,0 @@
---
ip: 192.168.2.{{ 0 +(inventory_hostname|regex_replace('\D+','')|int) }}

View file

@ -1,3 +0,0 @@
---
cert_manager_issuer: letsencrypt-production
banditlair_domain: banditlair.com

View file

@ -1,17 +0,0 @@
[prod-master]
[prod-etcd]
[prod-node]
[kube-master:children]
prod-master
[etcd:children]
prod-etcd
[kube-node:children]
prod-node
[k8s-cluster:children]
kube-master
etcd
kube-node

View file

@ -1,12 +0,0 @@
plugin: scaleway
hostnames:
- hostname
regions:
- par1
- ams1
tags:
- prod-master
- prod-etcd
- prod-node
variables:
ansible_host: public_ip.address

View file

@ -1,5 +0,0 @@
---
cert_manager_issuer: letsencrypt-staging
banditlair_domain: k8s.banditlair.com
floating_ip: 116.203.8.164
floating_ip_id: 91174

View file

@ -1,16 +0,0 @@
[master]
[node]
[kube-master:children]
master
[etcd:children]
master
[kube-node:children]
node
[k8s-cluster:children]
kube-master
etcd
kube-node

View file

@ -1,6 +0,0 @@
plugin: hcloud
label_selector: type=master
groups:
master: yes

View file

@ -1,6 +0,0 @@
plugin: hcloud
label_selector: type=node
groups:
node: yes

View file

@ -1,8 +0,0 @@
- hosts: kube-node
roles:
- role: keepalived-hcloud
tags: keepalived
- name: Include kubespray tasks
import_playbook: kubespray.yml

@ -1 +0,0 @@
Subproject commit 86cc703c75768207e1943ddf8f6a8082d756cb83

View file

@ -1 +0,0 @@
kubespray/cluster.yml

View file

@ -1,300 +0,0 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
DOCUMENTATION = """
---
module: kube
short_description: Manage Kubernetes Cluster
description:
- Create, replace, remove, and stop resources within a Kubernetes Cluster
version_added: "2.0"
options:
name:
required: false
default: null
description:
- The name associated with resource
filename:
required: false
default: null
description:
- The path and filename of the resource(s) definition file.
kubectl:
required: false
default: null
description:
- The path to the kubectl bin
namespace:
required: false
default: null
description:
- The namespace associated with the resource(s)
resource:
required: false
default: null
description:
- The resource to perform an action on. pods (po), replicationControllers (rc), services (svc)
label:
required: false
default: null
description:
- The labels used to filter specific resources.
server:
required: false
default: null
description:
- The url for the API server that commands are executed against.
force:
required: false
default: false
description:
- A flag to indicate to force delete, replace, or stop.
all:
required: false
default: false
description:
- A flag to indicate delete all, stop all, or all namespaces when checking exists.
log_level:
required: false
default: 0
description:
- Indicates the level of verbosity of logging by kubectl.
state:
required: false
choices: ['present', 'absent', 'latest', 'reloaded', 'stopped']
default: present
description:
- present handles checking existence or creating if definition file provided,
absent handles deleting resource(s) based on other options,
latest handles creating or updating based on existence,
reloaded handles updating resource(s) definition using definition file,
stopped handles stopping resource(s) based on other options.
requirements:
- kubectl
author: "Kenny Jones (@kenjones-cisco)"
"""
EXAMPLES = """
- name: test nginx is present
kube: name=nginx resource=rc state=present
- name: test nginx is stopped
kube: name=nginx resource=rc state=stopped
- name: test nginx is absent
kube: name=nginx resource=rc state=absent
- name: test nginx is present
kube: filename=/tmp/nginx.yml
"""
class KubeManager(object):
def __init__(self, module):
self.module = module
self.kubectl = module.params.get('kubectl')
if self.kubectl is None:
self.kubectl = module.get_bin_path('kubectl', True)
self.base_cmd = [self.kubectl]
if module.params.get('server'):
self.base_cmd.append('--server=' + module.params.get('server'))
if module.params.get('log_level'):
self.base_cmd.append('--v=' + str(module.params.get('log_level')))
if module.params.get('namespace'):
self.base_cmd.append('--namespace=' + module.params.get('namespace'))
self.all = module.params.get('all')
self.force = module.params.get('force')
self.name = module.params.get('name')
self.filename = module.params.get('filename')
self.resource = module.params.get('resource')
self.label = module.params.get('label')
def _execute(self, cmd):
args = self.base_cmd + cmd
try:
rc, out, err = self.module.run_command(args)
if rc != 0:
self.module.fail_json(
msg='error running kubectl (%s) command (rc=%d): %s' % (' '.join(args), rc, out or err))
except Exception as exc:
self.module.fail_json(
msg='error running kubectl (%s) command: %s' % (' '.join(args), str(exc)))
return out.splitlines()
def _execute_nofail(self, cmd):
args = self.base_cmd + cmd
rc, out, err = self.module.run_command(args)
if rc != 0:
return None
return out.splitlines()
def create(self, check=True, force=True):
if check and self.exists():
return []
cmd = ['apply']
if force:
cmd.append('--force')
if not self.filename:
self.module.fail_json(msg='filename required to create')
cmd.append('--filename=' + self.filename)
return self._execute(cmd)
def replace(self, force=True):
cmd = ['apply']
if force:
cmd.append('--force')
if not self.filename:
self.module.fail_json(msg='filename required to reload')
cmd.append('--filename=' + self.filename)
return self._execute(cmd)
def delete(self):
if not self.force and not self.exists():
return []
cmd = ['delete']
if self.filename:
cmd.append('--filename=' + self.filename)
else:
if not self.resource:
self.module.fail_json(msg='resource required to delete without filename')
cmd.append(self.resource)
if self.name:
cmd.append(self.name)
if self.label:
cmd.append('--selector=' + self.label)
if self.all:
cmd.append('--all')
if self.force:
cmd.append('--ignore-not-found')
return self._execute(cmd)
def exists(self):
cmd = ['get']
if not self.resource:
return False
cmd.append(self.resource)
if self.name:
cmd.append(self.name)
cmd.append('--no-headers')
if self.label:
cmd.append('--selector=' + self.label)
if self.all:
cmd.append('--all-namespaces')
result = self._execute_nofail(cmd)
if not result:
return False
return True
def stop(self):
if not self.force and not self.exists():
return []
cmd = ['stop']
if self.filename:
cmd.append('--filename=' + self.filename)
else:
if not self.resource:
self.module.fail_json(msg='resource required to stop without filename')
cmd.append(self.resource)
if self.name:
cmd.append(self.name)
if self.label:
cmd.append('--selector=' + self.label)
if self.all:
cmd.append('--all')
if self.force:
cmd.append('--ignore-not-found')
return self._execute(cmd)
def main():
module = AnsibleModule(
argument_spec=dict(
name=dict(),
filename=dict(),
namespace=dict(),
resource=dict(),
label=dict(),
server=dict(),
kubectl=dict(),
force=dict(default=False, type='bool'),
all=dict(default=False, type='bool'),
log_level=dict(default=0, type='int'),
state=dict(default='present', choices=['present', 'absent', 'latest', 'reloaded', 'stopped']),
)
)
changed = False
manager = KubeManager(module)
state = module.params.get('state')
if state == 'present':
result = manager.create(check=False)
elif state == 'absent':
result = manager.delete()
elif state == 'reloaded':
result = manager.replace()
elif state == 'stopped':
result = manager.stop()
elif state == 'latest':
result = manager.replace()
else:
module.fail_json(msg='Unrecognized state %s.' % state)
if result:
changed = True
module.exit_json(changed=changed,
msg='success: %s' % (' '.join(result))
)
from ansible.module_utils.basic import * # noqa
if __name__ == '__main__':
main()

View file

@ -1,6 +0,0 @@
- hosts: kube-master[0]
gather_facts: no
roles:
- role: k8s-manifests
- role: k8s-utils
tags: ["utils"]

View file

@ -1,56 +0,0 @@
---
- hosts: localhost
tasks:
- name: Install tinc and ping
apt:
name: [ 'tinc', 'iputils-ping' ]
state: latest
- name: Adding Kubernetes official gpg key
apt_key:
url: "{{ kubernetes_apt_key }}"
state: present
- name: Adding Kubernetes repository
apt_repository:
repo: "deb http://apt.kubernetes.io/ kubernetes-{{ kubernetes_release }} {{ kubernetes_apt_channel }}"
state: present
filename: 'kubernetes'
- name: Installing kubernetes core components (kubectl, kubelet ...)
apt:
name: ['kubelet={{kubernetes_version_apt}}', 'kubeadm={{kubernetes_version_apt}}', 'kubectl={{kubernetes_version_apt}}']
register: result
retries: 3
until: result is success
- name: Get the kernel revision
shell: "uname -r"
register: kernel
changed_when: False
check_mode: False
- name: Try install linux-image
apt:
state: present
name: "{{ 'linux-image-' + kernel.stdout }}"
register: result
failed_when: False
- name: modprobe
modprobe:
name: "{{ item }}"
state: present
with_items:
- ip_vs
- nf_conntrack_ipv4
- name: /etc/modules
lineinfile:
path: /etc/modules
line: "{{ item }}"
with_items:
- ip_vs
- nf_conntrack_ipv4
roles:
- role: docker

View file

@ -1,58 +0,0 @@
{
"variables": {
"api_access_key": "{{ env `SCALEWAY_ORGANIZATION` }}",
"api_token": "{{ env `SCALEWAY_TOKEN` }}",
"vault_pass_file": ""
},
"builders": [
{
"type": "scaleway",
"api_access_key": "{{ user `api_access_key` }}",
"api_token": "{{ user `api_token` }}",
"server_name": "k8s-template",
"image_name": "ubuntu-bionic-k8s",
"snapshot_name": "ubuntu-bionic-k8s-snapshot",
"image": "d4067cdc-dc9d-4810-8a26-0dae51d7df42",
"region": "par1",
"commercial_type": "START1-S",
"ssh_username": "root"
}
],
"provisioners": [
{
"type": "shell",
"inline": [
"sleep 30",
"apt -y update",
"DEBIAN_FRONTEND=noninteractive apt-get -y upgrade",
"apt -y install software-properties-common",
"apt-add-repository ppa:ansible/ansible",
"apt -y update",
"apt -y install ansible"
]
},
{
"type": "file",
"source": "{{ user `vault_pass_file` }}",
"destination": "/tmp/vault-pass"
},
{
"type": "ansible-local",
"role_paths": "../roles/docker",
"group_vars": "../group_vars",
"clean_staging_directory": true,
"playbook_file": "common.yml",
"extra_arguments": "--vault-password-file=/tmp/vault-pass"
},
{
"type": "shell",
"inline": [
"rm -f /tmp/vault-pass",
"apt -y remove --purge ansible",
"apt-add-repository --remove ppa:ansible/ansible",
"apt autoremove -y",
"apt update"
]
}
]
}

View file

@ -18,8 +18,6 @@
tags: [ 'docker' ] tags: [ 'docker' ]
- role: traefik-proxy-docker - role: traefik-proxy-docker
tags: [ 'traefik' ] tags: [ 'traefik' ]
# - role: murmur-docker
# tags: [ 'murmur' ]
- role: searx-docker - role: searx-docker
tags: [ 'searx' ] tags: [ 'searx' ]
- role: wiki-docker - role: wiki-docker
@ -30,8 +28,6 @@
tags: [ 'gitlab' ] tags: [ 'gitlab' ]
- role: nextcloud-docker - role: nextcloud-docker
tags: [ 'nextcloud' ] tags: [ 'nextcloud' ]
# - role: matrix-docker
# tags: [ 'matrix' ]
- role: torrent-docker - role: torrent-docker
tags: [ 'torrent' ] tags: [ 'torrent' ]
- role: monit - role: monit

View file

@ -1,8 +1,2 @@
#195.154.134.7 ansible_user=root
#5.9.66.49 ansible_user=root ansible_python_interpreter=/usr/bin/python3
[storage] [storage]
storage1 ansible_user=root ansible_python_interpreter=/usr/bin/python3 ansible_host=144.76.18.197 storage1 ansible_user=root ansible_python_interpreter=/usr/bin/python3 ansible_host=144.76.18.197
[mail]
mail1 ansible_user=root ansible_python_interpreter=/usr/bin/python3 ansible_host=78.47.116.71

View file

@ -1,2 +0,0 @@
COMPOSE_PROJECT_NAME=arch-mirror

View file

@ -1,24 +0,0 @@
version: '2.2'
networks:
web:
external:
name: web
services:
arch-mirror:
image: nginx:latest
expose:
- 80
labels:
- "traefik.backend=arch-mirror"
- "traefik.docker.network=web"
- "traefik.frontend.rule=Host:arch.banditlair.com"
- "traefik.enable=true"
- "traefik.port=80"
- "traefik.default.protocol=http"
volumes:
- /srv/repo:/usr/share/nginx/html:ro
networks:
- web
restart: always

View file

@ -1,80 +0,0 @@
#!/bin/bash
# This is a simple mirroring script. To save bandwidth it first checks a
# timestamp via HTTP and only runs rsync when the timestamp differs from the
# local copy. As of 2016, a single rsync run without changes transfers roughly
# 6MiB of data which adds up to roughly 250GiB of traffic per month when rsync
# is run every minute. Performing a simple check via HTTP first can thus save a
# lot of traffic.
# Directory where the repo is stored locally. Example: /srv/repo
target="/srv/repo"
# Directory where files are downloaded to before being moved in place.
# This should be on the same filesystem as $target, but not a subdirectory of $target.
# Example: /srv/tmp
tmp="/srv/tmp"
# Lockfile path
lock="/home/claude/.lock/syncrepo.lck"
# If you want to limit the bandwidth used by rsync set this.
# Use 0 to disable the limit.
# The default unit is KiB (see man rsync /--bwlimit for more)
bwlimit=0
# The source URL of the mirror you want to sync from.
# If you are a tier 1 mirror use rsync.archlinux.org, for example like this:
# rsync://rsync.archlinux.org/ftp_tier1
# Otherwise chose a tier 1 mirror from this list and use its rsync URL:
# https://www.archlinux.org/mirrors/
source_url='rsync://mirror.f4st.host/archlinux/'
# An HTTP(S) URL pointing to the 'lastupdate' file on your chosen mirror.
# If you are a tier 1 mirror use: http://rsync.archlinux.org/lastupdate
# Otherwise use the HTTP(S) URL from your chosen mirror.
lastupdate_url='https://mirror2.f4st.host/archlinux/lastupdate'
#### END CONFIG
[ ! -d "${target}" ] && mkdir -p "${target}"
[ ! -d "${tmp}" ] && mkdir -p "${tmp}"
exec 9>"${lock}"
flock -n 9 || exit
rsync_cmd() {
local -a cmd=(rsync -rtlH --safe-links --delete-after ${VERBOSE} "--timeout=600" "--contimeout=60" -p \
--delay-updates --no-motd "--temp-dir=${tmp}")
if stty &>/dev/null; then
cmd+=(-h -v --progress)
else
cmd+=(--quiet)
fi
if ((bwlimit>0)); then
cmd+=("--bwlimit=$bwlimit")
fi
"${cmd[@]}" "$@"
}
# if we are called without a tty (cronjob) only run when there are changes
if ! tty -s && [[ -f "$target/lastupdate" ]] && diff -b <(curl -Ls "$lastupdate_url") "$target/lastupdate" >/dev/null; then
# keep lastsync file in sync for statistics generated by the Arch Linux website
rsync_cmd "$source_url/lastsync" "$target/lastsync"
exit 0
fi
rsync_cmd \
--exclude='*.links.tar.gz*' \
--exclude='/other' \
--exclude='/sources' \
--exclude='/iso' \
"${source_url}" \
"${target}"
#echo "Last sync was $(date -d @$(cat ${target}/lastsync))"

View file

@ -1,23 +0,0 @@
---
- name: Copy mirror sync script
copy:
src: syncArchRepo.sh
dest: /home/claude/syncArchRepo.sh
mode: 0700
owner: claude
- name: Create mirror sync cron job
cron:
name: arch mirror sync
state: present
minute: 0
hour: "*/6"
job: "/home/claude/syncArchRepo.sh"
user: claude
- name: Copy Arch Linux mirror config
copy:
src: arch-mirror
dest: "{{docker_compose_files_folder}}"
- name: Start Arch mirror project
docker_compose:
project_src: "{{docker_compose_files_folder}}/arch-mirror"
state: present

View file

@ -1,29 +0,0 @@
---
language: python
python: "2.7"
# Use the new container infrastructure
sudo: false
# Install ansible
addons:
apt:
packages:
- python-pip
install:
# Install ansible
- pip install ansible
# Check ansible version
- ansible --version
# Create ansible.cfg with correct roles_path
- printf '[defaults]\nroles_path=../' >ansible.cfg
script:
# Basic role syntax check
- ansible-playbook tests/test.yml -i tests/inventory --syntax-check
notifications:
webhooks: https://galaxy.ansible.com/api/v1/notifications/

View file

@ -1,674 +0,0 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
{one line to give the program's name and a brief idea of what it does.}
Copyright (C) {year} {name of author}
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, either version 3 of the License, or
(at your option) any later version.
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.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
{project} Copyright (C) {year} {fullname}
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.

View file

@ -1,211 +0,0 @@
ansible-role-harden-linux
=========================
This Ansible role was mainly created for [Kubernetes the not so hard way with Ansible (at Scaleway) - Part 2 - Harden the instances](https://www.tauceti.blog/post/kubernetes-the-not-so-hard-way-with-ansible-at-scaleway-part-2/). But it can be used also standalone of course to harden Linux (targeting Ubuntu 16.04/18.04 mainly at the moment). It has the following features:
- Change root password
- Add a regular/deploy user used for administration (e.g. for Ansible or login via SSH)
- Adjust APT update intervals
- Setup ufw firewall and allow only SSH access by default (add more rules/allowed networks if you like)
- Adjust security related sysctl settings (/proc filesystem)
- Change SSH default port (if requested)
- Disable password authentication
- Disable root login
- Disable PermitTunnel
- Install Sshguard and adjust whitelist
Versions
--------
I tag every release and try to stay with [semantic versioning](http://semver.org). If you want to use the role I recommend to checkout the latest tag. The master branch is basically development while the tags mark stable releases. But in general I try to keep master in good shape too.
Changelog
---------
**v3.0.0**
- Ansible v2.5 needed for Ubuntu 18.04 Bionic Beaver as Python 3 is default there. It *should* work with Ansible >= 2.2 too but who knows ;-) As Ubuntu 18.04 comes with Python 3 support only by default you may adjust your Ansible's `hosts` file. E.g you can add the `ansible_python_interpreter` env. like so: `host.domain.tld ansible_python_interpreter=/usr/bin/python3` (also see http://docs.ansible.com/ansible/latest/reference_appendices/python_3_support.html for more examples)
**v2.1.0**
- support for Ubuntu 18.04 Bionic Beaver
- added `sudo` package to `harden_linux_required_packages`
**v2.0.1**
- fixed deprecation warning while installing aptitude
**v2.0.0**
- major refactoring
- removed `common_ssh_port` (see `harden_linux_sshd_settings` instead)
- all variables that started with `common_` are now starting with the prefix `harden_linux_`. Additionally ALL variables that the role uses are now prefixed with `harden_linux_`. Using a variable name prefix avoids potential collisions with other role/group variables.
- introduced `harden_linux_deploy_user_uid` and `harden_linux_deploy_user_shell`
- single settings in `harden_linux_sysctl_settings` can be overriden by specifing the key/value in `harden_linux_sysctl_settings_user` list (whole list needed to be replaced before this change)
- more documentation added to `defaults/main.yml` (please read it ;-) )
- every setting in hosts `/etc/ssh/sshd_config` config file can now be replaced by using `harden_linux_sshd_settings_user` list. The defaults are specified in `harden_linux_sysctl_settings` and will be merged with `harden_linux_sysctl_settings_user` during run time.
- added variable `harden_linux_sshguard_whitelist` for Sshguard whitelist
- firewall rules can now be added using `harden_linux_ufw_rules` variable
**v1.0.0**
- initial release
Role Variables
--------------
The following variables don't have defaults. You need to specify them either in a file in `group_vars` or `host_vars` directory. E.g. if this settings should be used only for one specific host create a file for that host called like the FQDN of that host (e.g `host_vars/your-server.example.tld`) and put the variables with the correct values there. If you want to apply this variables to a host group create a file `group_vars/your-group.yml` e.g. Replace `your-group` with the host group name which you created in the Ansible `hosts` file (do not confuse with /etc/hosts...). `harden_linux_deploy_user_public_keys` loads all the public SSH key files specifed in the list from your local hard disk. So at least you need to specify:
```
harden_linux_root_password: your_encrypted_password_here
harden_linux_deploy_user: deploy
harden_linux_deploy_user_password: your_encrypted_password_here
harden_linux_deploy_user_home: /home/deploy
harden_linux_deploy_user_public_keys:
- /home/your_user/.ssh/id_rsa.pub
```
With `harden_linux_root_password` and `harden_linux_deploy_user_password` we specify the password for the `root` user and the `deploy` user. Ansible won't encrypt the password for you. To create a encrypted password you can do so e.g. with `python -c 'import crypt; print crypt.crypt("This is my Password", "$1$SomeSalt$")'` (You may need `python2` instead of `python` in case of Archlinux e.g.).
`harden_linux_deploy_user` specifies the user we want to use to login at the remote host. As already mentioned the `harden-linux` role will disable root user login via SSH for a good reason. So we need a different user. This user will get "sudo" permission which we need for Ansible (and yourself of course) to do it's work.
`harden_linux_deploy_user_public_keys` specifies a list of public SSH key files you want to add to `$HOME/.ssh/authorized_keys` of the deploy user on the remote host. If you specify `/home/deploy/.ssh/id_rsa.pub` e.g. as a value here the content of that **local** file will be added to `$HOME/.ssh/authorized_keys` of the deploy user on the remote host.
The following variables below have defaults. So you only need to change them if you need another value for the variable. `harden_linux_required_packages` specifies the packages this playbook requires to work. You can extend the list but don't remove the packages listed:
```
harden_linux_required_packages:
- ufw
- sshguard
- unattended-upgrades
- sudo
```
The role changes some SSHd settings by default:
```
harden_linux_sshd_settings:
"^PasswordAuthentication": "PasswordAuthentication no" # Disable password authentication
"^PermitRootLogin": "PermitRootLogin no" # Disable SSH root login
"^PermitTunnel": "PermitTunnel no" # Disable tun(4) device forwarding
"^Port ": "Port 22" # Set SSHd port
```
Personally I always change the default SSH port as lot of brute force attacks taking place against this port. So if you want to change the port setting for example you can do so:
```
harden_linux_sshd_settings_user:
"^Port ": "Port 22222"
```
(Please notice the whitespace after "Port"!). The playbook will combine `harden_linux_sshd_settings` and `harden_linux_sshd_settings_user` while the settings in `harden_linux_sshd_settings_user` have preference which means it will override the `^Port ` setting/key in `harden_linux_sshd_settings`. As you may have noticed all the key's in `harden_linux_sshd_settings` and `harden_linux_sshd_settings_user` begin with `^`. That's because it is a regular expression (regex). One of playbook task's will search for a line in `/etc/ssh/sshd_config` e.g. `^Port ` (while the `^` means "a line starting with ...") and replaces the line (if found) with e.g `Port 22222`. This way makes the playbook very flexible for adjusting settings in `sshd_config` (you can basically replace every setting). You'll see this pattern for other tasks too so everything mentioned here holds true in such cases.
Next we have some defaults for our firewall/iptables:
```
harden_linux_ufw_defaults:
"^IPV6": 'IPV6=yes'
"^DEFAULT_INPUT_POLICY": 'DEFAULT_INPUT_POLICY="DROP"'
"^DEFAULT_OUTPUT_POLICY": 'DEFAULT_OUTPUT_POLICY="ACCEPT"'
"^DEFAULT_FORWARD_POLICY": 'DEFAULT_FORWARD_POLICY="DROP"'
"^DEFAULT_APPLICATION_POLICY": 'DEFAULT_APPLICATION_POLICY="SKIP"'
"^MANAGE_BUILTINS": 'MANAGE_BUILTINS=no'
"^IPT_SYSCTL": 'IPT_SYSCTL=/etc/ufw/sysctl.conf'
"^IPT_MODULES": 'IPT_MODULES="nf_conntrack_ftp nf_nat_ftp nf_conntrack_netbios_ns"'
```
This settings are basically changing the values in `/etc/defaults/ufw`. To override one or more of the default settings you can so by specifying the same key (which is a regex) as above e.g. `^DEFAULT_FORWARD_POLICY` and simply assign it the new value:
```
harden_linux_ufw_defaults_user:
"^DEFAULT_FORWARD_POLICY": 'DEFAULT_FORWARD_POLICY="ACCEPT"'
```
As already mentioned above this playbook will also combine `harden_linux_ufw_defaults` and `harden_linux_ufw_defaults_user` while the settings in `harden_linux_ufw_defaults_user` have preference.
Next we can specify some firewall rules with `harden_linux_ufw_rules`. This is the default:
```
harden_linux_ufw_rules:
- rule: "allow"
to_port: "22"
protocol: "tcp"
```
You can add more settings for a rule like `interface`, `from_ip`, ... Please have a look at `tasks/main.yml` (search for "Apply firewall rules") for all possible settings.
You can also allow hosts to communicate on specific networks (without port restrictions) e.g.:
```
harden_linux_ufw_allow_networks:
- "10.3.0.0/24"
- "10.200.0.0/16"
```
Next harden-linux role also changes some system variables (sysctl.conf / proc filesystem). This settings are recommendations from Google which they use for their Google Compute Cloud OS images (see https://cloud.google.com/compute/docs/images/building-custom-os and https://cloud.google.com/compute/docs/images/configuring-imported-images). This are the default settings (if you are happy with this settings you don't have to do anything but I recommend to verify if they work for your setup):
```
harden_linux_sysctl_settings:
"net.ipv4.tcp_syncookies": 1 # Enable syn flood protection
"net.ipv4.conf.all.accept_source_route": 0 # Ignore source-routed packets
"net.ipv6.conf.all.accept_source_route": 0 # IPv6 - Ignore ICMP redirects
"net.ipv4.conf.default.accept_source_route": 0 # Ignore source-routed packets
"net.ipv6.conf.default.accept_source_route": 0 # IPv6 - Ignore source-routed packets
"net.ipv4.conf.all.accept_redirects": 0 # Ignore ICMP redirects
"net.ipv6.conf.all.accept_redirects": 0 # IPv6 - Ignore ICMP redirects
"net.ipv4.conf.default.accept_redirects": 0 # Ignore ICMP redirects
"net.ipv6.conf.default.accept_redirects": 0 # IPv6 - Ignore ICMP redirects
"net.ipv4.conf.all.secure_redirects": 1 # Ignore ICMP redirects from non-GW hosts
"net.ipv4.conf.default.secure_redirects": 1 # Ignore ICMP redirects from non-GW hosts
"net.ipv4.ip_forward": 0 # Do not allow traffic between networks or act as a router
"net.ipv6.conf.all.forwarding": 0 # IPv6 - Do not allow traffic between networks or act as a router
"net.ipv4.conf.all.send_redirects": 0 # Don't allow traffic between networks or act as a router
"net.ipv4.conf.default.send_redirects": 0 # Don't allow traffic between networks or act as a router
"net.ipv4.conf.all.rp_filter": 1 # Reverse path filtering - IP spoofing protection
"net.ipv4.conf.default.rp_filter": 1 # Reverse path filtering - IP spoofing protection
"net.ipv4.icmp_echo_ignore_broadcasts": 1 # Ignore ICMP broadcasts to avoid participating in Smurf attacks
"net.ipv4.icmp_ignore_bogus_error_responses": 1 # Ignore bad ICMP errors
"net.ipv4.icmp_echo_ignore_all": 0 # Ignore bad ICMP errors
"net.ipv4.conf.all.log_martians": 1 # Log spoofed, source-routed, and redirect packets
"net.ipv4.conf.default.log_martians": 1 # Log spoofed, source-routed, and redirect packets
"net.ipv4.tcp_rfc1337": 1 # Implement RFC 1337 fix
"kernel.randomize_va_space": 2 # Randomize addresses of mmap base, heap, stack and VDSO page
"fs.protected_hardlinks": 1 # Provide protection from ToCToU races
"fs.protected_symlinks": 1 # Provide protection from ToCToU races
"kernel.kptr_restrict": 1 # Make locating kernel addresses more difficult
"kernel.perf_event_paranoid": 2 # Set perf only available to root
```
You can override every single setting e.g. by creating a variable called `harden_linux_sysctl_settings_user`:
```
harden_linux_sysctl_settings_user:
"net.ipv4.ip_forward": 1
"net.ipv6.conf.default.forwarding": 1
"net.ipv6.conf.all.forwarding": 1
```
One of the playbook tasks will combine `harden_linux_sysctl_settings` and `harden_linux_sysctl_settings_user` while again `harden_linux_sysctl_settings_user` settings have preference. Have a look at `defaults/main.yml` file of the role for more information about the settings.
If you want UFW logging enabled set:
```
harden_linux_ufw_logging: 'on'
```
Possible values are `on`,`off`,`low`,`medium`,`high` and `full`.
And finally we've the Sshguard settings. Sshguard protects from brute force attacks against SSH. To avoid locking out yourself for a while you can add IPs or IP ranges to a whitelist. By default it's basically only "localhost":
```
harden_linux_sshguard_whitelist:
- "127.0.0.0/8"
- "::1/128"
```
Example Playbook
----------------
If you installed the role via `ansible-galaxy install githubixx.harden-linux` then include the role into your playbook like in this example:
```
- hosts: webservers
roles:
- githubixx.harden-linux
```
License
-------
GNU GENERAL PUBLIC LICENSE Version 3
Author Information
------------------
[www.tauceti.blog](https://www.tauceti.blog)

View file

@ -1,110 +0,0 @@
---
# Some default settings for deploy user
harden_linux_deploy_user_uid: 9999
harden_linux_deploy_user_shell: "/bin/bash"
# Packages required by this role
harden_linux_required_packages:
- ufw
- sshguard
- unattended-upgrades
- sudo
# Most of this settings are recommendations from Google which they use for
# their Google Compute Cloud OS images and from UFW firewall. Add more settings
# on your own by adding a group or host variable called "sysctl_settings_user".
# "sysctl_settings" and "sysctl_settings_user" will get merged by a
# task. You can also override a setting defined in "sysctl_settings"
# by specifing a key with the same name and a different value in
# "sysctl_settings_user".
#
# For more information about this settings have a look at:
# https://cloud.google.com/compute/docs/images/building-custom-os
# https://cloud.google.com/compute/docs/images/configuring-imported-images
# With ufw package installed: /etc/ufw/sysctl.conf
#
# The following settings are not available in Scaleway's Linux image but maybe
# other use it (keep it for reference):
# "kernel.yama.ptrace_scope": 1 # Set ptrace protections
#
# This would be cool but doesn't work with UFW very well so leave it out:
# "kernel.modules_disabled": 1 # Disable CAP_SYS_MODULE which allows for loading and unloading of kernel modules.
# If you set kernel.modules_disabled=1 you're not able to load new netfilter/iptable
# modules anymore (at least on Ubuntu 16.04)! So "ufw" would fail to start if
# it is loaded afterwards.
# Add this to "sysctl_settings_user" to turn off ipv6 autoconfiguration:
# "net.ipv6.conf.default.autoconf": 0
# "net.ipv6.conf.all.autoconf": 0
# Add this to "sysctl_settings_user" to enable ipv6 privacy addressing
# "net.ipv6.conf.default.use_tempaddr": 2
# "net.ipv6.conf.all.use_tempaddr": 2
harden_linux_sysctl_settings:
"net.ipv4.tcp_syncookies": 1 # Enable syn flood protection
"net.ipv4.conf.all.accept_source_route": 0 # Ignore source-routed packets
"net.ipv6.conf.all.accept_source_route": 0 # IPv6 - Ignore ICMP redirects
"net.ipv4.conf.default.accept_source_route": 0 # Ignore source-routed packets
"net.ipv6.conf.default.accept_source_route": 0 # IPv6 - Ignore source-routed packets
"net.ipv4.conf.all.accept_redirects": 0 # Ignore ICMP redirects
"net.ipv6.conf.all.accept_redirects": 0 # IPv6 - Ignore ICMP redirects
"net.ipv4.conf.default.accept_redirects": 0 # Ignore ICMP redirects
"net.ipv6.conf.default.accept_redirects": 0 # IPv6 - Ignore ICMP redirects
"net.ipv4.conf.all.secure_redirects": 1 # Ignore ICMP redirects from non-GW hosts
"net.ipv4.conf.default.secure_redirects": 1 # Ignore ICMP redirects from non-GW hosts
"net.ipv4.ip_forward": 0 # Do not allow traffic between networks or act as a router
"net.ipv6.conf.all.forwarding": 0 # IPv6 - Do not allow traffic between networks or act as a router
"net.ipv4.conf.all.send_redirects": 0 # Don't allow traffic between networks or act as a router
"net.ipv4.conf.default.send_redirects": 0 # Don't allow traffic between networks or act as a router
"net.ipv4.conf.all.rp_filter": 1 # Reverse path filtering - IP spoofing protection
"net.ipv4.conf.default.rp_filter": 1 # Reverse path filtering - IP spoofing protection
"net.ipv4.icmp_echo_ignore_broadcasts": 1 # Ignore ICMP broadcasts to avoid participating in Smurf attacks
"net.ipv4.icmp_ignore_bogus_error_responses": 1 # Ignore bad ICMP errors
"net.ipv4.icmp_echo_ignore_all": 0 # Ignore bad ICMP errors
"net.ipv4.conf.all.log_martians": 1 # Log spoofed, source-routed, and redirect packets
"net.ipv4.conf.default.log_martians": 1 # Log spoofed, source-routed, and redirect packets
"net.ipv4.tcp_rfc1337": 1 # Implement RFC 1337 fix
"kernel.randomize_va_space": 2 # Randomize addresses of mmap base, heap, stack and VDSO page
"fs.protected_hardlinks": 1 # Provide protection from ToCToU races
"fs.protected_symlinks": 1 # Provide protection from ToCToU races
"kernel.kptr_restrict": 1 # Make locating kernel addresses more difficult
"kernel.perf_event_paranoid": 2 # Set perf only available to root
# The "key" here is a regex of a setting you want to replace and the value is
# the setting name + the setting value. E.g. we want to replace the line
# "Port 22" with "Port 22222". The regex (the key) would be "^Port 22 " which
# means "search for a line in /etc/ssh/sshd_config that begins with 'Port 22 '
# and replace the whole line with 'Port 22222'". This enables you to replace
# every setting in sshd_config.
harden_linux_sshd_settings:
"^PasswordAuthentication": "PasswordAuthentication no" # Disable password authentication
"^PermitRootLogin": "PermitRootLogin no" # Disable SSH root login
"^PermitTunnel": "PermitTunnel no" # Disable tun(4) device forwarding
"^Port ": "Port 22" # Set SSHd port
# By default we only allow SSH inbound traffic.
harden_linux_ufw_rules:
- rule: "allow"
to_port: "22"
protocol: "tcp"
# Defaults for UFW (/etc/default/ufw). Same rules as for
# harden_linux_sshd_settings applies.
harden_linux_ufw_defaults:
"^IPV6": 'IPV6=yes'
"^DEFAULT_INPUT_POLICY": 'DEFAULT_INPUT_POLICY="DROP"'
"^DEFAULT_OUTPUT_POLICY": 'DEFAULT_OUTPUT_POLICY="ACCEPT"'
"^DEFAULT_FORWARD_POLICY": 'DEFAULT_FORWARD_POLICY="DROP"'
"^DEFAULT_APPLICATION_POLICY": 'DEFAULT_APPLICATION_POLICY="SKIP"'
"^MANAGE_BUILTINS": 'MANAGE_BUILTINS=no'
"^IPT_SYSCTL": 'IPT_SYSCTL=/etc/ufw/sysctl.conf'
"^IPT_MODULES": 'IPT_MODULES="nf_conntrack_ftp nf_nat_ftp nf_conntrack_netbios_ns"'
# Disable/enable UFW logging
harden_linux_ufw_logging: 'off'
# SSHGuard whitelist. SSHGuard blocks IPs for some time if
# to many login attempts fail. Specify IP (ranges) that
# should not be blocked
harden_linux_sshguard_whitelist:
- "127.0.0.0/8"
- "::1/128"

View file

@ -1,4 +0,0 @@
APT::Periodic::Update-Package-Lists "1";
APT::Periodic::Download-Upgradeable-Packages "1";
APT::Periodic::AutocleanInterval "7";
APT::Periodic::Unattended-Upgrade "1";

View file

@ -1,10 +0,0 @@
---
- name: reload ufw
ufw:
state: reloaded
- name: restart ssh
service:
name: ssh
state: restarted

View file

@ -1,16 +0,0 @@
galaxy_info:
author: Robert Wimmer
description: Ansible role for hardening Linux (targeting Ubuntu 16.04/18.04 mainly)
license: GPLv3
min_ansible_version: 2.5
platforms:
- name: Ubuntu
versions:
- xenial
- bionic
galaxy_tags:
- networking
- security
- linux
- firewall
- ssh

View file

@ -1,180 +0,0 @@
- name: Delete root pw file /root/.pw (if present)
file:
path: /root/.pw
state: absent
- name: Update APT package cache
apt:
update_cache: true
cache_valid_time: 3600
tags:
- apt
- name: Install aptitude
apt:
pkg: aptitude
state: present
tags:
- apt
- name: Upgrade APT to the latest packages
apt:
upgrade: safe
- name: Install required packages
apt:
state: present
pkg: "{{item}}"
with_items:
- "{{harden_linux_required_packages}}"
tags:
- ufw
- name: Add deploy user
user:
name: "{{harden_linux_deploy_user}}"
password: "{{harden_linux_deploy_user_password}}"
uid: "{{harden_linux_deploy_user_uid}}"
shell: "{{harden_linux_deploy_user_shell}}"
home: "{{harden_linux_deploy_user_home}}"
tags:
- user
- name: Add authorized keys for deploy user
authorized_key:
user: "{{harden_linux_deploy_user}}"
key: "{{item}}"
with_items:
- "{{harden_linux_deploy_user_public_keys}}"
when: harden_linux_deploy_user_public_keys is defined
tags:
- user
- name: Add deploy user to sudoers
lineinfile:
dest: /etc/sudoers
regexp: "{{harden_linux_deploy_user}} ALL"
line: "{{harden_linux_deploy_user}} ALL=(ALL) NOPASSWD:ALL"
state: present
tags:
- user
- sudo
- name: Adjust APT update intervals
copy:
src: etc/apt/apt.conf.d/10periodic
dest: /etc/apt/apt.conf.d/10periodic
owner: root
group: root
mode: 0644
tags:
- apt
- name: Combine harden_linux_sshd_settings and harden_linux_sshd_settings_user (if defined)
set_fact:
harden_linux_sshd_settings: "{{harden_linux_sshd_settings | combine(harden_linux_sshd_settings_user|default({})) }}"
tags:
- ssh
- name: Ensure sshd_config setting
lineinfile:
dest: "/etc/ssh/sshd_config"
regexp: "{{item}}"
line: "{{harden_linux_sshd_settings[item]}}"
state: "present"
notify: "restart ssh"
with_items:
- "{{harden_linux_sshd_settings | list}}"
tags:
- ssh
- name: Combine harden_linux_sysctl_settings and harden_linux_sysctl_settings_user (if defined)
set_fact:
harden_linux_sysctl_settings: "{{harden_linux_sysctl_settings | combine(harden_linux_sysctl_settings_user|default({})) }}"
tags:
- sysctl
- name: Sysctl settings
sysctl:
name: "{{item}}"
value: "{{harden_linux_sysctl_settings[item]}}"
sysctl_set: yes
with_items:
- "{{harden_linux_sysctl_settings | list}}"
tags:
- sysctl
- name: Combine harden_linux_ufw_defaults and harden_linux_ufw_defaults_user (if defined)
set_fact:
harden_linux_ufw_defaults: "{{harden_linux_ufw_defaults | combine(harden_linux_ufw_defaults_user|default({})) }}"
tags:
- ufw
- name: UFW - Configure defaults
lineinfile:
dest: /etc/default/ufw
regexp: "{{item}}"
line: "{{harden_linux_ufw_defaults[item]}}"
state: present
notify: "reload ufw"
with_items:
- "{{harden_linux_ufw_defaults | list}}"
tags:
- ufw
- name: UFW - Apply firewall rules
ufw:
rule: "{{item.rule}}"
interface: "{{item.interface | default('')}}"
direction: "{{item.direction | default('in')}}"
from_ip: "{{item.from_ip | default('any')}}"
to_ip: "{{item.to_ip | default('any')}}"
from_port: "{{item.from_port | default('')}}"
to_port: "{{item.to_port | default('')}}"
protocol: "{{item.protocol | default('any')}}"
log: "{{item.log | default(False)}}"
with_items: "{{harden_linux_ufw_rules}}"
tags:
- ufw
- ufwrules
- name: UFW - Allow configured networks to communicate
ufw:
rule: allow
src: "{{item}}"
with_items:
- "{{harden_linux_ufw_allow_networks}}"
when: harden_linux_ufw_allow_networks is defined
tags:
- ufw
- name: UFW - Setup logging
ufw:
logging: "{{harden_linux_ufw_logging}}"
tags:
- ufw
- name: Update Sshguard white list
lineinfile:
dest: /etc/sshguard/whitelist
regexp: "^{{item}}"
line: "{{item}}"
state: present
with_items:
- "{{harden_linux_sshguard_whitelist}}"
tags:
- sshguard
- name: UFW - Enable firewall/iptables
ufw:
state: enabled
tags:
- ufw
- name: Change root password
user:
name: "root"
password: "{{harden_linux_root_password}}"
when: harden_linux_root_password is defined
tags:
- user

View file

@ -1 +0,0 @@
localhost

View file

@ -1,5 +0,0 @@
---
- hosts: localhost
remote_user: root
roles:
- harden-linux

View file

@ -1 +0,0 @@
---

View file

@ -1,8 +0,0 @@
replicas_default_backend: 1
image_default_backend: gcr.io/google_containers/defaultbackend
version_default_backend: 1.4
scaleway_servername1: proxy1
scaleway_servername2: proxy2
scaleway_ipaddr: "" # set this in the inventory file
scaleway_reverse_ipaddr: "" # set this in the inventory file

View file

@ -1,81 +0,0 @@
---
- name: traefik-ingress-controller | Getting node labels
command: "kubectl get nodes -l role=ingress-controller"
register: nodes
changed_when: no
when: inventory_hostname == initial_master
- name: traefik-ingress-controller | Printing nodes
debug: var=nodes
when: inventory_hostname == initial_master
- name: traefik-ingress-controller | Labelling proxy nodes with role=ingress-controller
command: "kubectl label node {{ hostvars[item].ansible_hostname }} role=ingress-controller"
with_items:
- "{{ groups['k8s_proxy'] }}"
when:
- inventory_hostname == initial_master
- hostvars[item].ansible_hostname not in nodes.stdout
- name: traefik-ingress-controller | Templating manifests
template:
src: "{{ item }}"
dest: "/tmp/{{ item | regex_replace('.j2', '') }}"
with_items:
- default-backend-controller.yml.j2
- default-backend-service.yml.j2
- traefik-ingress-clusterolebinding.yml.j2
- traefik-ingress-configmap.yml.j2
- traefik-ingress-sa.yml.j2
- traefik-ingress-clusterole.yml.j2
- traefik-ingress-ds.yml.j2
- traefik-ingress-service.yml.j2
when: inventory_hostname == initial_master
- name: traefik-ingress-controller | Deploy the nginx_ingress_controller
kube:
filename: "{{ item }}"
state: latest
with_items:
- '/tmp/default-backend-controller.yml'
- '/tmp/default-backend-service.yml'
- '/tmp/traefik-ingress-clusterolebinding.yml'
- '/tmp/traefik-ingress-configmap.yml'
- '/tmp/traefik-ingress-clusterole.yml'
- '/tmp/traefik-ingress-sa.yml'
- '/tmp/traefik-ingress-ds.yml'
- '/tmp/traefik-ingress-service.yml'
when: inventory_hostname == initial_master
- name: traefik-ingress-controller | Creating directory for scaleway-ipmove
file:
path: /usr/local/bin/scaleway-ipmove
state: directory
when: "'k8s_proxy' in group_names"
- name: traefik-ingress-controller | Getting scaleway-ipmove.py
git:
repo: https://github.com/chmod666org/scaleway-ipmove
dest: /usr/local/bin/scaleway-ipmove
force: yes
when: "'k8s_proxy' in group_names"
- name: traefik-ingress-controller | notify.sh
template:
src: notify.sh.j2
dest: /usr/local/bin/scaleway-ipmove/notify.sh
mode: 0500
owner: root
group: root
when: "'k8s_proxy' in group_names"
# this runs keepalived on proxy nodes
- name: traefik-ingress-controller | Templating keepalived on proxy node
template:
src: "{{ item.src }}"
dest: "{{ item.dest }}"
with_items:
- { 'src': 'keepalived.yml.j2', 'dest': '/etc/kubernetes/manifests/keepalived.yml' }
when:
- "'k8s_proxy' in group_names"
- groups.k8s_proxy|length > 1

View file

@ -1,39 +0,0 @@
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: default-http-backend
labels:
k8s-app: default-http-backend
namespace: kube-system
spec:
replicas: {{ replicas_default_backend }}
template:
metadata:
labels:
k8s-app: default-http-backend
spec:
terminationGracePeriodSeconds: 60
containers:
- name: default-http-backend
# Any image is permissible as long as:
# 1. It serves a 404 page at /
# 2. It serves 200 on a /healthz endpoint
image: {{ image_default_backend }}:{{ version_default_backend }}
livenessProbe:
httpGet:
path: /healthz
port: 8080
scheme: HTTP
initialDelaySeconds: 30
timeoutSeconds: 5
ports:
- containerPort: 8080
resources:
limits:
cpu: 10m
memory: 20Mi
requests:
cpu: 10m
memory: 20Mi
nodeSelector:
role: ingress-controller

View file

@ -1,13 +0,0 @@
apiVersion: v1
kind: Service
metadata:
name: default-http-backend
namespace: kube-system
labels:
k8s-app: default-http-backend
spec:
ports:
- port: 80
targetPort: 8080
selector:
k8s-app: default-http-backend

View file

@ -1,37 +0,0 @@
apiVersion: v1
kind: Pod
metadata:
name: keepalived
namespace: kube-system
spec:
hostNetwork: true
volumes:
- hostPath:
path: /usr/local/bin/scaleway-ipmove/
name: scaleway-moveip
containers:
- name: keepalived
image: chmod666/keepalived:latest
# if tag is latest imagePullPolicy is always
# but when keepalived is backup a proxy may have no connection to the internet
# to avoid keepalived not starting in that case, we're putting imagePullPolicy: IfNotPresent
# assuming the image was already be pulled at cluster creation. Neat.
imagePullPolicy: IfNotPresent
volumeMounts:
- mountPath: "/mnt"
name: scaleway-moveip
securityContext:
capabilities:
add:
- NET_ADMIN
env:
- name: KEEPALIVED_INTERFACE
value: tun0
- name: KEEPALIVED_UNICAST_PEERS
value: "#PYTHON2BASH:['{{ groups['k8s_proxy'] | map('extract', hostvars, ['vpn_ip']) | join("', '") }}']"
- name: KEEPALIVED_VIRTUAL_IPS
value: "#PYTHON2BASH:['{{ keepalived_ip }}']"
- name: KEEPALIVED_PRIORITY
value: "{{ groups['k8s_proxy'].index(inventory_hostname) + 1 }}"
- name: KEEPALIVED_NOTIFY
value: "/mnt/notify.sh"

View file

@ -1,35 +0,0 @@
#!/bin/bash
# for ANY state transition.
# "notify" script is called AFTER the
# notify_* script(s) and is executed
# with 3 arguments provided by keepalived
# (ie don't include parameters in the notify line).
# arguments
# $1 = "GROUP"|"INSTANCE"
# $2 = name of group or instance
# $3 = target state of transition
# ("MASTER"|"BACKUP"|"FAULT")
TYPE=$1
NAME=$2
STATE=$3
case $STATE in
"MASTER") echo "I'm the MASTER! Whup whup." > /proc/1/fd/1
echo "Here is the master"
# this put the public ip on the master using the scaleway api
/mnt/scaleway-ipmove.py {{ scaleway_token }} {{ scaleway_servername1 }} {{ scaleway_servername2 }} {{ scaleway_ipaddr }} {{ scaleway_reverse_ipaddr }} {{ scaleway_orga }}
exit 0
;;
"BACKUP") echo "Ok, i'm just a backup, great." > /proc/1/fd/1
echo "Here is the backup"
exit 0
;;
"FAULT") echo "Fault, what ?" > /proc/1/fd/1
exit 0
;;
*) echo "Unknown state" > /proc/1/fd/1
exit 1
;;
esac

View file

@ -1,23 +0,0 @@
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
name: traefik-ingress-controller
rules:
- apiGroups:
- ""
resources:
- services
- endpoints
- secrets
verbs:
- get
- list
- watch
- apiGroups:
- extensions
resources:
- ingresses
verbs:
- get
- list
- watch

View file

@ -1,12 +0,0 @@
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
name: traefik-ingress-controller
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: traefik-ingress-controller
subjects:
- kind: ServiceAccount
name: traefik-ingress-controller
namespace: kube-system

View file

@ -1,45 +0,0 @@
kind: ConfigMap
apiVersion: v1
metadata:
name: traefik-config
namespace: kube-system
labels:
app: traefik-ingress-controller
data:
traefik.toml: |-
checkNewVersion = false
IdleTimeout = "180s"
MaxIdleConnsPerHost = 500
logLevel = "INFO"
defaultEntryPoints = ["http", "https"]
[retry]
attempts = 3
[kubernetes]
[web]
address = ":8081"
[acme]
email = "letsencrypt.account@banditlair.com"
storage = "traefik/acme/account"
entryPoint = "https"
OnHostRule = true
onDemand = true
acmeLogging = true
# TODO Remove this line when going to prod
caServer = "https://acme-staging-v02.api.letsencrypt.org/directory"
[[acme.domains]]
main = "{{ scaleway_reverse_ipaddr }}"
[entryPoints]
[entryPoints.http]
address = ":80"
compress = true
[entryPoints.http.redirect]
entryPoint = "https"
[entryPoints.https]
address = ":443"
[entryPoints.https.tls]

View file

@ -1,59 +0,0 @@
kind: DaemonSet
apiVersion: extensions/v1beta1
metadata:
name: traefik-ingress-controller
namespace: kube-system
labels:
k8s-app: traefik-ingress-lb
spec:
template:
metadata:
labels:
k8s-app: traefik-ingress-lb
name: traefik-ingress-lb
spec:
serviceAccountName: traefik-ingress-controller
terminationGracePeriodSeconds: 60
containers:
- image: traefik
name: traefik-ingress-lb
resources:
limits:
cpu: 200m
memory: 30Mi
requests:
cpu: 100m
memory: 20Mi
ports:
- name: http
containerPort: 80
hostPort: 80
- name: https
hostPort: 443
containerPort: 443
- name: admin
containerPort: 8081
securityContext:
capabilities:
drop:
- ALL
add:
- NET_BIND_SERVICE
volumeMounts:
- mountPath: "/config"
name: "config"
args:
- --api
- --configfile=/config/traefik.toml
- --kubernetes
- --logLevel=INFO
volumes:
- name: config
configMap:
name: traefik-config
items:
- key: traefik.toml
path: traefik.toml
nodeSelector:
# node must be labelled with roles=ingress-controller
role: ingress-controller

View file

@ -1,5 +0,0 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: traefik-ingress-controller
namespace: kube-system

View file

@ -1,18 +0,0 @@
kind: Service
apiVersion: v1
metadata:
name: traefik-web-ui
namespace: kube-system
spec:
selector:
k8s-app: traefik-ingress-lb
ports:
- protocol: TCP
port: 80
name: http
- protocol: TCP
port: 443
name: https
- protocol: TCP
port: 8080
name: admin

View file

@ -1,5 +0,0 @@
---
letsencrypt_email: letsencrypt.account@banditlair.com
traefik_domain: "traefik.{{banditlair_domain}}"
searx_domain: "searx.{{banditlair_domain}}"
rook_domain: "rook.{{banditlair_domain}}"

View file

@ -1,25 +0,0 @@
- name: cert-manager issuers
k8s:
state: present
namespace: "{{item.name}}"
definition:
apiVersion: certmanager.k8s.io/v1alpha1
kind: ClusterIssuer
metadata:
name: "{{item.name}}"
spec:
acme:
# The ACME server URL
server: "{{item.server}}"
# Email address used for ACME registration
email: "{{letsencrypt_email}}"
# Name of a secret used to store the ACME account private key
privateKeySecretRef:
name: "{{item.name}}"
# Enable HTTP01 validations
http01: {}
with_items:
- name: letsencrypt-production
server: https://acme-v02.api.letsencrypt.org/directory
- name: letsencrypt-staging
server: https://acme-staging-v02.api.letsencrypt.org/directory

View file

@ -1,23 +0,0 @@
- name: Create secret with token for CSI driver
k8s:
definition:
apiVersion: v1
kind: Secret
metadata:
name: hcloud-csi
namespace: kube-system
stringData:
token: "{{ hcloud_token_csi }}"
- name: Download the CSI driver manifest
get_url:
url: https://raw.githubusercontent.com/hetznercloud/csi-driver/master/deploy/kubernetes/hcloud-csi.yml
dest: /tmp/hcloud-csi.yml
mode: 0600
force: yes
delegate_to: localhost
- name: Apply CSI driver manifest
k8s:
state: present
definition: "{{ lookup('file', '/tmp/hcloud-csi.yml') }}"

View file

@ -1,28 +0,0 @@
---
- import_tasks: prerequisites.yml
tags: prerequisites
- import_tasks: hcloud-csi.yml
tags: hcloud-csi
- import_tasks: rook.yml
tags: rook
- import_tasks: cert-manager.yml
tags: cert-manager
- import_tasks: searx.yml
tags: searx
- include_tasks:
file: wiki.yml
apply:
tags:
- wiki
vars:
wiki_instance: "{{ item }}"
loop:
- anderia
- arkadia
tags: wiki

View file

@ -1,12 +0,0 @@
- name: Install pip
package:
name:
- python3-pip
- python3-setuptools
state: present
- name: Install python dependencies
pip:
name:
- openshift
state: present

View file

@ -1,202 +0,0 @@
- name: Download Rook manifests
get_url:
url: "{{item.url}}"
dest: "/tmp/{{item.filename}}"
mode: 0600
force: yes
delegate_to: localhost
changed_when: false
with_items:
- url: https://raw.githubusercontent.com/rook/rook/release-1.0/cluster/examples/kubernetes/ceph/common.yaml
filename: rook-common.yml
- url: https://raw.githubusercontent.com/rook/rook/release-1.0/cluster/examples/kubernetes/ceph/operator.yaml
filename: rook-operator.yml
# Workaround until https://github.com/ansible/ansible/pull/59160 is released
- name: Remove last line of the manifest file
command: sed -i '$ d' /tmp/rook-common.yml
delegate_to: localhost
changed_when: false
warn: false
- name: Apply Rook manifests
k8s:
state: present
definition: "{{ lookup('file', '/tmp/' + item) }}"
with_items:
- rook-common.yml
- rook-operator.yml
- name: Rook cluster CRD
k8s:
state: present
definition:
apiVersion: ceph.rook.io/v1
kind: CephCluster
metadata:
name: rook-ceph
namespace: rook-ceph
spec:
cephVersion:
image: ceph/ceph:v14.2.2-20190722
allowUnsupported: false
dataDirHostPath: /var/lib/rook
mon:
count: 3
allowMultiplePerNode: false
dashboard:
enabled: true
# serve the dashboard under a subpath (useful when you are accessing the dashboard via a reverse proxy)
# urlPrefix: /ceph-dashboard
# serve the dashboard at the given port.
port: 8080
# serve the dashboard using SSL
ssl: false
network:
hostNetwork: false
rbdMirroring:
workers: 0
storage:
useAllNodes: true
useAllDevices: true
directories:
- path: /var/lib/rook
- name: Rook CephFS
k8s:
state: present
definition:
apiVersion: ceph.rook.io/v1
kind: CephFilesystem
metadata:
name: ceph-fs
namespace: rook-ceph
spec:
metadataPool:
failureDomain: host
replicated:
size: 2
dataPools:
- failureDomain: host
replicated:
size: 3
metadataServer:
activeCount: 1
activeStandby: true
- name: Rook Toolbox
k8s:
state: present
definition:
apiVersion: apps/v1
kind: Deployment
metadata:
name: rook-ceph-tools
namespace: rook-ceph
labels:
app: rook-ceph-tools
spec:
replicas: 1
selector:
matchLabels:
app: rook-ceph-tools
template:
metadata:
labels:
app: rook-ceph-tools
spec:
dnsPolicy: ClusterFirstWithHostNet
containers:
- name: rook-ceph-tools
image: rook/ceph:v1.0.5
command: ["/tini"]
args: ["-g", "--", "/usr/local/bin/toolbox.sh"]
imagePullPolicy: IfNotPresent
env:
- name: ROOK_ADMIN_SECRET
valueFrom:
secretKeyRef:
name: rook-ceph-mon
key: admin-secret
securityContext:
privileged: true
volumeMounts:
- mountPath: /dev
name: dev
- mountPath: /sys/bus
name: sysbus
- mountPath: /lib/modules
name: libmodules
- name: mon-endpoint-volume
mountPath: /etc/rook
# if hostNetwork: false, the "rbd map" command hangs, see https://github.com/rook/rook/issues/2021
hostNetwork: true
volumes:
- name: dev
hostPath:
path: /dev
- name: sysbus
hostPath:
path: /sys/bus
- name: libmodules
hostPath:
path: /lib/modules
- name: mon-endpoint-volume
configMap:
name: rook-ceph-mon-endpoints
items:
- key: data
path: mon-endpoints
- name: Rook ceph dashboard service
k8s:
state: present
definition:
apiVersion: v1
kind: Service
metadata:
name: rook-ceph-mgr-dashboard
namespace: rook-ceph
labels:
app: rook-ceph-mgr
rook_cluster: rook-ceph
spec:
type: ClusterIP
ports:
- name: dashboard
port: 8080
targetPort: 8080
selector:
app: rook-ceph-mgr
rook_cluster: rook-ceph
sessionAffinity: None
- name: Rook ceph dashboard ingress
k8s:
state: present
definition:
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: rook-ceph-mgr-dashboard
namespace: rook-ceph
annotations:
kubernetes.io/ingress.class: nginx
certmanager.k8s.io/cluster-issuer: "{{cert_manager_issuer}}"
# kubernetes.io/tls-acme: "true"
# nginx.ingress.kubernetes.io/backend-protocol: "HTTPS"
# nginx.ingress.kubernetes.io/server-snippet: |
# proxy_ssl_verify off;
spec:
rules:
- host: "{{rook_domain}}"
http:
paths:
- path: /
backend:
serviceName: rook-ceph-mgr-dashboard
servicePort: 8080
tls:
- hosts:
- "{{rook_domain}}"
secretName: rook-cert

View file

@ -1,78 +0,0 @@
- name: Searx deployment
k8s:
namespace: default
state: present
definition:
apiVersion: apps/v1
kind: Deployment
metadata:
name: searx
spec:
replicas: 2
selector:
matchLabels:
app: searx
template:
metadata:
labels:
app: searx
spec:
containers:
- name: searx
image: hoellen/searx
imagePullPolicy: IfNotPresent
ports:
- containerPort: 8888
livenessProbe:
httpGet:
path: /
port: 8888
readinessProbe:
httpGet:
path: /
port: 8888
- name: Searx service
k8s:
namespace: default
state: present
definition:
apiVersion: v1
kind: Service
metadata:
name: searx
spec:
type: ClusterIP
ports:
- port: 80
targetPort: 8888
selector:
app: searx
- name: Searx ingress
k8s:
namespace: default
state: present
definition:
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: searx
annotations:
kubernetes.io/ingress.class: nginx
certmanager.k8s.io/cluster-issuer: "{{cert_manager_issuer}}"
# ingress.kubernetes.io/ssl-redirect: "true"
# ingress.kubernetes.io/ssl-temporary-redirect: "false"
spec:
rules:
- host: "{{searx_domain}}"
http:
paths:
- path: /
backend:
serviceName: searx
servicePort: 80
tls:
- hosts:
- "{{searx_domain}}"
secretName: searx-cert

View file

@ -1,90 +0,0 @@
- name: "{{ wiki_instance }} wiki deployment"
k8s:
namespace: default
state: present
definition:
apiVersion: apps/v1
kind: Deployment
metadata:
name: "{{ wiki_instance }}-wiki"
spec:
replicas: 2
selector:
matchLabels:
app: "{{ wiki_instance }}-wiki"
template:
metadata:
labels:
app: "{{ wiki_instance }}-wiki"
spec:
containers:
- name: "{{ wiki_instance }}-wiki"
image: bitnami/dokuwiki:0.20180422.201901061035
imagePullPolicy: IfNotPresent
ports:
- containerPort: 80
livenessProbe:
httpGet:
path: /
port: 80
readinessProbe:
httpGet:
path: /
port: 80
volumeMounts:
- mountPath: /bitnami
name: "{{ wiki_instance }}-wiki-data"
volumes:
- name: "{{ wiki_instance }}-wiki-data"
flexVolume:
driver: ceph.rook.io/rook
fsType: ceph
options:
fsName: ceph-fs # name of the filesystem specified in the filesystem CRD.
clusterNamespace: rook-ceph # namespace where the Rook cluster is deployed
path: /wiki/{{ wiki_instance }}
- name: "{{ wiki_instance }} wiki service"
k8s:
namespace: default
state: present
definition:
apiVersion: v1
kind: Service
metadata:
name: "{{ wiki_instance }}-wiki"
spec:
type: ClusterIP
ports:
- port: 80
targetPort: 80
selector:
app: "{{ wiki_instance }}-wiki"
- name: "{{ wiki_instance }} wiki ingress"
k8s:
namespace: default
state: present
definition:
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: "{{ wiki_instance }}"
annotations:
kubernetes.io/ingress.class: nginx
certmanager.k8s.io/cluster-issuer: "{{cert_manager_issuer}}"
# ingress.kubernetes.io/ssl-redirect: "true"
# ingress.kubernetes.io/ssl-temporary-redirect: "false"
spec:
rules:
- host: "{{ wiki_instance }}.{{banditlair_domain}}"
http:
paths:
- path: /
backend:
serviceName: "{{ wiki_instance }}-wiki"
servicePort: 80
tls:
- hosts:
- "{{ wiki_instance }}.{{banditlair_domain}}"
secretName: "{{ wiki_instance }}-cert"

View file

@ -1,60 +0,0 @@
kubectl run sshd-data --image=panubo/sshd --rm -ti --restart=Never --overrides='
{
"metadata": {
"labels": {
"app": "sshd-data"
}
},
"spec": {
"containers": [
{
"stdin": true,
"tty": true,
"name": "sshd-data",
"image": "panubo/sshd",
"env": [
{
"name":"SSH_USERS",
"value":"storage1:1042:1042"
},
{
"name":"SSH_ENABLE_ROOT",
"value":"true"
}
],
"volumeMounts": [
{
"name": "data",
"mountPath": "/data"
},
{
"name": "authorized-keys",
"mountPath": "/etc/authorized_keys/root",
"subPath": "root"
}
]
}
],
"volumes": [
{
"name": "data",
"flexVolume": {
"driver": "ceph.rook.io/rook",
"fsType": "ceph",
"options": {
"fsName": "ceph-fs",
"clusterNamespace" : "rook-ceph"
}
}
},
{
"name": "authorized-keys",
"configMap": {
"name": "sshd-authorized-keys",
"defaultMode": 420
}
}
]
}
}
'

View file

@ -1,44 +0,0 @@
- name: Create utils directory
file:
state: directory
path: /root/utils
- name: Create run_sshd_pod.sh
copy:
src: run_sshd_pod.sh
dest: /root/utils/run_sshd_pod.sh
mode: 0700
- name: Create sshd_authorized_keys config map
k8s:
state: present
definition:
apiVersion: v1
kind: ConfigMap
metadata:
name: sshd-authorized-keys
namespace: default
data:
root: |
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDMPhCld0dsDzpdkMvPRdiwd6IX8HF8Mb2V6uQzBl8/syeny8FbZxlZR8gk39RGxNYcLaZ+nA50DS6mOIplXCGdtozfw0Vm+FdITN3apMufWIdobG7Igs1vxKBBbkAb5lwxkEFUCUMzPdCLFHd5zabVH0WE42Be8+hYPLd5W/ikPCOgxRaGwryHHroxRMdkD3PcNE8upSEMdGl51pzgXhO6Fcig8UokOYHxV92SiQ0KEsCbc+oe8e9Gkr7g78tz+6YcTYLY2p2ygR7Vrh/WyTaUVnrNNqL8NIqp+Lc2kVtnqGXHFBJ0Wggaly+AeKWygy+dnOMEGSirhQ6/dUcB/Phz phfroidmont@archdesktop-2017-07-31
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDQNavMeTECRU+7JGsv2sSZgC9qfPU9kKkYmM/p+07MGydqt76AJSYBIMl+4u0rSU/Di+TRn0E89Ik/RTduTUwXyqBxOuYMaIu7KnDZAHl0xlg0nEvPuanI0GiUh0uzskVnTyn6zwx9JvglBdH/j6MH/6/LBJ4CnWLIvlvlQN/wpw24Vm9WoTruEp/IWxg30lUA+MUNjx+5MmMUXZatk/zNGZK06fD0/vUMsWh3vQNIE3FsUQ7OEpLCrIPglfU2Wg5T/jmaxl6pD3cze4DjwBT9quqpbep36ZWDcD+ThsuMx5kca/HzGtMEwUA7L1PMNOjqVe5yBSBtOsIw4iB4qNKpjloxMVU1TXZRQd0EIqA/G7YNbsE+38FCzxqjtqin9Rnd9A5ISrkdyVYVycm3CElAU7rlpANT2Qh8y+tPfS/L4K7dyQGt5Fc5GLnIBCWVJlLpDAgykVL1hAOOuzct3dyKAn/7D+bU6OjPI2p0HwkeoI4JBmDqQEv/V04a0aDHm1kYieXzb2CMgkekXe7FwcUvujlNSr6VAoJq0NrNN6hSsPC8itNNElwv618dJwxc/ALO0d1CPRjJzs0lTSeVTZASq29TxJOWhlSGc+zWzxfxEB9EYF+QpqMyhrXh+eMQzqmVv055kMFFwSLCtLOBUq1dW0W/U/5abhNeJ1DRrACUEw== root@storage1-2018-10-11
- name: Create sshd-data service
k8s:
state: present
definition:
apiVersion: v1
kind: Service
metadata:
name: sshd-data-svc
namespace: default
labels:
name: sshd-data-svc
spec:
ports:
- name: ssh
port: 22
nodePort: 30522
type: NodePort
selector:
app: sshd-data

View file

@ -1,15 +0,0 @@
---
# set basic_auth_user as non-empty to enforce basic auth
dashboard_basic_auth_user: ""
dashboard_basic_auth_password: ""
# e.g. the fqdn would be k8s.yourdomain.tld if
# dashboard_subdomain=k8s
# scaleway_reverse_ipaddr=yourdomain.tld
dashboard_subdomain: k8s
dashboard_image: gcr.io/google_containers/kubernetes-dashboard-amd64
dashboard_version: v1.10.0
init_dashboard_image: gcr.io/google_containers/kubernetes-dashboard-init-amd64
init_dashboard_version: v1.0.1

View file

@ -1,12 +0,0 @@
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
name: kubernetes-dashboard-crb
roleRef:
apiGroup: ""
kind: ClusterRole
name: cluster-admin
subjects:
- kind: ServiceAccount
name: kubernetes-dashboard
namespace: kube-system

View file

@ -1,20 +0,0 @@
kind: Role
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
name: kubernetes-dashboard-minimal
namespace: kube-system
rules:
# Allow Dashboard to create and watch for changes of 'kubernetes-dashboard-key-holder' secret.
- apiGroups: [""]
resources: ["secrets"]
verbs: ["create", "watch"]
- apiGroups: [""]
resources: ["secrets"]
# Allow Dashboard to get, update and delete 'kubernetes-dashboard-key-holder' secret.
resourceNames: ["kubernetes-dashboard-key-holder", "kubernetes-dashboard-certs"]
verbs: ["get", "update", "delete"]
# Allow Dashboard to get metrics from heapster.
- apiGroups: [""]
resources: ["services"]
resourceNames: ["heapster"]
verbs: ["proxy"]

View file

@ -1,13 +0,0 @@
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: RoleBinding
metadata:
name: kubernetes-dashboard-minimal
namespace: kube-system
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: kubernetes-dashboard-minimal
subjects:
- kind: ServiceAccount
name: kubernetes-dashboard
namespace: kube-system

View file

@ -1,7 +0,0 @@
apiVersion: v1
kind: ServiceAccount
metadata:
labels:
k8s-app: kubernetes-dashboard
name: kubernetes-dashboard
namespace: kube-system

View file

@ -1,8 +0,0 @@
apiVersion: v1
kind: Secret
metadata:
labels:
k8s-app: kubernetes-dashboard
name: kubernetes-dashboard-certs
namespace: kube-system
type: Opaque

View file

@ -1,13 +0,0 @@
kind: Service
apiVersion: v1
metadata:
labels:
k8s-app: kubernetes-dashboard
name: kubernetes-dashboard
namespace: kube-system
spec:
ports:
- port: 80
targetPort: 9090
selector:
k8s-app: kubernetes-dashboard

View file

@ -1,16 +0,0 @@
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
name: heapster
labels:
k8s-addon: monitoring-standalone.addons.k8s.io
kubernetes.io/cluster-service: "true"
addonmanager.kubernetes.io/mode: Reconcile
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: system:heapster
subjects:
- kind: ServiceAccount
name: heapster
namespace: kube-system

View file

@ -1,77 +0,0 @@
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: heapster
namespace: kube-system
labels:
k8s-addon: monitoring-standalone.addons.k8s.io
k8s-app: heapster
kubernetes.io/cluster-service: "true"
addonmanager.kubernetes.io/mode: Reconcile
version: v1.7.0
spec:
replicas: 1
selector:
matchLabels:
k8s-app: heapster
version: v1.7.0
template:
metadata:
labels:
k8s-app: heapster
version: v1.7.0
annotations:
scheduler.alpha.kubernetes.io/critical-pod: ''
spec:
serviceAccountName: heapster
containers:
- image: gcr.io/google_containers/heapster:v1.4.0
name: heapster
livenessProbe:
httpGet:
path: /healthz
port: 8082
scheme: HTTP
initialDelaySeconds: 180
timeoutSeconds: 5
resources:
# keep request = limit to keep this container in guaranteed class
limits:
cpu: 100m
memory: 300Mi
requests:
cpu: 100m
memory: 300Mi
command:
- /heapster
- --source=kubernetes.summary_api:''
- image: gcr.io/google_containers/addon-resizer:2.0
name: heapster-nanny
resources:
limits:
cpu: 50m
memory: 100Mi
requests:
cpu: 50m
memory: 100Mi
env:
- name: MY_POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: MY_POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
command:
- /pod_nanny
- --cpu=80m
- --extra-cpu=0.5m
- --memory=140Mi
- --extra-memory=4Mi
- --deployment=heapster
- --container=heapster
- --poll-period=300000
tolerations:
- key: "CriticalAddonsOnly"
operator: "Exists"

View file

@ -1,24 +0,0 @@
# Heapster's pod_nanny monitors the heapster deployment & its pod(s), and scales
# the resources of the deployment if necessary.
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: Role
metadata:
name: system:pod-nanny
namespace: kube-system
labels:
kubernetes.io/cluster-service: "true"
addonmanager.kubernetes.io/mode: Reconcile
rules:
- apiGroups:
- ""
resources:
- pods
verbs:
- get
- apiGroups:
- "extensions"
resources:
- deployments
verbs:
- get
- update

View file

@ -1,16 +0,0 @@
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: RoleBinding
metadata:
name: heapster-binding
namespace: kube-system
labels:
kubernetes.io/cluster-service: "true"
addonmanager.kubernetes.io/mode: Reconcile
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: system:pod-nanny
subjects:
- kind: ServiceAccount
name: heapster
namespace: kube-system

View file

@ -1,7 +0,0 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: heapster
namespace: kube-system
labels:
k8s-addon: monitoring-standalone.addons.k8s.io

View file

@ -1,15 +0,0 @@
apiVersion: v1
kind: Service
metadata:
name: heapster
namespace: kube-system
labels:
k8s-addon: monitoring-standalone.addons.k8s.io
kubernetes.io/name: "Heapster"
kubernetes.io/cluster-service: "true"
spec:
ports:
- port: 80
targetPort: 8082
selector:
k8s-app: heapster

View file

@ -1,85 +0,0 @@
---
- block:
- name: Installing python-passlib
apt:
name: python3-passlib
state: latest
register: result
retries: 3
until: result is success
- name: Creating htpasswd file if k8s has basic auth
htpasswd:
path: /tmp/auth
name: "{{ dashboard_basic_auth_user }}"
password: "{{ dashboard_basic_auth_password }}"
when: inventory_hostname == initial_master
- name: Getting secrets
command: kubectl get secrets --namespace=kube-system
register: secrets
when: inventory_hostname == initial_master
- name: Creating secret
command: kubectl create secret generic dashboard-basic-auth --namespace=kube-system --from-file=/tmp/auth
when:
- inventory_hostname == initial_master
- '"dashboard-basic-auth" not in secrets.stdout'
- name: Deleting basic_auth file
file:
path: /tmp/auth
state: absent
when: inventory_hostname == initial_master
when: dashboard_basic_auth_user | length > 0
- name: Templating manifests
template:
src: "{{ item }}"
dest: "/tmp/{{ item | regex_replace('.j2', '') }}"
with_items:
- dashboard-ingress.yml.j2
- dashboard-deployment.yml.j2
when: inventory_hostname == initial_master
- name: Copying manifests files
copy:
src: "{{ item }}"
dest: "/tmp/{{ item }}"
with_items:
- dashboard-rolebinding.yml
- dashboard-role.yml
- dashboard-sa.yml
- dashboard-clusterrolebinding.yml
- dashboard-secret.yml
- dashboard-service.yml
- heapster-rolebinding.yml
- heapster-clusterrolebinding.yml
- heapster-role.yml
- heapster-sa.yml
- heapster-service.yml
- heapster-deployment.yml
when: inventory_hostname == initial_master
- name: Deploying kubernetes-dashboard
kube:
name: "{{ item.name }}"
resource: "{{ item.type }}"
filename: "{{ item.file }}"
state: latest
with_items:
- { 'name': 'kubernetes-dashboard', 'type': 'sa', 'file': '/tmp/dashboard-sa.yml' }
- { 'name': 'kubernetes-dashboard', 'type': 'clusterrolebinding', 'file': '/tmp/dashboard-clusterrolebinding.yml' }
- { 'name': 'kubernetes-dashboard', 'type': 'secret', 'file': '/tmp/dashboard-secret.yml' }
- { 'name': 'kubernetes-dashboard', 'type': 'service', 'file': '/tmp/dashboard-service.yml' }
- { 'name': 'kubernetes-dashboard', 'type': 'deployment', 'file': '/tmp/dashboard-deployment.yml' }
- { 'name': 'kubernetes-dashboard', 'type': 'ingress', 'file': '/tmp/dashboard-ingress.yml' }
- { 'name': 'heapster', 'type': 'sa', 'file': '/tmp/heapster-sa.yml' }
- { 'name': 'heapster', 'type': 'clusterrolebinding', 'file': '/tmp/heapster-clusterrolebinding.yml' }
- { 'name': 'heapster', 'type': 'rolebinding', 'file': '/tmp/heapster-rolebinding.yml' }
- { 'name': 'heapster', 'type': 'role', 'file': '/tmp/heapster-role.yml' }
- { 'name': 'heapster', 'type': 'service', 'file': '/tmp/heapster-service.yml' }
- { 'name': 'heapster', 'type': 'deployment', 'file': '/tmp/heapster-deployment.yml' }
when: inventory_hostname == initial_master

View file

@ -1,47 +0,0 @@
kind: Deployment
apiVersion: extensions/v1beta1
metadata:
labels:
k8s-app: kubernetes-dashboard
name: kubernetes-dashboard
namespace: kube-system
spec:
replicas: 1
revisionHistoryLimit: 10
selector:
matchLabels:
k8s-app: kubernetes-dashboard
template:
metadata:
labels:
k8s-app: kubernetes-dashboard
spec:
containers:
- name: kubernetes-dashboard
image: {{ dashboard_image }}:{{ dashboard_version }}
ports:
- containerPort: 9090
protocol: TCP
args:
# Uncomment the following line to manually specify Kubernetes API server Host
# If not specified, Dashboard will attempt to auto discover the API server and connect
# to it. Uncomment only if the default does not work.
# - --apiserver-host=http://my-address:port
volumeMounts:
# Create on-disk volume to store exec logs
- mountPath: /tmp
name: tmp-volume
livenessProbe:
httpGet:
path: /
port: 9090
initialDelaySeconds: 30
timeoutSeconds: 30
volumes:
- name: tmp-volume
emptyDir: {}
serviceAccountName: kubernetes-dashboard
# Comment the following tolerations if Dashboard must not be deployed on master
tolerations:
- key: node-role.kubernetes.io/master
effect: NoSchedule

View file

@ -1,26 +0,0 @@
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
namespace: kube-system
name: kubernetes-dashboard
annotations:
kubernetes.io/ingress.class: traefik
{% if dashboard_basic_auth_user | length > 0 %}
traefik.ingress.kubernetes.io/auth-type: basic
traefik.ingress.kubernetes.io/auth-secret: dashboard-basic-auth
{% endif %}
spec:
# this enables tls for the specified domain names
# tls:
# - hosts:
# - {{ dashboard_subdomain }}.{{ scaleway_reverse_ipaddr }}
# secretName: dashboard-tls
rules:
- host: {{ dashboard_subdomain }}.{{ scaleway_reverse_ipaddr }}
http:
paths:
- path: /
backend:
serviceName: kubernetes-dashboard
servicePort: 80

View file

@ -1,7 +0,0 @@
COMPOSE_PROJECT_NAME=monitoring
#Domains
GRAFANA_DOMAIN=grafana.banditlair.com
#Letsencrypt
LETSENCRYPT_EMAIL=banditlair@outlook.com

View file

@ -1,10 +0,0 @@
route:
receiver: 'slack'
receivers:
- name: 'slack'
slack_configs:
- send_resolved: true
username: '<username>'
channel: '#<channel-name>'
api_url: '<incomming-webhook-url>'

View file

@ -1,93 +0,0 @@
version: '2.2'
volumes:
prometheus_data: {}
grafana_data: {}
networks:
proxy-tier:
external:
name: nginx-proxy
back-tier:
driver: bridge
services:
prometheus:
image: prom/prometheus
volumes:
- ./prometheus:/etc/prometheus/
- /var/lib/prometheus:/prometheus
command:
- '--config.file=/etc/prometheus/prometheus.yml'
- '--storage.tsdb.path=/prometheus'
# - '--alertmanager.url=http://alertmanager:9093'
expose:
- 9090
links:
- cadvisor:cadvisor
- alertmanager:alertmanager
depends_on:
- cadvisor
networks:
- back-tier
restart: always
node-exporter:
image: prom/node-exporter
volumes:
- /proc:/host/proc:ro
- /sys:/host/sys:ro
- /:/rootfs:ro
command: '--path.procfs=/host/proc --path.sysfs=/host/sys --collector.filesystem.ignored-mount-points="^(/rootfs|/host|)/(sys|proc|dev|host|etc)($$|/)" --collector.filesystem.ignored-fs-types="^(sys|proc|auto|cgroup|devpts|ns|au|fuse\.lxc|mqueue)(fs|)$$"'
expose:
- 9100
networks:
- back-tier
restart: always
alertmanager:
image: prom/alertmanager
ports:
- 9093:9093
volumes:
- ./alertmanager/:/etc/alertmanager/
networks:
- back-tier
command:
- '-config.file=/etc/alertmanager/config.yml'
- '-storage.path=/alertmanager'
restart: always
cadvisor:
image: google/cadvisor
volumes:
- /:/rootfs:ro
- /var/run:/var/run:rw
- /sys:/sys:ro
- /var/lib/docker/:/var/lib/docker:ro
expose:
- 8080
networks:
- back-tier
restart: always
grafana:
image: grafana/grafana
depends_on:
- prometheus
expose:
- 3000
volumes:
- /var/lib/grafana:/var/lib/grafana
environment:
- VIRTUAL_HOST=${GRAFANA_DOMAIN}
- VIRTUAL_NETWORK=nginx-proxy
- VIRTUAL_PORT=3000
# - LETSENCRYPT_HOST=${GRAFANA_DOMAIN}
# - LETSENCRYPT_EMAIL=${LETSENCRYPT_EMAIL}
env_file:
- ./grafana/grafana.env
networks:
- back-tier
- proxy-tier
restart: always

View file

@ -1,2 +0,0 @@
GF_SECURITY_ADMIN_PASSWORD=pSvpRYWAS9LJrcEiuiuAV33f
GF_USERS_ALLOW_SIGN_UP=false

View file

@ -1,9 +0,0 @@
ALERT service_down
IF up == 0
ALERT high_load
IF node_load1 > 0.5
ANNOTATIONS {
summary = "Instance {{ $labels.instance }} under high load",
description = "{{ $labels.instance }} of job {{ $labels.job }} is under high load.",
}

View file

@ -1,31 +0,0 @@
# my global config
global:
scrape_interval: 15s # By default, scrape targets every 15 seconds.
evaluation_interval: 15s # By default, scrape targets every 15 seconds.
# scrape_timeout is set to the global default (10s).
# Attach these labels to any time series or alerts when communicating with
# external systems (federation, remote storage, Alertmanager).
external_labels:
monitor: 'banditlair'
# Load and evaluate rules in this file every 'evaluation_interval' seconds.
rule_files:
- "alert.rules"
# - "first.rules"
# - "second.rules"
# A scrape configuration containing exactly one endpoint to scrape:
# Here it's Prometheus itself.
scrape_configs:
# The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
- job_name: 'prometheus'
# Override the global default and scrape targets from this job every 5 seconds.
scrape_interval: 5s
# metrics_path defaults to '/metrics'
# scheme defaults to 'http'.
static_configs:
- targets: ['localhost:9090','cadvisor:8080','node-exporter:9100']

View file

@ -1 +0,0 @@
COMPOSE_PROJECT_NAME=murmur

View file

@ -1,13 +0,0 @@
version: '2.2'
services:
murmur:
image: mattikus/murmur
volumes:
- ./murmur.ini:/etc/murmur.ini
- /var/lib/murmur/murmur.sqlite:/data/murmur.sqlite
- /etc/localtime:/etc/localtime:ro
ports:
- 64738:64738
- 64738:64738/udp
restart: always

View file

@ -1,223 +0,0 @@
# Murmur configuration file.
#
# General notes:
# * Settings in this file are default settings and many of them can be overridden
# with virtual server specific configuration via the Ice or DBus interface.
# * Due to the way this configuration file is read some rules have to be
# followed when specifying variable values (as in variable = value):
# * Make sure to quote the value when using commas in strings or passwords.
# NOT variable = super,secret BUT variable = "super,secret"
# * Make sure to escape special characters like '\' or '"' correctly
# NOT variable = """ BUT variable = "\""
# NOT regex = \w* BUT regex = \\w*
# Path to database. If blank, will search for
# murmur.sqlite in default locations or create it if not found.
database=/data/murmur.sqlite
# If you wish to use something other than SQLite, you'll need to set the name
# of the database above, and also uncomment the below.
# Sticking with SQLite is strongly recommended, as it's the most well tested
# and by far the fastest solution.
#
#dbDriver=QMYSQL
#dbUsername=
#dbPassword=
#dbHost=
#dbPort=
#dbPrefix=murmur_
#dbOpts=
# Murmur defaults to not using D-Bus. If you wish to use dbus, which is one of the
# RPC methods available in Murmur, please specify so here.
#
#dbus=session
# Alternate D-Bus service name. Only use if you are running distinct
# murmurd processes connected to the same D-Bus daemon.
#dbusservice=net.sourceforge.mumble.murmur
# If you want to use ZeroC Ice to communicate with Murmur, you need
# to specify the endpoint to use. Since there is no authentication
# with ICE, you should only use it if you trust all the users who have
# shell access to your machine.
# Please see the ICE documentation on how to specify endpoints.
ice="tcp -h 127.0.0.1 -p 6502"
# Ice primarily uses local sockets. This means anyone who has a
# user account on your machine can connect to the Ice services.
# You can set a plaintext "secret" on the Ice connection, and
# any script attempting to access must then have this secret
# (as context with name "secret").
# Access is split in read (look only) and write (modify)
# operations. Write access always includes read access,
# unless read is explicitly denied (see note below).
#
# Note that if this is uncommented and with empty content,
# access will be denied.
#icesecretread=
icesecretwrite=
# How many login attempts do we tolerate from one IP
# inside a given timeframe before we ban the connection?
# Note that this is global (shared between all virtual servers), and that
# it counts both successfull and unsuccessfull connection attempts.
# Set either Attempts or Timeframe to 0 to disable.
#autobanAttempts = 10
#autobanTimeframe = 120
#autobanTime = 300
# Specifies the file Murmur should log to. By default, Murmur
# logs to the file 'murmur.log'. If you leave this field blank
# on Unix-like systems, Murmur will force itself into foreground
# mode which logs to the console.
#logfile=/data/murmur.log
# If set, Murmur will write its process ID to this file
# when running in daemon mode (when the -fg flag is not
# specified on the command line). Only available on
# Unix-like systems.
#pidfile=
# The below will be used as defaults for new configured servers.
# If you're just running one server (the default), it's easier to
# configure it here than through D-Bus or Ice.
#
# Welcome message sent to clients when they connect.
welcometext="<br />
Bienvenue sur le nouveau Mumble.<br />
Maintenant fini de rire, le premier qui dit un truc <b>naus&eacute;abonde</b> est banni<br />
⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⣀⠴⠖⡛⣩⠿⠿⠿⢷⣿⣾⣷⣀<br />
⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⣼⣧⡣⠖⠋⢀⢀⢀⢀⢀⠈⠉⠙⠺⠢⡀<br />
⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢸⣯⡯⣇⢀⡀⡀⢀⢀⢀⢀⢀⢀⢀⢀⢀⠘⡄<br />
⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⡀⣸⣿⣽⣳⣿⣹⣡⠄⢀⡀⢀⢀⢀⣀⣀⡀⢀⠑⡀<br />
⢀⢀⢀⢀⢀⢀⢀⣀⠠⢀⣿⣿⣿⡿⣿⣷⣿⣿⠅⢀⢛⡴⡿⠿⣶⣄⡒⡚⠛⢈⣰⣀<br />
⢀⢀⢀⢀⢀⠔⠁⠈⠑⡄⠘⢻⡟⣛⡻⣿⣽⠍⢀⠠⢏⣃⣴⢾⡛⢏⠛⠏⢿⢿⢦⡅<br />
⢀⢀⢀⢀⠎⢠⠃⢀⢀⠸⡀⢸⢨⡵⡽⣌⡏⠐⡂⠤⠉⠛⠢⠩⣭⠝⠈⢀⠈⠙⠧⡁<br />
⢀⢀⢀⡌⢀⡈⢀⢀⢀⢀⢃⢸⡄⠃⠣⢸⣗⠰⠂⢀⢀⢀⢀⢀⢀⢀⢀⡀⢀⢀⢀⠐⡄<br />
⢀⢀⢀⢇⢀⡇⢀⢀⢀⢀⠘⣼⠸⡌⢁⣾⣿⣏⣿⡼⣒⢃⣄⠠⡠⡞⠉⠉⢆⢀⢀⢀⢱<br />
⢀⢀⡎⢀⢸⣇⢀⢀⢀⢀⢀⢫⡇⢓⣾⣿⣻⣻⣿⣟⣿⣵⣾⣿⣧⣁⠶⢄⡀⠁⠁⢀⢰<br />
⢀⢀⡇⢀⠈⢻⢀⢀⢀⢀⢀⠈⡁⠈⡽⣟⣿⣯⣯⡿⡏⢮⢭⣟⠛⠛⠻⠳⣾⣗⠲⠤⠜<br />
⢀⢀⢇⢀⢀⣾⢀⢀⢀⢀⢀⢀⠇⢀⣹⢿⣿⣷⣿⣿⣇⢎⠻⣼⣽⣛⡯⡽⠉<br />
⢀⢸⢀⢀⢀⠟⡄⢀⢀⢀⢀⢀⠘⡤⠛⣧⣿⣜⢿⣿⣿⣾⣷⣌⠉⠙⣡⣿⡄⣀<br />
⢠⠛⢀⢀⢀⢰⠇⢀⢀⢀⢀⢀⢀⠘⡰⣻⣿⣼⣿⣿⣿⣿⣿⣿⣿⣿⡿⠻⠋⣡⠁<br />
⢸⢀⢀⢀⢀⢀⡧⢀⢀⢀⢀⢀⢀⢀⠘⡇⢻⢏⣿⣽⣿⣟⣿⣿⣿⠟⢀⠠⢎⣉⠊⢰⡀<br />
⠸⢀⢀⢀⢀⢀⠰⠂⢀⢀⢀⢀⢀⢀⢀⣘⡛⢡⡟⢻⣟⡾⠿⢿⠋⢀⢀⢀⠈⡋⠐⢁⢼<br />
⢀⢀⢀⢀⢀⢀⢀⢣⢀⢀⢀⢀⢀⢀⠞⠁⠎⠉⠉⠉⢀⢀⢀⢈⣇⢀⢐⠂⡒⣁⢀⢅⢴⠁<br />
⢀⢀⢀⢀⢀⢀⢀⠈⢂⢀⢀⢀⢀⢀⢀⠘⢀⢀⢀⢀⢀⢀⢀⢀⠿⣀⣞⠛⢺⠁⣏⢹⠃<br />
⢀⢀⢀⢀⢀⢀⢀⢀⢀⠣⡀⢀⢀⢀⢀⢀⢀⢀⢠⢀⢀⢀⠄⠚⠁⠉⠉⠙⠊⠙⠁⠁<br />
⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⠐⢄⡀⢀⠠⠤⠢⣕⠡⠔⠊⠁<br />
⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⠉⠉⠉⠉⠉<br />
"
# Port to bind TCP and UDP sockets to.
port=64738
# Specific IP or hostname to bind to.
# If this is left blank (default), Murmur will bind to all available addresses.
host=0.0.0.0
# Password to join server.
serverpassword=changeme
# Maximum bandwidth (in bits per second) clients are allowed
# to send speech at.
bandwidth=128000
# Maximum number of concurrent clients allowed.
users=100
# Amount of users with Opus support needed to force Opus usage, in percent.
# 0 = Always enable Opus, 100 = enable Opus if it's supported by all clients.
#opusthreshold=100
# Maximum depth of channel nesting. Note that some databases like MySQL using
# InnoDB will fail when operating on deeply nested channels.
#channelnestinglimit=10
# Regular expression used to validate channel names.
# (Note that you have to escape backslashes with \ )
#channelname=[ \\-=\\w\\#\\[\\]\\{\\}\\(\\)\\@\\|]+
# Regular expression used to validate user names.
# (Note that you have to escape backslashes with \ )
#username=[-=\\w\\[\\]\\{\\}\\(\\)\\@\\|\\.]+
# Maximum length of text messages in characters. 0 for no limit.
#textmessagelength=5000
# Maximum length of text messages in characters, with image data. 0 for no limit.
#imagemessagelength=131072
# Allow clients to use HTML in messages, user comments and channel descriptions?
allowhtml=true
# Murmur retains the per-server log entries in an internal database which
# allows it to be accessed over D-Bus/ICE.
# How many days should such entries be kept?
# Set to 0 to keep forever, or -1 to disable logging to the DB.
#logdays=31
# To enable public server registration, the serverpassword must be blank, and
# this must all be filled out.
# The password here is used to create a registry for the server name; subsequent
# updates will need the same password. Don't lose your password.
# The URL is your own website, and only set the registerHostname for static IP
# addresses.
# Only uncomment the 'registerName' parameter if you wish to give your "Root" channel a custom name.
#
#registerName=Mumble Server
#registerPassword=secret
#registerUrl=http://mumble.sourceforge.net/
#registerHostname=
# If this option is enabled, the server will announce its presence via the
# bonjour service discovery protocol. To change the name announced by bonjour
# adjust the registerName variable.
# See http://developer.apple.com/networking/bonjour/index.html for more information
# about bonjour.
#bonjour=True
# If you have a proper SSL certificate, you can provide the filenames here.
# Otherwise, Murmur will create it's own certificate automatically.
#sslCert=
#sslKey=
# The sslCiphers option chooses the cipher suites to make available for use
# in SSL/TLS. This option is server-wide, and cannot be set on a
# per-virtual-server basis.
#
# This option is specified using OpenSSL cipher list notation (see
# https://www.openssl.org/docs/apps/ciphers.html#CIPHER-LIST-FORMAT).
#
# It is recommended that you try your cipher string using 'openssl ciphers <string>'
# before setting it here, to get a feel for which cipher suites you will get.
#
# After setting this option, it is recommend that you inspect your Murmur log
# to ensure that Murmur is using the cipher suites that you expected it to.
#
# Note: Changing this option may impact the backwards compatibility of your
# Murmur server, and can remove the ability for older Mumble clients to be able
# to connect to it.
#sslCiphers=EECDH+AESGCM:AES256-SHA:AES128-SHA
# If Murmur is started as root, which user should it switch to?
# This option is ignored if Murmur isn't started with root privileges.
#uname=
# If this options is enabled, only clients which have a certificate are allowed
# to connect.
#certrequired=False
# If enabled, clients are sent information about the servers version and operating
# system.
sendversion=True
# You can configure any of the configuration options for Ice here. We recommend
# leave the defaults as they are.
# Please note that this section has to be last in the configuration file.
#
[Ice]
Ice.Warn.UnknownProperties=1
Ice.MessageSizeMax=65536

View file

@ -1,19 +0,0 @@
---
- name: Copy murmur config
copy:
src: murmur
dest: "{{docker_compose_files_folder}}"
- name: Create murmur data folder
file:
dest: /var/lib/murmur
state: directory
- name: Copy murmur database
copy:
src: /backups/murmur/murmur.sqlite
dest: /var/lib/murmur/
force: no
remote_src: yes
- name: Start murmur docker project
docker_compose:
project_src: "{{docker_compose_files_folder}}/murmur"
state: present

View file

@ -1,24 +0,0 @@
---
# the ip address prefix applied to tun* devices, e.g. assuming that
# the default of 10.50. is used and tun4 is used, the addresses
# 10.50.4.1 and 10.50.4.2 will be used on both nodes; the trailing
# period must be included.
proxy_ssh_ip_prefix: 10.50.
# the name of the private interface which is reachable by other hosts
proxy_private_interface: "" # autodetected if empty
# use 1 for tun1, 10 for tun10 etc
proxy_ssh_tun_index_min: 1
# the ssh proxy user created on all hosts
proxy_ssh_user: sshproxy
# the timeout in seconds when checking urls for internet access
proxy_test_timeout: 5
# the addresses to try calling when checking for internet access
proxy_test_urls:
- https://archlinux.org/
- https://letsencrypt.org/
- http://mirrors.ubuntu.com/

View file

@ -1,5 +0,0 @@
---
- name: reload sshd
systemd:
name: sshd
state: reloaded

View file

@ -1,3 +0,0 @@
---
#TODO
- debug: msg="Not Implemented"

View file

@ -1,63 +0,0 @@
---
- name: Get the internet interface
shell: ip route get 1.1.1.1 | head -n1 | sed -E 's/^.+dev ([^ ]+).+$/\1/'
register: interface_result
changed_when: False
check_mode: False
- name: Set host interface facts
set_fact:
proxy_interface: "{{ interface_result.stdout | trim }}"
- name: Allow ip forwarding
sysctl:
name: net.ipv4.ip_forward
value: 1
sysctl_set: True
reload: True
when: inventory_hostname == tinc_primary_router
- name: Activate masquerade
iptables:
table: nat
chain: POSTROUTING
out_interface: "{{ proxy_interface }}"
jump: MASQUERADE
when: inventory_hostname == tinc_primary_router
- name: Allow packet forwarding from WAN to LAN
iptables:
chain: FORWARD
in_interface: tun0
out_interface: "{{ proxy_interface }}"
jump: ACCEPT
when: inventory_hostname == tinc_primary_router
- name: Check if incoming packets comme from an active connexion
iptables:
chain: FORWARD
in_interface: "{{ proxy_interface }}"
out_interface: tun0
ctstate:
- ESTABLISHED
- RELATED
jump: ACCEPT
when: inventory_hostname == tinc_primary_router
- name: Set up tinc
include_role:
name: tinc
- name: Set up keepalived
include: keepalived.yml
- name: Check for internet access
shell: |-
false \{% for url in proxy_test_urls %}
|| curl -IsSL -m{{ proxy_test_timeout }} {{ url }} \
{% endfor %}
|| false
args:
warn: False
check_mode: False
changed_when: no

View file

@ -1,52 +0,0 @@
---
- name: Kill existing tunnel connections
shell: |
CONNECTION_PIDS=$(ps aux | awk '$1 == "{{ proxy_ssh_user }}" && $0 ~ /ssh -N -f/ { print $2 }')
echo $CONNECTION_PIDS | xargs -r kill
echo "$CONNECTION_PIDS" | grep -vE '^$' | wc -l
register: ssh_result
changed_when: ssh_result.stdout_lines | last | int > 0
- name: Remove tunnel interfaces
shell:
cmd: |
bash -s <<'EOF'
TUN_INTERFACE_FILES=$(grep -El '^## sshproxy' /etc/network/interfaces.d/tun*)
IFS=$'\n\t'
for file in $TUN_INTERFACE_FILES; do
interface=$(basename $file)
echo $interface
rm $file
ip link delete $interface
done
EOF
register: tun_result
changed_when: tun_result.stdout_lines | length > 0
- name: Remove tunnel iptables (1/2)
iptables:
state: absent
chain: FORWARD
in_interface: "{{ proxy_interface }}"
out_interface: "{{ item }}"
ctstate:
- RELATED
- ESTABLISHED
jump: ACCEPT
with_items: "{{ tun_result.stdout_lines }}"
when: inventory_hostname == proxy_router_hostname
- name: Remove tunnel iptables (2/2)
iptables:
state: absent
chain: FORWARD
in_interface: "{{ item }}"
out_interface: "{{ proxy_interface }}"
jump: ACCEPT
with_items: "{{ tun_result.stdout_lines }}"
when: inventory_hostname == proxy_router_hostname
- name: Remove authorized keys file
file:
path: "/home/{{ proxy_ssh_user }}/.ssh/authorized_keys"
state: absent

View file

@ -1,131 +0,0 @@
---
# All nodes may use the ssh proxy user to connect to any other node
# to use point-to-point tunnelling.
# remove existing interfaces in case of an error so we don't run out of ip addresses
- name: Remove existing tunnel interfaces
include: ssh-down.yml
- name: Add the proxy user
user:
name: "{{ proxy_ssh_user }}"
shell: /bin/false
- name: Allow point-to-point tunnelling for the ssh proxy user
blockinfile:
block: |
# sshproxy start
Match User {{ proxy_ssh_user }}
AllowTcpForwarding yes
PermitTunnel point-to-point
ForceCommand /bin/false
# sshproxy end
dest: "/etc/ssh/sshd_config"
validate: "/usr/sbin/sshd -T -f %s"
notify: reload sshd
- meta: flush_handlers
- name: Create ssh private key
shell: yes '' | ssh-keygen -N ''
args:
chdir: "/home/{{ proxy_ssh_user }}"
creates: "/home/{{ proxy_ssh_user }}/.ssh/id_rsa.pub"
become: True
become_method: su
become_flags: '-s /bin/sh'
become_user: "{{ proxy_ssh_user }}"
- name: Read public key
slurp:
src: "/home/{{ proxy_ssh_user }}/.ssh/id_rsa.pub"
register: public_key_result
- name: Set public key fact
set_fact:
proxy_ssh_public_key: "{{ public_key_result.content | b64decode | trim }}"
- block:
- name: Set authorized keys
authorized_key:
user: "{{ proxy_ssh_user }}"
key: "{{ item }}"
with_items: "{{ hostvars.values() | selectattr('inventory_hostname', 'in', groups['k8s']) | selectattr('proxy_ssh_public_key', 'defined') | map(attribute='proxy_ssh_public_key') | list }}"
- name: Create tunnel interfaces on the router host
shell:
cmd: |
bash -s <<'EOF'
{{ lookup('template', './tunnel.j2') }}
EOF
register: tun_result
with_items: "{{ hostvars.values() | selectattr('inventory_hostname', 'in', groups['k8s']) | selectattr('proxy_inet', '==', False) | map(attribute='inventory_hostname') | list }}"
- name: Set created interfaces fact
set_fact:
proxy_ssh_tunnel_map: "{{ tun_result.results | map(attribute='stdout') | map('from_json') | list }}"
- name: Add tunnel iptables (1/2)
iptables:
chain: FORWARD
in_interface: "{{ proxy_interface }}"
out_interface: "{{ item.interface }}"
ctstate:
- RELATED
- ESTABLISHED
jump: ACCEPT
with_items: "{{ proxy_ssh_tunnel_map }}"
- name: Add tunnel iptables (2/2)
iptables:
chain: FORWARD
in_interface: "{{ item.interface }}"
out_interface: "{{ proxy_interface }}"
jump: ACCEPT
with_items: "{{ proxy_ssh_tunnel_map }}"
when: inventory_hostname == proxy_router_hostname
- block:
- set_fact: proxy_target="{{ ( hostvars[proxy_router_hostname].proxy_ssh_tunnel_map | selectattr('target_hostname', '==', inventory_hostname) | list )[0] }}"
- block:
- shell: "ip route get 169.254.42.42 | head -n1 | sed -E 's/.+ dev ([^ ]+).+/\\1/'"
register: result
- set_fact: proxy_private_interface="{{ result.stdout }}"
when: proxy_private_interface | length == 0
# TODO edit /etc/network/interfaces (?) to apply rules on network up
- name: Create tunnel interface on the target hosts
shell:
cmd: |
bash -s <<'EOF'
echo "## sshproxy" > /etc/network/interfaces.d/{{ proxy_target.interface }}
ip tuntap add mode tun dev {{ proxy_target.interface }}
ip addr add {{ proxy_target.target_ip }}/30 peer {{ proxy_target.router_ip }} dev {{ proxy_target.interface }}
ip link set dev {{ proxy_target.interface }} up
DEFAULT_GATEWAY=$(ip route | awk '$3 == "{{ proxy_private_interface }}" { print $1 }' | cut -d'/' -f1)
ip route add 10.0.0.0/8 via $DEFAULT_GATEWAY dev {{ proxy_private_interface }}
ip route add 169.254.0.0/16 via $DEFAULT_GATEWAY dev {{ proxy_private_interface }}
ip route add 172.16.0.0/12 via $DEFAULT_GATEWAY dev {{ proxy_private_interface }}
ip route add 192.168.0.0/16 via $DEFAULT_GATEWAY dev {{ proxy_private_interface }}
ip route replace default via {{ proxy_target.target_ip }}
EOF
- name: Establish the SSH tunnel
shell: |
ssh -N -f \
-w {{ proxy_target.interface_id }}:{{ proxy_target.interface_id }} \
-o StrictHostKeyChecking=no \
-o UserKnownHostsFile=/dev/null \
{{ hostvars[proxy_router_hostname]['ansible_' + proxy_private_interface].ipv4.address }} &
echo $!
become: True
become_method: su
become_flags: '-s /bin/sh'
become_user: "{{ proxy_ssh_user }}"
when: inventory_hostname in hostvars[proxy_router_hostname].proxy_ssh_tunnel_map | map(attribute='target_hostname') | list

View file

@ -1,40 +0,0 @@
#!/bin/bash
for i in `seq {{ proxy_ssh_tun_index_min }} 255`; do
interface=tun${i}
file=/etc/network/interfaces.d/$interface
ln -s /dev/null "$file" 2>/dev/null
if [[ $? -eq 0 ]]; then
INTERFACE_ID=$i
IP_SELF={{ proxy_ssh_ip_prefix }}${INTERFACE_ID}.2
IP_PEER={{ proxy_ssh_ip_prefix }}${INTERFACE_ID}.1
tmp=$(mktemp)
cat <<EOF2 | sed -E 's/^ {8}//' | tee "$tmp" >/dev/null
## sshproxy
#{ "router_hostname": "{{ ansible_hostname }}",
# "router_ip": "$IP_SELF",
# "target_hostname": "{{ item }}",
# "target_ip": "$IP_PEER",
# "interface_id": $INTERFACE_ID,
# "interface": "$interface"
#}
EOF2
mv -f "$tmp" "$file"
break
fi
done
if [[ -z "$INTERFACE_ID" ]]; then
echo "ERR could not create tunnel interface" >&2
exit 1
fi
set -e
ip tuntap add mode tun dev $interface
ip addr add $IP_SELF/30 peer $IP_PEER dev $interface
ip link set dev $interface up
grep -E "^#" "$file" | grep -vE "^##" | sed -E "s/^#//"

View file

@ -1,9 +0,0 @@
---
netname: meshvpn
scw_private_domain: priv.cloud.scaleway.com
tinc_primary_router: master1
tinc_route_default_ip: 192.168.66.1
tinc_route_get_ip: 169.254.42.42
vpn_interface: tun0
vpn_netmask: 255.255.255.0
vpn_subnet_cidr_netmask: 32

View file

@ -1,14 +0,0 @@
---
- name: restart tinc
systemd:
name: "{{ item }}"
state: restarted
with_items:
- tinc
- name: reload tinc
systemd:
name: "{{ item }}"
state: reloaded
with_items:
- tinc

View file

@ -1,141 +0,0 @@
---
- name: Install tinc
apt:
name: tinc
state: latest
- name: Ensure tinc netname directory exists
file:
path: /etc/tinc/{{ netname }}/hosts
recurse: True
state: directory
- name: Create /etc/tinc/nets.boot file from template
template:
src: nets.boot.j2
dest: /etc/tinc/nets.boot
notify:
- restart tinc
- name: Ensure tinc.conf contains connection to all other nodes
template:
src: tinc.conf.j2
dest: /etc/tinc/{{ netname }}/tinc.conf
notify:
- restart tinc
- reload tinc
- name: Create tinc-up file
template:
src: tinc-up.j2
dest: /etc/tinc/{{ netname }}/tinc-up
mode: 0755
notify:
- restart tinc
- name: Create tinc-down file
template:
src: tinc-down.j2
dest: /etc/tinc/{{ netname }}/tinc-down
mode: 0755
notify:
- restart tinc
- name: Ensure tinc hosts file binds to scaleway dns address
block:
- name: Gather Scaleway instance ID
shell: "/usr/local/bin/scw-metadata ID"
register: scw_id
changed_when: no
- lineinfile:
dest: /etc/tinc/{{ netname }}/hosts/{{ inventory_hostname }}
line: "Address = {{ scw_id.stdout }}.{{ scw_private_domain }}"
create: yes
notify:
- restart tinc
when: tinc_ignore_scaleway_dns | default(False) | bool == False
- name: Ensure tinc hosts file binds to physical ip address
lineinfile:
dest: /etc/tinc/{{ netname }}/hosts/{{ inventory_hostname }}
line: |-
Address = {{ ansible_eth0.ipv4.address }}
create: yes
notify:
- restart tinc
when: tinc_ignore_scaleway_dns | default(False) | bool == True
- name: Ensure subnet ip address is properly set in tinc host file
lineinfile:
dest: /etc/tinc/{{ netname }}/hosts/{{ inventory_hostname }}
line: "Subnet = {{ vpn_ip }}/{{ vpn_subnet_cidr_netmask }}"
create: yes
notify:
- restart tinc
- name: Check whether /etc/tinc/netname/hosts/inventory_hostname contains "-----END RSA PUBLIC KEY-----"
command: awk '/^-----END RSA PUBLIC KEY-----$/' /etc/tinc/{{ netname }}/hosts/{{ inventory_hostname }}
changed_when: "public_key.stdout != '-----END RSA PUBLIC KEY-----'"
register: public_key
# this is necessary because the public key will not be generated (non-interactively) if the private key already exists
- name: Delete private key and regenerate keypair if public key is absent from tinc hosts file
file:
path: /etc/tinc/{{ netname }}/rsa_key.priv
state: absent
when: public_key.changed
- name: Create tinc private key (and append public key to tincd hosts file)
shell: tincd -n {{ netname }} -K4096
args:
creates: /etc/tinc/{{ netname }}/rsa_key.priv
notify:
- restart tinc
- block:
- name: Fetch tinc hosts file after key creation
fetch:
src: /etc/tinc/{{ netname }}/hosts/{{ inventory_hostname }}
dest: fetch/{{ inventory_hostname }}
flat: yes
changed_when: false
- name: Sync the fetched tinc hosts files on each host
synchronize:
src: fetch/
dest: /etc/tinc/{{ netname }}/hosts/
use_ssh_args: yes
notify:
- reload tinc
always:
- name: Remove fetched files
local_action:
module: file
path: fetch
state: absent
run_once: True
changed_when: false
- meta: flush_handlers
- name: Start tinc on boot
systemd:
name: tinc@{{ netname }}
enabled: yes
state: started
- name: Ensure tun0 exists
shell: "ip a s"
register: result
until: result.stdout.find("tun0") != -1
retries: 200
delay: 10
changed_when: False
- name: Add nodes to /etc/hosts (ansible_inventory resolves to vpn_ip)
lineinfile: dest=/etc/hosts regexp='.*{{ item }}$' line="{{ hostvars[item].vpn_ip }} {{item}}" state=present
when: hostvars[item].vpn_ip is defined
with_items: "{{ play_hosts }}"

View file

@ -1 +0,0 @@
{{ netname }}

View file

@ -1,2 +0,0 @@
#!/bin/sh
ifconfig {{ vpn_interface }} down

Some files were not shown because too many files have changed in this diff Show more