Skip to content

Commit 67ee078

Browse files
committed
Simplify Split GPG-2
I came across the diataxis approach and used it to get a better understanding of this page. Additionnaly, I did this: * move instructions to edit a policy and to enable a service qube to the related pages * clean the structure of the server options and make them cross-referenceable using `:confval:` role
1 parent 1ce1534 commit 67ee078

File tree

2 files changed

+102
-118
lines changed

2 files changed

+102
-118
lines changed
-39.6 KB
Binary file not shown.

user/security-in-qubes/split-gpg-2.rst

Lines changed: 102 additions & 118 deletions
Original file line numberDiff line numberDiff line change
@@ -2,128 +2,76 @@
22
Split GPG-2
33
===========
44

5-
Split GPG-2 allows less trusted qubes to delegate GPG operations to another trusted qube (i.e. a network-isolated qube). The encryption, decryption and signing operations are handled by the trusted qube.
5+
Qubes OS allows you to split the management and usage of GPG keys. You can store your secret keys in one trusted qube and use them in another less trusted qube.
66

7-
With Split GPG-2, you can use the Thunderbird mail client in one qube, and hold your GPG secret keys in another qube. This way the compromise of your qube where Thunderbird is running does not allow the attacker to automatically also steal all your keys.
7+
This way the compromise of your less trusted qube does not allow the attacker to automatically also steal all your keys.
88

9-
.. figure:: /attachment/doc/split-gpg-diagram.png
10-
:alt:
11-
12-
Example of the Split GPG-2 architecture
13-
14-
In a qube called *work-email* (with a green level of trust), ``qubes-gpg-client`` pretends to be a standard ``/usr/bin/gpg`` to other apps, here with Thunderbird.
15-
16-
In the *work-email* qube, ``qubes-gpg-client`` is communicating with ``qubes-gpg-server`` located in the *work-gpg* qube (with a black level of trust). The communication is made through the ``qubes.Gpg2`` remote procedure call using the ``qrexec`` protocol.
9+
How-to split your GPG keys between two qubes
10+
--------------------------------------------
1711

18-
Inside the *work-gpg* qube, ``qubes-gpg-server`` has access to the GPG key, through ``/usr/bin/gpg``.
19-
20-
The following page will setup Split GPG-2 with two qubes:
21-
22-
* one qube holding the private keys, called **server-qube** (in the previous example, it is the role of *work-gpg*)
23-
* the other qube using the keys, called **client-qube** (in the previous example, it *work-email*, where Thunderbird is used)
24-
25-
Installation of Split GPG-2
26-
---------------------------
27-
28-
In the template(s) qube(s) used by *server-qube* and *client-qube*, install ``split-gpg2``:
29-
30-
* **with Fedora**:
31-
32-
.. code:: console
12+
The following how-to will setup Split GPG-2 with two qubes:
3313

34-
[root@fedora-template] # dnf install split-gpg2
14+
* one qube holding the private keys, called **server-qube**. This qube is offline and should be trusted.
15+
* the other qube using the keys, called **client-qube**. This qube doesn't have to be trusted as much as the server.
3516

36-
* **with Debian**:
17+
Each time you want to do something with a GPG key, the *client-qube* will delegate the operation to the *server-qube*. This qube will ask you to confirm the operation.
3718

38-
.. code:: console
19+
Install Split GPG-2
20+
^^^^^^^^^^^^^^^^^^^
3921

40-
[root@debian-template] # apt install split-gpg2
22+
In the template(s) qube(s) used by *server-qube* and *client-qube*, :ref:`install the split-gpg2 package <user/how-to-guides/how-to-install-software:installing software from default repositories>`.
4123

4224
.. note:: If you use a minimal template, make sure to install ``zenity``
4325

44-
Configuration of Split GPG-2
45-
----------------------------
46-
47-
Create a new policy in dom0
48-
^^^^^^^^^^^^^^^^^^^^^^^^^^^
26+
Create a policy for Split GPG-2
27+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4928

50-
**In dom0**, create or edit a RPC policy. Use either the *Qubes OS Policy Editor* program or the ``qubes-policy-editor`` command. You can call is :file:`{30-user-gpg2}.policy` or something else. Add a line like the following and make sure to replace :samp:`{client-qube}` and :samp:`{server-qube}` by the appropriate values.
29+
**In dom0**, :doc:`create or edit a RPC policy </user/how-to-guides/how-to-edit-a-policy>`. Add a line like the following and make sure to replace :samp:`{client-qube}` and :samp:`{server-qube}` by the appropriate values.
5130

