1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
|
+++
title = "Pass"
description = "Pass"
weight = 40
+++
https://www.passwordstore.org/
## you are new and want to access the secret repository
You need a GPG key to start with.
You can generate 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:
```bash
gpg2 --export --armor <your email address>
```
You can upload it to Gitea, it will then be available publicly easily.
For example, you can access my key at this URL:
```
https://git.deuxfleurs.fr/quentin.gpg
```
You can import it to your keychain as follow:
```bash
gpg2 --import <(curl https://git.deuxfleurs.fr/quentin.gpg)
gpg2 --list-keys
# pub ed25519/0xE9602264D639FF68 2022-04-19 [SC] [expire : 2027-04-18]
# Empreinte de la clef = 8023 E27D F1BB D52C 559B 054C E960 2264 D639 FF68
# uid [ ultime ] Quentin Dufour <quentin@deuxfleurs.fr>
# 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.
To perform the check, you need another communication channel (ideally physically, otherwise through the phone, Matrix if you already trusted the other person, etc.)
Once you trust someone, sign its key:
```bash
gpg --edit-key quentin@deuxfleurs.fr
# or
gpg --edit-key E9602264D639FF68
# gpg> lsign
# (say yes)
# gpg> save
```
Once you signed everybody, ask to a sysadmin to add your key to `<secrets>/.gpg-id` and then run:
```
pass init -p deuxfleurs $(cat ~/.password-store/deuxfleurs/.gpg-id)
cd ~/.password-store
git commit
git push
```
Now you are ready to install `pass`:
```bash
sudo apt-get install pass # Debian + Ubuntu
sudo yum install pass # Fedora + RHEL
sudo zypper in password-store # OpenSUSE
sudo emerge -av pass # Gentoo
sudo pacman -S pass # Arch Linux
brew install pass # macOS
pkg install password-store # FreeBSD
```
*Go to [passwordstore.org](https://www.passwordstore.org/) for more information about pass*.
Download the repository:
```
mkdir -p ~/.password-store
cd ~/.password-store
git clone git@git.deuxfleurs.fr:Deuxfleurs/secrets.git deuxfleurs
```
And then check that everything work:
```bash
pass show deuxfleurs
```
---
---
## init
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:
```bash
pass generate deuxfleurs/backup_nextcloud 20
# or
pass insert deuxfleurs/backup_nextcloud
```
## add a teammate
edit `~/.password-store/acme/.gpg-id` and add the id of your friends:
```
alice@example.com
jane@example.com
bob@example.com
```
make sure that you trust the keys of your teammates:
```
$ gpg --edit-key jane@example.com
gpg> lsign
gpg> y
gpg> save
```
Now re-encrypt the secrets:
```
pass init -p deuxfleurs $(cat ~/.password-store/deuxfleurs/.gpg-id)
```
They will now be able to decrypt the password:
```
pass deuxfleurs/backup_nextcloud
```
## sharing with git
To create the repo:
```bash
cd ~/.password-store/deuxfleurs
git init
git add .
git commit -m "Initial commit"
# Set up remote
git push
```
To setup the repo:
```bash
cd ~/.password-store
git clone https://git.example.com/org/repo.git deuxfleurs
```
## Ref
https://medium.com/@davidpiegza/using-pass-in-a-team-1aa7adf36592
|