From 494b02e0bf8cd721051a1bd788eca4af854d8e22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arma=C3=ABl=20Gu=C3=A9neau?= Date: Tue, 25 Feb 2025 19:57:50 +0100 Subject: [PATCH] improve operator onboarding docs --- content/operations/acces.md | 5 ++- content/operations/pass.md | 34 ++++------------ content/operations/ssh.md | 67 ++++++++++++++++++++++++++++++- content/operations/user_passwd.md | 31 ++++++++++++++ 4 files changed, 108 insertions(+), 29 deletions(-) create mode 100644 content/operations/user_passwd.md diff --git a/content/operations/acces.md b/content/operations/acces.md index 4885e47..5e202e6 100644 --- a/content/operations/acces.md +++ b/content/operations/acces.md @@ -7,4 +7,7 @@ extra: parent: 'operations/_index.md' --- -Ici l'on traite de comment gagner accès au cluster de Deuxfleurs, quand on a reçu la _terrible responsabilité_ de sysadmin. Vous êtes prêt⋅e ? Alors entrez dans [le dépôt des secrets](@/operations/pass.md). +Ici l'on traite de comment gagner accès au cluster de Deuxfleurs, quand on a reçu la _terrible responsabilité_ de sysadmin. Vous êtes prêt⋅e ? Les étapes sont les suivantes : +- [le dépôt des secrets](@/operations/pass.md) +- [SSH](@/operations/ssh.md) +- [mot de passe linux](@/operations/user_passwd.md) diff --git a/content/operations/pass.md b/content/operations/pass.md index 1b3c122..8382cf0 100644 --- a/content/operations/pass.md +++ b/content/operations/pass.md @@ -100,40 +100,22 @@ brew install pass # macOS pkg install password-store # FreeBSD ``` -_Go to for more information about pass_. +_Go to [passwordstore.org](https://ww.passwordstore.org) for more information about pass_. Finally check that everything works: +```bash +pass deuxfleurs/nix_priv_key +``` + +If you see an output of the form `nix.web.deuxfleurs.fr:xxxxxx` then it worked! You are now able to decrypt all the secrets. You can do the following command to list them: + ```bash pass show deuxfleurs ``` -If you see a listing, it worked. Last step is to select a shell password for yourself on the cluster you are now in charge of (`prod` or `staging`, at the time of writing). +The next step is to [setup SSH](@/operations/ssh.md) to be able to connect to computers of the clusters. -Clone the nixcfg repository: - -``` -git clone git@git.deuxfleurs.fr:Deuxfleurs/nixcfg.git -cd nixcfg -``` - -Use the passwd utility to set your shell password: - -``` -./passwd -> Usage: ./passwd -> The cluster name must be the name of a subdirectory of cluster/ -``` - -This commited changes to Deuxfleurs' password store, do verify your modifications before pushing them: - -``` -cd ~/.password-store/deuxfleurs -git diff -git push -``` - -You should now be able to `ssh` into our infrastructure with a unified shell password. This is explicated in `nixcfg` repo's [README](https://git.deuxfleurs.fr/Deuxfleurs/nixcfg#how-to-operate-a-node). Be cautious, and enjoy! > With great power comes great responsibility. diff --git a/content/operations/ssh.md b/content/operations/ssh.md index 83b09bd..4354214 100644 --- a/content/operations/ssh.md +++ b/content/operations/ssh.md @@ -6,6 +6,69 @@ extra: parent: 'operations/acces.md' --- -Voir si on documente comment gérer SSH depuis GPG +SSH permet de se connecter aux machines du cluster à administrer (`staging` ou `prod`). -# Ajout de la clé au cluster +# Ajout d'une nouvelle clé SSH au cluster + +Dans le dépot [nixcfg](https://git.deuxfleurs.fr/deuxfleurs/nixcfg), éditer le +fichier `cluster/CLUSTER/cluster.nix`, où `CLUSTER` est à remplacer par `prod` +ou `staging`. + +La variable qui nous intéresse est `deuxfleurs.adminAccounts`. On trouve une +définition de la forme suivante : + +```nix + deuxfleurs.adminAccounts = { + lx = [ + "ssh-ed25519 ...." + ]; + quentin = [ + "ssh-rsa ...." + "ssh-rsa ...." + ]; + ... + }; +``` + +Ici, `lx` et `quentin` correspondent à des noms d'utilisateur linux sur les +machines du cluster, et les `"ssh-ed25519 ..` ou `"ssh-rsa ..."` sont les clefs +SSH publiques qui permettent de se connecter à ces utilisateurs. + +Ajouter un attribut à `deuxfleurs.adminAccounts` avec le nom d'utilisateur et sa +clef ssh publique choisie. Par exemple, pour ajouter une nouvelle utilisatrice +`alice` : + +```nix + deuxfleurs.adminAccounts = { + lx = [ + "ssh-ed25519 ...." + ]; + quentin = [ + "ssh-rsa ...." + "ssh-rsa ...." + ]; + ... + alice = [ + "clef SSH publique d'alice" + ]; +``` + +Commiter et pousser ces modifications (`git commit/push`). + +Un autre administrateur doit ensuite déployer ces modifications sur les machines +du cluster en utilisant le script `./deploy_nixos` du dépot `nixcfg`. + +*TODO*: dire ce qu'il faut mettre dans le `.ssh/config`. + +Vous pouvez ensuite tester de vous connecter à une machine du cluster : + +```bash +ssh caribou # staging +# ou +ssh pasteque # prod +``` + + +Pour terminer la création d'un nouveau compte utilisateur linux sur le cluster, +la dernière étape est de lui [assigner un mot de +passe](@/operations/user_passwd.md). diff --git a/content/operations/user_passwd.md b/content/operations/user_passwd.md new file mode 100644 index 0000000..6206525 --- /dev/null +++ b/content/operations/user_passwd.md @@ -0,0 +1,31 @@ +--- +title: "Mot de passe unix" +description: "Mot de passe unix" +weight: 200 +extra: + parent: 'operations/acces.md' +--- + +The last step of adding an administrator is to select a user password for +yourself on the cluster you are now in charge of (`prod` or `staging`). + +In the [nixcfg](https://git.deuxfleurs.fr/deuxfleurs/nixcfg) repository, +use the passwd utility to set your shell password: + +``` +./passwd +> Usage: ./passwd +> The cluster name must be the name of a subdirectory of cluster/ +``` + +This commited changes to Deuxfleurs' password store, do verify your modifications before pushing them: + +``` +cd ~/.password-store/deuxfleurs +git diff +git push +``` + +These changes must be deployed to the machines to take effect. Ask another +administrator to deploy them. They will need to use the script +`./deploy_passwords` from the `nixcfg` repository after pulling your changes.