... | @@ -130,4 +130,46 @@ ip -6 route add default via fe80::100 dev ensYY # adapter l'interface |
... | @@ -130,4 +130,46 @@ ip -6 route add default via fe80::100 dev ensYY # adapter l'interface |
|
|
|
|
|
Penser à supprimer le paquet `resolvconf` si il empêche de mettre à jour le fichier `/etc/resolv.conf`.
|
|
Penser à supprimer le paquet `resolvconf` si il empêche de mettre à jour le fichier `/etc/resolv.conf`.
|
|
|
|
|
|
|
|
# Dropbear SSH / initramfs
|
|
|
|
|
|
|
|
Pour déchiffrer le disque root à distance, il est commun d'utiliser un serveur ssh dans l'initramfs, la plus part des tutoriels sur internet suivent la documentation du [kernel linux](https://www.kernel.org/doc/Documentation/filesystems/nfs/nfsroot.txt
|
|
|
|
) mais celle si n'est pas très explicite et surtout ne fonctionne pas dans le cas où la gateway est hors du sous-réseau (par exemple 100.100.100.100 pour la salle serveur).
|
|
|
|
|
|
|
|
Dans ce cas il faut:
|
|
|
|
1. si déjà en place/testé, supprimer la configuration donné dans la doc de linux (et lancer `update-initramfs -u`)
|
|
|
|
2. créer un script `/etc/initramfs-tools/scripts/init-premount/network` avec comme contenu:
|
|
|
|
```sh
|
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# Nom de l'interface réseaux utilisé (eth0, eno1, etc)
|
|
|
|
# Pour la connaitre on peux la récupérer avec la
|
|
|
|
# commande "ip -a"
|
|
|
|
NET_IFACE=xxxxx
|
|
|
|
STATIC_IP=193.23.164.X/32
|
|
|
|
STATIC_GW=100.100.100.100
|
|
|
|
|
|
|
|
# The script seems to be run on the host when generating the initramfs,
|
|
|
|
# so we want to avoid messing up with the network there.
|
|
|
|
ip route get 1.2.3.4 2>/dev/null && exit 0
|
|
|
|
|
|
|
|
# Necessary to trick the dropbear script to think that it has already
|
|
|
|
# configured the network.
|
|
|
|
touch /run/net-${NET_IFACE}.conf
|
|
|
|
|
|
|
|
echo ip link set ${NET_IFACE} up
|
|
|
|
ip link set ${NET_IFACE} up
|
|
|
|
sleep 2
|
|
|
|
|
|
|
|
echo ip addr add ${STATIC_IP} dev ${NET_IFACE}
|
|
|
|
ip addr add ${STATIC_IP} dev ${NET_IFACE}
|
|
|
|
|
|
|
|
echo ip route add default via ${STATIC_GW} dev ${NET_IFACE} onlink
|
|
|
|
ip route add default via ${STATIC_GW} dev ${NET_IFACE} onlink
|
|
|
|
```
|
|
|
|
3. adapter le nom de l'interface réseau, l'IP et la gateway
|
|
|
|
4. rendre le script exécutable :
|
|
|
|
`chmod +x /etc/initramfs-tools/scripts/init-premount/network`
|
|
|
|
5. régénérer l'initramfs:
|
|
|
|
`update-initramfs -u`
|
|
|
|
|
|
# BSD ? |
|
# BSD ? |