| 1 | <?xml version="1.0" encoding="UTF-8"?> |
|---|
| 2 | <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" |
|---|
| 3 | "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd"> |
|---|
| 4 | <book> |
|---|
| 5 | <title>Box Backup Build and Installation Guide</title> |
|---|
| 6 | |
|---|
| 7 | <preface> |
|---|
| 8 | <title>License</title> |
|---|
| 9 | |
|---|
| 10 | <para>Copyright © 2003 - 2007, Ben Summers and contributors. |
|---|
| 11 | All rights reserved.</para> |
|---|
| 12 | |
|---|
| 13 | <para>Redistribution and use in source and binary forms, with or without |
|---|
| 14 | modification, are permitted provided that the following conditions are |
|---|
| 15 | met:</para> |
|---|
| 16 | |
|---|
| 17 | <itemizedlist> |
|---|
| 18 | <listitem> |
|---|
| 19 | <para>Redistributions of source code must retain the above copyright |
|---|
| 20 | notice, this list of conditions and the following disclaimer.</para> |
|---|
| 21 | </listitem> |
|---|
| 22 | |
|---|
| 23 | <listitem> |
|---|
| 24 | <para>Redistributions in binary form must reproduce the above |
|---|
| 25 | copyright notice, this list of conditions and the following disclaimer |
|---|
| 26 | in the documentation and/or other materials provided with the |
|---|
| 27 | distribution.</para> |
|---|
| 28 | </listitem> |
|---|
| 29 | |
|---|
| 30 | <listitem> |
|---|
| 31 | <para>All use of this software and associated advertising materials |
|---|
| 32 | must display the following acknowledgement: This product includes |
|---|
| 33 | software developed by Ben Summers.</para> |
|---|
| 34 | </listitem> |
|---|
| 35 | |
|---|
| 36 | <listitem> |
|---|
| 37 | <para>The names of the Authors may not be used to endorse or promote |
|---|
| 38 | products derived from this software without specific prior written |
|---|
| 39 | permission.</para> |
|---|
| 40 | </listitem> |
|---|
| 41 | </itemizedlist> |
|---|
| 42 | |
|---|
| 43 | |
|---|
| 44 | <para>[Where legally impermissible the Authors do not disclaim liability |
|---|
| 45 | for direct physical injury or death caused solely by defects in the |
|---|
| 46 | software unless it is modified by a third party.]</para> |
|---|
| 47 | |
|---|
| 48 | <para>THIS SOFTWARE IS PROVIDED BY THE AUTHORS "AS IS" AND ANY EXPRESS |
|---|
| 49 | OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
|---|
| 50 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
|---|
| 51 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR |
|---|
| 52 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
|---|
| 53 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
|---|
| 54 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
|---|
| 55 | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, |
|---|
| 56 | STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING |
|---|
| 57 | IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
|---|
| 58 | POSSIBILITY OF SUCH DAMAGE.</para> |
|---|
| 59 | </preface> |
|---|
| 60 | |
|---|
| 61 | <chapter> |
|---|
| 62 | <title>Introduction</title> |
|---|
| 63 | |
|---|
| 64 | <para>The backup daemon, bbackupd, runs on all machines to be backed up. |
|---|
| 65 | The store server daemon, bbstored runs on a central server. Data is sent |
|---|
| 66 | to the store server, which stores all data on local filesystems, that is, |
|---|
| 67 | only on local hard drives. Tape or other archive media is not used.</para> |
|---|
| 68 | |
|---|
| 69 | <para>The system is designed to be easy to set up and run, and cheap to |
|---|
| 70 | use. Once set up, there should be no need for user or administrative |
|---|
| 71 | intervention, apart from usual system maintenance.</para> |
|---|
| 72 | |
|---|
| 73 | <section> |
|---|
| 74 | <title>Client daemon</title> |
|---|
| 75 | |
|---|
| 76 | <para>bbackupd is configured with a list of directories to back up. It |
|---|
| 77 | has a lazy approach to backing up data. Every so often, the directories |
|---|
| 78 | are scanned, and new data is uploaded to the server. This new data must |
|---|
| 79 | be over a set age before it is uploaded. This prevents rapid revisions |
|---|
| 80 | of a file resulting in many uploads of the same file in a short period |
|---|
| 81 | of time.</para> |
|---|
| 82 | |
|---|
| 83 | <para>It can also operate in a snapshot mode, which behaves like |
|---|
| 84 | traditional backup software. When instructed by an external bbackupctl |
|---|
| 85 | program, it will upload all changed files to the server.</para> |
|---|
| 86 | |
|---|
| 87 | <para>The daemon is always running, although sleeping most of the time. |
|---|
| 88 | In lazy mode, it is completely self contained -- scripts running under |
|---|
| 89 | cron jobs are not used. The objective is to keep files backed up, not to |
|---|
| 90 | make snapshots of the filesystem at particular points in time |
|---|
| 91 | available.</para> |
|---|
| 92 | |
|---|
| 93 | <para>If an old version of the file is present on the server, a modified |
|---|
| 94 | version of the rsync algorithm is used to upload only the changed |
|---|
| 95 | portions of the file.</para> |
|---|
| 96 | |
|---|
| 97 | <para>After a new version is uploaded, the old version is still |
|---|
| 98 | available (subject to disc space on the server). Similarly, a deleted |
|---|
| 99 | file is still available. The only limit to their availability is space |
|---|
| 100 | allocated to this account on the server</para> |
|---|
| 101 | |
|---|
| 102 | <para>Future versions will add the ability to mark the current state of |
|---|
| 103 | files on the server, and restore from this mark. This will emulate the |
|---|
| 104 | changing of tapes in a tape backup system.</para> |
|---|
| 105 | |
|---|
| 106 | <section> |
|---|
| 107 | <title>Restoration</title> |
|---|
| 108 | |
|---|
| 109 | <para>Restoring files is performed using a query tool, bbackupquery. |
|---|
| 110 | This can be used to restore entire directories, or as an 'FTP-like' |
|---|
| 111 | tool to list and retrieve individual files. Old versions and deleted |
|---|
| 112 | files can be retrieved using this tool for as long as they are kept on |
|---|
| 113 | the server.</para> |
|---|
| 114 | </section> |
|---|
| 115 | |
|---|
| 116 | <section> |
|---|
| 117 | <title>Client Resource Usage</title> |
|---|
| 118 | |
|---|
| 119 | <para>bbackupd uses only a minimal amount of disc space to store |
|---|
| 120 | records on uploaded files -- less than 32 bytes per directory and file |
|---|
| 121 | over a set size threshold. However, it minimises the amount of queries |
|---|
| 122 | it must make to the server by storing, in memory, a data structure |
|---|
| 123 | which allows it to determine what data is new. It does not need to |
|---|
| 124 | store a record of all files, essentially just the directory names and |
|---|
| 125 | last modification times. This is not a huge amount of memory.</para> |
|---|
| 126 | |
|---|
| 127 | <para>If there are no changes to the directories, then the client will |
|---|
| 128 | not even connect to the server.</para> |
|---|
| 129 | </section> |
|---|
| 130 | </section> |
|---|
| 131 | |
|---|
| 132 | <section> |
|---|
| 133 | <title>Security</title> |
|---|
| 134 | |
|---|
| 135 | <para>Box Backup is designed to be secure in several ways. The data |
|---|
| 136 | stored on the backup store server is encrypted using secret-key |
|---|
| 137 | cryptography. Additionally, the transport layer is encrypted using TLS, |
|---|
| 138 | to ensure that the communications can't be snooped.</para> |
|---|
| 139 | |
|---|
| 140 | <section> |
|---|
| 141 | <title>Encryption</title> |
|---|
| 142 | |
|---|
| 143 | <para>The files, directories, filenames and file attributes are all |
|---|
| 144 | encrypted. By examining the stored files on the server, it is only |
|---|
| 145 | possible to determine the approximate sizes of a files and the tree |
|---|
| 146 | structure of the disc (not names, just number of files and |
|---|
| 147 | subdirectories in a directory). By monitoring the actions performed by |
|---|
| 148 | a client, it is possible to determine the frequency and approximate |
|---|
| 149 | scope of changes to files and directories.</para> |
|---|
| 150 | |
|---|
| 151 | <para>The connections between the server and client are encrypted |
|---|
| 152 | using TLS (latest version of SSL). Traffic analysis is possible to |
|---|
| 153 | some degree, but limited in usefulness.</para> |
|---|
| 154 | |
|---|
| 155 | <para>An attacker will not be able to recover the backed up data |
|---|
| 156 | without the encryption keys. Of course, you won't be able to recover |
|---|
| 157 | your files without the keys either, so you must make a conventional, |
|---|
| 158 | secure, backup of these keys.</para> |
|---|
| 159 | </section> |
|---|
| 160 | |
|---|
| 161 | <section> |
|---|
| 162 | <title>Authentication</title> |
|---|
| 163 | |
|---|
| 164 | <para>SSL certificates are used to authenticate clients. UNIX user |
|---|
| 165 | accounts are not used to minimise the dependence on the configuration |
|---|
| 166 | of the operating system hosting the server.</para> |
|---|
| 167 | |
|---|
| 168 | <para>A script is provided to run the necessary certification |
|---|
| 169 | authority with minimal effort.</para> |
|---|
| 170 | </section> |
|---|
| 171 | </section> |
|---|
| 172 | |
|---|
| 173 | <section> |
|---|
| 174 | <title>Server daemon</title> |
|---|
| 175 | |
|---|
| 176 | <para>The server daemon is designed to be simple to deploy, and run on |
|---|
| 177 | the cheapest hardware possible. To avoid the necessity to use expensive |
|---|
| 178 | hardware RAID or software RAID with complex setup, it (optionally) |
|---|
| 179 | stores files using RAID techniques.</para> |
|---|
| 180 | |
|---|
| 181 | <para>It does not need to run as a privileged user.</para> |
|---|
| 182 | |
|---|
| 183 | <para>Each account has a set amount of disc space allocated, with a soft |
|---|
| 184 | and a hard limit. If the account exceeds the soft limit, a housekeeping |
|---|
| 185 | process will start deleting old versions and deleted files to reduce the |
|---|
| 186 | space used to below the soft limit. If the backup client attempts to |
|---|
| 187 | upload a file which causes the store to exceed the hard limit, the |
|---|
| 188 | upload will be refused.</para> |
|---|
| 189 | </section> |
|---|
| 190 | </chapter> |
|---|
| 191 | |
|---|
| 192 | <chapter> |
|---|
| 193 | <title>Building and installing</title> |
|---|
| 194 | |
|---|
| 195 | <section> |
|---|
| 196 | <title>Before you start</title> |
|---|
| 197 | |
|---|
| 198 | <para>Firstly, check that all the clocks on your clients, servers and |
|---|
| 199 | signing machines are accurate and in sync. A disagreement in time |
|---|
| 200 | between a client and a server is the biggest cause of installation |
|---|
| 201 | difficulties, as the times in the generated certificates will cause |
|---|
| 202 | login failures if the start date is in the future.</para> |
|---|
| 203 | </section> |
|---|
| 204 | |
|---|
| 205 | <section> |
|---|
| 206 | <title>Box Backup compile</title> |
|---|
| 207 | |
|---|
| 208 | <para>In the following instructions, replace 0.00 with the actual |
|---|
| 209 | version number of the archive you have downloaded.</para> |
|---|
| 210 | |
|---|
| 211 | <para>For help building on Windows, see the <link linkend="AppB">Windows |
|---|
| 212 | Compile Appendix</link>. And if you want to build a Linux RPM, <link |
|---|
| 213 | linkend="AppC">look here</link>.</para> |
|---|
| 214 | |
|---|
| 215 | <para>You need the latest version of OpenSSL, as some of the extra APIs |
|---|
| 216 | it provides are required. You should have this anyway, as earlier |
|---|
| 217 | versions have security flaws. (If you have an earlier version installed, |
|---|
| 218 | the configuration script will give you instructions on enabling |
|---|
| 219 | experimental support for older versions.)</para> |
|---|
| 220 | |
|---|
| 221 | <para>See <link linkend="AppA">OpenSSL notes</link> for more information |
|---|
| 222 | on OpenSSL issues.</para> |
|---|
| 223 | |
|---|
| 224 | <para>There are some notes in the archive about compiling on various |
|---|
| 225 | platforms within the boxbackup-0.00 directory -- read them first. For |
|---|
| 226 | example, if you are compiling under Linux, look for LINUX.txt as |
|---|
| 227 | boxbackup-0.00/LINUX.txt after untaring the archive.</para> |
|---|
| 228 | |
|---|
| 229 | <para>Download the archive, then in that directory type</para> |
|---|
| 230 | |
|---|
| 231 | <programlisting>tar xvzf boxbackup-0.00.tgz |
|---|
| 232 | cd boxbackup-0.00 |
|---|
| 233 | ./configure |
|---|
| 234 | make</programlisting> |
|---|
| 235 | |
|---|
| 236 | <para>The server and client will be built and packaged up for |
|---|
| 237 | installation on this machine, or ready to be transferred as tar files to |
|---|
| 238 | another machine for installation.</para> |
|---|
| 239 | |
|---|
| 240 | <para>This builds two parcels of binaries and scripts, 'backup-client' |
|---|
| 241 | and 'backup-server'. The generated installation scripts assumes you want |
|---|
| 242 | everything installed in <emphasis |
|---|
| 243 | role="bold">/usr/local/bin</emphasis></para> |
|---|
| 244 | |
|---|
| 245 | <para>Optionally, type <emphasis role="bold">make test</emphasis> to run |
|---|
| 246 | all the tests.</para> |
|---|
| 247 | </section> |
|---|
| 248 | |
|---|
| 249 | <section> |
|---|
| 250 | <title>Local installation</title> |
|---|
| 251 | |
|---|
| 252 | <para>Type <emphasis role="bold">make install-backup-client</emphasis> |
|---|
| 253 | to install the backup client.</para> |
|---|
| 254 | |
|---|
| 255 | <para>Type <emphasis role="bold">make install-backup-server</emphasis> |
|---|
| 256 | to install the backup server.</para> |
|---|
| 257 | </section> |
|---|
| 258 | |
|---|
| 259 | <section> |
|---|
| 260 | <title>Remote installation</title> |
|---|
| 261 | |
|---|
| 262 | <para>In the parcels directory, there are tar files for each parcel. The |
|---|
| 263 | name reflects the version and platform you have built it for.</para> |
|---|
| 264 | |
|---|
| 265 | <para>Transfer this tar file to the remote server, and unpack it, then |
|---|
| 266 | run the install script. For example:</para> |
|---|
| 267 | |
|---|
| 268 | <programlisting>tar xvzf boxbackup-0.00-backup-server-OpenBSD.tgz |
|---|
| 269 | cd boxbackup-0.00-backup-server-OpenBSD |
|---|
| 270 | ./install-backup-server</programlisting> |
|---|
| 271 | </section> |
|---|
| 272 | |
|---|
| 273 | <section> |
|---|
| 274 | <title>Configure options</title> |
|---|
| 275 | |
|---|
| 276 | <para>You can use arguments to the configure script to adjust the |
|---|
| 277 | compile and link lines in the generated Makefiles, should this be |
|---|
| 278 | necessary for your platform. The configure script takes the usual GNU |
|---|
| 279 | autoconf arguments, a full list of which can be obtained with <emphasis |
|---|
| 280 | role="bold">--help</emphasis>. Additional options for Box Backup |
|---|
| 281 | include:</para> |
|---|
| 282 | |
|---|
| 283 | <informaltable> |
|---|
| 284 | <tgroup cols="2"> |
|---|
| 285 | <tbody> |
|---|
| 286 | <row> |
|---|
| 287 | <entry char="-">--enable-gnu-readline</entry> |
|---|
| 288 | |
|---|
| 289 | <entry>Use GNU readline if present. Linking Box Backup against |
|---|
| 290 | GNU readline may create licence implications if you then |
|---|
| 291 | distribute the binaries. libeditline is also supported as a safe |
|---|
| 292 | alternative, and is used by default if available.</entry> |
|---|
| 293 | </row> |
|---|
| 294 | |
|---|
| 295 | <row> |
|---|
| 296 | <entry>--disable-largefile</entry> |
|---|
| 297 | |
|---|
| 298 | <entry>Omit support for large files</entry> |
|---|
| 299 | </row> |
|---|
| 300 | |
|---|
| 301 | <row> |
|---|
| 302 | <entry>--with-bdb-lib=DIR</entry> |
|---|
| 303 | |
|---|
| 304 | <entry>Specify Berkeley DB library location</entry> |
|---|
| 305 | </row> |
|---|
| 306 | |
|---|
| 307 | <row> |
|---|
| 308 | <entry>--with-bdb-headers=DIR</entry> |
|---|
| 309 | |
|---|
| 310 | <entry>Specify Berkeley DB headers location</entry> |
|---|
| 311 | </row> |
|---|
| 312 | |
|---|
| 313 | <row> |
|---|
| 314 | <entry>--with-random=FILE</entry> |
|---|
| 315 | |
|---|
| 316 | <entry>Use FILE as random number seed (normally |
|---|
| 317 | auto-detected)</entry> |
|---|
| 318 | </row> |
|---|
| 319 | |
|---|
| 320 | <row> |
|---|
| 321 | <entry>--with-tmp-dir=DIR</entry> |
|---|
| 322 | |
|---|
| 323 | <entry>Directory for temporary files (normally /tmp)</entry> |
|---|
| 324 | </row> |
|---|
| 325 | </tbody> |
|---|
| 326 | </tgroup> |
|---|
| 327 | </informaltable> |
|---|
| 328 | |
|---|
| 329 | <para>See <link linkend="AppA">OpenSSL notes</link> for the OpenSSL |
|---|
| 330 | specific options.</para> |
|---|
| 331 | </section> |
|---|
| 332 | |
|---|
| 333 | <section> |
|---|
| 334 | <title>Tests</title> |
|---|
| 335 | |
|---|
| 336 | <para>There are a number of unit tests provided. To compile and run one |
|---|
| 337 | type:</para> |
|---|
| 338 | |
|---|
| 339 | <programlisting>./runtest.pl bbackupd release |
|---|
| 340 | ./runtest.pl common debug |
|---|
| 341 | ./runtest.pl ALL</programlisting> |
|---|
| 342 | |
|---|
| 343 | <para>The runtest.pl script will compile and run the test. The first |
|---|
| 344 | argument is the test name, and the second the type of build. Use ALL as |
|---|
| 345 | a test name to run all the tests.</para> |
|---|
| 346 | |
|---|
| 347 | <para>The output from the tests is slightly muddled using this script. |
|---|
| 348 | If you're developing, porting or trying out new things, it might be |
|---|
| 349 | better to use the following scheme:</para> |
|---|
| 350 | |
|---|
| 351 | <programlisting>cd test/bbackupd |
|---|
| 352 | make |
|---|
| 353 | cd ../../debug/test/bbackupd |
|---|
| 354 | ./t</programlisting> |
|---|
| 355 | |
|---|
| 356 | <para>or in release mode...</para> |
|---|
| 357 | |
|---|
| 358 | <programlisting>cd test/bbackupd |
|---|
| 359 | make -D RELEASE |
|---|
| 360 | cd ../../release/test/bbackupd |
|---|
| 361 | ./t</programlisting> |
|---|
| 362 | |
|---|
| 363 | <para>(use RELEASE=1 with GNU make)</para> |
|---|
| 364 | |
|---|
| 365 | <para>I tend to use two windows, one for compilation, and one for |
|---|
| 366 | running tests.</para> |
|---|
| 367 | </section> |
|---|
| 368 | </chapter> |
|---|
| 369 | |
|---|
| 370 | <appendix> |
|---|
| 371 | <title id="AppA">Box Backup and SSL</title> |
|---|
| 372 | |
|---|
| 373 | <section> |
|---|
| 374 | <title>General notes</title> |
|---|
| 375 | |
|---|
| 376 | <para>Ideally, you need to use version 0.9.7 or later of OpenSSL. If |
|---|
| 377 | this is installed on your system by default (and it is on most recent |
|---|
| 378 | releases of UNIX like OSes) then everything should just work.</para> |
|---|
| 379 | |
|---|
| 380 | <para>However, if it isn't, you have a few options.</para> |
|---|
| 381 | |
|---|
| 382 | <section> |
|---|
| 383 | <title>Upgrade your installation</title> |
|---|
| 384 | |
|---|
| 385 | <para>The best option is to upgrade your installation to use 0.9.7. |
|---|
| 386 | Hopefully your package manager will make this easy for you. This may |
|---|
| 387 | require reinstallation of lots of software which depends on OpenSSL, |
|---|
| 388 | so may not be ideal.</para> |
|---|
| 389 | |
|---|
| 390 | <para>(But as there have been a few security flaws in OpenSSL |
|---|
| 391 | recently, you probably want to upgrade it anyway.)</para> |
|---|
| 392 | </section> |
|---|
| 393 | |
|---|
| 394 | <section> |
|---|
| 395 | <title>Install another OpenSSL</title> |
|---|
| 396 | |
|---|
| 397 | <para>The second best option is to install another copy. If you |
|---|
| 398 | download and install from source, it will probably install into |
|---|
| 399 | /usr/local/ssl. You can then configure Box Backup to use it |
|---|
| 400 | using:</para> |
|---|
| 401 | |
|---|
| 402 | <programlisting>./configure --with-ssl-headers=/usr/local/ssl/include --with-ssl-lib=/usr/local/ssl/lib</programlisting> |
|---|
| 403 | |
|---|
| 404 | <para>which will set up the various includes and libraries for |
|---|
| 405 | you.</para> |
|---|
| 406 | |
|---|
| 407 | <para>The configuration scripts may be a problem, depending on your |
|---|
| 408 | installation. See below for more information.</para> |
|---|
| 409 | </section> |
|---|
| 410 | |
|---|
| 411 | <section> |
|---|
| 412 | <title>Use the old version of OpenSSL</title> |
|---|
| 413 | |
|---|
| 414 | <para>If you have an old version installed, the configuration script |
|---|
| 415 | will give you instructions on how to enable support for older |
|---|
| 416 | versions. Read the warnings, and please, whatever you do, don't |
|---|
| 417 | release binary packages or ports which enable this option.</para> |
|---|
| 418 | |
|---|
| 419 | <para>You may have issues with the configuration scripts, see |
|---|
| 420 | below.</para> |
|---|
| 421 | </section> |
|---|
| 422 | </section> |
|---|
| 423 | |
|---|
| 424 | <section> |
|---|
| 425 | <title>If you have problems with the config scripts</title> |
|---|
| 426 | |
|---|
| 427 | <para>If you get OpenSSL related errors with the configuration scripts, |
|---|
| 428 | there are two things to check:</para> |
|---|
| 429 | |
|---|
| 430 | <itemizedlist> |
|---|
| 431 | <listitem> |
|---|
| 432 | <para>The bin directory within your OpenSSL directory is in the path |
|---|
| 433 | (if you have installed another version)</para> |
|---|
| 434 | </listitem> |
|---|
| 435 | |
|---|
| 436 | <listitem> |
|---|
| 437 | <para>You have an openssl.cnf file which works and can be |
|---|
| 438 | found.</para> |
|---|
| 439 | </listitem> |
|---|
| 440 | </itemizedlist> |
|---|
| 441 | |
|---|
| 442 | <section> |
|---|
| 443 | <title>OpenSSL config file</title> |
|---|
| 444 | |
|---|
| 445 | <para>You need to have an openssl.cnf file. The default will generally |
|---|
| 446 | work well (see example at end). Make sure the openssl utility can find |
|---|
| 447 | it, either set the OPENSSL_CONF environment variable, or install it |
|---|
| 448 | into the location that is mentioned in the error messages.</para> |
|---|
| 449 | |
|---|
| 450 | <para>Example OpenSSL config file:</para> |
|---|
| 451 | |
|---|
| 452 | <programlisting id="openssl.cnf" xreflabel="openssl.cnf"># |
|---|
| 453 | # OpenSSL example configuration file. |
|---|
| 454 | # This is mostly being used for generation of certificate requests. |
|---|
| 455 | # |
|---|
| 456 | |
|---|
| 457 | RANDFILE = /dev/arandom |
|---|
| 458 | |
|---|
| 459 | #################################################################### |
|---|
| 460 | [ req ] |
|---|
| 461 | default_bits = 1024 |
|---|
| 462 | default_keyfile = privkey.pem |
|---|
| 463 | distinguished_name = req_distinguished_name |
|---|
| 464 | attributes = req_attributes |
|---|
| 465 | |
|---|
| 466 | [ req_distinguished_name ] |
|---|
| 467 | countryName = Country Name (2 letter code) |
|---|
| 468 | #countryName_default = AU |
|---|
| 469 | countryName_min = 2 |
|---|
| 470 | countryName_max = 2 |
|---|
| 471 | |
|---|
| 472 | stateOrProvinceName = State or Province Name (full name) |
|---|
| 473 | #stateOrProvinceName_default = Some-State |
|---|
| 474 | |
|---|
| 475 | localityName = Locality Name (eg, city) |
|---|
| 476 | |
|---|
| 477 | 0.organizationName = Organization Name (eg, company) |
|---|
| 478 | #0.organizationName_default = Internet Widgits Pty Ltd |
|---|
| 479 | |
|---|
| 480 | # we can do this but it is not needed normally :-) |
|---|
| 481 | #1.organizationName = Second Organization Name (eg, company) |
|---|
| 482 | #1.organizationName_default = CryptSoft Pty Ltd |
|---|
| 483 | |
|---|
| 484 | organizationalUnitName = Organizational Unit Name (eg, section) |
|---|
| 485 | #organizationalUnitName_default = |
|---|
| 486 | |
|---|
| 487 | commonName = Common Name (eg, fully qualified host name) |
|---|
| 488 | commonName_max = 64 |
|---|
| 489 | |
|---|
| 490 | emailAddress = Email Address |
|---|
| 491 | emailAddress_max = 64 |
|---|
| 492 | |
|---|
| 493 | [ req_attributes ] |
|---|
| 494 | challengePassword = A challenge password |
|---|
| 495 | challengePassword_min = 4 |
|---|
| 496 | challengePassword_max = 20 |
|---|
| 497 | |
|---|
| 498 | unstructuredName = An optional company name |
|---|
| 499 | |
|---|
| 500 | [ x509v3_extensions ] |
|---|
| 501 | |
|---|
| 502 | nsCaRevocationUrl = http://www.cryptsoft.com/ca-crl.pem |
|---|
| 503 | nsComment = "This is a comment" |
|---|
| 504 | |
|---|
| 505 | # under ASN.1, the 0 bit would be encoded as 80 |
|---|
| 506 | nsCertType = 0x40</programlisting> |
|---|
| 507 | </section> |
|---|
| 508 | </section> |
|---|
| 509 | </appendix> |
|---|
| 510 | |
|---|
| 511 | <appendix> |
|---|
| 512 | <title id="AppB">Compiling bbackupd on Windows using Visual C++</title> |
|---|
| 513 | |
|---|
| 514 | <para>This Appendix explains how to build the bbackupd daemon for Windows |
|---|
| 515 | using the Visual C++ compiler.</para> |
|---|
| 516 | |
|---|
| 517 | <para>If you have any problems following these instructions, please sign |
|---|
| 518 | up to the <ulink |
|---|
| 519 | url="http://lists.warhead.org.uk/mailman/listinfo/boxbackup">mailing |
|---|
| 520 | lis</ulink>t and report them to us, or send an email to <ulink |
|---|
| 521 | url="mailto:bbwiki@qwirx.com">Chris Wilson</ulink>. Thanks!</para> |
|---|
| 522 | |
|---|
| 523 | <para><emphasis role="bold">Note</emphasis>: bbstored will not be built |
|---|
| 524 | with this process. bbstored is not currently supported on Windows. There |
|---|
| 525 | are no plans for bbstored support on Windows.</para> |
|---|
| 526 | |
|---|
| 527 | <section> |
|---|
| 528 | <title>Tools</title> |
|---|
| 529 | |
|---|
| 530 | <para>You will need quite a bit of software to make this work. All of it |
|---|
| 531 | is available for free on the Internet, although Visual C++ Express has |
|---|
| 532 | license restrictions and a time limit.</para> |
|---|
| 533 | |
|---|
| 534 | <section> |
|---|
| 535 | <title>Visual C++</title> |
|---|
| 536 | |
|---|
| 537 | <para>Microsoft's Visual C++ compiler and development environment are |
|---|
| 538 | part of their commercial product <ulink |
|---|
| 539 | url="http://msdn.microsoft.com/vstudio/">Visual Studio</ulink>. Visual |
|---|
| 540 | Studio 2005 is supported, and 2003 should work as well.</para> |
|---|
| 541 | |
|---|
| 542 | <para>You can also <ulink |
|---|
| 543 | url="http://msdn.microsoft.com/vstudio/express/visualc/download/">download</ulink> |
|---|
| 544 | a free copy of Visual C++ 2005 Express. This copy must be registered |
|---|
| 545 | (activated) within 30 days, and is free for one year.</para> |
|---|
| 546 | |
|---|
| 547 | <para>You will need the <ulink |
|---|
| 548 | url="http://msdn.microsoft.com/vstudio/express/visualc/usingpsdk/">Platform |
|---|
| 549 | SDK</ulink> to allow you to compile Windows applications.</para> |
|---|
| 550 | </section> |
|---|
| 551 | |
|---|
| 552 | <section> |
|---|
| 553 | <title>Perl</title> |
|---|
| 554 | |
|---|
| 555 | <para>Download and install <ulink |
|---|
| 556 | url="http://www.activestate.com/Products/ActivePerl/">ActivePerl for |
|---|
| 557 | Windows</ulink>, which you can probably find <ulink |
|---|
| 558 | url="http://downloads.activestate.com/ActivePerl/Windows/5.6/ActivePerl-5.6.1.638-MSWin32-x86.msi">here</ulink>.</para> |
|---|
| 559 | </section> |
|---|
| 560 | |
|---|
| 561 | <section> |
|---|
| 562 | <title>Libraries</title> |
|---|
| 563 | |
|---|
| 564 | <para>You will need to download and install several libraries. They |
|---|
| 565 | must all be built in the same directory, to be able to link |
|---|
| 566 | properly.</para> |
|---|
| 567 | |
|---|
| 568 | <para>Choose a directory where you will unpack and compile OpenSSL, |
|---|
| 569 | Zlib and Box Backup. We will call this the base directory. An example |
|---|
| 570 | might be:</para> |
|---|
| 571 | |
|---|
| 572 | <programlisting>C:\Documents and Settings\Your Username\Desktop\Box</programlisting> |
|---|
| 573 | |
|---|
| 574 | <para>Make sure you know the full path to this directory.</para> |
|---|
| 575 | |
|---|
| 576 | <section> |
|---|
| 577 | <title>OpenSSL</title> |
|---|
| 578 | |
|---|
| 579 | <para>You will need to compile OpenSSL using Visual C++. The latest |
|---|
| 580 | release at this time, OpenSSL 0.9.8a, does not compile with Visual |
|---|
| 581 | C++ 2005 out of the box, so you need <ulink |
|---|
| 582 | url="http://www.boxbackup.org/svn/box/chris/win32/support/openssl-0.9.8a-vc2005.zip">a |
|---|
| 583 | patched version</ulink>. The <ulink |
|---|
| 584 | url="http://www.openssl.org/source/openssl-0.9.8a.tar.gz">original |
|---|
| 585 | source</ulink> and <ulink |
|---|
| 586 | url="http://www.boxbackup.org/svn/box/chris/win32/support/openssl-0.9.8a-win32fix.patch">patch</ulink> |
|---|
| 587 | are also available.</para> |
|---|
| 588 | |
|---|
| 589 | <para>To compile OpenSSL:</para> |
|---|
| 590 | |
|---|
| 591 | <itemizedlist> |
|---|
| 592 | <listitem> |
|---|
| 593 | <para>Use a Windows unzipper such as <ulink |
|---|
| 594 | url="http://www.winzip.com/">WinZip (free trial)</ulink> to |
|---|
| 595 | extract the <emphasis |
|---|
| 596 | role="bold">openssl-0.9.8a-vc2005.tar.gz</emphasis> archive, |
|---|
| 597 | which you just downloaded, into the base directory.</para> |
|---|
| 598 | </listitem> |
|---|
| 599 | |
|---|
| 600 | <listitem> |
|---|
| 601 | <para>Rename the folder from <emphasis |
|---|
| 602 | role="bold">openssl-0.9.8a-vc2005</emphasis> to <emphasis |
|---|
| 603 | role="bold">openssl</emphasis></para> |
|---|
| 604 | </listitem> |
|---|
| 605 | |
|---|
| 606 | <listitem> |
|---|
| 607 | <para>Open a command shell (run <emphasis |
|---|
| 608 | role="bold">cmd.exe</emphasis>) and <emphasis |
|---|
| 609 | role="bold">cd</emphasis> to the openssl directory</para> |
|---|
| 610 | </listitem> |
|---|
| 611 | |
|---|
| 612 | <listitem> |
|---|
| 613 | <para>Run the following commands:</para> |
|---|
| 614 | |
|---|
| 615 | <programlisting>perl Configure VC-WIN32 |
|---|
| 616 | ms\do_ms |
|---|
| 617 | "c:\program files\Microsoft Visual Studio 8\Common7\Tools\vsvars32.bat" |
|---|
| 618 | nmake -f ms\ntdll.mak</programlisting> |
|---|
| 619 | </listitem> |
|---|
| 620 | </itemizedlist> |
|---|
| 621 | </section> |
|---|
| 622 | |
|---|
| 623 | <section> |
|---|
| 624 | <title>Zlib</title> |
|---|
| 625 | |
|---|
| 626 | <para>You will need to download the <ulink |
|---|
| 627 | url="http://www.zlib.net/zlib123-dll.zip">Zlib compiled DLL</ulink>. |
|---|
| 628 | Create a directory called <emphasis role="bold">zlib</emphasis> in |
|---|
| 629 | the base directory, and unzip the file you just downloaded into that |
|---|
| 630 | directory. You don't need to compile anything.</para> |
|---|
| 631 | </section> |
|---|
| 632 | </section> |
|---|
| 633 | |
|---|
| 634 | <section> |
|---|
| 635 | <title>Download Box Backup</title> |
|---|
| 636 | |
|---|
| 637 | <para>The first version of Box Backup that's known to compile and with |
|---|
| 638 | Visual C++ 2005 is available on the <ulink |
|---|
| 639 | url="http://www.boxbackup.org/svn/box/chris/win32/vc2005-compile-fixes/">Subversion |
|---|
| 640 | server</ulink>. However, this version has not been extensively tested |
|---|
| 641 | and may be out of date.</para> |
|---|
| 642 | |
|---|
| 643 | <para>The changes are expected to be merged into the <ulink |
|---|
| 644 | url="http://www.boxbackup.org/svn/box/trunk">Subversion trunk</ulink> |
|---|
| 645 | at some point, and this page should then be updated. If in doubt, |
|---|
| 646 | please sign up to the <ulink |
|---|
| 647 | url="http://lists.warhead.org.uk/mailman/listinfo/boxbackup">mailing |
|---|
| 648 | list</ulink> and ask us.</para> |
|---|
| 649 | |
|---|
| 650 | <para>To get the source code out of Subversion you will need a <ulink |
|---|
| 651 | url="http://subversion.tigris.org/files/documents/15/25364/svn-1.2.3-setup.exe">Subversion |
|---|
| 652 | client for Windows</ulink>. After installing it, open a new command |
|---|
| 653 | prompt, go to the base directory, and type:</para> |
|---|
| 654 | |
|---|
| 655 | <programlisting>svn co http://www.boxbackup.org/svn/box/chris/win32/vc2005-compile-fixes/ boxbackup</programlisting> |
|---|
| 656 | |
|---|
| 657 | <para>This should create a directory called <emphasis |
|---|
| 658 | role="bold">boxbackup</emphasis> inside the base directory.</para> |
|---|
| 659 | </section> |
|---|
| 660 | |
|---|
| 661 | <section> |
|---|
| 662 | <title>Configure Box Backup</title> |
|---|
| 663 | |
|---|
| 664 | <para>Open a command prompt, change to the base directory then |
|---|
| 665 | <emphasis role="bold">boxbackup</emphasis>, and run <emphasis |
|---|
| 666 | role="bold">win32.bat</emphasis> to configure the sources. Otherwise, |
|---|
| 667 | Visual C++ will complain about missing files whose names start with |
|---|
| 668 | <emphasis role="bold">autogen</emphasis>, and missing <emphasis |
|---|
| 669 | role="bold">config.h</emphasis>.</para> |
|---|
| 670 | </section> |
|---|
| 671 | |
|---|
| 672 | <section> |
|---|
| 673 | <title>Compile Box Backup</title> |
|---|
| 674 | |
|---|
| 675 | <para>Open Visual C++. Choose "File/Open/Project", navigate to the |
|---|
| 676 | base directory, then to <emphasis |
|---|
| 677 | role="bold">boxbackup\infrastructure\msvc\2005</emphasis> (or |
|---|
| 678 | <emphasis role="bold">2003</emphasis> if using Visual Studio 2003), |
|---|
| 679 | and open any project or solution file in that directory.</para> |
|---|
| 680 | |
|---|
| 681 | <para>Press F7 to compile Box Backup. If the compilation is |
|---|
| 682 | successful, <emphasis |
|---|
| 683 | role="bold">boxbackup\Debug\bbackupd.exe</emphasis> will be |
|---|
| 684 | created.</para> |
|---|
| 685 | </section> |
|---|
| 686 | |
|---|
| 687 | <section> |
|---|
| 688 | <title>Install Box Backup</title> |
|---|
| 689 | |
|---|
| 690 | <para>Create the destination directory, <emphasis |
|---|
| 691 | role="bold">C:\Program Files\Box Backup\bbackupd</emphasis>.</para> |
|---|
| 692 | |
|---|
| 693 | <para>Write a configuration file, keys and certificate on a Unix |
|---|
| 694 | machine, and copy them into the <emphasis role="bold">Box |
|---|
| 695 | Backup</emphasis> directory, together with the following files from |
|---|
| 696 | the base directory:</para> |
|---|
| 697 | |
|---|
| 698 | <itemizedlist> |
|---|
| 699 | <listitem> |
|---|
| 700 | <para>boxbackup\Debug\bbackupd.exe</para> |
|---|
| 701 | </listitem> |
|---|
| 702 | |
|---|
| 703 | <listitem> |
|---|
| 704 | <para>openssl\out32dll\libeay32.dll</para> |
|---|
| 705 | </listitem> |
|---|
| 706 | |
|---|
| 707 | <listitem> |
|---|
| 708 | <para>openssl\out32dll\ssleay32.dll</para> |
|---|
| 709 | </listitem> |
|---|
| 710 | |
|---|
| 711 | <listitem> |
|---|
| 712 | <para>zlib\zlib1.dll</para> |
|---|
| 713 | </listitem> |
|---|
| 714 | </itemizedlist> |
|---|
| 715 | |
|---|
| 716 | <para>Ensure that the user running Box Backup can read from the |
|---|
| 717 | <emphasis role="bold">Box Backup</emphasis> directory, and write to |
|---|
| 718 | the <emphasis role="bold">bbackupd</emphasis> directory inside |
|---|
| 719 | it.</para> |
|---|
| 720 | |
|---|
| 721 | <para>Run Box Backup by double-clicking on it, and check that it |
|---|
| 722 | connects to the server. If the window opens and closes immediately, |
|---|
| 723 | it's probably due to a problem with the configuration file - check the |
|---|
| 724 | Windows Event Viewer for details.</para> |
|---|
| 725 | </section> |
|---|
| 726 | |
|---|
| 727 | <section> |
|---|
| 728 | <title>Windows Service</title> |
|---|
| 729 | |
|---|
| 730 | <para>Box Backup can also run as a Windows service, in which case it |
|---|
| 731 | will be automatically started at boot time in the background. To |
|---|
| 732 | install this, open a command prompt, and run:</para> |
|---|
| 733 | |
|---|
| 734 | <programlisting>cd "C:\Program Files\Box Backup" |
|---|
| 735 | bbackupd.exe -i</programlisting> |
|---|
| 736 | |
|---|
| 737 | <para>This should output Box Backup service installed.</para> |
|---|
| 738 | </section> |
|---|
| 739 | </section> |
|---|
| 740 | </appendix> |
|---|
| 741 | |
|---|
| 742 | <appendix> |
|---|
| 743 | <title id="AppC">Compilation and installation by building an RPM on |
|---|
| 744 | Linux</title> |
|---|
| 745 | |
|---|
| 746 | <para>It is very easy to build an RPM of Box Backup on Linux platforms. |
|---|
| 747 | This should work on all Red Hat distributions (including Fedora), SuSE, |
|---|
| 748 | and probably others too.</para> |
|---|
| 749 | |
|---|
| 750 | <para>Given that you have the correct development packages installed |
|---|
| 751 | simply execute this command (replacing the version number):</para> |
|---|
| 752 | |
|---|
| 753 | <programlisting>rpmbuild -ta boxbackup-0.00.tgz</programlisting> |
|---|
| 754 | |
|---|
| 755 | <para>rpmbuild will report where the packages have been written to, and |
|---|
| 756 | these can be installed in the normal manner.</para> |
|---|
| 757 | |
|---|
| 758 | <para>If you have never built an RPM before you should set up a convenient |
|---|
| 759 | build area as described in the <ulink |
|---|
| 760 | url="http://www.rpm.org/max-rpm/s1-rpm-anywhere-different-build-area.html">RPM |
|---|
| 761 | book</ulink>.</para> |
|---|
| 762 | |
|---|
| 763 | <para>If you wish to customise the package you can find the spec file in |
|---|
| 764 | the contrib/rpm directory.</para> |
|---|
| 765 | </appendix> |
|---|
| 766 | </book> |
|---|