]> git.sur5r.net Git - bacula/docs/blob - docs/manuals/fr/main/dataencryption.tex
Setup fr/console
[bacula/docs] / docs / manuals / fr / main / dataencryption.tex
1
2 \chapter{Data Encryption}
3 \label{DataEncryption}
4 \index[general]{Data Encryption}
5 \index[general]{Encryption!Data}
6 \index[general]{Data Encryption}
7
8 Bacula permits file data encryption and signing within the File Daemon (or
9 Client) prior to sending data to the Storage Daemon.  Upon restoration,
10 file signatures are validated and any mismatches are reported.  At no time
11 does the Director or the Storage Daemon have access to unencrypted file
12 contents.
13
14
15 It is very important to specify what this implementation does NOT
16 do:
17 \begin{itemize}
18 \item There is one important restore problem to be aware of, namely, it's
19   possible for the director to restore new keys or a Bacula configuration
20   file to the client, and thus force later backups to be made with a
21   compromised key and/or with no encryption at all.  You can avoid this by
22   not changing the location of the keys in your Bacula File daemon
23   configuration file, and not changing your File daemon keys.  If you do
24   change either one, you must ensure that no restore is done that restores
25   the old configuration or the old keys.  In general, the worst effect of
26   this will be that you can no longer connect the File daemon.
27
28 \item The implementation does not encrypt file metadata such as file path
29   names, permissions, and ownership. Extended attributes are also currently
30   not encrypted. However, Mac OS X resource forks are encrypted.
31 \end{itemize}
32
33 Encryption and signing are implemented using RSA private keys coupled with
34 self-signed x509 public certificates. This is also sometimes known as PKI
35 or Public Key Infrastructure. 
36
37 Each File Daemon should be given its own unique private/public key pair.
38 In addition to this key pair, any number of "Master Keys" may be specified
39 -- these are key pairs that may be used to decrypt any backups should the
40 File Daemon key be lost.  Only the Master Key's public certificate should
41 be made available to the File Daemon.  Under no circumstances should the
42 Master Private Key be shared or stored on the Client machine.
43
44 The Master Keys should be backed up to a secure location, such as a CD
45 placed in a in a fire-proof safe or bank safety deposit box. The Master
46 Keys should never be kept on the same machine as the Storage Daemon or
47 Director if you are worried about an unauthorized party compromising either
48 machine and accessing your encrypted backups.
49
50 While less critical than the Master Keys, File Daemon Keys are also a prime
51 candidate for off-site backups; burn the key pair to a CD and send the CD
52 home with the owner of the machine.
53
54 NOTE!!! If you lose your encryption keys, backups will be unrecoverable.
55 {\bf ALWAYS} store a copy of your master keys in a secure, off-site location.
56
57 The basic algorithm used for each backup session (Job) is:
58 \begin{enumerate}
59 \item The File daemon generates a session key.
60 \item The FD encrypts that session key via PKE for all recipients (the file  
61 daemon, any master keys).
62 \item The FD uses that session key to perform symmetric encryption on the data.
63 \end{enumerate}
64
65
66 \section{Building Bacula with Encryption Support}
67 \index[general]{Building Bacula with Encryption Support}
68
69 The configuration option for enabling OpenSSL encryption support has not changed
70 since Bacula 1.38. To build Bacula with encryption support, you will need
71 the OpenSSL libraries and headers installed.  When configuring Bacula, use:
72
73 \begin{verbatim}
74    ./configure --with-openssl ...
75 \end{verbatim}
76
77 \section{Encryption Technical Details}
78 \index[general]{Encryption Technical Details}
79
80 The implementation uses 128bit AES-CBC, with RSA encrypted symmetric
81 session keys. The RSA key is user supplied.
82 If you are running OpenSSL 0.9.8 or later, the signed file hash uses
83 SHA-256 -- otherwise, SHA-1 is used.
84
85 End-user configuration settings for the algorithms are not currently
86 exposed -- only the algorithms listed above are used. However, the
87 data written to Volume supports arbitrary symmetric, asymmetric, and
88 digest algorithms for future extensibility, and the back-end
89 implementation currently supports:
90
91 \begin{verbatim}
92 Symmetric Encryption:
93     - 128, 192, and 256-bit AES-CBC
94     - Blowfish-CBC
95
96 Asymmetric Encryption (used to encrypt symmetric session keys):
97     - RSA
98
99 Digest Algorithms:
100     - MD5
101     - SHA1
102     - SHA256
103     - SHA512
104 \end{verbatim}
105
106 The various algorithms are exposed via an entirely re-usable,
107 OpenSSL-agnostic API (ie, it is possible to drop in a new encryption
108 backend). The Volume format is DER-encoded ASN.1, modeled after the
109 Cryptographic Message Syntax from RFC 3852. Unfortunately, using CMS
110 directly was not possible, as at the time of coding a free software
111 streaming DER decoder/encoder was not available.
112
113
114 \section{Decrypting with a Master Key}
115 \index[general]{Decrypting with a Master Key}
116
117 It is preferable to retain a secure, non-encrypted copy of the  
118 client's own encryption keypair. However, should you lose the  
119 client's keypair, recovery with the master keypair is possible.
120
121 You must:
122 \begin{itemize}
123 \item Concatenate the master private and public key into a single  
124    keypair file, ie:
125    cat master.key master.cert \gt master.keypair
126
127 \item Set the PKI Keypair statement in your bacula configuration file:
128
129 \begin{verbatim}
130    PKI Keypair = master.keypair
131 \end{verbatim}
132
133 \item Start the restore. The master keypair will be used to decrypt
134      the file data.
135  
136 \end{itemize}
137
138
139 \section{Generating Private/Public Encryption Keys}
140 \index[general]{Generating Private/Public Encryption Keypairs}
141
142 Generate a Master Key Pair with:
143
144 \footnotesize
145 \begin{verbatim}
146   openssl genrsa -out master.key 2048
147   openssl req -new -key master.key -x509 -out master.cert
148 \end{verbatim}
149 \normalsize
150
151 Generate  a File Daemon Key Pair for each FD:
152
153 \footnotesize
154 \begin{verbatim}
155   openssl genrsa -out fd-example.key 2048
156   openssl req -new -key fd-example.key -x509 -out fd-example.cert
157   cat fd-example.key fd-example.cert >fd-example.pem
158 \end{verbatim}
159 \normalsize
160
161 Note, there seems to be a lot of confusion around the file extensions given
162 to these keys.  For example, a .pem file can contain all the following:
163 private keys (RSA and DSA), public keys (RSA and DSA) and (x509) certificates. 
164 It is the default format for OpenSSL. It stores data Base64 encoded DER format,
165 surrounded by ASCII headers, so is suitable for text mode transfers between
166 systems. A .pem file may contain any number of keys either public or
167 private. We use it in cases where there is both a public and a private
168 key.
169
170 Typically, above we have used the .cert extension to refer to X509
171 certificate encoding that contains only a single public key.
172
173
174 \section{Example Data Encryption Configuration}
175 \index[general]{Example!File Daemon Configuration File}
176 \index[general]{Example!Data Encryption Configuration File}
177 \index[general]{Example Data Encryption Configuration}
178
179 {\bf bacula-fd.conf}
180 \footnotesize
181 \begin{verbatim}
182 FileDaemon {
183    Name = example-fd
184    FDport = 9102                  # where we listen for the director
185    WorkingDirectory = /var/bacula/working
186    Pid Directory = /var/run
187    Maximum Concurrent Jobs = 20
188  
189    PKI Signatures = Yes            # Enable Data Signing
190    PKI Encryption = Yes            # Enable Data Encryption
191    PKI Keypair = "/etc/bacula/fd-example.pem"    # Public and Private Keys
192    PKI Master Key = "/etc/bacula/master.cert"    # ONLY the Public Key
193 }
194 \end{verbatim}
195 \normalsize