openssl-rehash.pod 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. =pod
  2. =for comment
  3. Original text by James Westby, contributed under the OpenSSL license.
  4. =head1 NAME
  5. openssl-rehash, c_rehash - Create symbolic links to files named by the hash
  6. values
  7. =head1 SYNOPSIS
  8. B<openssl>
  9. B<rehash>
  10. [B<-h>]
  11. [B<-help>]
  12. [B<-old>]
  13. [B<-n>]
  14. [B<-v>]
  15. [I<directory>] ...
  16. B<c_rehash>
  17. [B<-h>]
  18. [B<-help>]
  19. [B<-old>]
  20. [B<-n>]
  21. [B<-v>]
  22. [I<directory>] ...
  23. =head1 DESCRIPTION
  24. On some platforms, this command isn't available, and the external
  25. script B<c_rehash> has to be used instead. They are functionally
  26. equivalent, except for minor differences noted below.
  27. B<openssl rehash> scans directories and calculates a hash value of
  28. each F<.pem>, F<.crt>, F<.cer>, or F<.crl>
  29. file in the specified directory list and creates symbolic links
  30. for each file, where the name of the link is the hash value.
  31. (If the platform does not support symbolic links, a copy is made.)
  32. This command is useful as many programs that use OpenSSL require
  33. directories to be set up like this in order to find certificates.
  34. If any directories are named on the command line, then those are
  35. processed in turn. If not, then the B<SSL_CERT_DIR> environment variable
  36. is consulted; this should be a colon-separated list of directories,
  37. like the Unix B<PATH> variable.
  38. If that is not set then the default directory (installation-specific
  39. but often F</usr/local/ssl/certs>) is processed.
  40. In order for a directory to be processed, the user must have write
  41. permissions on that directory, otherwise an error will be generated.
  42. The links created are of the form I<HHHHHHHH.D>, where each I<H>
  43. is a hexadecimal character and I<D> is a single decimal digit.
  44. When a directory is processed, all links in it that have a name
  45. in that syntax are first removed, even if they are being used for
  46. some other purpose.
  47. To skip the removal step, use the B<-n> flag.
  48. Hashes for CRL's look similar except the letter B<r> appears after
  49. the period, like this: I<HHHHHHHH.>B<r>I<D>.
  50. Multiple objects may have the same hash; they will be indicated by
  51. incrementing the I<D> value. Duplicates are found by comparing the
  52. full SHA-1 fingerprint. A warning will be displayed if a duplicate
  53. is found.
  54. A warning will also be displayed if there are files that
  55. cannot be parsed as either a certificate or a CRL or if
  56. more than one such object appears in the file.
  57. =head2 Script Configuration
  58. The B<c_rehash> script
  59. uses the B<openssl> program to compute the hashes and
  60. fingerprints. If not found in the user's B<PATH>, then set the
  61. B<OPENSSL> environment variable to the full pathname.
  62. Any program can be used, it will be invoked as follows for either
  63. a certificate or CRL:
  64. $OPENSSL x509 -hash -fingerprint -noout -in FILENAME
  65. $OPENSSL crl -hash -fingerprint -noout -in FILENAME
  66. where I<FILENAME> is the filename. It must output the hash of the
  67. file on the first line, and the fingerprint on the second,
  68. optionally prefixed with some text and an equals sign.
  69. =head1 OPTIONS
  70. =over 4
  71. =item B<-help> B<-h>
  72. Display a brief usage message.
  73. =item B<-old>
  74. Use old-style hashing (MD5, as opposed to SHA-1) for generating
  75. links to be used for releases before 1.0.0.
  76. Note that current versions will not use the old style.
  77. =item B<-n>
  78. Do not remove existing links.
  79. This is needed when keeping new and old-style links in the same directory.
  80. =item B<-compat>
  81. Generate links for both old-style (MD5) and new-style (SHA1) hashing.
  82. This allows releases before 1.0.0 to use these links along-side newer
  83. releases.
  84. =item B<-v>
  85. Print messages about old links removed and new links created.
  86. By default, this command only lists each directory as it is processed.
  87. =back
  88. =head1 ENVIRONMENT
  89. =over 4
  90. =item B<OPENSSL>
  91. The path to an executable to use to generate hashes and
  92. fingerprints (see above).
  93. =item B<SSL_CERT_DIR>
  94. Colon separated list of directories to operate on.
  95. Ignored if directories are listed on the command line.
  96. =back
  97. =head1 SEE ALSO
  98. L<openssl(1)>,
  99. L<openssl-crl(1)>,
  100. L<openssl-x509(1)>
  101. =head1 COPYRIGHT
  102. Copyright 2015-2019 The OpenSSL Project Authors. All Rights Reserved.
  103. Licensed under the Apache License 2.0 (the "License"). You may not use
  104. this file except in compliance with the License. You can obtain a copy
  105. in the file LICENSE in the source distribution or at
  106. L<https://www.openssl.org/source/license.html>.
  107. =cut