UsoDiOpenPGPCard » History » Version 30
Elena Grandi, 04/10/2017 02:40 PM
1 | 1 | Elena Grandi | h1. Uso di OpenPGP Card |
---|---|---|---|
2 | 1 | Elena Grandi | |
3 | 28 | Elena Grandi | {{>toc}} |
4 | 28 | Elena Grandi | |
5 | 2 | Elena Grandi | L'"OpenPGP Card":https://en.wikipedia.org/wiki/OpenPGP_card è una smartcard sulla quale si possono salvare in modo sicuro ed usare le sottochiavi segrete usate da GnuPG per crittografia, firma ed anche autenticazione; ne esistono versioni tradizionali, oppure implementate in un dispositivo USB. In ogni caso si possono caricare nuove chiavi sulla scheda, ma non si possono estrarre (per via software) quelle salvate ed è la scheda stessa ad effettuare le operazioni crittografiche. |
6 | 1 | Elena Grandi | |
7 | 2 | Elena Grandi | L'obiettivo che si vuole ottenere è di non avere materiale crittografico segreto sui computer, in modo che un attaccante remoto non possa impossessarsene, mantenendo comunque la comodità di poter usare le chiavi sulla stessa macchina di uso comune. Per farlo si dovrà avere una chiave principale di lunga durata conservata offline ed usata solo saltuariamente per operazioni di gestione della chiave stessa (creazione di nuove sottochiavi, modifica delle scadenze, firma di altre chiavi per la _Web Of Trust_) e delle sottochiavi da usare quotidianamente, conservate sulla card. |
8 | 2 | Elena Grandi | |
9 | 19 | Elena Grandi | L'OpenPGP Card permette di caricare tre sottochiavi con finalità di crittografia, firma ed autenticazione: le prime due si usano normalmente tramite GnuPG, la terza può essere usata per l'autenticazione ssh tramite gpg-agent. |
10 | 2 | Elena Grandi | |
11 | 1 | Elena Grandi | |
12 | 27 | Elena Grandi | h2. Prerequisiti |
13 | 23 | Simone Piccardi | |
14 | 2 | Elena Grandi | Tutte le versioni di "GnuPG":https://gnupg.org/ supportano l'uso di base delle OpenPGP Card, ma per meglio sfruttarne le capacità è meglio usare la versione 2.1 (_modern_), specialmente in fase di creazione della chiave e delle sue sottochiavi. |
15 | 1 | Elena Grandi | |
16 | 20 | Elena Grandi | In questa guida si da per scontato l'uso di GnuPG 2.1 installato come eseguibile @gpg@, come ad esempio su Debian da stretch in poi; versioni precedenti o altre distribuzioni potrebbero usare un eseguibile @gpg2@ o altre varianti. |
17 | 20 | Elena Grandi | |
18 | 3 | Elena Grandi | Nel caso si voglia usare poi la Card per autenticazione ssh con versioni precedenti di GnuPG è necessario installare anche gpg-agent (in 2.1 usato di default). |
19 | 3 | Elena Grandi | |
20 | 3 | Elena Grandi | Per il supporto della Card è poi necessario installare "PC/SC Lite":http://pcsclite.alioth.debian.org/. |
21 | 3 | Elena Grandi | |
22 | 21 | Simone Piccardi | Sotto distribuzioni Debian o derivate (che già preinstallano @gnupg@ e @openssh-client@) i pacchetti da installare sono quindi: |
23 | 3 | Elena Grandi | |
24 | 1 | Elena Grandi | <pre> |
25 | 20 | Elena Grandi | apt install pcscd gnupg-agent scdaemon |
26 | 1 | Elena Grandi | </pre> |
27 | 1 | Elena Grandi | |
28 | 21 | Simone Piccardi | Si tenga presente che in alcuni casi l'accesso alla Card può richiedere versioni sufficientemente aggiornate della libereria, ad esempio con il lettore _O2 Micro OZ776_ è necessario usare una versione di @libccid@ sufficientemente recente (la versione 1.4.15 di Ubuntu Trusty/Mint 17 non funziona, la versione 1.4.22 di Xenial/Mint 18 si). |
29 | 1 | Elena Grandi | |
30 | 28 | Elena Grandi | Si consiglia di svolgere le operazioni di creazione di chiavi e tutto ciò che coinvolga la chiave principale su un sistema pulito, ad esempio una distribuzione live, meglio se scollegato da internet, e di configurare poi le macchine di uso quotidiano secondo quanto descritto nella sezione [[UsoDiOpenPGPCard#Configurazione su una nuova macchina|Configurazione su una nuova macchina]]. |
31 | 1 | Elena Grandi | |
32 | 1 | Elena Grandi | |
33 | 23 | Simone Piccardi | h2. Creazione della chiave |
34 | 23 | Simone Piccardi | |
35 | 4 | Elena Grandi | Innanzitutto bisogna creare una chiave principale che verrà associata alla nostra identità; questa dovrà essere da almeno 4096 bit per garantirle sufficiente longevità, dato che la sua sostituzione comporta un nuovo ingresso nella Web of Trust. |
36 | 4 | Elena Grandi | |
37 | 4 | Elena Grandi | Ovviamente, se si ha già una chiave gpg da 4096 bit si può saltare questo passaggio ed usare quella. |
38 | 4 | Elena Grandi | |
39 | 4 | Elena Grandi | Innanzitutto, configurare gpg per l'uso di SHA2 aggiungendo le seguenti righe a @~/.gnupg/gpg.conf@: |
40 | 4 | Elena Grandi | |
41 | 4 | Elena Grandi | <pre> |
42 | 4 | Elena Grandi | personal-digest-preferences SHA256 |
43 | 4 | Elena Grandi | cert-digest-algo SHA256 |
44 | 4 | Elena Grandi | default-preference-list SHA512 SHA384 SHA256 SHA224 AES256 AES192 AES CAST5 ZLIB BZIP2 ZIP Uncompressed |
45 | 4 | Elena Grandi | </pre> |
46 | 4 | Elena Grandi | |
47 | 4 | Elena Grandi | Quindi generare una nuova chiave: notare l'uso di gpg versione 2.1 e la dimensione a 4096 bit (per il resto si sono accettate le scelte di default oppure inseriti i propri dati). |
48 | 4 | Elena Grandi | |
49 | 4 | Elena Grandi | <pre> |
50 | 4 | Elena Grandi | $ gpg --full-gen-key |
51 | 4 | Elena Grandi | gpg (GnuPG) 2.1.15; Copyright (C) 2016 Free Software Foundation, Inc. |
52 | 4 | Elena Grandi | This is free software: you are free to change and redistribute it. |
53 | 4 | Elena Grandi | There is NO WARRANTY, to the extent permitted by law. |
54 | 4 | Elena Grandi | |
55 | 4 | Elena Grandi | Please select what kind of key you want: |
56 | 4 | Elena Grandi | (1) RSA and RSA (default) |
57 | 4 | Elena Grandi | (2) DSA and Elgamal |
58 | 4 | Elena Grandi | (3) DSA (sign only) |
59 | 4 | Elena Grandi | (4) RSA (sign only) |
60 | 4 | Elena Grandi | Your selection? 1 |
61 | 4 | Elena Grandi | RSA keys may be between 1024 and 4096 bits long. |
62 | 4 | Elena Grandi | What keysize do you want? (2048) 4096 |
63 | 4 | Elena Grandi | Requested keysize is 4096 bits |
64 | 4 | Elena Grandi | Please specify how long the key should be valid. |
65 | 4 | Elena Grandi | 0 = key does not expire |
66 | 4 | Elena Grandi | <n> = key expires in n days |
67 | 4 | Elena Grandi | <n>w = key expires in n weeks |
68 | 4 | Elena Grandi | <n>m = key expires in n months |
69 | 4 | Elena Grandi | <n>y = key expires in n years |
70 | 4 | Elena Grandi | Key is valid for? (0) |
71 | 4 | Elena Grandi | Key does not expire at all |
72 | 4 | Elena Grandi | Is this correct? (y/N) y |
73 | 4 | Elena Grandi | |
74 | 4 | Elena Grandi | GnuPG needs to construct a user ID to identify your key. |
75 | 4 | Elena Grandi | |
76 | 4 | Elena Grandi | Real name: Random User |
77 | 4 | Elena Grandi | Email address: random@example.org |
78 | 4 | Elena Grandi | Comment: |
79 | 4 | Elena Grandi | You selected this USER-ID: |
80 | 4 | Elena Grandi | "Random User <random@example.org>" |
81 | 4 | Elena Grandi | |
82 | 4 | Elena Grandi | Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit? o |
83 | 4 | Elena Grandi | We need to generate a lot of random bytes. It is a good idea to perform |
84 | 4 | Elena Grandi | some other action (type on the keyboard, move the mouse, utilize the |
85 | 4 | Elena Grandi | disks) during the prime generation; this gives the random number |
86 | 4 | Elena Grandi | generator a better chance to gain enough entropy. |
87 | 4 | Elena Grandi | gpg: key 3E0EE5BAC50DF7C1 marked as ultimately trusted |
88 | 4 | Elena Grandi | gpg: directory '/home/random/.gnupg/openpgp-revocs.d' created |
89 | 4 | Elena Grandi | gpg: revocation certificate stored as '/home/valhalla/.gnupg/openpgp-revocs.d/19DB75A75734ABBEDB1124163E0EE5BAC50DF7C1.rev' |
90 | 4 | Elena Grandi | public and secret key created and signed. |
91 | 4 | Elena Grandi | |
92 | 4 | Elena Grandi | pub rsa4096 2016-10-19 [SC] |
93 | 4 | Elena Grandi | 19DB75A75734ABBEDB1124163E0EE5BAC50DF7C1 |
94 | 4 | Elena Grandi | 19DB75A75734ABBEDB1124163E0EE5BAC50DF7C1 |
95 | 4 | Elena Grandi | uid Random User <random@example.org> |
96 | 4 | Elena Grandi | sub rsa4096 2016-10-19 [E] |
97 | 1 | Elena Grandi | </pre> |
98 | 1 | Elena Grandi | |
99 | 4 | Elena Grandi | |
100 | 23 | Simone Piccardi | h2. Creazione delle sottochiavi |
101 | 23 | Simone Piccardi | |
102 | 5 | Elena Grandi | Questo è il punto in cui è particolarmente importante l'uso di GnuPG 2.1, che rende molto più semplice la creazione di una chiave per l'autenticazione. |
103 | 5 | Elena Grandi | |
104 | 5 | Elena Grandi | Molte delle OpenPGP Card disponibili sul mercato supportano chiavi al massimo a 2048 bit: questo non è un grosso problema dato che al momento sono considerate ancora ragionevolmente sicure, ed una loro eventuale sostituzione in futuro non è particolarmente onerosa (oltre ovviamente alla necessità di usare una Card o un dispositivo diverso). |
105 | 5 | Elena Grandi | |
106 | 5 | Elena Grandi | Per generare le sottochiavi necessarie, si entra in modalità di modifica con l'opzione @--expert@ che abilita la creazione di chiavi di autenticazione. |
107 | 5 | Elena Grandi | |
108 | 5 | Elena Grandi | <pre> |
109 | 5 | Elena Grandi | $ gpg --expert --edit-key 3E0EE5BAC50DF7C1 |
110 | 5 | Elena Grandi | gpg (GnuPG) 2.1.15; Copyright (C) 2016 Free Software Foundation, Inc. |
111 | 5 | Elena Grandi | This is free software: you are free to change and redistribute it. |
112 | 5 | Elena Grandi | There is NO WARRANTY, to the extent permitted by law. |
113 | 5 | Elena Grandi | |
114 | 5 | Elena Grandi | Secret key is available. |
115 | 5 | Elena Grandi | |
116 | 5 | Elena Grandi | sec rsa4096/3E0EE5BAC50DF7C1 |
117 | 5 | Elena Grandi | created: 2016-10-19 expires: never usage: SC |
118 | 5 | Elena Grandi | trust: ultimate validity: ultimate |
119 | 5 | Elena Grandi | ssb rsa4096/F303978FEBB6E995 |
120 | 5 | Elena Grandi | created: 2016-10-19 expires: never usage: E |
121 | 5 | Elena Grandi | [ultimate] (1). Random User <random@example.org> |
122 | 5 | Elena Grandi | </pre> |
123 | 5 | Elena Grandi | |
124 | 22 | Simone Piccardi | Quindi si crea prima una normale sottochiave di firma (opzione 4), alla selezione verrà chiesta (due volte) una passphrase per la nuova sottochiave ed anche la passphrase per la chiave principale: |
125 | 5 | Elena Grandi | |
126 | 5 | Elena Grandi | <pre> |
127 | 5 | Elena Grandi | gpg> addkey |
128 | 5 | Elena Grandi | Please select what kind of key you want: |
129 | 5 | Elena Grandi | (3) DSA (sign only) |
130 | 5 | Elena Grandi | (4) RSA (sign only) |
131 | 5 | Elena Grandi | (5) Elgamal (encrypt only) |
132 | 5 | Elena Grandi | (6) RSA (encrypt only) |
133 | 5 | Elena Grandi | (7) DSA (set your own capabilities) |
134 | 5 | Elena Grandi | (8) RSA (set your own capabilities) |
135 | 5 | Elena Grandi | (10) ECC (sign only) |
136 | 5 | Elena Grandi | (11) ECC (set your own capabilities) |
137 | 5 | Elena Grandi | (12) ECC (encrypt only) |
138 | 5 | Elena Grandi | (13) Existing key |
139 | 5 | Elena Grandi | Your selection? 4 |
140 | 5 | Elena Grandi | RSA keys may be between 1024 and 4096 bits long. |
141 | 5 | Elena Grandi | What keysize do you want? (2048) |
142 | 5 | Elena Grandi | Requested keysize is 2048 bits |
143 | 5 | Elena Grandi | Please specify how long the key should be valid. |
144 | 5 | Elena Grandi | 0 = key does not expire |
145 | 5 | Elena Grandi | <n> = key expires in n days |
146 | 5 | Elena Grandi | <n>w = key expires in n weeks |
147 | 5 | Elena Grandi | <n>m = key expires in n months |
148 | 5 | Elena Grandi | <n>y = key expires in n years |
149 | 5 | Elena Grandi | Key is valid for? (0) 1y |
150 | 5 | Elena Grandi | Key expires at Thu 19 Oct 2017 12:15:49 CEST |
151 | 5 | Elena Grandi | Is this correct? (y/N) y |
152 | 5 | Elena Grandi | Really create? (y/N) y |
153 | 5 | Elena Grandi | We need to generate a lot of random bytes. It is a good idea to perform |
154 | 5 | Elena Grandi | some other action (type on the keyboard, move the mouse, utilize the |
155 | 5 | Elena Grandi | disks) during the prime generation; this gives the random number |
156 | 5 | Elena Grandi | generator a better chance to gain enough entropy. |
157 | 5 | Elena Grandi | |
158 | 5 | Elena Grandi | sec rsa4096/3E0EE5BAC50DF7C1 |
159 | 5 | Elena Grandi | created: 2016-10-19 expires: never usage: SC |
160 | 5 | Elena Grandi | trust: ultimate validity: ultimate |
161 | 5 | Elena Grandi | ssb rsa4096/F303978FEBB6E995 |
162 | 5 | Elena Grandi | created: 2016-10-19 expires: never usage: E |
163 | 5 | Elena Grandi | ssb rsa2048/40A2ADF0FE9E4620 |
164 | 5 | Elena Grandi | created: 2016-10-19 expires: 2017-10-19 usage: S |
165 | 5 | Elena Grandi | [ultimate] (1). Random User <random@example.org> |
166 | 5 | Elena Grandi | |
167 | 5 | Elena Grandi | </pre> |
168 | 5 | Elena Grandi | |
169 | 22 | Simone Piccardi | Poi occorre creare una normale sottochiave per la crittografia (opzione 6), anche in questo caso verrà chiesta due volte la passphrase per la nuova chiave, ma avendola già data prima non sarà richiesta quella della chiave principale: |
170 | 5 | Elena Grandi | |
171 | 5 | Elena Grandi | <pre> |
172 | 5 | Elena Grandi | gpg> addkey |
173 | 5 | Elena Grandi | Please select what kind of key you want: |
174 | 5 | Elena Grandi | (3) DSA (sign only) |
175 | 5 | Elena Grandi | (4) RSA (sign only) |
176 | 5 | Elena Grandi | (5) Elgamal (encrypt only) |
177 | 5 | Elena Grandi | (6) RSA (encrypt only) |
178 | 5 | Elena Grandi | (7) DSA (set your own capabilities) |
179 | 5 | Elena Grandi | (8) RSA (set your own capabilities) |
180 | 5 | Elena Grandi | (10) ECC (sign only) |
181 | 5 | Elena Grandi | (11) ECC (set your own capabilities) |
182 | 5 | Elena Grandi | (12) ECC (encrypt only) |
183 | 5 | Elena Grandi | (13) Existing key |
184 | 5 | Elena Grandi | Your selection? 6 |
185 | 5 | Elena Grandi | RSA keys may be between 1024 and 4096 bits long. |
186 | 5 | Elena Grandi | What keysize do you want? (2048) |
187 | 5 | Elena Grandi | Requested keysize is 2048 bits |
188 | 5 | Elena Grandi | Please specify how long the key should be valid. |
189 | 5 | Elena Grandi | 0 = key does not expire |
190 | 5 | Elena Grandi | <n> = key expires in n days |
191 | 5 | Elena Grandi | <n>w = key expires in n weeks |
192 | 5 | Elena Grandi | <n>m = key expires in n months |
193 | 5 | Elena Grandi | <n>y = key expires in n years |
194 | 5 | Elena Grandi | Key is valid for? (0) 1y |
195 | 5 | Elena Grandi | Key expires at Thu 19 Oct 2017 12:18:16 CEST |
196 | 5 | Elena Grandi | Is this correct? (y/N) y |
197 | 5 | Elena Grandi | Really create? (y/N) y |
198 | 5 | Elena Grandi | We need to generate a lot of random bytes. It is a good idea to perform |
199 | 5 | Elena Grandi | some other action (type on the keyboard, move the mouse, utilize the |
200 | 5 | Elena Grandi | disks) during the prime generation; this gives the random number |
201 | 5 | Elena Grandi | generator a better chance to gain enough entropy. |
202 | 5 | Elena Grandi | |
203 | 5 | Elena Grandi | sec rsa4096/3E0EE5BAC50DF7C1 |
204 | 5 | Elena Grandi | created: 2016-10-19 expires: never usage: SC |
205 | 5 | Elena Grandi | trust: ultimate validity: ultimate |
206 | 5 | Elena Grandi | ssb rsa4096/F303978FEBB6E995 |
207 | 5 | Elena Grandi | created: 2016-10-19 expires: never usage: E |
208 | 5 | Elena Grandi | ssb rsa2048/40A2ADF0FE9E4620 |
209 | 5 | Elena Grandi | created: 2016-10-19 expires: 2017-10-19 usage: S |
210 | 5 | Elena Grandi | ssb rsa2048/ED9BBD7B3BFF900F |
211 | 5 | Elena Grandi | created: 2016-10-19 expires: 2017-10-19 usage: E |
212 | 5 | Elena Grandi | [ultimate] (1). Random User <random@example.org> |
213 | 5 | Elena Grandi | </pre> |
214 | 5 | Elena Grandi | |
215 | 22 | Simone Piccardi | Ed infine una sottochiave per l'autenticazione, selezionando l'opzione 8, togliendo le capacità di firma e crittografia e mettendo quella di autenticazione (anche qui occorrerà specificare una passphrase). |
216 | 5 | Elena Grandi | |
217 | 5 | Elena Grandi | <pre> |
218 | 5 | Elena Grandi | gpg> addkey |
219 | 5 | Elena Grandi | Please select what kind of key you want: |
220 | 5 | Elena Grandi | (3) DSA (sign only) |
221 | 5 | Elena Grandi | (4) RSA (sign only) |
222 | 5 | Elena Grandi | (5) Elgamal (encrypt only) |
223 | 5 | Elena Grandi | (6) RSA (encrypt only) |
224 | 5 | Elena Grandi | (7) DSA (set your own capabilities) |
225 | 5 | Elena Grandi | (8) RSA (set your own capabilities) |
226 | 5 | Elena Grandi | (10) ECC (sign only) |
227 | 5 | Elena Grandi | (11) ECC (set your own capabilities) |
228 | 5 | Elena Grandi | (12) ECC (encrypt only) |
229 | 5 | Elena Grandi | (13) Existing key |
230 | 5 | Elena Grandi | Your selection? 8 |
231 | 5 | Elena Grandi | |
232 | 5 | Elena Grandi | Possible actions for a RSA key: Sign Encrypt Authenticate |
233 | 5 | Elena Grandi | Current allowed actions: Sign Encrypt |
234 | 5 | Elena Grandi | |
235 | 5 | Elena Grandi | (S) Toggle the sign capability |
236 | 5 | Elena Grandi | (E) Toggle the encrypt capability |
237 | 5 | Elena Grandi | (A) Toggle the authenticate capability |
238 | 5 | Elena Grandi | (Q) Finished |
239 | 5 | Elena Grandi | |
240 | 5 | Elena Grandi | Your selection? s |
241 | 5 | Elena Grandi | |
242 | 5 | Elena Grandi | Possible actions for a RSA key: Sign Encrypt Authenticate |
243 | 5 | Elena Grandi | Current allowed actions: Encrypt |
244 | 5 | Elena Grandi | |
245 | 5 | Elena Grandi | (S) Toggle the sign capability |
246 | 5 | Elena Grandi | (E) Toggle the encrypt capability |
247 | 5 | Elena Grandi | (A) Toggle the authenticate capability |
248 | 5 | Elena Grandi | (Q) Finished |
249 | 5 | Elena Grandi | |
250 | 5 | Elena Grandi | Your selection? e |
251 | 5 | Elena Grandi | |
252 | 5 | Elena Grandi | Possible actions for a RSA key: Sign Encrypt Authenticate |
253 | 5 | Elena Grandi | Current allowed actions: |
254 | 5 | Elena Grandi | |
255 | 5 | Elena Grandi | (S) Toggle the sign capability |
256 | 5 | Elena Grandi | (E) Toggle the encrypt capability |
257 | 5 | Elena Grandi | (A) Toggle the authenticate capability |
258 | 5 | Elena Grandi | (Q) Finished |
259 | 5 | Elena Grandi | |
260 | 5 | Elena Grandi | Your selection? a |
261 | 5 | Elena Grandi | |
262 | 5 | Elena Grandi | Possible actions for a RSA key: Sign Encrypt Authenticate |
263 | 5 | Elena Grandi | Current allowed actions: Authenticate |
264 | 5 | Elena Grandi | |
265 | 5 | Elena Grandi | (S) Toggle the sign capability |
266 | 5 | Elena Grandi | (E) Toggle the encrypt capability |
267 | 5 | Elena Grandi | (A) Toggle the authenticate capability |
268 | 5 | Elena Grandi | (Q) Finished |
269 | 5 | Elena Grandi | |
270 | 5 | Elena Grandi | Your selection? q |
271 | 5 | Elena Grandi | RSA keys may be between 1024 and 4096 bits long. |
272 | 5 | Elena Grandi | What keysize do you want? (2048) |
273 | 5 | Elena Grandi | Requested keysize is 2048 bits |
274 | 5 | Elena Grandi | Please specify how long the key should be valid. |
275 | 5 | Elena Grandi | 0 = key does not expire |
276 | 5 | Elena Grandi | <n> = key expires in n days |
277 | 5 | Elena Grandi | <n>w = key expires in n weeks |
278 | 5 | Elena Grandi | <n>m = key expires in n months |
279 | 5 | Elena Grandi | <n>y = key expires in n years |
280 | 5 | Elena Grandi | Key is valid for? (0) 1y |
281 | 5 | Elena Grandi | Key expires at Thu 19 Oct 2017 12:24:56 CEST |
282 | 5 | Elena Grandi | Is this correct? (y/N) y |
283 | 5 | Elena Grandi | Really create? (y/N) y |
284 | 5 | Elena Grandi | We need to generate a lot of random bytes. It is a good idea to perform |
285 | 5 | Elena Grandi | some other action (type on the keyboard, move the mouse, utilize the |
286 | 5 | Elena Grandi | disks) during the prime generation; this gives the random number |
287 | 5 | Elena Grandi | generator a better chance to gain enough entropy. |
288 | 5 | Elena Grandi | |
289 | 5 | Elena Grandi | sec rsa4096/3E0EE5BAC50DF7C1 |
290 | 5 | Elena Grandi | created: 2016-10-19 expires: never usage: SC |
291 | 5 | Elena Grandi | trust: ultimate validity: ultimate |
292 | 5 | Elena Grandi | ssb rsa4096/F303978FEBB6E995 |
293 | 5 | Elena Grandi | created: 2016-10-19 expires: never usage: E |
294 | 5 | Elena Grandi | ssb rsa2048/40A2ADF0FE9E4620 |
295 | 5 | Elena Grandi | created: 2016-10-19 expires: 2017-10-19 usage: S |
296 | 5 | Elena Grandi | ssb rsa2048/ED9BBD7B3BFF900F |
297 | 5 | Elena Grandi | created: 2016-10-19 expires: 2017-10-19 usage: E |
298 | 5 | Elena Grandi | ssb rsa2048/5F89B668295AE797 |
299 | 5 | Elena Grandi | created: 2016-10-19 expires: 2017-10-19 usage: A |
300 | 5 | Elena Grandi | [ultimate] (1). Random User <random@example.org> |
301 | 5 | Elena Grandi | </pre> |
302 | 5 | Elena Grandi | |
303 | 5 | Elena Grandi | Si può quindi uscire dalla modalità di modifica chiave, salvando le modifiche. |
304 | 5 | Elena Grandi | |
305 | 5 | Elena Grandi | <pre> |
306 | 1 | Elena Grandi | gpg> save |
307 | 1 | Elena Grandi | </pre> |
308 | 5 | Elena Grandi | |
309 | 5 | Elena Grandi | |
310 | 23 | Simone Piccardi | h2. Salvataggio su supporto esterno |
311 | 23 | Simone Piccardi | |
312 | 8 | Elena Grandi | A questo punto la chiave è ancora gestita nel modo tradizionale, su hard disk. Questo è il momento di salvarne un backup e di farne una copia su chiavetta USB da usare in futuro per le modifiche della chiave. |
313 | 8 | Elena Grandi | |
314 | 9 | Elena Grandi | Per il backup ci sono vari metodi, da una semplice e poco efficiente copia di tutta la @~/.gnupg@ su un ulteriore supporto all'uso di "paperkey":http://www.jabberwocky.com/software/paperkey/ per salvare una copia su carta; l'importante è che venga fatto e custodito in un luogo sicuro, anche se magari remoto (cassetta di sicurezza). |
315 | 8 | Elena Grandi | |
316 | 22 | Simone Piccardi | Per avere una copia della chiave principale da usare sporadicamente, invece, è necessario copiare l'intera @~/.gnupg@ su una chiavetta USB o simili; una volta fatta la copia verificare che contenga quanto dovuto con: |
317 | 9 | Elena Grandi | |
318 | 9 | Elena Grandi | <pre> |
319 | 9 | Elena Grandi | $ gpg --homedir indirizzo/della/chiavetta/gnupg --list-secret-keys |
320 | 9 | Elena Grandi | indirizzo/della/chiavetta/gnupg |
321 | 9 | Elena Grandi | pubring.gpg |
322 | 9 | Elena Grandi | --------------------------------- |
323 | 9 | Elena Grandi | sec rsa4096 2016-10-19 [SC] |
324 | 9 | Elena Grandi | 19DB75A75734ABBEDB1124163E0EE5BAC50DF7C1 |
325 | 9 | Elena Grandi | uid [ultimate] Random User <random@example.org> |
326 | 9 | Elena Grandi | ssb rsa4096 2016-10-19 [E] |
327 | 9 | Elena Grandi | ssb rsa2048 2016-10-19 [S] [expires: 2017-10-19] |
328 | 9 | Elena Grandi | ssb rsa2048 2016-10-19 [E] [expires: 2017-10-19] |
329 | 9 | Elena Grandi | ssb rsa2048 2016-10-19 [A] [expires: 2017-10-19] |
330 | 1 | Elena Grandi | </pre> |
331 | 9 | Elena Grandi | |
332 | 9 | Elena Grandi | smontare la chiavetta e riporla in un luogo sicuro; la si userà nuovamente quando sarà necessario cambiare le date di scadenza delle sottochiavi, oppure firmare chiavi di altre persone, per la Web of Trust. |
333 | 9 | Elena Grandi | |
334 | 23 | Simone Piccardi | |
335 | 22 | Simone Piccardi | h2. Spostamento delle chiavi sulla Card |
336 | 2 | Elena Grandi | |
337 | 10 | Elena Grandi | Per il prossimo passaggio è estremamente importante assicurarsi di aver fatto le copie delle chiavi e sottochiavi private: in questo passaggio verranno trasferite sulla Card, dalla quale non possono più essere estratte, e cancellate dal disco. |
338 | 10 | Elena Grandi | |
339 | 10 | Elena Grandi | Collegare il lettore al computer, inserire la Card e controllare che venga correttamente riconosciuta: |
340 | 10 | Elena Grandi | |
341 | 10 | Elena Grandi | <pre> |
342 | 10 | Elena Grandi | $ gpg --card-status |
343 | 10 | Elena Grandi | Reader ...........: #### |
344 | 10 | Elena Grandi | Application ID ...: #### |
345 | 10 | Elena Grandi | Version ..........: 2.0 |
346 | 10 | Elena Grandi | Manufacturer .....: #### |
347 | 10 | Elena Grandi | Serial number ....: #### |
348 | 10 | Elena Grandi | Name of cardholder: [not set] |
349 | 10 | Elena Grandi | Language prefs ...: [not set] |
350 | 10 | Elena Grandi | Sex ..............: unspecified |
351 | 10 | Elena Grandi | URL of public key : [not set] |
352 | 10 | Elena Grandi | Login data .......: [not set] |
353 | 10 | Elena Grandi | Signature PIN ....: forced |
354 | 10 | Elena Grandi | Key attributes ...: rsa2048 rsa2048 rsa2048 |
355 | 10 | Elena Grandi | Max. PIN lengths .: 127 127 127 |
356 | 10 | Elena Grandi | PIN retry counter : 3 3 3 |
357 | 10 | Elena Grandi | Signature counter : 0 |
358 | 10 | Elena Grandi | Signature key ....: [none] |
359 | 10 | Elena Grandi | Encryption key....: [none] |
360 | 10 | Elena Grandi | Authentication key: [none] |
361 | 10 | Elena Grandi | General key info..: [none] |
362 | 10 | Elena Grandi | </pre> |
363 | 10 | Elena Grandi | |
364 | 22 | Simone Piccardi | Se la Card è nuova occorre cambiare poi i PIN della chiave rispetto ai default: |
365 | 12 | Elena Grandi | |
366 | 12 | Elena Grandi | <pre> |
367 | 12 | Elena Grandi | $ gpg --card-edit |
368 | 12 | Elena Grandi | Reader ...........: #### |
369 | 12 | Elena Grandi | Application ID ...: #### |
370 | 12 | Elena Grandi | Version ..........: 2.0 |
371 | 12 | Elena Grandi | Manufacturer .....: #### |
372 | 12 | Elena Grandi | Serial number ....: #### |
373 | 12 | Elena Grandi | Name of cardholder: [not set] |
374 | 12 | Elena Grandi | Language prefs ...: [not set] |
375 | 12 | Elena Grandi | Sex ..............: unspecified |
376 | 12 | Elena Grandi | URL of public key : [not set] |
377 | 12 | Elena Grandi | Login data .......: [not set] |
378 | 12 | Elena Grandi | Signature PIN ....: forced |
379 | 12 | Elena Grandi | Key attributes ...: rsa2048 rsa2048 rsa2048 |
380 | 12 | Elena Grandi | Max. PIN lengths .: 127 127 127 |
381 | 12 | Elena Grandi | PIN retry counter : 3 3 3 |
382 | 12 | Elena Grandi | Signature counter : 0 |
383 | 12 | Elena Grandi | Signature key ....: [none] |
384 | 12 | Elena Grandi | Encryption key....: [none] |
385 | 12 | Elena Grandi | Authentication key: [none] |
386 | 12 | Elena Grandi | General key info..: [none] |
387 | 12 | Elena Grandi | |
388 | 12 | Elena Grandi | gpg/card> admin |
389 | 12 | Elena Grandi | Admin commands are allowed |
390 | 12 | Elena Grandi | |
391 | 12 | Elena Grandi | gpg/card> passwd |
392 | 12 | Elena Grandi | gpg: OpenPGP card no. #### detected |
393 | 12 | Elena Grandi | |
394 | 12 | Elena Grandi | 1 - change PIN |
395 | 12 | Elena Grandi | 2 - unblock PIN |
396 | 12 | Elena Grandi | 3 - change Admin PIN |
397 | 12 | Elena Grandi | 4 - set the Reset Code |
398 | 1 | Elena Grandi | Q - quit |
399 | 21 | Simone Piccardi | |
400 | 21 | Simone Piccardi | Your selection? 1 |
401 | 1 | Elena Grandi | </pre> |
402 | 21 | Simone Piccardi | |
403 | 22 | Simone Piccardi | a questo punto verrà chiesto il PIN Standard corrente (il default della carta è 123456) e poi due volte quello nuovo (si faccia attenzione a mettere il PIN corretto, si hanno un massimo di tre errori possibili, dopo verrà bloccato, lo si può sbloccare solo con il PIN amministrativo). Quest'ultimo si cambia dal default selezionando ulteriormente: |
404 | 21 | Simone Piccardi | |
405 | 21 | Simone Piccardi | <pre> |
406 | 21 | Simone Piccardi | PIN changed. |
407 | 21 | Simone Piccardi | |
408 | 21 | Simone Piccardi | 1 - change PIN |
409 | 21 | Simone Piccardi | 2 - unblock PIN |
410 | 1 | Elena Grandi | 3 - change Admin PIN |
411 | 1 | Elena Grandi | 4 - set the Reset Code |
412 | 1 | Elena Grandi | Q - quit |
413 | 21 | Simone Piccardi | |
414 | 21 | Simone Piccardi | Selezione? 3 |
415 | 21 | Simone Piccardi | PIN changed. |
416 | 21 | Simone Piccardi | </pre> |
417 | 21 | Simone Piccardi | |
418 | 22 | Simone Piccardi | dando quello vecchio e ripetendo due volte quello nuovo; qui però tre errori nel dare quello corrente comporteranno l'impossibilità di modificarlo, rendendo di fatto non più recuperabile la Card senza un reset alle condizioni di fabbrica. |
419 | 21 | Simone Piccardi | |
420 | 22 | Simone Piccardi | A questo menù si può accedere direttamente anche con il comando @gpg --change-pin@, e ad esempio per recuperare un PIN dimenticato si può selezionare l'opzione 2, _Unblock PIN_ nel qual caso verrà chiesto il PIN amministrativo, e si potrà impostare un nuovo PIN. |
421 | 22 | Simone Piccardi | |
422 | 10 | Elena Grandi | Si può quindi passare a spostare le varie sottochiavi sulla Card, aprendo la modalità di editing della chiave: |
423 | 10 | Elena Grandi | |
424 | 10 | Elena Grandi | <pre> |
425 | 10 | Elena Grandi | $ gpg --edit-key 3E0EE5BAC50DF7C1 |
426 | 10 | Elena Grandi | gpg (GnuPG) 2.1.15; Copyright (C) 2016 Free Software Foundation, Inc. |
427 | 10 | Elena Grandi | This is free software: you are free to change and redistribute it. |
428 | 10 | Elena Grandi | There is NO WARRANTY, to the extent permitted by law. |
429 | 10 | Elena Grandi | |
430 | 10 | Elena Grandi | Secret key is available. |
431 | 10 | Elena Grandi | |
432 | 10 | Elena Grandi | sec rsa4096/3E0EE5BAC50DF7C1 |
433 | 10 | Elena Grandi | created: 2016-10-19 expires: never usage: SC |
434 | 10 | Elena Grandi | trust: ultimate validity: ultimate |
435 | 10 | Elena Grandi | ssb rsa4096/F303978FEBB6E995 |
436 | 1 | Elena Grandi | created: 2016-10-19 expires: never usage: E |
437 | 10 | Elena Grandi | ssb rsa2048/40A2ADF0FE9E4620 |
438 | 10 | Elena Grandi | created: 2016-10-19 expires: 2017-10-19 usage: S |
439 | 10 | Elena Grandi | ssb rsa2048/ED9BBD7B3BFF900F |
440 | 10 | Elena Grandi | created: 2016-10-19 expires: 2017-10-19 usage: E |
441 | 10 | Elena Grandi | ssb rsa2048/5F89B668295AE797 |
442 | 10 | Elena Grandi | created: 2016-10-19 expires: 2017-10-19 usage: A |
443 | 10 | Elena Grandi | [ultimate] (1). Random User <random@example.org> |
444 | 10 | Elena Grandi | </pre> |
445 | 10 | Elena Grandi | |
446 | 22 | Simone Piccardi | passando alla modalità di modifica delle chiavi private, con il comando @toggle@ che consente di selezionare le chiavi: |
447 | 10 | Elena Grandi | |
448 | 10 | Elena Grandi | <pre> |
449 | 10 | Elena Grandi | gpg> toggle |
450 | 10 | Elena Grandi | |
451 | 10 | Elena Grandi | sec rsa4096/3E0EE5BAC50DF7C1 |
452 | 10 | Elena Grandi | created: 2016-10-19 expires: never usage: SC |
453 | 10 | Elena Grandi | trust: ultimate validity: ultimate |
454 | 1 | Elena Grandi | ssb rsa4096/F303978FEBB6E995 |
455 | 10 | Elena Grandi | created: 2016-10-19 expires: never usage: E |
456 | 10 | Elena Grandi | ssb rsa2048/40A2ADF0FE9E4620 |
457 | 10 | Elena Grandi | created: 2016-10-19 expires: 2017-10-19 usage: S |
458 | 10 | Elena Grandi | ssb rsa2048/ED9BBD7B3BFF900F |
459 | 10 | Elena Grandi | created: 2016-10-19 expires: 2017-10-19 usage: E |
460 | 10 | Elena Grandi | ssb rsa2048/5F89B668295AE797 |
461 | 10 | Elena Grandi | created: 2016-10-19 expires: 2017-10-19 usage: A |
462 | 10 | Elena Grandi | [ultimate] (1). Random User <random@example.org> |
463 | 10 | Elena Grandi | </pre> |
464 | 10 | Elena Grandi | |
465 | 22 | Simone Piccardi | per trasferire una ad una le sottochiavi sulla Card andranno selezionate ed inserite, una volta usato @toggle@ il comando @key@ permette di selezionare/deselezionare le chiavi da trasferire con il comando @keytocard@; pertanto per trasferire la chiave di firma useremo i comandi: |
466 | 10 | Elena Grandi | |
467 | 10 | Elena Grandi | <pre> |
468 | 10 | Elena Grandi | gpg> key 2 |
469 | 10 | Elena Grandi | |
470 | 10 | Elena Grandi | sec rsa4096/3E0EE5BAC50DF7C1 |
471 | 10 | Elena Grandi | created: 2016-10-19 expires: never usage: SC |
472 | 10 | Elena Grandi | trust: ultimate validity: ultimate |
473 | 10 | Elena Grandi | ssb rsa4096/F303978FEBB6E995 |
474 | 10 | Elena Grandi | created: 2016-10-19 expires: never usage: E |
475 | 10 | Elena Grandi | ssb* rsa2048/40A2ADF0FE9E4620 |
476 | 1 | Elena Grandi | created: 2016-10-19 expires: 2017-10-19 usage: S |
477 | 10 | Elena Grandi | ssb rsa2048/ED9BBD7B3BFF900F |
478 | 10 | Elena Grandi | created: 2016-10-19 expires: 2017-10-19 usage: E |
479 | 10 | Elena Grandi | ssb rsa2048/5F89B668295AE797 |
480 | 10 | Elena Grandi | created: 2016-10-19 expires: 2017-10-19 usage: A |
481 | 10 | Elena Grandi | [ultimate] (1). Random User <random@example.org> |
482 | 10 | Elena Grandi | |
483 | 10 | Elena Grandi | gpg> keytocard |
484 | 10 | Elena Grandi | Please select where to store the key: |
485 | 10 | Elena Grandi | (1) Signature key |
486 | 10 | Elena Grandi | (3) Authentication key |
487 | 10 | Elena Grandi | Your selection? 1 |
488 | 22 | Simone Piccardi | </pre> |
489 | 10 | Elena Grandi | |
490 | 22 | Simone Piccardi | qui occorre selezionare il tipo di chiave e poi verrà chiesta la passphrase della chiave e poi proseguirà con: |
491 | 10 | Elena Grandi | |
492 | 22 | Simone Piccardi | <pre> |
493 | 10 | Elena Grandi | sec rsa4096/3E0EE5BAC50DF7C1 |
494 | 10 | Elena Grandi | created: 2016-10-19 expires: never usage: SC |
495 | 10 | Elena Grandi | trust: ultimate validity: ultimate |
496 | 10 | Elena Grandi | ssb rsa4096/F303978FEBB6E995 |
497 | 10 | Elena Grandi | created: 2016-10-19 expires: never usage: E |
498 | 10 | Elena Grandi | ssb* rsa2048/40A2ADF0FE9E4620 |
499 | 10 | Elena Grandi | created: 2016-10-19 expires: 2017-10-19 usage: S |
500 | 10 | Elena Grandi | ssb rsa2048/ED9BBD7B3BFF900F |
501 | 10 | Elena Grandi | created: 2016-10-19 expires: 2017-10-19 usage: E |
502 | 10 | Elena Grandi | ssb rsa2048/5F89B668295AE797 |
503 | 10 | Elena Grandi | created: 2016-10-19 expires: 2017-10-19 usage: A |
504 | 10 | Elena Grandi | [ultimate] (1). Random User <random@example.org> |
505 | 10 | Elena Grandi | </pre> |
506 | 10 | Elena Grandi | |
507 | 22 | Simone Piccardi | per trasferire quella di crittografia occorrerà deselezionare la chiave di firma e selezionare quella di autenticazione, e ripetere il comando @keytocard@: |
508 | 10 | Elena Grandi | |
509 | 10 | Elena Grandi | <pre> |
510 | 10 | Elena Grandi | gpg> key 2 |
511 | 10 | Elena Grandi | |
512 | 10 | Elena Grandi | sec rsa4096/3E0EE5BAC50DF7C1 |
513 | 10 | Elena Grandi | created: 2016-10-19 expires: never usage: SC |
514 | 10 | Elena Grandi | trust: ultimate validity: ultimate |
515 | 10 | Elena Grandi | ssb rsa4096/F303978FEBB6E995 |
516 | 10 | Elena Grandi | created: 2016-10-19 expires: never usage: E |
517 | 10 | Elena Grandi | ssb rsa2048/40A2ADF0FE9E4620 |
518 | 10 | Elena Grandi | created: 2016-10-19 expires: 2017-10-19 usage: S |
519 | 10 | Elena Grandi | ssb rsa2048/ED9BBD7B3BFF900F |
520 | 10 | Elena Grandi | created: 2016-10-19 expires: 2017-10-19 usage: E |
521 | 10 | Elena Grandi | ssb rsa2048/5F89B668295AE797 |
522 | 10 | Elena Grandi | created: 2016-10-19 expires: 2017-10-19 usage: A |
523 | 10 | Elena Grandi | [ultimate] (1). Random User <random@example.org> |
524 | 10 | Elena Grandi | |
525 | 10 | Elena Grandi | gpg> key 3 |
526 | 1 | Elena Grandi | |
527 | 10 | Elena Grandi | sec rsa4096/3E0EE5BAC50DF7C1 |
528 | 1 | Elena Grandi | created: 2016-10-19 expires: never usage: SC |
529 | 1 | Elena Grandi | trust: ultimate validity: ultimate |
530 | 1 | Elena Grandi | ssb rsa4096/F303978FEBB6E995 |
531 | 10 | Elena Grandi | created: 2016-10-19 expires: never usage: E |
532 | 10 | Elena Grandi | ssb rsa2048/40A2ADF0FE9E4620 |
533 | 10 | Elena Grandi | created: 2016-10-19 expires: 2017-10-19 usage: S |
534 | 10 | Elena Grandi | ssb* rsa2048/ED9BBD7B3BFF900F |
535 | 10 | Elena Grandi | created: 2016-10-19 expires: 2017-10-19 usage: E |
536 | 10 | Elena Grandi | ssb rsa2048/5F89B668295AE797 |
537 | 10 | Elena Grandi | created: 2016-10-19 expires: 2017-10-19 usage: A |
538 | 10 | Elena Grandi | [ultimate] (1). Random User <random@example.org> |
539 | 10 | Elena Grandi | |
540 | 10 | Elena Grandi | gpg> keytocard |
541 | 10 | Elena Grandi | Please select where to store the key: |
542 | 10 | Elena Grandi | (2) Encryption key |
543 | 10 | Elena Grandi | Your selection? 2 |
544 | 22 | Simone Piccardi | </pre> |
545 | 10 | Elena Grandi | |
546 | 22 | Simone Piccardi | di nuovo si sceglie (stavolta solo chiave di cifratura) e verrà chiesta la passphrase della chiave scelta: |
547 | 22 | Simone Piccardi | |
548 | 22 | Simone Piccardi | <pre> |
549 | 10 | Elena Grandi | sec rsa4096/3E0EE5BAC50DF7C1 |
550 | 10 | Elena Grandi | created: 2016-10-19 expires: never usage: SC |
551 | 10 | Elena Grandi | trust: ultimate validity: ultimate |
552 | 10 | Elena Grandi | ssb rsa4096/F303978FEBB6E995 |
553 | 10 | Elena Grandi | created: 2016-10-19 expires: never usage: E |
554 | 10 | Elena Grandi | ssb rsa2048/40A2ADF0FE9E4620 |
555 | 10 | Elena Grandi | created: 2016-10-19 expires: 2017-10-19 usage: S |
556 | 10 | Elena Grandi | ssb* rsa2048/ED9BBD7B3BFF900F |
557 | 10 | Elena Grandi | created: 2016-10-19 expires: 2017-10-19 usage: E |
558 | 10 | Elena Grandi | ssb rsa2048/5F89B668295AE797 |
559 | 10 | Elena Grandi | created: 2016-10-19 expires: 2017-10-19 usage: A |
560 | 10 | Elena Grandi | [ultimate] (1). Random User <random@example.org> |
561 | 10 | Elena Grandi | </pre> |
562 | 10 | Elena Grandi | |
563 | 22 | Simone Piccardi | infine si ripeterà la procedura con la chiave di autenticazione: |
564 | 10 | Elena Grandi | |
565 | 10 | Elena Grandi | <pre> |
566 | 10 | Elena Grandi | gpg> key 3 |
567 | 10 | Elena Grandi | |
568 | 10 | Elena Grandi | sec rsa4096/3E0EE5BAC50DF7C1 |
569 | 10 | Elena Grandi | created: 2016-10-19 expires: never usage: SC |
570 | 10 | Elena Grandi | trust: ultimate validity: ultimate |
571 | 10 | Elena Grandi | ssb rsa4096/F303978FEBB6E995 |
572 | 10 | Elena Grandi | created: 2016-10-19 expires: never usage: E |
573 | 10 | Elena Grandi | ssb rsa2048/40A2ADF0FE9E4620 |
574 | 10 | Elena Grandi | created: 2016-10-19 expires: 2017-10-19 usage: S |
575 | 10 | Elena Grandi | ssb rsa2048/ED9BBD7B3BFF900F |
576 | 10 | Elena Grandi | created: 2016-10-19 expires: 2017-10-19 usage: E |
577 | 10 | Elena Grandi | ssb rsa2048/5F89B668295AE797 |
578 | 10 | Elena Grandi | created: 2016-10-19 expires: 2017-10-19 usage: A |
579 | 10 | Elena Grandi | [ultimate] (1). Random User <random@example.org> |
580 | 10 | Elena Grandi | |
581 | 10 | Elena Grandi | gpg> key 4 |
582 | 10 | Elena Grandi | |
583 | 10 | Elena Grandi | sec rsa4096/3E0EE5BAC50DF7C1 |
584 | 10 | Elena Grandi | created: 2016-10-19 expires: never usage: SC |
585 | 10 | Elena Grandi | trust: ultimate validity: ultimate |
586 | 10 | Elena Grandi | ssb rsa4096/F303978FEBB6E995 |
587 | 10 | Elena Grandi | created: 2016-10-19 expires: never usage: E |
588 | 10 | Elena Grandi | ssb rsa2048/40A2ADF0FE9E4620 |
589 | 10 | Elena Grandi | created: 2016-10-19 expires: 2017-10-19 usage: S |
590 | 10 | Elena Grandi | ssb rsa2048/ED9BBD7B3BFF900F |
591 | 10 | Elena Grandi | created: 2016-10-19 expires: 2017-10-19 usage: E |
592 | 10 | Elena Grandi | ssb* rsa2048/5F89B668295AE797 |
593 | 10 | Elena Grandi | created: 2016-10-19 expires: 2017-10-19 usage: A |
594 | 10 | Elena Grandi | [ultimate] (1). Random User <random@example.org> |
595 | 10 | Elena Grandi | |
596 | 10 | Elena Grandi | gpg> keytocard |
597 | 10 | Elena Grandi | Please select where to store the key: |
598 | 10 | Elena Grandi | (3) Authentication key |
599 | 10 | Elena Grandi | Your selection? 3 |
600 | 10 | Elena Grandi | |
601 | 10 | Elena Grandi | sec rsa4096/3E0EE5BAC50DF7C1 |
602 | 10 | Elena Grandi | created: 2016-10-19 expires: never usage: SC |
603 | 10 | Elena Grandi | trust: ultimate validity: ultimate |
604 | 10 | Elena Grandi | ssb rsa4096/F303978FEBB6E995 |
605 | 10 | Elena Grandi | created: 2016-10-19 expires: never usage: E |
606 | 10 | Elena Grandi | ssb rsa2048/40A2ADF0FE9E4620 |
607 | 10 | Elena Grandi | created: 2016-10-19 expires: 2017-10-19 usage: S |
608 | 10 | Elena Grandi | ssb rsa2048/ED9BBD7B3BFF900F |
609 | 10 | Elena Grandi | created: 2016-10-19 expires: 2017-10-19 usage: E |
610 | 10 | Elena Grandi | ssb* rsa2048/5F89B668295AE797 |
611 | 10 | Elena Grandi | created: 2016-10-19 expires: 2017-10-19 usage: A |
612 | 10 | Elena Grandi | [ultimate] (1). Random User <random@example.org> |
613 | 10 | Elena Grandi | </pre> |
614 | 10 | Elena Grandi | |
615 | 11 | Elena Grandi | Uscire salvando: |
616 | 11 | Elena Grandi | |
617 | 11 | Elena Grandi | <pre> |
618 | 11 | Elena Grandi | gpg> save |
619 | 11 | Elena Grandi | </pre> |
620 | 11 | Elena Grandi | |
621 | 11 | Elena Grandi | e a questo punto si può controllare che le sottochiavi sono sulla Card: |
622 | 11 | Elena Grandi | |
623 | 11 | Elena Grandi | <pre> |
624 | 11 | Elena Grandi | $ gpg --card-status |
625 | 11 | Elena Grandi | |
626 | 11 | Elena Grandi | Reader ...........: #### |
627 | 11 | Elena Grandi | Application ID ...: #### |
628 | 11 | Elena Grandi | Version ..........: 2.0 |
629 | 11 | Elena Grandi | Manufacturer .....: #### |
630 | 11 | Elena Grandi | Serial number ....: #### |
631 | 11 | Elena Grandi | Name of cardholder: [not set] |
632 | 11 | Elena Grandi | Language prefs ...: [not set] |
633 | 11 | Elena Grandi | Sex ..............: unspecified |
634 | 11 | Elena Grandi | URL of public key : [not set] |
635 | 11 | Elena Grandi | Login data .......: [not set] |
636 | 11 | Elena Grandi | Signature PIN ....: forced |
637 | 11 | Elena Grandi | Key attributes ...: rsa2048 rsa2048 rsa2048 |
638 | 11 | Elena Grandi | Max. PIN lengths .: 127 127 127 |
639 | 11 | Elena Grandi | PIN retry counter : 3 3 3 |
640 | 11 | Elena Grandi | Signature counter : 0 |
641 | 11 | Elena Grandi | Signature key ....: 2128 412C BC75 34F5 6305 9447 40A2 ADF0 FE9E 4620 |
642 | 11 | Elena Grandi | created ....: 2016-10-19 10:15:26 |
643 | 11 | Elena Grandi | Encryption key....: 0B24 9C62 4A7D 19FE 7AB9 DCB3 ED9B BD7B 3BFF 900F |
644 | 11 | Elena Grandi | created ....: 2016-10-19 10:17:57 |
645 | 11 | Elena Grandi | Authentication key: 40E1 AE4A 7C13 FD8C C6EA 2C56 5F89 B668 295A E797 |
646 | 11 | Elena Grandi | created ....: 2016-10-19 10:24:14 |
647 | 11 | Elena Grandi | General key info..: sub rsa2048/40A2ADF0FE9E4620 2016-10-19 Random User <random@example.org> |
648 | 11 | Elena Grandi | sec rsa4096/3E0EE5BAC50DF7C1 created: 2016-10-19 expires: never |
649 | 11 | Elena Grandi | ssb rsa4096/F303978FEBB6E995 created: 2016-10-19 expires: never |
650 | 11 | Elena Grandi | ssb> rsa2048/40A2ADF0FE9E4620 created: 2016-10-19 expires: 2017-10-19 |
651 | 11 | Elena Grandi | card-no: #### |
652 | 11 | Elena Grandi | ssb> rsa2048/ED9BBD7B3BFF900F created: 2016-10-19 expires: 2017-10-19 |
653 | 11 | Elena Grandi | card-no: #### |
654 | 11 | Elena Grandi | ssb> rsa2048/5F89B668295AE797 created: 2016-10-19 expires: 2017-10-19 |
655 | 1 | Elena Grandi | card-no: #### |
656 | 11 | Elena Grandi | </pre> |
657 | 11 | Elena Grandi | |
658 | 11 | Elena Grandi | e non sono più presenti sul disco |
659 | 11 | Elena Grandi | |
660 | 11 | Elena Grandi | <pre> |
661 | 11 | Elena Grandi | $ gpg --list-secret-keys |
662 | 11 | Elena Grandi | /home/random/.gnupg/pubring.gpg |
663 | 11 | Elena Grandi | --------------------------------- |
664 | 11 | Elena Grandi | sec rsa4096 2016-10-19 [SC] |
665 | 11 | Elena Grandi | 19DB75A75734ABBEDB1124163E0EE5BAC50DF7C1 |
666 | 11 | Elena Grandi | uid [ultimate] Random User <random@example.org> |
667 | 11 | Elena Grandi | ssb rsa4096 2016-10-19 [E] |
668 | 11 | Elena Grandi | ssb> rsa2048 2016-10-19 [S] [expires: 2017-10-19] |
669 | 11 | Elena Grandi | ssb> rsa2048 2016-10-19 [E] [expires: 2017-10-19] |
670 | 11 | Elena Grandi | ssb> rsa2048 2016-10-19 [A] [expires: 2017-10-19] |
671 | 1 | Elena Grandi | </pre> |
672 | 11 | Elena Grandi | |
673 | 11 | Elena Grandi | è però ancora presente la chiave principale. |
674 | 11 | Elena Grandi | |
675 | 23 | Simone Piccardi | |
676 | 22 | Simone Piccardi | h2. Rimozione della chiave principale |
677 | 13 | Elena Grandi | |
678 | 14 | Elena Grandi | Usando gpg 2.1 si possono rimuovere sottochiavi semplicemente cancellando file in @~/.gnupg/private-keys-v1.d/@; per scoprire quale file cancellare bisogna scoprire il _keygrip_ della chiave in questione: |
679 | 14 | Elena Grandi | |
680 | 14 | Elena Grandi | <pre> |
681 | 14 | Elena Grandi | $ gpg --with-keygrip --list-key 3E0EE5BAC50DF7C1 |
682 | 14 | Elena Grandi | pub rsa4096 2016-10-19 [SC] |
683 | 14 | Elena Grandi | 19DB75A75734ABBEDB1124163E0EE5BAC50DF7C1 |
684 | 14 | Elena Grandi | Keygrip = 3BC042D5749A498AA2F904CF548C6B5DEDDF0600 |
685 | 14 | Elena Grandi | uid [ultimate] Random User <random@example.org> |
686 | 14 | Elena Grandi | sub rsa4096 2016-10-19 [E] |
687 | 14 | Elena Grandi | Keygrip = 0B2A484CBE52875A07F377A1A87F229C60277642 |
688 | 14 | Elena Grandi | sub rsa2048 2016-10-19 [S] [expires: 2017-10-19] |
689 | 14 | Elena Grandi | Keygrip = AD155C5349ECE4D3725AD77269EC9E696A8191E9 |
690 | 14 | Elena Grandi | sub rsa2048 2016-10-19 [E] [expires: 2017-10-19] |
691 | 14 | Elena Grandi | Keygrip = BFADD9EEDA2E38A77DCF925E58FFD4FFA2F50B7C |
692 | 14 | Elena Grandi | sub rsa2048 2016-10-19 [A] [expires: 2017-10-19] |
693 | 14 | Elena Grandi | Keygrip = D9F3249B5F583B7B4099B80DCAB343A9BA440BA8 |
694 | 14 | Elena Grandi | </pre> |
695 | 14 | Elena Grandi | |
696 | 1 | Elena Grandi | A questo punto è sufficiente rimuovere il file corrispondente alla chiave principale: |
697 | 14 | Elena Grandi | |
698 | 14 | Elena Grandi | <pre> |
699 | 14 | Elena Grandi | $ rm ~/.gnupg/private-keys-v1.d/3BC042D5749A498AA2F904CF548C6B5DEDDF0600.key |
700 | 14 | Elena Grandi | </pre> |
701 | 14 | Elena Grandi | |
702 | 14 | Elena Grandi | E si può verificare che la chiave sia stata effettivamente rimossa: |
703 | 1 | Elena Grandi | |
704 | 1 | Elena Grandi | <pre> |
705 | 1 | Elena Grandi | $ gpg --list-secret-keys 3E0EE5BAC50DF7C1 |
706 | 14 | Elena Grandi | sec# rsa4096 2016-10-19 [SC] |
707 | 14 | Elena Grandi | 19DB75A75734ABBEDB1124163E0EE5BAC50DF7C1 |
708 | 14 | Elena Grandi | uid [ultimate] Random User <random@example.org> |
709 | 14 | Elena Grandi | ssb rsa4096 2016-10-19 [E] |
710 | 14 | Elena Grandi | ssb> rsa2048 2016-10-19 [S] [expires: 2017-10-19] |
711 | 14 | Elena Grandi | ssb> rsa2048 2016-10-19 [E] [expires: 2017-10-19] |
712 | 14 | Elena Grandi | ssb> rsa2048 2016-10-19 [A] [expires: 2017-10-19] |
713 | 14 | Elena Grandi | </pre> |
714 | 14 | Elena Grandi | |
715 | 14 | Elena Grandi | dove @#@ dopo @sec@ indica che la chiave segreta non è presente sulla macchina in questione. |
716 | 14 | Elena Grandi | |
717 | 22 | Simone Piccardi | h2. Configurazione di ssh |
718 | 6 | Elena Grandi | |
719 | 15 | Elena Grandi | Per abilitare l'autenticazione ssh tramite chiave, aggiungere la seguente riga al file @~/.gnupg/gpg-agent.conf@: |
720 | 15 | Elena Grandi | |
721 | 15 | Elena Grandi | <pre> |
722 | 15 | Elena Grandi | enable-ssh-support |
723 | 15 | Elena Grandi | </pre> |
724 | 15 | Elena Grandi | |
725 | 24 | Elena Grandi | Con una versione sufficientemente recente di gpg questo è sufficiente per far sì che le connessioni SSH usino la chiave gpg per l'autenticazione. |
726 | 1 | Elena Grandi | |
727 | 24 | Elena Grandi | Alla prima connessione ssh verso un server sul quale possiamo identificarci tramite chiave verrà lanciato il gpg-agent che a sua volta lancerà un pinentry per chiedere il pin che abbiamo impostato sulla card. |
728 | 24 | Elena Grandi | |
729 | 25 | Elena Grandi | !https://labs.truelite.it/attachments/download/2503/pinentry.png! |
730 | 25 | Elena Grandi | |
731 | 24 | Elena Grandi | Da quel momento in poi il pin verrà tenuto in memoria in modo sicuro, e sarà possibile collegarsi ai server senza digitare nuovamente password. |
732 | 24 | Elena Grandi | |
733 | 24 | Elena Grandi | Per far dimenticare il pin è sufficiente rimuovere la card dal lettore. |
734 | 24 | Elena Grandi | |
735 | 30 | Elena Grandi | h3. Agent forwarding |
736 | 30 | Elena Grandi | |
737 | 30 | Elena Grandi | Con versioni sufficientemente recenti di gnupg e openssh, l'agent forwarding si configura come se si stesse usando l'agent ssh, aggiungendo a @~/.ssh/config@ delle righe tipo: |
738 | 30 | Elena Grandi | <pre> |
739 | 30 | Elena Grandi | Host example.org |
740 | 30 | Elena Grandi | ForwardAgent yes |
741 | 30 | Elena Grandi | </pre> |
742 | 30 | Elena Grandi | per gli host per i quali si desidera abilitare il forwarding. |
743 | 30 | Elena Grandi | |
744 | 24 | Elena Grandi | h3. Troubleshooting |
745 | 24 | Elena Grandi | |
746 | 24 | Elena Grandi | Il funzionamento delle PGPCard per autenticazione è stato reso completamente automatico solo nelle versioni più recenti di gnupg e delle distribuzioni: su versioni precedenti (e.g. Debian jessie) potrebbe essere necessario intervenire manualmente. |
747 | 24 | Elena Grandi | |
748 | 22 | Simone Piccardi | Il caso di non funzionamento più comune è che il @gpg-agent@ non stia effettivamente girando: dato che generalmente è lanciato alla bisogna da GnuPG, è sufficiente usare un comando @gpg@, ad esempio @gpg --card-status@ e da quel momento in poi l'agent sarà disponibile per @ssh@. |
749 | 15 | Elena Grandi | |
750 | 29 | Elena Grandi | Un secondo caso di non funzionamento potrebbe essere dovuto alla presenza di un altro agent per @ssh@: da Debian stretch in poi questo non dovrebbe essere presente, ma vecchie versioni o altre distribuzioni potrebbero lanciarlo ad esempio tramite degli script in @/etc/X11/Xsession.d@ (in Debian @90x11-common_ssh-agent@, da disattivare. |
751 | 1 | Elena Grandi | |
752 | 29 | Elena Grandi | Un'ulteriore causa di problemi possono essere le vecchie versioni di @gnome-keyring-daemon@ che cercano di sostituirsi all'agent, senza però implementarne tutte le funzionalità: in questo caso per permettere a @gpg-agent@ di fare il suo lavoro è necessario disabilitarlo ad esempio modificando @/etc/xdg/autostart/gnome-keyring-ssh.desktop@ e @/etc/xdg/autostart/gnome-keyring-gpg.desktop@ e sostituendo una riga tipo: |
753 | 29 | Elena Grandi | <pre> |
754 | 29 | Elena Grandi | OnlyShowIn=GNOME;Unity;MATE; |
755 | 29 | Elena Grandi | </pre> |
756 | 29 | Elena Grandi | con |
757 | 29 | Elena Grandi | <pre> |
758 | 29 | Elena Grandi | OnlyShowIn= |
759 | 29 | Elena Grandi | </pre> |
760 | 15 | Elena Grandi | |
761 | 16 | Elena Grandi | h2. Esportazione della chiave pubblica |
762 | 16 | Elena Grandi | |
763 | 17 | Elena Grandi | Adesso che tutto è funzionante, si può inviare la propria chiave pubblica sui keyserver: |
764 | 17 | Elena Grandi | |
765 | 17 | Elena Grandi | <pre> |
766 | 1 | Elena Grandi | $ gpg --send-keys 3E0EE5BAC50DF7C1 |
767 | 17 | Elena Grandi | gpg: sending key 3E0EE5BAC50DF7C1 to [server] |
768 | 17 | Elena Grandi | </pre> |
769 | 17 | Elena Grandi | |
770 | 17 | Elena Grandi | Nel caso non abbiate configurato un server in @~/.gnupg/dirmngr.conf@ (o in @~/.gnupg/gpg.conf@ ) lo si può specificare sulla riga di comando: |
771 | 1 | Elena Grandi | |
772 | 17 | Elena Grandi | <pre> |
773 | 17 | Elena Grandi | $ gpg --keyserver keys.gnupg.net --send-keys 3E0EE5BAC50DF7C1 |
774 | 17 | Elena Grandi | gpg: sending key 3E0EE5BAC50DF7C1 to hkp://keys.gnupg.net |
775 | 17 | Elena Grandi | </pre> |
776 | 17 | Elena Grandi | |
777 | 17 | Elena Grandi | Se la chiave non deve essere pubblica, è comunque necessario estrarne la parte pubblica da importare su altre macchine dove si vuole usare la Card: |
778 | 1 | Elena Grandi | |
779 | 17 | Elena Grandi | <pre> |
780 | 17 | Elena Grandi | gpg --armour --export 3E0EE5BAC50DF7C1 > 3E0EE5BAC50DF7C1.asc |
781 | 17 | Elena Grandi | </pre> |
782 | 23 | Simone Piccardi | |
783 | 17 | Elena Grandi | |
784 | 16 | Elena Grandi | h2. Configurazione su una nuova macchina |
785 | 6 | Elena Grandi | |
786 | 18 | Elena Grandi | Per poter usare la Card si una macchina diversa è necessario far conoscere a GnuPG la chiave: innanzitutto importando la chiave pubblica: |
787 | 18 | Elena Grandi | |
788 | 18 | Elena Grandi | <pre> |
789 | 18 | Elena Grandi | gpg --recv-key 3E0EE5BAC50DF7C1 |
790 | 18 | Elena Grandi | </pre> |
791 | 18 | Elena Grandi | |
792 | 22 | Simone Piccardi | oppure: |
793 | 18 | Elena Grandi | |
794 | 18 | Elena Grandi | <pre> |
795 | 18 | Elena Grandi | gpg --import 3E0EE5BAC50DF7C1.asc |
796 | 18 | Elena Grandi | </pre> |
797 | 18 | Elena Grandi | |
798 | 22 | Simone Piccardi | e quindi far ricreare gli stub di chiavi dalle chiavi presenti sulla card, semplicemente con: |
799 | 18 | Elena Grandi | |
800 | 18 | Elena Grandi | <pre> |
801 | 18 | Elena Grandi | $ gpg --card-status |
802 | 18 | Elena Grandi | |
803 | 18 | Elena Grandi | Reader ...........: #### |
804 | 18 | Elena Grandi | Application ID ...: #### |
805 | 18 | Elena Grandi | Version ..........: 2.0 |
806 | 18 | Elena Grandi | Manufacturer .....: #### |
807 | 18 | Elena Grandi | Serial number ....: #### |
808 | 1 | Elena Grandi | Name of cardholder: [not set] |
809 | 1 | Elena Grandi | Language prefs ...: [not set] |
810 | 1 | Elena Grandi | Sex ..............: unspecified |
811 | 18 | Elena Grandi | URL of public key : [not set] |
812 | 18 | Elena Grandi | Login data .......: [not set] |
813 | 18 | Elena Grandi | Signature PIN ....: forced |
814 | 18 | Elena Grandi | Key attributes ...: rsa2048 rsa2048 rsa2048 |
815 | 18 | Elena Grandi | Max. PIN lengths .: 127 127 127 |
816 | 18 | Elena Grandi | PIN retry counter : 3 3 3 |
817 | 18 | Elena Grandi | Signature counter : 0 |
818 | 18 | Elena Grandi | Signature key ....: 2128 412C BC75 34F5 6305 9447 40A2 ADF0 FE9E 4620 |
819 | 18 | Elena Grandi | created ....: 2016-10-19 10:15:26 |
820 | 18 | Elena Grandi | Encryption key....: 0B24 9C62 4A7D 19FE 7AB9 DCB3 ED9B BD7B 3BFF 900F |
821 | 18 | Elena Grandi | created ....: 2016-10-19 10:17:57 |
822 | 18 | Elena Grandi | Authentication key: 40E1 AE4A 7C13 FD8C C6EA 2C56 5F89 B668 295A E797 |
823 | 18 | Elena Grandi | created ....: 2016-10-19 10:24:14 |
824 | 18 | Elena Grandi | General key info..: sub rsa2048/40A2ADF0FE9E4620 2016-10-19 Random User <random@example.org> |
825 | 18 | Elena Grandi | sec rsa4096/3E0EE5BAC50DF7C1 created: 2016-10-19 expires: never |
826 | 18 | Elena Grandi | ssb rsa4096/F303978FEBB6E995 created: 2016-10-19 expires: never |
827 | 18 | Elena Grandi | ssb> rsa2048/40A2ADF0FE9E4620 created: 2016-10-19 expires: 2017-10-19 |
828 | 18 | Elena Grandi | card-no: #### |
829 | 18 | Elena Grandi | ssb> rsa2048/ED9BBD7B3BFF900F created: 2016-10-19 expires: 2017-10-19 |
830 | 18 | Elena Grandi | card-no: #### |
831 | 18 | Elena Grandi | ssb> rsa2048/5F89B668295AE797 created: 2016-10-19 expires: 2017-10-19 |
832 | 18 | Elena Grandi | card-no: #### |
833 | 18 | Elena Grandi | </pre> |