~ubuntu-branches/ubuntu/natty/gnupg2/natty-security

« back to all changes in this revision

Viewing changes to doc/gpg-agent.texi

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Urlichs
  • Date: 2005-12-08 22:13:21 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20051208221321-4rvs2vu835iam5wv
Tags: 1.9.19-2
* Convert debian/changelog to UTF-8.
* Put gnupg-agent and gpgsm lintian overrides in the respectively
  right package.  Closes: #335066
* Added debhelper tokens to maintainer scripts.
* xsession fixes:
  o Added host name to gpg-agent PID file name.  Closes: #312717
  o Fixed xsession script to be able to run under zsh.  Closes: #308516
  o Don't run gpg-agent if one is already running.  Closes: #336480
* debian/control:
  o Fixed package description of gpgsm package.  Closes: #299842
  o Added mention of gpg-agent to description of gnupg-agent package.
    Closes: #304355
* Thanks to Peter Eisentraut <petere@debian.org> for all of the above.

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
@c man begin DESCRIPTION
12
12
 
13
13
@command{gpg-agent} is a daemon to manage secret (private) keys
14
 
independelty from any protocol.  It is used as a backend for
 
14
independently from any protocol.  It is used as a backend for
15
15
@command{gpg} and @command{gpgsm} as well as for a couple of other
16
16
utilities.
17
17
 
25
25
@noindent
26
26
If you don't use an X server, you can also put this into your regular
27
27
startup file @code{~/.profile} or @code{.bash_profile}.  It is best not
28
 
to run multiple instance of the @command{gpg-agent}, so you should make sure that
29
 
only is running:  @command{gpg-agent} uses an environment variable to inform
30
 
clients about the communication parameters. You can write the
31
 
content of this environment variable to a file so that you can test for
32
 
a running agent.  This short script may do the job:
 
28
to run multiple instance of the @command{gpg-agent}, so you should make
 
29
sure that only one is running: @command{gpg-agent} uses an environment
 
30
variable to inform clients about the communication parameters. You can
 
31
write the content of this environment variable to a file so that you can
 
32
test for a running agent.  This short script may do the job:
33
33
 
34
34
@smallexample
35
35
if test -f $HOME/.gpg-agent-info && \
43
43
@end smallexample
44
44
 
45
45
@noindent
 
46
Note that the new option @option{--write-env-file} may be used instead.
 
47
 
 
48
 
 
49
@noindent
46
50
You should always add the following lines to your @code{.bashrc} or
47
51
whatever initialization file is used for all shell invocations:
48
52
 
71
75
@menu
72
76
* Agent Commands::      List of all commands.
73
77
* Agent Options::       List of all options.
 
78
* Agent Configuration:: Configuration files.
74
79
* Agent Signals::       Use of some signals.
75
80
* Agent Examples::      Some usage examples.
76
81
* Agent Protocol::      The protocol the agent uses.
123
128
 
124
129
@table @gnupgtabopt
125
130
 
 
131
@anchor{option --options}
126
132
@item --options @var{file}
127
133
@opindex options
128
134
Reads configuration from @var{file} instead of from the default
130
136
@file{gpg-agent.conf} and expected in the @file{.gnupg} directory directly
131
137
below the home directory of the user.
132
138
 
 
139
@anchor{option --homedir}
133
140
@item --homedir @var{dir}
134
141
@opindex homedir
135
142
Set the name of the home directory to @var{dir}. If his option is not
240
247
environment variable @code{SHELL} which is in almost all cases
241
248
sufficient.
242
249
 
 
250
@item --write-env-file @var{file}
 
251
@opindex write-env-file
 
252
Often it is required to connect to the agent from a process not being an
 
253
inferior of @command{gpg-agent} and thus the environment variable with
 
254
the socket name is not available.  To help setting up those variables in
 
255
other sessions, this option may be used to write the information into
 
256
@var{file}.  If @var{file} is not specified the default name
 
257
@file{$@{HOME@}/.gpg-agent-info} will be used.  The format is suitable
 
258
to be evaluated by a Bourne shell like in this simple example:
 
259
 
 
260
@example
 
261
eval `cat @var{file}`
 
262
eval `cut -d= -f 1 < @var{file} | xargs echo export`
 
263
@end example
 
264
 
 
265
 
 
266
 
243
267
@item --no-grab
244
268
@opindex no-grab
245
269
Tell the pinentryo not to grab the keyboard and mouse.  This option
250
274
Append all logging output to @var{file}.  This is very helpful in
251
275
seeing what the agent actually does.
252
276
 
