From 50b6801b20d38f43c91165aa201df436a75a62e1 Mon Sep 17 00:00:00 2001 From: Adrien Date: Wed, 9 Nov 2022 22:13:10 +0100 Subject: =?UTF-8?q?am=C3=A9lior=C3=A9=20guide=20d'acc=C3=A8s=20au=20d?= =?UTF-8?q?=C3=A9p=C3=B4t=20des=20secrets?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- content/operations/acces/_index.md | 1 + content/operations/acces/gpg.md | 11 ----- content/operations/acces/pass.md | 95 ++++++++++++++++++-------------------- content/operations/acces/ssh.md | 4 +- 4 files changed, 49 insertions(+), 62 deletions(-) delete mode 100644 content/operations/acces/gpg.md (limited to 'content/operations') diff --git a/content/operations/acces/_index.md b/content/operations/acces/_index.md index 278f724..08824bc 100644 --- a/content/operations/acces/_index.md +++ b/content/operations/acces/_index.md @@ -5,3 +5,4 @@ sort_by = "weight" weight = 5 +++ +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](./pass/). \ No newline at end of file diff --git a/content/operations/acces/gpg.md b/content/operations/acces/gpg.md deleted file mode 100644 index 24b5648..0000000 --- a/content/operations/acces/gpg.md +++ /dev/null @@ -1,11 +0,0 @@ -+++ -title = "GPG" -description = "GPG" -weight = 10 -+++ - -# Générer une clé - -# La partager - -# Signatures croisées diff --git a/content/operations/acces/pass.md b/content/operations/acces/pass.md index 5f89631..8193969 100644 --- a/content/operations/acces/pass.md +++ b/content/operations/acces/pass.md @@ -1,35 +1,37 @@ +++ -title = "Pass" -description = "Pass" -weight = 40 +title = "Le dépôt des secrets" +description = "Le dépôt des secrets" +weight = 10 +++ -https://www.passwordstore.org/ +We use [pass, 'the standard unix password manager'](https://www.passwordstore.org/), to manage our key store securely at Deuxfleurs. Getting access to our production involves publishing one's GPG key (through Gitea) and importing/verifying/signing every other sysadmin's key, before setting up `pass`. -## you are new and want to access the secret repository +Our process was adapted from [this Medium article](https://medium.com/@davidpiegza/using-pass-in-a-team-1aa7adf36592) — thanks, David! + +## You are new and want to access the secrets repository You need a GPG key to start with. -You can generate one with: +If you do not already have one, you can generate a new one with: ```bash gpg2 --expert --full-gen-key # Personnaly I use `9) ECC and ECC`, `1) Curve 25519`, and `5y` ``` -Now export your public key: +In any case, you need to export your public key. Upload the output (public key) of the following command to [your Gitea account](https://git.deuxfleurs.fr/user/settings/keys). + ```bash gpg2 --export --armor ``` -You can upload it to Gitea, it will then be available publicly easily. -For example, you can access my key at this URL: +It is now publicly accessible at `https://git.deuxfleurs.fr/.gpg` -``` -https://git.deuxfleurs.fr/quentin.gpg -``` +Inform all the other sysadmins that you have published your key for them to import/verify/sign it. + +### Import/verify/sign every other sysadmin's key into your keychain -You can import it to your keychain as follow: +You now need to import and sign every other sysadmin's GPG key. For example, import Quentin's key to your keychain as follow: ```bash gpg2 --import <(curl https://git.deuxfleurs.fr/quentin.gpg) @@ -40,35 +42,24 @@ gpg2 --list-keys # sub cv25519/0xA40574404FF72851 2022-04-19 [E] [expire : 2027-04-18] ``` -How to read this snippet: - - the key id: `E9602264D639FF68` - - the key fingerprint: `8023 E27D F1BB D52C 559B 054C E960 2264 D639 FF68` - -Now, you need to: - 1. Inform all other sysadmins that you have published your key - 2. Check that the key of other sysadmins is the correct one. +> How to read this snippet: +> - the key id: `E9602264D639FF68` +> - the key fingerprint: `8023 E27D F1BB D52C 559B 054C E960 2264 D639 FF68` -To perform the check, you need another communication channel (ideally physically, otherwise through the phone, Matrix if you already trusted the other person, etc.) +To perform the check, you need another communication channel (ideally physically, otherwise through the phone, Matrix if you already trusted the other person, or else). Compare the signature you read with the sysadmin's. If they match, you good. -Once you trust someone, sign its key: +Now that you have verified the key, sign it: ```bash -gpg --edit-key quentin@deuxfleurs.fr +gpg --edit-key quentin@deuxfleurs.fr # by email # or -gpg --edit-key E9602264D639FF68 +gpg --edit-key E9602264D639FF68 # by key id # gpg> lsign -# (say yes) +# (say yes, maybe several times) # gpg> save ``` -Once you signed everybody, ask to a sysadmin to add your key to `/.gpg-id` and then run: - -``` -pass init -p deuxfleurs $(cat ~/.password-store/deuxfleurs/.gpg-id) -cd ~/.password-store -git commit -git push -``` +Once you signed every sysadmin, ask a sysadmin to add your key to the secrets keystore. They will need to [Add a sysadmin](#add-a-sysadmin). Now you are ready to install `pass`: @@ -92,25 +83,31 @@ cd ~/.password-store git clone git@git.deuxfleurs.fr:Deuxfleurs/secrets.git deuxfleurs ``` -And then check that everything work: +Finally check that everything works: ```bash pass show deuxfleurs ``` +If you see a listing, you settled! + --- --- -## init +## You are a sysadmin and want to operate the secrets repository -generate a new password store named deuxfleurs for you: +## Initialise the pass store + +> These instructions are for _bootstrapping_ the pass store. **Don't do it on Deuxfleurs' secrets repository** (don't be like ADRN). You would override the existing sysadmins and generally have a bad time. + +Generate a new password store named deuxfleurs for you: ``` pass init -p deuxfleurs you@example.com ``` -add a password in this store, it will be encrypted with your gpg key: +Add a password in this store, it will be encrypted with your gpg key: ```bash pass generate deuxfleurs/backup_nextcloud 20 @@ -118,9 +115,9 @@ pass generate deuxfleurs/backup_nextcloud 20 pass insert deuxfleurs/backup_nextcloud ``` -## add a teammate +## Add a sysadmin -edit `~/.password-store/acme/.gpg-id` and add the id of your friends: +Edit `~/.password-store/acme/.gpg-id` and add the id of the newbie: ``` alice@example.com @@ -128,7 +125,7 @@ jane@example.com bob@example.com ``` -make sure that you trust the keys of your teammates: +Make sure that you trust the keys of your new sysadmin: ``` $ gpg --edit-key jane@example.com @@ -137,21 +134,24 @@ gpg> y gpg> save ``` -Now re-encrypt the secrets: +Now re-encrypt the secrets and push your modifications: ``` pass init -p deuxfleurs $(cat ~/.password-store/deuxfleurs/.gpg-id) +cd ~/.password-store/deuxfleurs +git commit +git push ``` -They will now be able to decrypt the password: +They will now be able to decrypt any password: ``` pass deuxfleurs/backup_nextcloud ``` -## sharing with git +## Sharing with git -To create the repo: +To create the repo _on bootstrap exclusively_: ```bash cd ~/.password-store/deuxfleurs @@ -162,13 +162,10 @@ git commit -m "Initial commit" git push ``` -To setup the repo: +To retrieve the repo: ```bash +mkdir -p ~/.password-store cd ~/.password-store git clone https://git.example.com/org/repo.git deuxfleurs ``` - -## Ref - -https://medium.com/@davidpiegza/using-pass-in-a-team-1aa7adf36592 diff --git a/content/operations/acces/ssh.md b/content/operations/acces/ssh.md index 5f92888..e053934 100644 --- a/content/operations/acces/ssh.md +++ b/content/operations/acces/ssh.md @@ -1,9 +1,9 @@ +++ title = "SSH" description = "SSH" -weight = 20 +weight = 100 +++ -Voir si on documented comment gérer SSH depuis GPG +Voir si on documente comment gérer SSH depuis GPG # Ajout de la clé au cluster -- cgit v1.2.3