rehash.pod 4.1 KB

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