253
 
@item --disable-pth
254
 
@opindex disable-pth
255
 
Don't allow multiple connections.  This option is in general not very
256
 
useful. 
257
 
 
 
277
@anchor{option --allow-mark-trusted}
258
278
@item --allow-mark-trusted
259
279
@opindex allow-mark-trusted
260
280
Allow clients to mark keys as trusted, i.e. put them into the
261
 
@code{trustlist.txt} file.  This is by default not allowed to make it
 
281
@file{trustlist.txt} file.  This is by default not allowed to make it
262
282
harder for users to inadvertly accept Root-CA keys.
263
283
 
264
284
@item --ignore-cache-for-signing
272
292
Set the time a cache entry is valid to @var{n} seconds.  The default are
273
293
600 seconds.
274
294
 
 
295
@item --default-cache-ttl-ssh @var{n}
 
296
@opindex default-cache-ttl
 
297
Set the time a cache entry used for SSH keys is valid to @var{n}
 
298
seconds.  The default are 1800 seconds.
 
299
 
275
300
@item --max-cache-ttl @var{n}
276
301
@opindex max-cache-ttl
277
302
Set the maximum time a cache entry is valid to @var{n} seconds.  After
278
303
this time a cache entry will get expired even if it has been accessed
279
304
recently.  The default are 2 hours (7200 seconds).
280
305
 
 
306
@item --max-cache-ttl-ssh @var{n}
 
307
@opindex max-cache-ttl-ssh
 
308
Set the maximum time a cache entry used for SSH keys is valid to @var{n}
 
309
seconds.  After this time a cache entry will get expired even if it has
 
310
been accessed recently.  The default are 2 hours (7200 seconds).
 
311
 
281
312
@item --pinentry-program @var{filename}
282
313
@opindex pinentry-program
283
314
Use program @var{filename} as the PIN entry.  The default is installation
289
320
installation dependend and can be shown with the @code{--version}
290
321
command.
291
322
 
 
323
@item --disable-scdaemon
 
324
@opindex disable-scdaemon
 
325
Do not make use of the scdaemon tool.  This option has the effect of
 
326
disabling the ability to do smartcard operations.  Note, that enabling
 
327
this option at runtime does not kill an already forked scdaemon.
 
328
 
292
329
@item --use-standard-socket
293
330
@itemx --no-use-standard-socket
294
331
@opindex use-standard-socket
326
363
window system's @code{DISPLAY} variable.  This is useful to lock the
327
364
pinentry to pop up at the @sc{tty} or display you started the agent.
328
365
 
 
366
@anchor{option --enable-ssh-support}
 
367
@item --enable-ssh-support
 
368
@opindex enable-ssh-support
 
369
 
 
370
Enable emulation of the OpenSSH Agent protocol.
 
371
 
 
372
In this mode of operation, the agent does not only implement the
 
373
gpg-agent protocol, but also the agent protocol used by OpenSSH
 
374
(through a seperate socket).  Consequently, it should possible to use
 
375
the gpg-agent as a drop-in replacement for the well known ssh-agent.
 
376
 
 
377
SSH Keys, which are to be used through the agent, need to be added to
 
378
the gpg-agent initially through the ssh-add utility.  When a key is
 
379
added, ssh-add will ask for the password of the provided key file and
 
380
send the unprotected key material to the agent; this causes the
 
381
gpg-agent to ask for a passphrase, which is to be used for encrypting
 
382
the newly received key and storing it in a gpg-agent specific
 
383
directory.
 
384
 
 
385
Once, a key has been added to the gpg-agent this way, the gpg-agent
 
386
will be ready to use the key.
 
387
 
 
388
Note: in case the gpg-agent receives a signature request, the user might
 
389
need to be prompted for a passphrase, which is necessary for decrypting
 
390
the stored key.  Since the ssh-agent protocol does not contain a
 
391
mechanism for telling the agent on which display/terminal it is running,
 
392
gpg-agent's ssh-support will use the TTY or X display where gpg-agent
 
393
has been started.  To switch this display to the current one, the
 
394
follwing command may be used:
 
395
 
 
396
@smallexample
 
397
echo UPDATESTARTUPTTY | gpg-connect-agent
 
398
@end smallexample
 
399
 
 
400
 
329
401
 
330
402
@end table
331
403
 
