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