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