332
404
All the long options may also be given in the configuration file after
333
405
stripping off the two leading dashes.
334
406
 
 
407
 
 
408
@c man begin FILES
 
409
 
 
410
@node Agent Configuration
 
411
@section Configuration
 
412
 
 
413
There are a few configuration files needed for the operation of the
 
414
agent. By default they may all be found in the current home directory
 
415
(@pxref{option --homedir}).
 
416
 
 
417
@table @file
 
418
 
 
419
@item gpg-agent.conf
 
420
@cindex gpg-agent.conf
 
421
  This is the standard configuration file read by @command{gpg-agent} on
 
422
  startup.  It may contain any valid long option; the leading
 
423
  two dashes may not be entered and the option may not be abbreviated.
 
424
  This file is also read after a @code{SIGHUP} however only a few
 
425
  options will actually have an effect.  This default name may be
 
426
  changed on the command line (@pxref{option --options}).
 
427
 
 
428
@item trustlist.txt
 
429
  This is the list of trusted keys.  Comment lines, indicated by a leading
 
430
  hash mark, as well as empty lines are ignored.  To mark a key as trusted
 
431
  you need to enter its fingerprint followed by a space and a capital
 
432
  letter @code{S}.  Colons may optionally be used to separate the bytes of
 
433
  a fingerprint; this allows to cut and paste the fingeperint from a key
 
434
  listing output.
 
435
  
 
436
  Here is an example where two keys are marked as ultimately trusted:
 
437
  
 
438
  @example
 
439
  # CN=Wurzel ZS 3,O=Intevation GmbH,C=DE
 
440
  A6935DD34EF3087973C706FC311AA2CCF733765B S
 
441
  
 
442
  # CN=PCA-1-Verwaltung-02/O=PKI-1-Verwaltung/C=DE
 
443
  DC:BD:69:25:48:BD:BB:7E:31:6E:BB:80:D3:00:80:35:D4:F8:A6:CD S 
 
444
  @end example
 
445
  
 
446
  Before entering a key into this file, you need to ensure its
 
447
  authenticity.  How to do this depends on your organisation; your
 
448
  administrator might have already entered those keys which are deemed
 
449
  trustworthy enough into this file.  Places where to look for the
 
450
  fingerprint of a root certificate are letters received from the CA or
 
451
  the website of the CA (after making 100% sure that this is indeed the
 
452
  website of that CA).  You may want to consider allowing interactive
 
453
  updates of this file by using the @xref{option --allow-mark-trusted}.
 
454
  This is however not as secure as maintaining this file manually.  It is
 
455
  even advisable to change the permissions to read-only so that this file
 
456
  can't be changed inadvertently.
 
457
  
 
458
  @item sshcontrol
 
459
 
 
460
  This file is used when support for the secure shell agent protocol has
 
461
  been enabled (@pxref{option --enable-ssh-support}). Only keys present in
 
462
  this file are used in the SSH protocol.  The @command{ssh-add} tool y be
 
463
  used to add new entries to this file; you may also add them manually.
 
464
  Comment lines, indicated by a leading hash mark, as well as empty lines
 
465
  are ignored.  An entry starts with optional white spaces, followed by
 
466
  the keygrip of the key given as 40 hex digits, optionally followed by
 
467
  the caching TTL in seconds and another optional field for arbitrary
 
468
  flags.  A @code{!} may be prepended to the keygrip to disable this
 
469
  entry.
 
470
    
 
471
  The follwoing example lists exactly one key.  Note that keys available
 
472
  through a OpenPGP smartcard in the active smartcard reader are implictly
 
473
  added to this list; i.e. there is no need to list them.
 
474
  
 
475
  @example
 
476
  # Key added on 2005-02-25 15:08:29
 
477
  5A6592BF45DC73BD876874A28FD4639282E29B52 0
 
478
  @end example
 
479
@end table
 
480
 
 
481
Note that on larger installations, it is useful to put predefined
 
482
files into the directory @file{/etc/skel/.gnupg/} so that newly created
 
483
users start up with a working configuration.  For existing users the
 
484
a small helper script is provied to create these files (@pxref{addgnupghome}).
 
485
 
 
486
 
 
487
 
335
488
@c
336
489
@c Agent Signals
337
490
@c
346
499
 
347
500
@item SIGHUP
348
501
@cpindex SIGHUP
349
 
This signals flushes all chached passphrases and when the program was
 
