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