c_rehash.pod 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. =pod
  2. =for comment
  3. Original text by James Westby, contributed under the OpenSSL license.
  4. =head1 NAME
  5. c_rehash - Create symbolic links to files named by the hash values
  6. =head1 SYNOPSIS
  7. B<c_rehash>
  8. B<[-old]>
  9. B<[-h]>
  10. B<[-n]>
  11. B<[-v]>
  12. [ I<directory>...]
  13. =head1 DESCRIPTION
  14. B<c_rehash> scans directories and calculates a hash value of each
  15. C<.pem>, C<.crt>, C<.cer>, or C<.crl>
  16. file in the specified directory list and creates symbolic links
  17. for each file, where the name of the link is the hash value.
  18. (If the platform does not support symbolic links, a copy is made.)
  19. This utility is useful as many programs that use OpenSSL require
  20. directories to be set up like this in order to find certificates.
  21. If any directories are named on the command line, then those are
  22. processed in turn. If not, then the B<SSL_CERT_DIR> environment variable
  23. is consulted; this shold be a colon-separated list of directories,
  24. like the Unix B<PATH> variable.
  25. If that is not set then the default directory (installation-specific
  26. but often B</usr/local/ssl/certs>) is processed.
  27. In order for a directory to be processed, the user must have write
  28. permissions on that directory, otherwise it will be skipped.
  29. The links created are of the form C<HHHHHHHH.D>, where each B<H>
  30. is a hexadecimal character and B<D> is a single decimal digit.
  31. When processing a directory, B<c_rehash> will first remove all links
  32. that have a name in that syntax. If you have links in that format
  33. used for other purposes, they will be removed.
  34. To skip the removal step, use the B<-n> flag.
  35. Hashes for CRL's look similar except the letter B<r> appears after
  36. the period, like this: C<HHHHHHHH.rD>.
  37. Multiple objects may have the same hash; they will be indicated by
  38. incrementing the B<D> value. Duplicates are found by comparing the
  39. full SHA-1 fingerprint. A warning will be displayed if a duplicate
  40. is found.
  41. A warning will also be displayed if there are files that
  42. cannot be parsed as either a certificate or a CRL.
  43. The program uses the B<openssl> program to compute the hashes and
  44. fingerprints. If not found in the user's B<PATH>, then set the
  45. B<OPENSSL> environment variable to the full pathname.
  46. Any program can be used, it will be invoked as follows for either
  47. a certificate or CRL:
  48. $OPENSSL x509 -hash -fingerprint -noout -in FILENAME
  49. $OPENSSL crl -hash -fingerprint -noout -in FILENAME
  50. where B<FILENAME> is the filename. It must output the hash of the
  51. file on the first line, and the fingerprint on the second,
  52. optionally prefixed with some text and an equals sign.
  53. =head1 OPTIONS
  54. =over 4
  55. =item B<-old>
  56. Use old-style hashing (MD5, as opposed to SHA-1) for generating
  57. links for releases before 1.0.0. Note that current versions will
  58. not use the old style.
  59. =item B<-h>
  60. Display a brief usage message.
  61. =item B<-n>
  62. Do not remove existing links.
  63. This is needed when keeping new and old-style links in the same directory.
  64. =item B<-v>
  65. Print messages about old links removed and new links created.
  66. By default, B<c_rehash> only lists each directory as it is processed.
  67. =back
  68. =head1 ENVIRONMENT
  69. =over
  70. =item B<OPENSSL>
  71. The path to an executable to use to generate hashes and
  72. fingerprints (see above).
  73. =item B<SSL_CERT_DIR>
  74. Colon separated list of directories to operate on.
  75. Ignored if directories are listed on the command line.
  76. =back
  77. =head1 SEE ALSO
  78. L<openssl(1)|openssl(1)>,
  79. L<crl(1)|crl(1)>.
  80. L<x509(1)|x509(1)>.