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