openssl-rehash.pod.in 4.3 KB

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