502
This signal flushes all chached passphrases and if the program has been
350
503
started with a configuration file, the configuration file is read again.
351
504
Only certain options are honored: @code{quiet}, @code{verbose},
352
 
@code{debug}, @code{debug-all}, @code{no-grab}, @code{pinentry-program},
353
 
@code{default-cache-ttl} and @code{ignore-cache-for-signing}.
354
 
@code{scdaemon-program} is also supported but due to the current
355
 
implementation, which calls the scdaemon only once, it is not of much
356
 
use.
 
505
@code{debug}, @code{debug-all}, @code{debug-level}, @code{no-grab},
 
506
@code{pinentry-program}, @code{default-cache-ttl}, @code{max-cache-ttl},
 
507
@code{ignore-cache-for-signing}, @code{allow-mark-trusted} and
 
508
@code{disable-scdaemon}.  @code{scdaemon-program} is also supported but
 
509
due to the current implementation, which calls the scdaemon only once,
 
510
it is not of much use unless you manually kill the scdaemon.
357
511
 
358
512
 
359
513
@item SIGTERM
366
520
@cpindex SIGINT
367
521
Shuts down the process immediately.
368
522
 
369
 
 
370
523
@item SIGUSR1
371
 
@itemx SIGUSR2
372
524
@cpindex SIGUSR1
 
525
Dump internal information to the log file.
 
526
 
 
527
@item SIGUSR2
373
528
@cpindex SIGUSR2
374
 
These signals are used for internal purposes.
 
529
This signal is used for internal purposes.
375
530
 
376
531
@end table
377
532
 
383
538
 
384
539
@c man begin EXAMPLES
385
540
 
 
541
The usual way to invoke @command{gpg-agent} is
 
542
 
386
543
@example
387
544
$ eval `gpg-agent --daemon`
388
545
@end example
389
546
 
390
547
@c man end
391
548
 
 
549
An alternative way is by replacing @command{ssh-agent} with
 
550
@command{gpg-agent}.  If for example @command{ssh-agent} is started as
 
551
part of the Xsession intialization you may simply replace
 
552
@command{ssh-agent} by a script like:
 
553
 
 
554
@cartouche
 
555
@example
 
556
#!/bin/sh
 
557
 
 
558
exec /usr/local/bin/gpg-agent --enable-ssh-support --daemon \
 
559
      --write-env-file $@{HOME@}/.gpg-agent-info "$@@"
 
560
@end example
 
561
@end cartouche
 
562
 
 
563
@noindent
 
564
and add something like (for Bourne shells)
 
565
 
 
566
@cartouche
 
567
@example
 
568
  if [ -f "$@{HOME@}/.gpg-agent-info" ]; then
 
569
    . "$@{HOME@}/.gpg-agent-info"
 
570
    export GPG_AGENT_INFO
 
571
    export SSH_AUTH_SOCK
 
572
    export SSH_AGENT_PID
 
573
  fi
 
574
@end example
 
575
@end cartouche
 
576
 
 
577
@noindent
 
578
to your shell initialization file (e.g. @file{~/.bashrc}).
392
579
 
393
580
@c 
394
581
@c  Assuan Protocol
396
583
@node Agent Protocol
397
584
@section Agent's Assuan Protocol
398
585
 
 
586
Note: this section does only document the protocol, which is used by
 
587
GnuPG components; it does not deal with the ssh-agent protocol.
 
588
 
399
589
The @command{gpg-agent} should be started by the login shell and set an
400
590
environment variable to tell clients about the socket to be used.
401
591
Clients should deny to access an agent with a socket name which does
426
616
* Agent HAVEKEY::         Check whether a key is available
427
617
* Agent LEARN::           Register a smartcard
428
618
* Agent PASSWD::          Change a Passphrase
 
619
* Agent UPDATESTARTUPTTY:: Change the Standard Display
429
620
@end menu
430
621
 
431
622
@node Agent PKDECRYPT
826
1017
indentified by the hex string @var{keygrip}.
827
1018
 
828
1019
 
 
1020
@node Agent UPDATESTARTUPTTY
 
1021
@subsection Change the standard display
 
1022
 
 
1023
@example
 
1024
  UPDATESTARTUPTTY
 
1025
@end example
 
1026
 
 
1027
Set the startup TTY and X-DISPLAY variables to the values of this
 
1028
session.  This command is useful to direct future pinentry invocations
 
1029
to another screen.  It is only required because there is no way in the
 
1030
ssh-agent protocol to convey this information.
 
1031
 
829
1032