Compare commits
17 Commits
c4065559fc
...
master
Author | SHA1 | Date | |
---|---|---|---|
ff7644a32a | |||
5dff08c44d | |||
5aff69a05a | |||
9dc73bf077 | |||
cf2b702eb5 | |||
23d03f8ba0 | |||
5ed8b36c28 | |||
3cd5d20de6 | |||
2685f7bb11 | |||
f0270a56ec | |||
0f5412ea8b | |||
5fb573f447 | |||
5b2f572453 | |||
958a6225b1 | |||
41e7591163 | |||
4117afd993 | |||
c7e438d4ee |
29
README.md
29
README.md
@ -1,7 +1,6 @@
|
||||
# kaz-vagrant
|
||||
|
||||
[Kaz](https://kaz.bzh/) est un CHATONS du Morbihan. Nous proposons ici un moyen de le répliquer dans une VM. Il y a des éléments de configuration à définir avant d'initialiser ce simulateur.
|
||||
|
||||
[Kaz](https://kaz.bzh/) est un CHATONS du Morbihan. Nous proposons ici un moyen de le répliquer dans une VM. Il y a des éléments de configuration à définir avant d'initialiser ce simulateur.
|
||||
Le principe est de faire fonctionner un simulateur de notre CHATONS dans une VirtualBox pour mettre au point nos différents services.
|
||||
|
||||
Nous utilisons :
|
||||
@ -11,7 +10,7 @@ Nous utilisons :
|
||||
* LXC pour faire tourner ces services dans des conteneurs distincts (ie, kaz-prod est un conteneur LXC)
|
||||
* Docker pour chaque service de notre serveur
|
||||
|
||||
À la fin, nous obtenons une maquette d'un petit internet simulé, avec du DNS, des mails tiers, et notre serveur kaz-prod dans un coin.
|
||||
À la fin, nous obtenons une maquette d'un petit internet simulé, avec du DNS, des mails tiers, et nos serveurs hoster-a-kaz1 et hoster-b-kaz2 dans un coin.
|
||||
|
||||

|
||||
|
||||
@ -36,7 +35,7 @@ cd kaz-vagrant/
|
||||
vagrant up
|
||||
```
|
||||
|
||||
Cette étape peut-être (très) longue. Notamment, la construction de kaz-prod se fait dans un conteneur LXC, dans lequel les overlays docker passent par un filesystem plus lent qu'en natif... Comptez entre 40 minutes et quelques heures, selon la connexion réseau et les performances de la machine.
|
||||
Cette étape peut-être (très) longue, notamment la construction des machines Kaz... Comptez entre 40 minutes et quelques heures, selon la connexion réseau et les performances de la machine.
|
||||
|
||||
|
||||
|
||||
@ -46,15 +45,18 @@ Les utilisateurs créés sont
|
||||
* debian/debian
|
||||
* root/root.
|
||||
|
||||
Se connecter en root/root
|
||||
|
||||
Lors du démarrage de la VM, il faut lancer SNSTER :
|
||||
```bash
|
||||
cd /root/snster-kaz
|
||||
snster start
|
||||
```
|
||||
|
||||
Normalement, kaz-prod lance automatiquement les dockers (dans son rc.local), mais si ça ne marche pas bien il peut falloir les relancer (que se passe-t-il si on relance container.sh pendant que container.sh n'est pas encore fini ? faut-il l'enlever du rc.local ? Le lancement initial peut rater, probablement si le DNS n'est pas encore fonctionnel lors du lancement, à mettre au point et peut-être enlever du rc.local ?)
|
||||
Normalement, hoster-a-kaz1 et hoster-b-kaz2 lancent automatiquement les dockers (dans rc.local), mais si ça ne marche pas bien il peut falloir les relancer (que se passe-t-il si on relance container.sh pendant que container.sh n'est pas encore fini ? faut-il l'enlever du rc.local ? Le lancement initial peut rater, probablement si le DNS n'est pas encore fonctionnel lors du lancement, à mettre au point et peut-être enlever du rc.local ?)
|
||||
```bash
|
||||
snster attach kaz-prod -x /kaz/bin/container.sh start
|
||||
snster attach hoster-a-kaz1 -x /kaz/bin/container.sh start
|
||||
snster attach hoster-b-kaz2 -x /kaz/bin/container.sh start
|
||||
```
|
||||
|
||||
Vous pouvez alors (toutes les commandes snster doivent être exécutées dans `/root/snster-kaz`) :
|
||||
@ -62,17 +64,20 @@ Vous pouvez alors (toutes les commandes snster doivent être exécutées dans `/
|
||||
* Ouvrir Firefox et naviguer vers :
|
||||
* `https://www.kaz.sns`, le Kaz interne à la VM
|
||||
* `https://listes.kaz.sns`, le sympa interne à la VM
|
||||
* `https://pad2.kaz.sns`, le pad sur kaz2
|
||||
* `https://www.kaz.bzh`, le vrai Kaz
|
||||
* Ouvrir claws-mail et retrouver les comptes mails configurés :
|
||||
* `contact1@kaz.sns` à `contact4@kaz.sns`, hébergés sur le kaz-prod de la VM
|
||||
* `email@isp-a.sns`, hébergé dans le conteneur LXC isp-a-infra
|
||||
* Travailler sur kaz-prod : `snster attach kaz-prod`
|
||||
* Travailler sur hoster-a-kaz1 : `snster attach hoster-a-kaz1`
|
||||
* Afficher un plan de réseau : `snster print`
|
||||
* Le système de fichiers de kaz-prod est accessible directement dans la VM:
|
||||
* `/kaz-prod/` [VM] correspond à `/` [kaz-prod]
|
||||
* `/kaz` [VM] correspond à `/kaz` [kaz-prod]
|
||||
* Le système de fichiers de hoster-a-kaz1 est accessible directement dans la VM:
|
||||
* `/kaz1-prod/` [VM] correspond à `/` [hoster-a-kaz1]
|
||||
* `/kaz` [VM] correspond à `/kaz` [hoster-a-kaz1]
|
||||
* Il est probablement pratique d'installer son environnement de développement sur la VM, avec ses clés SSH et son éditeur favori.
|
||||
|
||||
Dans Vagrantfile, existent des répertoires partagés entre le host et le VM mais pour qu'ils soient visibles depuis la VM, il faut démarrer la VM non pas avec VirtualBox mais avec Vagrant up.
|
||||
|
||||
Il y a un aperçu de l'état des services avec l'url https://kaz.sns/status/allServices.html
|
||||
|
||||

|
||||
@ -93,9 +98,9 @@ Il vous faudra accepter les éventuelles alertes de sécurité pour certificat a
|
||||
|
||||
## Mise au point
|
||||
|
||||
Pour réinstaller Kaz sur kaz-prod (avec suppression de /kaz, des volumes dockers et réinstallation complète), depuis la VM :
|
||||
Pour réinstaller Kaz sur kaz1 (avec suppression de /kaz, des volumes dockers et réinstallation complète; idem kaz2), depuis la VM :
|
||||
```bash
|
||||
snster attach kaz-prod -x "/root/kaz.sh"
|
||||
snster attach hoster-a-kaz1 -x "/root/kaz.sh"
|
||||
```
|
||||
|
||||
Pour détruire la VM et recommencer, depuis l'hôte :
|
||||
|
20
Vagrantfile
vendored
20
Vagrantfile
vendored
@ -2,32 +2,14 @@
|
||||
# -*- mode: ruby -*-
|
||||
# vi: set ft=ruby :
|
||||
|
||||
unless Vagrant.has_plugin?("vagrant-disksize")
|
||||
raise Vagrant::Errors::VagrantError.new, "vagrant-disksize plugin is missing. Please install it using 'vagrant plugin install vagrant-disksize' and rerun 'vagrant up'"
|
||||
end
|
||||
|
||||
# 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|
|
||||
|
||||
required_plugins = %w( vagrant-disksize )
|
||||
_retry = false
|
||||
required_plugins.each do |plugin|
|
||||
unless Vagrant.has_plugin? plugin
|
||||
system "vagrant plugin install #{plugin}"
|
||||
_retry=true
|
||||
end
|
||||
end
|
||||
|
||||
if (_retry)
|
||||
exec "vagrant " + ARGV.join(' ')
|
||||
end
|
||||
|
||||
config.vm.box = "debian/bullseye64"
|
||||
config.vm.box = "debian/bookworm64"
|
||||
config.vm.hostname = 'kaz-vm'
|
||||
config.disksize.size = '50GB'
|
||||
|
||||
config.vm.provider "virtualbox" do |vb|
|
||||
vb.memory = "4096"
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 156 KiB After Width: | Height: | Size: 103 KiB |
@ -1,2 +1,2 @@
|
||||
proxy
|
||||
#traefik
|
||||
#proxy
|
||||
traefik
|
||||
|
@ -19,7 +19,8 @@ domain_sympa=listes.kaz.sns
|
||||
########################################
|
||||
# choix d'un serveur partiel
|
||||
# site=site-2
|
||||
site=
|
||||
site=kaz1
|
||||
acme_server="https://ca.mica.sns/acme/acme/directory"
|
||||
|
||||
########################################
|
||||
# Pour garradin qui met en "dure" dans
|
||||
|
@ -24,7 +24,7 @@ export DebugLog="${OUTPUT_DIR}/log/log-kaz-$(date +%y-%m-%d-%T)-"
|
||||
|
||||
# copie des sources
|
||||
cd /
|
||||
git clone https://git.kaz.bzh/KAZ/kaz.git
|
||||
git clone https://git.kaz.bzh/KAZ/KazV2.git kaz
|
||||
(cd /kaz ; git checkout "${KAZBRANCH}" )
|
||||
|
||||
cp "${DIR}/kaz-config/dockers.env" /kaz/config/dockers.env
|
||||
|
@ -35,6 +35,7 @@ koffre IN CNAME kaz1
|
||||
pad IN CNAME kaz1
|
||||
agora IN CNAME kaz1
|
||||
listes IN MX 10 listes
|
||||
pad2 IN CNAME kaz2
|
||||
listes IN A 100.80.1.2
|
||||
firewall IN A 100.80.0.1
|
||||
firewall IN AAAA 2001:db8:80::0:1
|
||||
|
@ -5,9 +5,13 @@ if [ -z $SNSTERGUARD ] ; then exit 1; fi
|
||||
DIR=`dirname $0`
|
||||
cd `dirname $0`
|
||||
|
||||
# disable systemd-resolved which conflicts with nsd
|
||||
echo "DNSStubListener=no" >> /etc/systemd/resolved.conf
|
||||
systemctl stop systemd-resolved
|
||||
DEB_VERSION=`cat /etc/debian_version | cut -d'.' -f1`
|
||||
if [ $DEB_VERSION -eq "11" ] # DEB 11 aka Bullseye
|
||||
then
|
||||
# disable systemd-resolved which conflicts with nsd
|
||||
echo "DNSStubListener=no" >> /etc/systemd/resolved.conf
|
||||
systemctl stop systemd-resolved
|
||||
fi
|
||||
|
||||
DEBIAN_FRONTEND=noninteractive apt-get update
|
||||
DEBIAN_FRONTEND=noninteractive apt-get remove -y apache2
|
||||
@ -55,11 +59,12 @@ echo "export SNSTERGUARD='true'" >> /root/.bashrc
|
||||
|
||||
|
||||
# On place les certifs
|
||||
if [ -d letsencrypt ]; then
|
||||
cp -ar letsencrypt /etc/
|
||||
cp /etc/letsencrypt/local/rootCA.pem /usr/local/share/ca-certificates/rootCA.crt
|
||||
/usr/sbin/update-ca-certificates --fresh
|
||||
fi
|
||||
cp -ar tls/root_ca.crt /usr/local/share/ca-certificates/
|
||||
/usr/sbin/update-ca-certificates --fresh
|
||||
|
||||
mkdir -p /etc/letsencrypt/live/kaz.sns
|
||||
cp tls/wildcard.crt /etc/letsencrypt/live/kaz.sns/fullchain.pem
|
||||
cp tls/wildcard.key /etc/letsencrypt/live/kaz.sns/privkey.pem
|
||||
|
||||
# On sauve le proxy APT
|
||||
proxy=$(/sbin/ip route | awk '/default/ { print $3 }' | head -1)
|
||||
|
@ -1,2 +1,2 @@
|
||||
proxy
|
||||
#traefik
|
||||
#proxy
|
||||
traefik
|
||||
|
@ -2,8 +2,7 @@
|
||||
#jirafeau
|
||||
#ethercalc
|
||||
#collabora
|
||||
#ethercalc
|
||||
#etherpad
|
||||
etherpad
|
||||
#quotas
|
||||
#web
|
||||
#vigilo
|
||||
|
@ -19,7 +19,8 @@ domain_sympa=listes.kaz.sns
|
||||
########################################
|
||||
# choix d'un serveur partiel
|
||||
# site=site-2
|
||||
site=site-2
|
||||
site=kaz2
|
||||
acme_server="https://ca.mica.sns/acme/acme/directory"
|
||||
|
||||
########################################
|
||||
# Pour garradin qui met en "dure" dans
|
||||
@ -52,7 +53,7 @@ gravHost=grav
|
||||
ldapHost=ldap
|
||||
matterHost=agora
|
||||
officeHost=office
|
||||
padHost=pad
|
||||
padHost=pad2
|
||||
quotasHost=quotas
|
||||
smtpHost=smtp
|
||||
sympaHost=listes
|
||||
@ -62,7 +63,7 @@ wordpressHost=wp
|
||||
ldapUIHost=mdp
|
||||
mobilizonHost=mobilizon
|
||||
vaultwardenHost=koffre
|
||||
traefikHost=dashboard
|
||||
traefikHost=dashboard2
|
||||
|
||||
########################################
|
||||
# ports internes
|
||||
|
@ -24,7 +24,7 @@ export DebugLog="${OUTPUT_DIR}/log/log-kaz-$(date +%y-%m-%d-%T)-"
|
||||
|
||||
# copie des sources
|
||||
cd /
|
||||
git clone https://git.kaz.bzh/KAZ/kaz.git
|
||||
git clone https://git.kaz.bzh/KAZ/KazV2.git kaz
|
||||
(cd /kaz ; git checkout "${KAZBRANCH}" )
|
||||
|
||||
cp "${DIR}/kaz-config/dockers.env" /kaz/config/dockers.env
|
||||
@ -33,6 +33,9 @@ export DebugLog="${OUTPUT_DIR}/log/log-kaz-$(date +%y-%m-%d-%T)-"
|
||||
cp "${DIR}/kaz-config/container-${type}.list" /kaz/config/
|
||||
done
|
||||
|
||||
# copie certif de la CA locale pour traefik (nécessaire pour ACME/Smallstep)
|
||||
cp /usr/local/share/ca-certificates/root_ca.crt /kaz/dockers/traefik/conf/
|
||||
|
||||
echo -e "\n #### secretGen\n"
|
||||
/kaz/bin/secretGen.sh
|
||||
|
||||
|
@ -5,9 +5,13 @@ if [ -z $SNSTERGUARD ] ; then exit 1; fi
|
||||
DIR=`dirname $0`
|
||||
cd `dirname $0`
|
||||
|
||||
# disable systemd-resolved which conflicts with nsd
|
||||
echo "DNSStubListener=no" >> /etc/systemd/resolved.conf
|
||||
systemctl stop systemd-resolved
|
||||
DEB_VERSION=`cat /etc/debian_version | cut -d'.' -f1`
|
||||
if [ $DEB_VERSION -eq "11" ] # DEB 11 aka Bullseye
|
||||
then
|
||||
# disable systemd-resolved which conflicts with nsd
|
||||
echo "DNSStubListener=no" >> /etc/systemd/resolved.conf
|
||||
systemctl stop systemd-resolved
|
||||
fi
|
||||
|
||||
DEBIAN_FRONTEND=noninteractive apt-get update
|
||||
DEBIAN_FRONTEND=noninteractive apt-get remove -y apache2
|
||||
@ -55,11 +59,12 @@ echo "export SNSTERGUARD='true'" >> /root/.bashrc
|
||||
|
||||
|
||||
# On place les certifs
|
||||
if [ -d letsencrypt ]; then
|
||||
cp -ar letsencrypt /etc/
|
||||
cp /etc/letsencrypt/local/rootCA.pem /usr/local/share/ca-certificates/rootCA.crt
|
||||
/usr/sbin/update-ca-certificates --fresh
|
||||
fi
|
||||
cp -ar tls/root_ca.crt /usr/local/share/ca-certificates/
|
||||
/usr/sbin/update-ca-certificates --fresh
|
||||
|
||||
mkdir -p /etc/letsencrypt/live/kaz.sns
|
||||
cp tls/wildcard.crt /etc/letsencrypt/live/kaz.sns/fullchain.pem
|
||||
cp tls/wildcard.key /etc/letsencrypt/live/kaz.sns/privkey.pem
|
||||
|
||||
# On sauve le proxy APT
|
||||
proxy=$(/sbin/ip route | awk '/default/ { print $3 }' | head -1)
|
||||
@ -99,6 +104,7 @@ DEBIAN_FRONTEND=noninteractive apt-get autoremove -y
|
||||
DEBIAN_FRONTEND=noninteractive apt-get clean
|
||||
|
||||
# On installe Kaz
|
||||
docker network create postfixNet # temp fix
|
||||
ifconfig lo:0 100.81.0.2
|
||||
echo "100.81.0.2 smtp imap www mail cloud cloud.kaz.sns tableur tableur.kaz.sns webmail webmail.kaz.sns garradin garradin.kaz.sns wiki wiki.kaz.sns git git.kaz.sns office office.kaz.sns depot depot.kaz.sns ldap ldap.kaz.sns mdp mdp.kaz.sns koffre koffre.kaz.sns pad pad.kaz.sns agora agora.kaz.sns dashboard dashboard.kaz.sns" >> /etc/hosts
|
||||
cp "${DIR}/kaz.sh" /root/kaz.sh
|
||||
|
@ -23,9 +23,8 @@ if [ -f /clawsmail/addclawsuser.sh ]; then
|
||||
fi
|
||||
|
||||
# On place les certifs
|
||||
if [ -d letsencrypt ]; then
|
||||
cp -ar letsencrypt /etc/
|
||||
cp /etc/letsencrypt/local/rootCA.pem /usr/local/share/ca-certificates/root.crt
|
||||
if [ -f tls/root_ca.crt ]; then
|
||||
cp -ar tls/root_ca.crt /usr/local/share/ca-certificates/root.crt
|
||||
/usr/sbin/update-ca-certificates --fresh
|
||||
fi
|
||||
|
||||
|
@ -7,13 +7,17 @@ cd `dirname $0`
|
||||
|
||||
# Email's mail account email@isp-a.sns
|
||||
useradd -m -s "/bin/bash" -p `mkpasswd --method=sha-512 email` email || true
|
||||
addgroup email mail
|
||||
adduser email mail
|
||||
#mkdir /home/hacker/mail
|
||||
#touch /home/hacker/mail/Drafts /home/hacker/mail/Queue /home/hacker/mail/Sent /home/hacker/mail/Trash
|
||||
|
||||
# disable systemd-resolved which conflicts with nsd
|
||||
echo "DNSStubListener=no" >> /etc/systemd/resolved.conf
|
||||
systemctl stop systemd-resolved
|
||||
DEB_VERSION=`cat /etc/debian_version | cut -d'.' -f1`
|
||||
if [ $DEB_VERSION -eq "11" ] # DEB 11 aka Bullseye
|
||||
then
|
||||
# disable systemd-resolved which conflicts with nsd
|
||||
echo "DNSStubListener=no" >> /etc/systemd/resolved.conf
|
||||
systemctl stop systemd-resolved
|
||||
fi
|
||||
|
||||
# manage isp-a.sns zone
|
||||
apt-get update
|
||||
|
@ -7,14 +7,14 @@ header:
|
||||
config:
|
||||
prefix: kaz
|
||||
nat-bridge: lxcbr0
|
||||
default-master: bullseye
|
||||
default-master: bookworm
|
||||
|
||||
masters:
|
||||
bullseye:
|
||||
bookworm:
|
||||
backend: lxc
|
||||
template: debian
|
||||
parameters:
|
||||
release: bullseye
|
||||
release: bookworm
|
||||
arch: amd64
|
||||
family: debian
|
||||
|
||||
@ -23,9 +23,8 @@ masters:
|
||||
template: download
|
||||
parameters:
|
||||
dist: alpine
|
||||
release: 3.14
|
||||
release: 3.21
|
||||
arch: amd64
|
||||
no-validate: true
|
||||
family: alpine
|
||||
|
||||
disabled-groups:
|
||||
|
@ -5,22 +5,36 @@ if [ -z $SNSTERGUARD ] ; then exit 1; fi
|
||||
DIR=`dirname $0`
|
||||
cd `dirname $0`
|
||||
|
||||
# disable systemd-resolved which conflicts with nsd
|
||||
echo "DNSStubListener=no" >> /etc/systemd/resolved.conf
|
||||
systemctl stop systemd-resolved
|
||||
DEB_VERSION=`cat /etc/debian_version | cut -d'.' -f1`
|
||||
if [ $DEB_VERSION -eq "11" ] # DEB 11 aka Bullseye
|
||||
then
|
||||
# disable systemd-resolved which conflicts with nsd
|
||||
echo "DNSStubListener=no" >> /etc/systemd/resolved.conf
|
||||
systemctl stop systemd-resolved
|
||||
fi
|
||||
|
||||
# manage mica.sns zone
|
||||
apt-get update
|
||||
DEBIAN_FRONTEND=noninteractive apt-get install -y unbound
|
||||
cp dns.conf /etc/unbound/unbound.conf.d/
|
||||
|
||||
# On place les certifs
|
||||
if [ -f tls/root_ca.crt ]; then
|
||||
cp -ar tls/root_ca.crt /usr/local/share/ca-certificates/
|
||||
/usr/sbin/update-ca-certificates --fresh
|
||||
fi
|
||||
|
||||
# Install smallstep CA / ACME server
|
||||
cd /tmp
|
||||
wget https://github.com/smallstep/cli/releases/download/v0.17.2/step-cli_0.17.2_amd64.deb
|
||||
dpkg -i step-cli_0.17.2_amd64.deb
|
||||
wget https://github.com/smallstep/certificates/releases/download/v0.17.2/step-ca_0.17.2_amd64.deb
|
||||
dpkg -i step-ca_0.17.2_amd64.deb
|
||||
wget "https://dl.smallstep.com/gh-release/cli/gh-release-header/v0.24.4/step-cli_0.24.4_amd64.deb"
|
||||
dpkg -i step-cli_0.24.4_amd64.deb
|
||||
wget "https://dl.smallstep.com/gh-release/certificates/gh-release-header/v0.24.2/step-ca_0.24.2_amd64.deb"
|
||||
dpkg -i step-ca_0.24.2_amd64.deb
|
||||
|
||||
echo "password" > /root/ca-passwordfile
|
||||
step ca init --deployment-type=standalone --name="Kaz CA" --dns="ca.mica.sns" --acme --address=":443" --provisioner="contact@kaz.sns" --password-file="/root/ca-passwordfile" --root="${DIR}/tls/root_ca.crt" --key "${DIR}/tls/root_ca.key"
|
||||
echo -e '#!/bin/sh\nstep-ca --password-file /root/ca-passwordfile' >> /etc/rc.local
|
||||
chmod +x /etc/rc.local
|
||||
|
||||
# step ca init
|
||||
# step ca root root.crt
|
||||
|
@ -6,9 +6,13 @@ if [ -z $SNSTERGUARD ] ; then exit 1; fi
|
||||
DIR=`dirname $0`
|
||||
cd `dirname $0`
|
||||
|
||||
# disable systemd-resolved which conflicts with nsd
|
||||
echo "DNSStubListener=no" >> /etc/systemd/resolved.conf
|
||||
systemctl stop systemd-resolved
|
||||
DEB_VERSION=`cat /etc/debian_version | cut -d'.' -f1`
|
||||
if [ $DEB_VERSION -eq "11" ] # DEB 11 aka Bullseye
|
||||
then
|
||||
# disable systemd-resolved which conflicts with nsd
|
||||
echo "DNSStubListener=no" >> /etc/systemd/resolved.conf
|
||||
systemctl stop systemd-resolved
|
||||
fi
|
||||
|
||||
apt-get update
|
||||
DEBIAN_FRONTEND=noninteractive apt-get install -y nsd
|
||||
|
@ -20,8 +20,8 @@ touch /etc/network/keepdhcp
|
||||
|
||||
# Force lxc bridged interface metric (else, it grows to 200+interface_index, which can be large with successive stop/start)
|
||||
# This metric must be lower than the one exported by BGP for the default route (static part below)
|
||||
mkdir /etc/udhcpc
|
||||
echo "IF_METRIC=200" > /etc/udhcpc/udhcpc.conf
|
||||
mkdir -p /etc/udhcpc
|
||||
echo "IF_METRIC=200" >> /etc/udhcpc/udhcpc.conf
|
||||
|
||||
|
||||
# customize bird config (BGP)
|
||||
@ -38,3 +38,5 @@ protocol static {
|
||||
# Add dnsmasq for external dns
|
||||
apk add dnsmasq
|
||||
rc-update add dnsmasq
|
||||
# dnsmasq listen on eth1
|
||||
echo "interface=eth1" >> /etc/dnsmasq.conf
|
||||
|
@ -143,48 +143,22 @@ SystemMaxFileSize=2M
|
||||
EOF
|
||||
fi
|
||||
|
||||
# CA et certifs avec mkcert
|
||||
# CA et certifs avec smallstep
|
||||
|
||||
echo -e "\n #### mkcert\n"
|
||||
DEBIAN_FRONTEND=noninteractive apt-get install -y libnss3-tools
|
||||
echo -e "\n #### smallstep\n"
|
||||
cd /tmp
|
||||
wget "https://dl.smallstep.com/gh-release/cli/gh-release-header/v0.24.4/step-cli_0.24.4_amd64.deb"
|
||||
dpkg -i step-cli_0.24.4_amd64.deb
|
||||
echo "password" > /root/ca-passwordfile
|
||||
step ca init --deployment-type=standalone --name="Kaz CA" --dns="ca.mica.sns" --acme --address=":443" --provisioner="contact@kaz.sns" --password-file="/root/ca-passwordfile"
|
||||
|
||||
mkdir -p /root/mkcert
|
||||
cd /root/mkcert
|
||||
if [ ! -f mkcert ]; then
|
||||
wget https://github.com/FiloSottile/mkcert/releases/download/v1.4.3/mkcert-v1.4.3-linux-amd64 -O mkcert
|
||||
chmod +x mkcert
|
||||
mkdir -p /etc/letsencrypt/local/
|
||||
export CAROOT=/etc/letsencrypt/local/
|
||||
/root/mkcert/mkcert -install # CA dans /etc/letsencrypt/local/
|
||||
cd "${CAROOT}"
|
||||
cat > "${CAROOT}/kaz.sns.cnf" <<EOF
|
||||
[ req ]
|
||||
prompt = no
|
||||
distinguished_name = dn
|
||||
req_extensions = req_ext
|
||||
mkdir -p /root/tls
|
||||
cp /root/.step/certs/root_ca.crt /root/tls/root_ca.crt
|
||||
chmod 644 /root/tls/root_ca.crt
|
||||
cp /root/.step/secrets/root_ca_key /root/tls/root_ca.key
|
||||
step crypto change-pass /root/tls/root_ca.key --no-password --insecure --password-file="/root/ca-passwordfile" --force
|
||||
|
||||
[ dn ]
|
||||
CN = *.kaz.sns
|
||||
emailAddress = admin@kaz.sns
|
||||
O = KAZ
|
||||
OU = Dev
|
||||
L = Vannes
|
||||
ST = France
|
||||
C = FR
|
||||
|
||||
[ req_ext ]
|
||||
subjectAltName = @alt_names
|
||||
|
||||
[alt_names]
|
||||
DNS.0 = *.kaz.sns
|
||||
EOF
|
||||
openssl req -new -newkey rsa:2048 -sha256 -nodes -keyout kaz.sns.key -out kaz.sns.csr -config kaz.sns.cnf
|
||||
/root/mkcert/mkcert -csr "${CAROOT}/kaz.sns.csr" # cert et clé dans /etc/letsencrypt/local/
|
||||
|
||||
mkdir -p /etc/letsencrypt/live/kaz.sns/
|
||||
ln -s ../../local/_wildcard.kaz.sns.pem /etc/letsencrypt/live/kaz.sns/fullchain.pem
|
||||
ln -s ../../local/kaz.sns.key /etc/letsencrypt/live/kaz.sns/privkey.pem
|
||||
fi
|
||||
step certificate create "*.kaz.sns" /root/tls/wildcard.crt /root/tls/wildcard.key --profile leaf --ca /root/.step/certs/intermediate_ca.crt --ca-key /root/.step/secrets/intermediate_ca_key --ca-password-file /root/ca-passwordfile --bundle --force --no-password --insecure --not-after 20000h
|
||||
|
||||
# Cache docker registry
|
||||
echo "proxy:
|
||||
@ -203,7 +177,7 @@ auth:
|
||||
git clone https://framagit.org/flesueur/snster.git
|
||||
cd snster
|
||||
# git checkout tags/v1.1.0
|
||||
git checkout fe59ef1f
|
||||
git checkout 34b7c57cb7480cb4b3a84d14a1a46b60d0eb5967
|
||||
./install.sh
|
||||
|
||||
# BTRFS avec hotfix sale de SNSTER
|
||||
@ -213,20 +187,22 @@ auth:
|
||||
mkfs.btrfs -f /root/btrfs.img
|
||||
echo "/root/btrfs.img /var/lib/lxc btrfs loop 0 0" >> /etc/fstab
|
||||
mount /var/lib/lxc
|
||||
sed -i -e "s/template=self.template/template=self.template, bdevtype='btrfs'/" /usr/local/lib/python3.9/dist-packages/backends/LxcBackend.py
|
||||
sed -i -e "s/template=self.template/template=self.template, bdevtype='btrfs'/" /usr/local/lib/python3.11/dist-packages/backends/LxcBackend.py
|
||||
|
||||
# SNSTER KAZ
|
||||
cp -ar ${VAGRANT_SRC_DIR}/snster-kaz /root
|
||||
|
||||
# crypto keys
|
||||
cp -ar /etc/letsencrypt /root/snster-kaz/hoster-a/kaz1/
|
||||
cp -ar /etc/letsencrypt /root/snster-kaz/isp-a/home/
|
||||
cp -ar /etc/letsencrypt /root/snster-kaz/hoster-b/kaz2/
|
||||
cp -ar /root/tls /root/snster-kaz/hoster-a/kaz1/
|
||||
cp -ar /root/tls /root/snster-kaz/hoster-b/kaz2/
|
||||
cp -ar /root/tls /root/snster-kaz/isp-a/home/
|
||||
cp -ar /root/tls /root/snster-kaz/mica/infra/
|
||||
|
||||
|
||||
# On lie le filesystem de kaz-prod dans le /kaz de la VM pour le dév
|
||||
ln -s /var/lib/lxc/kaz-hoster-a-kaz1/rootfs/ /kaz1-prod
|
||||
ln -s /var/lib/lxc/kaz-hoster-b-kaz2/rootfs/ /kaz2-prod
|
||||
ln -s /kaz-prod/kaz /kaz
|
||||
ln -s /kaz-prod1/kaz /kaz
|
||||
|
||||
# On met le KAZGUARD pour la mise au point
|
||||
echo "export KAZGUARD='true'" >> /root/.bashrc
|
||||
|
@ -15,16 +15,21 @@ git pull
|
||||
sed -i -e "s/template=self.template/template=self.template, bdevtype='btrfs'/" /usr/local/lib/python3.9/dist-packages/backends/LxcBackend.py
|
||||
|
||||
# On récupère le dernier kaz-vagrant
|
||||
if [ -z "${KAZBRANCH}" ] ; then
|
||||
KAZBRANCH="master"
|
||||
fi
|
||||
cd /tmp
|
||||
git clone https://git.kaz.bzh/KAZ/kaz-vagrant.git || (cd kaz-vagrant && git pull)
|
||||
git clone https://git.kaz.bzh/KAZ/kaz-vagrant.git || (cd kaz-vagrant && git fetch && git switch "${KAZBRANCH}" && git pull)
|
||||
cd /tmp/kaz-vagrant
|
||||
git switch "${KAZBRANCH}"
|
||||
|
||||
# On écrase les anciens fichiers
|
||||
cp -ar /tmp/kaz-vagrant/files/snster-kaz /root/
|
||||
# crypto keys
|
||||
cp -ar /etc/letsencrypt /root/snster-kaz/hoster-a/kaz1/
|
||||
cp -ar /etc/letsencrypt /root/snster-kaz/hoster-b/kaz2/
|
||||
cp -ar /etc/letsencrypt /root/snster-kaz/isp-a/home/
|
||||
cp -ar /root/tls /root/snster-kaz/hoster-a/kaz1/
|
||||
cp -ar /root/tls /root/snster-kaz/hoster-b/kaz2/
|
||||
cp -ar /root/tls /root/snster-kaz/isp-a/home/
|
||||
cp -ar /root/tls /root/snster-kaz/mica/infra/
|
||||
|
||||
# On détruit et reconstruit tout sauf kaz-prod
|
||||
SNSTER="snster -c /root/snster-kaz"
|
||||
|
Reference in New Issue
Block a user