5231
.. code:: text
5332
5433
qubes.Gpg2 + client-qube @default allow target=server-qube
5534
5635
Generate or import the secret keys in the server qube
57-
"""""""""""""""""""""""""""""""""""""""""""""""""""""
36+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
5837

59-
**In server-qube**:
38+
**In server-qube**, you have two options:
6039

61-
* generate your secret keys, like this:
40+
* either generate your secret keys, like this:
6241

6342
.. code:: console
6443
6544
[user@server-qube] $ gpg --gen-key
6645
67-
In that case, you have to export the public part of your keys and the "ownertrust" values in the client qube:
68-
69-
.. code:: console
70-
71-
[user@server-qube] $ gpg --export > public-keys-export
72-
[user@server-qube] $ gpg --export-ownertrust > ownertrust-export
73-
[user@server-qube] $ qvm-copy public-keys-export ownertrust-export
74-
75-
.. warning:: do not export the private keys !
76-
77-
* or import your secret keys, like the following example. Make sure to replace :file:`/path/to/my/{name-of-the-file}` by the path of the expected file:
46+
* or, if you want to use some old keys, previously generated in an other qube, import them and the ownertrust. Make sure to replace :file:`/home/user/QubesIncoming/{<SOME_OTHER_QUBE>}/{[...]}` by the path of the expected file:
7847

7948
.. code:: console
8049
81-
[user@server-qube] $ gpg --import /path/to/my/secret-keys-export
82-
[user@server-qube] $ gpg --import-ownertrust /path/to/my/ownertrust-export
83-
84-
Set up the client qube
85-
^^^^^^^^^^^^^^^^^^^^^^
86-
87-
The first step is to enable the ``split-gpg2-client`` service. There is two options to do it, with the client qube's settings or with the ``qvm-service`` command.
88-
89-
Enable ``split-gpg2-client`` with the qube's settings
90-
"""""""""""""""""""""""""""""""""""""""""""""""""""""
91-
92-
Follow these steps:
93-
94-
1. Open the *client-qube*'s settings
95-
2. Select the :guilabel:`Services` tab
96-
3. At the top, in :guilabel:`Select a service`, select :guilabel:`split-gpg2-client`
97-
4. Click on the :guilabel:`Add` button
98-
5. Click on :guilabel:`Apply` or :guilabel:`Ok` to validate
99-
100-
.. figure:: /attachment/split-gpg2/client-qube-settings.png
101-
:alt:
50+
[user@server-qube] $ gpg --import /home/user/QubesIncoming/<SOME_OTHER_QUBE>/secret-keys-export
51+
[user@server-qube] $ gpg --import-ownertrust /home/user/QubesIncoming/<SOME_OTHER_QUBE>/ownertrust-export
10252
103-
:guilabel:`split-gpg2-client` should be listed and the checkbox in front of this service should be checked.
104-
105-
Enable ``split-gpg2-client`` with ``qvm-service``
106-
"""""""""""""""""""""""""""""""""""""""""""""""""
107-
108-
Enable the service in the *client-qube*:
53+
In both situations, you have to export the public part of your keys and the "ownertrust" values in the client qube:
10954

11055
.. code:: console
11156
112-
[user@dom0] $ qvm-service client-qube split-gpg2-client on
57+
[user@server-qube] $ gpg --export > public-keys-export
58+
[user@server-qube] $ gpg --export-ownertrust > ownertrust-export
59+
[user@server-qube] $ qvm-copy public-keys-export ownertrust-export
11360
114-
To verify if this was done correctly type the following command and check that the output on the second line is ``on``:
61+
.. warning:: do not export the private keys !
11562

116-
.. code:: console
63+
Set up the *client qube*
64+
^^^^^^^^^^^^^^^^^^^^^^^^
11765

118-
[user@dom0] $ qvm-service client-qube split-gpg2-client
119-
on
66+
Enable ``split-gpg2-client`` service in *client qube*
67+
"""""""""""""""""""""""""""""""""""""""""""""""""""""
12068

121-
If *client-qube* is running, restart it.
69+
The first step is to :doc:`enable the qube service </user/how-to-guides/how-to-enable-a-service>` called ``split-gpg2-client``.
12270

12371
Import the public keys and ownertrust
124-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
72+
"""""""""""""""""""""""""""""""""""""
12573

126-
You have previously exported the public keys and the "ownertrust" values from *server-qube*. Now, you have to import them in the client qube. Replace the following paths by the correct values.
74+
If you have previously exported the public keys and the "ownertrust" values from *server-qube*. Now, you have to import them in the client qube. Replace the following paths by the correct values.
12775

12876
.. code:: console
12977
@@ -133,7 +81,7 @@ You have previously exported the public keys and the "ownertrust" values from *s
13381
Check that Split GPG-2 works
13482
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
13583

136-
This should be enough to have it running:
84+
You should be able to run ``gpg -K`` in the *client qube*:
13785

13886
.. code:: console
13987
@@ -146,24 +94,24 @@ This should be enough to have it running:
14694
ssb# rsa2048 2019-12-18 [E]
14795
14896
Troubleshooting
149-
---------------
97+
^^^^^^^^^^^^^^^
15098

15199
``gpg-agent`` only shows the "keygrip"
152-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
100+
""""""""""""""""""""""""""""""""""""""
153101

154102
If you have a passphrase on your keys and ``gpg-agent`` only shows the “keygrip” (something like the fingerprint of the private key) when asking for the passphrase, then make sure that you have imported the public key part in the server domain.
155103

156104
Subkeys vs primary keys
157-
^^^^^^^^^^^^^^^^^^^^^^^
105+
"""""""""""""""""""""""
158106

