Compare commits
10
Commits
fixes
...
antifascista
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
85271bdc7c
|
||
|
|
ea63f99d88
|
||
|
|
e3e20ab1dd
|
||
|
|
f4e8c6ff8b
|
||
|
|
7dbee24ff1
|
||
|
|
adb768fc30
|
||
|
|
c58ffb9e4d
|
||
|
|
bf1913b979
|
||
|
|
b651cc388d
|
||
|
|
58d7f17ffc
|
+54
-15
@@ -9,14 +9,49 @@ if ! test $UID -eq 0 ; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
hostname="`echo $HOSTNAME | tr -d "-" | tr -d "_"`"
|
||||
dir="`realpath $0 | xargs dirname`"
|
||||
authorized_keys=/home/$SUDO_USER/.ssh/authorized_keys
|
||||
|
||||
if test "$hostname" != "$HOSTNAME" ; then
|
||||
not_ok "El nombre del servidor no pude contener _ ni -, por favor cambialo con:"
|
||||
not_ok "sudo hostnamectl hostname $hostname"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! test -f $authorized_keys; then
|
||||
not_ok "Primero usa ssh-copy-id desde tu computadora para copiar llaves SSH!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if test `cat $authorized_keys | wc -l` -eq 0; then
|
||||
not_ok "Tu archivo $authorized_keys está vacío, no será posible desbloquear la huerta luego"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if test -z "$1"; then
|
||||
not_ok "El primer parámetro tiene que ser un disco completo sin particiones"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! grep -q "^FallbackDNS=9.9.9.9" /etc/systemd/resolved.conf; then
|
||||
ok "Cambiando el proveedor de DNS"
|
||||
|
||||
echo "[Resolve]" >/etc/systemd/resolved.conf
|
||||
echo "FallbackDNS=9.9.9.9#dns.quad9.net 149.112.112.112#dns.quad9.net" >>/etc/systemd/resolved.conf
|
||||
|
||||
systemctl restart systemd-resolved
|
||||
fi
|
||||
|
||||
disk=$1
|
||||
|
||||
for part in ${disk}?; do
|
||||
if test -b "$part"; then
|
||||
not_ok "El disco ${disk} contiene particiones, la instalación destruirá datos"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
apt update
|
||||
apt install -y dropbear-initramfs busybox-initramfs smartmontools git rsync make tinc dialog locales bash-completion gnutls-bin nano
|
||||
|
||||
@@ -26,9 +61,9 @@ if ! test -f /etc/modprobe.d/disable-algif.conf; then
|
||||
fi
|
||||
|
||||
ok "No permitir suspensión"
|
||||
sed -re "s/^#(HandleLidSwitch=).*/\1ignore/"
|
||||
-e "s/^#(HandleLidSwitchDocked=).*/\1ignore/"
|
||||
-e "s/^#(LidSwitchIgnoreInhibited=).*/\1no/"
|
||||
sed -re "s/^#(HandleLidSwitch=).*/\1ignore/" \
|
||||
-e "s/^#(HandleLidSwitchDocked=).*/\1ignore/" \
|
||||
-e "s/^#(LidSwitchIgnoreInhibited=).*/\1no/" \
|
||||
-i /etc/systemd/logind.conf
|
||||
|
||||
if ! test -d /root/rap; then
|
||||
@@ -48,7 +83,7 @@ if ! test -d $node_dir ; then
|
||||
fi
|
||||
|
||||
ok "Reparando la RAP"
|
||||
sed -re "s/^..(:.*)$/02\1/" -i $node_dir/mac
|
||||
sed -re "s/^..(:.*)$/02\1/" -i $node_dir/config/mac
|
||||
rm -f $node_dir/hosts/abyayala*
|
||||
|
||||
NETWORK=comun ./rap add-host $HOSTNAME abyayala
|
||||
@@ -56,12 +91,12 @@ NETWORK=comun ./rap install $HOSTNAME
|
||||
|
||||
if ! test -b /dev/mapper/dm_crypt-1 ; then
|
||||
ok "Cifrando el disco, usa la misma contraseña de cifrado que usaste durante la instalación"
|
||||
cryptsetup luksFormat /dev/sdb
|
||||
cryptsetup luksFormat $disk
|
||||
fi
|
||||
|
||||
if ! test -b /dev/mapper/dm_crypt-1 ; then
|
||||
ok "Abriendo el disco cifrado"
|
||||
cryptsetup open /dev/sdb dm_crypt-1
|
||||
cryptsetup open $disk dm_crypt-1
|
||||
fi
|
||||
|
||||
key_file=/etc/dm_crypt-1.key
|
||||
@@ -71,11 +106,11 @@ if ! test -f "$key_file" ; then
|
||||
dd bs=512 count=4 if=/dev/random iflag=fullblock | install -m 0600 /dev/stdin "$key_file"
|
||||
|
||||
ok "Asignando archivo de contraseña"
|
||||
cryptsetup luksAddKey /dev/sdb /etc/dm_crypt-1.key
|
||||
cryptsetup luksAddKey $disk /etc/dm_crypt-1.key
|
||||
fi
|
||||
|
||||
if ! grep -q dm_crypt-1 /etc/crypttab ; then
|
||||
uuid="`blkid /dev/sdb -o value -p | head -n2 | tail -n 1`"
|
||||
uuid="`blkid $disk -o value -p | head -n2 | tail -n 1`"
|
||||
|
||||
ok "Agregando $uuid a /etc/crypttab"
|
||||
echo "dm_crypt-1 UUID=$uuid /etc/dm_crypt-1.key luks" >> /etc/crypttab
|
||||
@@ -153,20 +188,24 @@ if ! which docker &>/dev/null; then
|
||||
ok "Instalando Docker"
|
||||
curl https://get.docker.com | bash
|
||||
|
||||
ok "Iniciando Swarm"
|
||||
docker swarm init --advertise-addr 127.0.0.1
|
||||
|
||||
ok "Creando red"
|
||||
docker network create -d overlay proxy
|
||||
|
||||
ok "Agregando $SUDO_USER al grupo Docker"
|
||||
usermod -aG docker $SUDO_USER
|
||||
fi
|
||||
|
||||
if ! docker network ls | grep -q swarm ; then
|
||||
ok "Iniciando Swarm"
|
||||
docker swarm init --advertise-addr 127.0.0.1
|
||||
fi
|
||||
|
||||
if ! docker network ls | grep -q proxy ; then
|
||||
ok "Creando red"
|
||||
docker network create -d overlay proxy
|
||||
fi
|
||||
|
||||
if ! grep -q https://hormuz.respaldos.abyaya.la /etc/docker/daemon.json ; then
|
||||
ok "Configurando Docker"
|
||||
|
||||
echo '{"registry-mirrors":["https://hormuz.respaldos.abyaya.la"]}' >/etc/docker/daemon.json
|
||||
echo '{"storage-driver":"overlay2","registry-mirrors":["https://hormuz.respaldos.abyaya.la"]}' >/etc/docker/daemon.json
|
||||
systemctl restart docker
|
||||
fi
|
||||
|
||||
|
||||
@@ -11,7 +11,6 @@ esac
|
||||
. /usr/share/initramfs-tools/hook-functions
|
||||
|
||||
copy_exec /usr/sbin/tincd /usr/sbin/
|
||||
copy_exec /usr/sbin/tinc /usr/sbin/
|
||||
copy_exec /usr/sbin/ip /usr/sbin/
|
||||
|
||||
rm "$DESTDIR/etc/dhcpcd.conf"
|
||||
|
||||
@@ -34,6 +34,7 @@ sed -re "s/^#(WILDCARDS_ENABLED=1)$/\1/" \
|
||||
-e "s/^#(SECRET_WILDCARD_CERT_VERSION=v1)$/\1/" \
|
||||
-e "s/^#(SECRET_WILDCARD_KEY_VERSION=v1)$/\1/" \
|
||||
-e "s/^#(COMPOSE_FILE=\".COMPOSE_FILE:compose.wildcard.yml\")$/\1/" \
|
||||
-e "s/^#(TRUSTED_IPS=).*/\1\"['10.13.12.1']\"/" \
|
||||
-i ~/.abra/servers/default/$traefik.env
|
||||
|
||||
ok "Generando e instalando certificados"
|
||||
|
||||
Reference in New Issue
Block a user