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