159107
Split GPG-2 only knows a hash of the data being signed. Therefore, it cannot differentiate between e.g. signatures of a piece of data or signatures of another key. This means that a client can use Split GPG-2 to sign other keys, which :doc:`split-gpg` did not allow.
160108

161109
To prevent this, Split GPG-2 creates a new GnuPG home directory and imports the secret subkeys (**not** the primary key!) to it. Clients will be able to use the secret parts of the subkeys, but not of the primary key. If your primary key is able to sign data and certify other keys, and your only subkey can only perform encryption, this means that all signing will fail. To make signing work again, generate a subkey that is capable of signing but **not** certification. Split GPG-2 does not generate this key for you, so you need to generate it yourself. If you want to generate a key in software, use the ``addkey`` command of ``gpg2 --edit-key``. If you want to generate a key on a smartcard or other hardware token, use ``addcardkey`` instead. You will need to import your public keys again.
162110

163-
Advanced usage
111+
Server options
164112
--------------
165113

166-
If you want change some server option copy :file:`/usr/share/doc/split-gpg2/examples/qubes-split-gpg2.conf.example` to :file:`/home/user/.config/qubes-split-gpg2/qubes-split-gpg2.conf` and change it as desired, it will take precedence over other loaded files, such as the drop-in configuration files with the suffix ``.conf`` in `/home/user/.config/qubes-split-gpg2/conf.d/`.
114+
If you want change some server option, copy :file:`/usr/share/doc/split-gpg2/examples/qubes-split-gpg2.conf.example` to :file:`/home/user/.config/qubes-split-gpg2/qubes-split-gpg2.conf` and change it as desired, it will take precedence over other loaded files, such as the drop-in configuration files with the suffix ``.conf`` in `/home/user/.config/qubes-split-gpg2/conf.d/`.
167115

168116
By setting up some values in the configuration file, you can change some parameters. The configurations files are INI files, you can set global options in the ``DEFAULT`` section, or provide some client specific options in their own :samp:`client:{QUBE_NAME}` section (where ``QUBE_NAME`` is the name of the client). The following configuration is an example where no qube is automatically accepted besides *personal* qube:
169117

@@ -175,52 +123,88 @@ By setting up some values in the configuration file, you can change some paramet
175123
[client:personal]
176124
autoaccept = yes
177125
178-
Automatically accept requests
179-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
126+
.. confval:: autoaccept
180127

181-
By default, all requests made to the *server-qube* need to be confirmed. If you already use a RPC policy to ask confirmation, you can tell Split GPG-2 to automatically accept all requests, always or during a period of time after a successful request. You have to put something like this in you configuration file:
128+
:type: text
129+
:default: ``no``
130+
:allowed values: ``no``, ``yes`` or any integer
182131

183-
.. code:: ini
132+
By default, all requests made to the *server-qube* need to be confirmed. You can tell Split GPG-2 to accept requests: never (``no``), always (``yes``) or during a period of time after a successful request. To accept all requests following a successful one during one minute, use a value of ``60`` seconds.
184133

185-
autoaccept = yes
134+
This option has two alternatives:
186135

187-
To accept all requests following a successful one during one minute (60 seconds), use this:
136+
.. confval:: pksign_autoaccept
188137

189-
.. code:: ini
138+
:type: boolean or integer
139+
:default: ``no``
140+
:allowed values: ``no``, ``yes`` or any integer
190141

191-
autoaccept = 60
142+
same as :confval:`autoaccept` but only for signing requests
192143

193-
This option has two alternatives:
144+
.. confval:: pkdecrypt_autoaccept
194145

195-
``pksign_autoaccept``
196-
same as ``autoaccept`` but only for signing requests
146+
:type: boolean or integer
147+
:default: ``no``
148+
:allowed values: ``no``, ``yes`` or any integer
197149

