]> git.sur5r.net Git - bacula/docs/blob - docs/manuals/es/main/security.tex
Reset everything to English
[bacula/docs] / docs / manuals / es / main / security.tex
1 %%
2 %%
3
4 \chapter{Bacula Security Issues}
5 \label{SecurityChapter}
6 \index[general]{Bacula Security Issues}
7 \index[general]{Security}
8 \index[general]{Issues!Bacula Security}
9
10 \begin{itemize}
11 \item Security means being able to restore your files, so read the 
12    \ilink{Critical Items Chapter}{Critical} of this manual.
13 \item The Clients ({\bf bacula-fd}) must run as root to be able to access  all
14    the system files. 
15 \item It is not necessary to run the Director as root. 
16 \item It is not necessary to run the Storage daemon as root, but you  must
17    ensure that it can open the tape drives, which are often restricted to root
18    access by default. In addition, if you do not run the Storage daemon as root,
19    it will not be able to automatically set your tape drive parameters on most
20    OSes since these functions, unfortunately require root access.
21 \item You should restrict access to the Bacula configuration files,  so that
22    the passwords are not world-readable. The {\bf Bacula}  daemons are password
23    protected using CRAM-MD5 (i.e. the password is not  sent across the network).
24    This will ensure that not everyone  can access the daemons. It is a reasonably
25    good protection, but  can be cracked by experts. 
26 \item If you are using the recommended ports 9101, 9102, and 9103, you  will
27    probably want to protect these ports from external access  using a firewall
28    and/or using tcp wrappers ({\bf etc/hosts.allow}).  
29 \item By default, all data that is sent across the network is unencrypted.
30    However, Bacula does support TLS (transport layer security) and can
31    encrypt transmitted data.  Please read the
32    \ilink{TLS (SSL) Communications Encryption}{CommEncryption}
33    section of this manual.
34 \item You should ensure that the Bacula working directories are  readable and
35    writable only by the Bacula daemons. 
36 \item If you are using {\bf MySQL} it is not necessary for it to  run with
37    {\bf root} permission. 
38 \item The default Bacula {\bf grant-mysql-permissions} script  grants all
39    permissions to use the MySQL database without a  password. If you want
40    security, please tighten this up! 
41 \item Don't forget that Bacula is a network program, so anyone anywhere  on
42    the network with the console program and the Director's password  can access
43    Bacula and the backed up data. 
44 \item You can restrict what IP addresses Bacula will bind to by using the 
45    appropriate {\bf DirAddress}, {\bf FDAddress}, or {\bf SDAddress}  records in
46    the respective daemon configuration files. 
47 \item Be aware that if you are backing up your database using the default
48    script, if you have a password on your database, it will be passed as
49    a command line option to that script, and any user will be able to see
50    this information. If you want it to be secure, you will need to pass it
51    by an environment variable or a secure file.
52
53    See also \ilink{Backing Up Your Bacula
54    Database - Security Considerations }{BackingUpBaculaSecurityConsiderations}
55    for more information.
56 \end{itemize}
57
58
59 \section{Backward Compatibility}
60 \index[general]{Backward Compatibility}
61 One of the major goals of Bacula is to ensure that you can restore
62 tapes (I'll use the word tape to include disk Volumes) that you wrote years
63 ago.  This means that each new version of Bacula should be able to read old
64 format tapes. The first problem you will have is to ensure that the 
65 hardware is still working some years down the road, and the second
66 problem will be to ensure that the media will still be good, then 
67 your OS must be able to interface to the device, and finally Bacula
68 must be able to recognize old formats.  All the problems except the
69 last are ones that we cannot solve, but by careful planning you can.
70
71 Since the very beginning of Bacula (January 2000) until today (December
72 2005), there have been two major Bacula tape formats.  The second format
73 was introduced in version 1.27 in November of 2002, and it has not
74 changed since then.  In principle, Bacula can still read the original
75 format, but I haven't tried it lately so who knows ...
76
77 Though the tape format is fixed, the kinds of data that we can put on the
78 tapes are extensible, and that is how we added new features
79 such as ACLs, Win32 data, encrypted data, ...  Obviously, an older
80 version of Bacula would not know how to read these newer data streams,
81 but each newer version of Bacula should know how to read all the 
82 older streams.
83
84 If you want to be 100% sure that you can read old tapes, you
85 should:
86
87 1. Try reading old tapes from time to time -- e.g. at least once
88 a year.
89
90 2. Keep statically linked copies of every version of Bacula that you use
91 in production then if for some reason, we botch up old tape compatibility, you
92 can always pull out an old copy of Bacula ...
93
94 The second point is probably overkill but if you want to be sure, it may
95 save you someday.
96
97
98
99 \label{wrappers}
100 \section{Configuring and Testing TCP Wrappers}
101 \index[general]{Configuring and Testing TCP Wrappers}
102 \index[general]{TCP Wrappers}
103 \index[general]{Wrappers!TCP}
104 \index[general]{libwrappers}
105
106 TCP Wrappers are implemented if you turn them on when configuring
107 ({\bf ./configure \verb:--:with-tcp-wrappers}). 
108 With this code enabled, you may control who may access your
109 daemons.  This control is done by modifying the file: {\bf
110 /etc/hosts.allow}.  The program name that {\bf Bacula} uses when
111 applying these access restrictions is the name you specify in the
112 daemon configuration file (see below for examples).
113 You must not use the {\bf twist} option in your {\bf
114 /etc/hosts.allow} or it will terminate the Bacula daemon when a
115 connection is refused.
116
117 The exact name of the package you need loaded to build with TCP wrappers
118 depends on the system.  For example,
119 on SuSE, the TCP wrappers libraries needed to link Bacula are
120 contained in the tcpd-devel package. On Red Hat, the package is named
121 tcp\_wrappers.
122
123 Dan Langille has provided the following information on configuring and
124 testing TCP wrappers with Bacula. 
125
126 If you read hosts\_options(5), you will see an option called twist. This
127 option replaces the current process by an instance of the specified shell
128 command. Typically, something like this is used: 
129
130 \footnotesize
131 \begin{verbatim}
132 ALL : ALL \
133  : severity auth.info \
134  : twist /bin/echo "You are not welcome to use %d from %h."
135 \end{verbatim}
136 \normalsize
137
138 The libwrap code tries to avoid {\bf twist} if it runs in a resident process,
139 but that test will not protect the first hosts\_access() call. This will
140 result in the process (e.g. bacula-fd, bacula-sd, bacula-dir) being terminated
141 if the first connection to their port results in the twist option being
142 invoked. The potential, and I stress potential, exists for an attacker to
143 prevent the daemons from running. This situation is eliminated if your
144 /etc/hosts.allow file contains an appropriate rule set. The following example
145 is sufficient: 
146
147 \footnotesize
148 \begin{verbatim}
149 undef-fd : localhost : allow
150 undef-sd : localhost : allow
151 undef-dir : localhost : allow
152 undef-fd : ALL : deny
153 undef-sd : ALL : deny
154 undef-dir : ALL : deny
155 \end{verbatim}
156 \normalsize
157
158 You must adjust the names to be the same as the Name directives found
159 in each of the daemon configuration files. They are, in general, not the
160 same as the binary daemon names. It is not possible to use the 
161 daemon names because multiple daemons may be running on the same machine
162 but with different configurations.
163
164 In these examples, the Director is undef-dir, the
165 Storage Daemon is undef-sd, and the File Daemon is undef-fd. Adjust to suit
166 your situation. The above example rules assume that the SD, FD, and DIR all
167 reside on the same box. If you have a remote FD client, then the following
168 rule set on the remote client will suffice: 
169
170 \footnotesize
171 \begin{verbatim}
172 undef-fd : director.example.org : allow
173 undef-fd : ALL : deny
174 \end{verbatim}
175 \normalsize
176
177 where director.example.org is the host which will be contacting the client
178 (ie. the box on which the Bacula Director daemon runs). The use of "ALL :
179 deny" ensures that the twist option (if present) is not invoked. To properly
180 test your configuration, start the daemon(s), then attempt to connect from an
181 IP address which should be able to connect. You should see something like
182 this: 
183
184 \footnotesize
185 \begin{verbatim}
186 $ telnet undef 9103
187 Trying 192.168.0.56...
188 Connected to undef.example.org.
189 Escape character is '^]'.
190 Connection closed by foreign host.
191 $
192 \end{verbatim}
193 \normalsize
194
195 This is the correct response. If you see this: 
196
197 \footnotesize
198 \begin{verbatim}
199 $ telnet undef 9103
200 Trying 192.168.0.56...
201 Connected to undef.example.org.
202 Escape character is '^]'.
203 You are not welcome to use undef-sd from xeon.example.org.
204 Connection closed by foreign host.
205 $
206 \end{verbatim}
207 \normalsize
208
209 then twist has been invoked and your configuration is not correct and you need
210 to add the deny statement. It is important to note that your testing must
211 include restarting the daemons after each connection attempt. You can also
212 tcpdchk(8) and tcpdmatch(8) to validate your /etc/hosts.allow rules. Here is a
213 simple test using tcpdmatch: 
214
215 \footnotesize
216 \begin{verbatim}
217 $ tcpdmatch undef-dir xeon.example.org
218 warning: undef-dir: no such process name in /etc/inetd.conf
219 client: hostname xeon.example.org
220 client: address 192.168.0.18
221 server: process undef-dir
222 matched: /etc/hosts.allow line 40
223 option: allow
224 access: granted
225 \end{verbatim}
226 \normalsize
227
228 If you are running Bacula as a standalone daemon, the warning above can be
229 safely ignored. Here is an example which indicates that your rules are missing
230 a deny statement and the twist option has been invoked. 
231
232 \footnotesize
233 \begin{verbatim}
234 $ tcpdmatch undef-dir 10.0.0.1
235 warning: undef-dir: no such process name in /etc/inetd.conf
236 client: address 10.0.0.1
237 server: process undef-dir
238 matched: /etc/hosts.allow line 91
239 option: severity auth.info
240 option: twist /bin/echo "You are not welcome to use
241   undef-dir from 10.0.0.1."
242 access: delegated
243 \end{verbatim}
244 \normalsize
245
246 \section{Running as non-root}
247 \index[general]{Running as non-root }
248
249 Security advice from Dan Langille: 
250 % TODO: don't use specific name
251
252 % TODO: don't be too specific on operating system
253
254 % TODO: maybe remove personalization?
255
256 It is a good idea to run daemons with the lowest possible privileges.  In
257 other words, if you can, don't run applications as root which do  not have to
258 be root.  The Storage Daemon and the Director Daemon do not need to be root.
259 The  File Daemon needs to be root in order to access all files on your system.
260 In order to run as non-root, you need to create a user and a group.  Choosing
261 {\tt bacula} as both the user name and the group name sounds like a good idea
262 to me.  
263
264 The FreeBSD port creates this user and group for you.
265 Here is what those entries looked like on my FreeBSD laptop: 
266
267 \footnotesize
268 \begin{verbatim}
269 bacula:*:1002:1002::0:0:Bacula Daemon:/var/db/bacula:/sbin/nologin
270 \end{verbatim}
271 \normalsize
272
273 I used vipw to create this entry. I selected a User ID and Group ID  of 1002
274 as they were unused on my system.  
275
276 I also created a group in /etc/group:  
277
278 \footnotesize
279 \begin{verbatim}
280 bacula:*:1002:
281 \end{verbatim}
282 \normalsize
283
284 The bacula user (as opposed to the Bacula daemon) will have a home  directory
285 of {\tt /var/db/bacula} which is the  default location for the Bacula
286 database.  
287
288 Now that you have both a bacula user and a bacula group, you can  secure the
289 bacula home directory by issuing this command: 
290
291 \footnotesize
292 \begin{verbatim}
293 chown -R bacula:bacula /var/db/bacula/
294 \end{verbatim}
295 \normalsize
296
297 This ensures that only the bacula user can access this directory.  It also
298 means that if we run the Director and the Storage daemon  as bacula, those
299 daemons also have restricted access. This would not be  the case if they were
300 running as root.  
301
302 It is important to note that the storage daemon actually needs  to be in the
303 operator group for normal access to tape drives etc (at  least on a FreeBSD
304 system, that's how things are set up by default)  Such devices are normally
305 chown root:operator. It is easier and less  error prone  to make Bacula a
306 member of that group than it is to play around  with system permissions. 
307
308 Starting the Bacula daemons 
309
310 To start the bacula daemons on a FreeBSD system, issue the following command: 
311
312 \footnotesize
313 \begin{verbatim}
314 /usr/local/etc/rc.d/bacula-dir start
315 /usr/local/etc/rc.d/bacula-sd  start
316 /usr/local/etc/rc.d/bacula-fd  start
317 \end{verbatim}
318 \normalsize
319
320 To confirm they are all running: 
321
322 \footnotesize
323 \begin{verbatim}
324 $ ps auwx | grep bacula
325 root   63418 0.0 0.3 1856 1036 ?? Ss 4:09PM 0:00.00
326     /usr/local/sbin/bacula-fd -v -c /usr/local/etc/bacula-fd.conf
327 bacula 63416 0.0 0.3 2040 1172 ?? Ss 4:09PM 0:00.01
328     /usr/local/sbin/bacula-sd -v -c /usr/local/etc/bacula-sd.conf
329 bacula 63422 0.0 0.4 2360 1440 ?? Ss 4:09PM 0:00.00
330     /usr/local/sbin/bacula-dir -v -c /usr/local/etc/bacula-dir.conf
331 \end{verbatim}
332 \normalsize