198-
``pkdecrypt_autoaccept``
199-
same as ``autoaccept`` but only for decrypt requests
150+
same as :confval:`autoaccept` but only for decrypt requests
200151

201-
Notifications
202-
^^^^^^^^^^^^^
152+
.. confval:: verbose_notifications
203153

204-
Setting ``verbose_notifications`` to ``yes`` will provide more notifications.
154+
:type: boolean
155+
:default: ``no``
156+
:allowed values: ``no`` or ``yes``
205157

206-
Edit GnuPG home
207-
^^^^^^^^^^^^^^^
158+
Setting ``verbose_notifications`` to ``yes`` will provide more notifications.
159+
160+
.. confval:: allow_keygen
161+
162+
:type: boolean
163+
:default: ``no``
164+
:allowed values: ``no`` or ``yes``
165+
166+
.. warning:: This feature is new and not much tested. Therefore it’s not security supported!
167+
168+
By setting :confval:`allow_keygen` to ``yes``, you can allow the client to generate new keys. Normal usage should not need this.
169+
170+
.. confval:: gnupghome
208171

209-
You can set up a different GnuPG home from the default :file:`/home/user/gpg-home`, using ``gnupghome``.
172+
:type: full path
173+
:default: empty
210174

211-
If you store different keys for different client qubes in the same server qube, you can isolate each GnuPG home, by setting ``isolated_gnupghome``. The value points at a directory where each client will get its own subdirectory. For example when this option is set to :file:`/home/user/gpg-home`, then the qube *personal* will use :file:`/home/user/gpg-home/{personal}` as GnuPG home.
175+
You can set up a different GnuPG home from the default :file:`/home/user/gpg-home`, using :confval:`gnupghome`.
212176

213-
If you do this, don't forget to use the option ``--gnupg-home`` or the environment variable ``GNUPGHOME`` when using ``gpg`` commands.
177+
.. confval:: isolated_gnupghome
214178

215-
Allow key generation
216-
^^^^^^^^^^^^^^^^^^^^
179+
:type: full path
180+
:default: empty
217181

218-
.. warning:: This feature is new and not much tested. Therefore it’s not security supported!
182+
If you store different keys for different client qubes in the same server qube, you can isolate each GnuPG home, by setting :confval:`isolated_gnupghome`. The value points at a directory where each client will get its own subdirectory. For example, when this option is set to :file:`/home/user/gpg-home`, then the qube *personal* will use :file:`/home/user/gpg-home/{personal}` as GnuPG home.
219183

220-
By setting ``allow_keygen = yes`` in ``qubes-split-gpg2.conf`` you can allow the client to generate new keys. Normal usage should not need this.
184+
If you do this, don't forget to use the option ``--gnupg-home`` or the environment variable ``GNUPGHOME`` when using :program:`gpg` commands.
221185

222-
Notes
223-
-----
186+
.. confval:: debug_log
187+
188+
:type: path
189+
:default: empty
190+
191+
Enable debug logging and set the debug log path.
192+
193+
.. warning:: This is for debugging purpose only, **everything will be logged** including potentially confidential data/keys/etc
194+
195+
Notes about Split GPG-2
196+
-----------------------
197+
198+
.. figure:: /attachment/doc/split-gpg-diagram.png
199+
:alt:
200+
201+
Example of the Split GPG-2 architecture
202+
203+
In a qube called *work-email* (with a green level of trust), ``qubes-gpg-client`` pretends to be a standard ``/usr/bin/gpg`` to other apps, here with Thunderbird.
204+
205+
In the *work-email* qube, ``qubes-gpg-client`` is communicating with ``qubes-gpg-server`` located in the *work-gpg* qube (with a black level of trust). The communication is made through the ``qubes.Gpg2`` remote procedure call using the ``qrexec`` protocol.
206+
207+
Inside the *work-gpg* qube, ``qubes-gpg-server`` has access to the GPG key, through ``/usr/bin/gpg``.
224208

225209
Using Split GPG-2 with Split GPG-1
226210
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -230,7 +214,7 @@ Using Split GPG-2 as the “backend” for :doc:`split-gpg` is known to work.
230214
Advanced usage: checking what is signed, etc.
231215
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
232216

233-
Similar to a smartcard, Split GPG-2 only tries to protect the private key. For advanced usages, consider if a specialized RPC service would be better. It could do things like checking what data is singed, detailed logging, exposing the encrypted content only to a VM without network, etc.
217+
Similar to a smartcard, Split GPG-2 only tries to protect the private key. For advanced usages, consider if a specialized RPC service would be better. It could do things like checking what data is signed, detailed logging, exposing the encrypted content only to a VM without network, etc.
234218

235219
Advantages of Split GPG vs. traditional GPG with a smart card
236220
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

0 commit comments

Comments
 (0)