]> git.sur5r.net Git - bacula/docs/blob - docs/manual/firewalls.tex
Initial revision
[bacula/docs] / docs / manual / firewalls.tex
1 %%
2 %%
3
4 \section*{Dealing with Firewalls}
5 \label{_ChapterStart26}
6 \index[general]{Dealing with Firewalls }
7 \index[general]{Firewalls!Dealing with }
8 \addcontentsline{toc}{section}{Dealing with Firewalls}
9
10 If you have a firewall or a DMZ installed on your computer, you may experience
11 difficulties contacting one or more of the Clients to back them up. This is
12 especially true if you are trying to backup a Client across the Internet. 
13
14 \subsection*{Technical Details}
15 \index[general]{Technical Details }
16 \index[general]{Details!Technical }
17 \addcontentsline{toc}{subsection}{Technical Details}
18
19 If you are attempting to do this, the sequence of network events in Bacula to
20 do a backup are the following: 
21
22 \footnotesize
23 \begin{verbatim}
24 Console -> DIR:9101
25 DIR     -> SD:9103
26 DIR     -> FD:9102
27 FD      -> SD:9103
28 \end{verbatim}
29 \normalsize
30
31 Where it should be obvious that DIR represents the Director, FD the File
32 daemon or client, and SD the Storage daemon. The numbers that follow those
33 names are the standard ports used by Bacula, and the -\gt{} represents the
34 left side making a connection to the right side (i.e. the right side is the
35 ``server'' or is listening on the specified port), and the left side is the
36 ``client'' who initiates the conversation. 
37
38 Note, port 9103 serves both the Director and the File daemon, each having its
39 own independent connection. 
40
41 If you are running {\bf iptables}, you might add something like: 
42
43 \footnotesize
44 \begin{verbatim}
45 -A FW-1-INPUT -m state --state NEW -m tcp -p tcp --dport 9101:9103 -j ACCEPT
46 \end{verbatim}
47 \normalsize
48
49 on your server, and 
50
51 \footnotesize
52 \begin{verbatim}
53 -A FW-1-INPUT -m state --state NEW -m tcp -p tcp --dport 9102 -j ACCEPT
54 \end{verbatim}
55 \normalsize
56
57 on your client. In both cases, I assume that the machine is allowed to
58 initiate connections on any port. If not, you will need to allow outgoing
59 connections on ports 9102 and 9103 on your server and 9103 on your client.
60 Thanks to Raymond Norton for this tip. 
61
62 \subsection*{A Concrete Example}
63 \index[general]{Example!Concrete }
64 \index[general]{Concrete Example }
65 \addcontentsline{toc}{subsection}{Concrete Example}
66
67 Jesse Guardiani's solution for his network for this problem, in his own words,
68 is: 
69
70 My bacula server is on the 192.168.1.0/24 network at IP address 192.168.1.52.
71 For the sake of discussion we will refer to this network as the 'internal'
72 network because it connects to the internet through a NAT'd firewall. We will
73 call the network on the public (internet) side of the NAT'd firewall the
74 'external' network. Also, for the sake of discussion we will call my bacula
75 server: 
76
77 \footnotesize
78 \begin{verbatim}
79     server.int.mydomain.tld
80 \end{verbatim}
81 \normalsize
82
83 when a fully qualified domain name is required, or simply: 
84
85 \footnotesize
86 \begin{verbatim}
87     server
88 \end{verbatim}
89 \normalsize
90
91 if a hostname is adequate. We will call the various bacula daemons running on
92 the server.int.mydomain.tld machine: 
93
94 \footnotesize
95 \begin{verbatim}
96     server-fd
97     server-sd
98     server-dir
99 \end{verbatim}
100 \normalsize
101
102 In addition, I have two clients that I want to back up with Bacula. The first
103 client is on the internal network. Its fully qualified domain name is: 
104
105 \footnotesize
106 \begin{verbatim}
107     private1.int.mydomain.tld
108 \end{verbatim}
109 \normalsize
110
111 And its hostname is: 
112
113 \footnotesize
114 \begin{verbatim}
115     private1
116 \end{verbatim}
117 \normalsize
118
119 This machine is a client and therefore runs just one bacula daemon: 
120
121 \footnotesize
122 \begin{verbatim}
123     private1-fd
124 \end{verbatim}
125 \normalsize
126
127 The second client is on the external network. Its fully qualified domain name
128 is: 
129
130 \footnotesize
131 \begin{verbatim}
132     public1.mydomain.tld
133 \end{verbatim}
134 \normalsize
135
136 And its hostname is: 
137
138 \footnotesize
139 \begin{verbatim}
140     public1
141 \end{verbatim}
142 \normalsize
143
144 This machine also runs just one bacula daemon: 
145
146 \footnotesize
147 \begin{verbatim}
148     public1-fd
149 \end{verbatim}
150 \normalsize
151
152 Finally, I have a NAT firewall/gateway with two network interfaces. The first
153 interface is on the internal network and serves as a gateway to the internet
154 for all the machines attached to the internal network (For example,
155 server.int.mydomain.tld and private1.int.mydomain.tld). The second interface
156 is on the external (internet) network. The external interface has been
157 assigned the name: 
158
159 \footnotesize
160 \begin{verbatim}
161     firewall.mydomain.tld
162 \end{verbatim}
163 \normalsize
164
165 Remember: 
166
167 \footnotesize
168 \begin{verbatim}
169     *.int.mydomain.tld = internal network
170         *.mydomain.tld = external network
171 \end{verbatim}
172 \normalsize
173
174 \subsubsection*{The Bacula Configuration Files for the Above}
175 \index[general]{Above!Bacula Configuration Files for the }
176 \index[general]{Bacula Configuration Files for the Above }
177 \addcontentsline{toc}{subsubsection}{Bacula Configuration Files for the Above}
178
179 server-sd manages a 4 tape AIT autoloader. All of my backups are written to
180 server-sd. I have just *one* Device resource in my server-sd.conf file: 
181
182 \footnotesize
183 \begin{verbatim}
184 Device {
185   Name = "autochanger1";
186   Media Type = AIT-1;
187   Archive Device = /dev/nrsa1;
188   Changer Device = /dev/ch0;
189   Changer Command = "/usr/local/sbin/chio-bacula %c %o %S %a";
190   Label Media = yes;
191   AutoChanger = yes;
192   AutomaticMount = yes;               # when device opened, read it
193   AlwaysOpen = yes;
194     Hardware End of Medium = No
195     Fast Forward Space File = No
196     BSF at EOM = yes
197 }
198 \end{verbatim}
199 \normalsize
200
201 (note, please see 
202 \ilink{the Tape Testing}{FreeBSDTapes} chapter of this manual
203 for important FreeBSD information.) However, I have *two* Storage resources in
204 my server-dir.conf file: 
205
206 \footnotesize
207 \begin{verbatim}
208 Storage {
209   Name = "autochanger1-int"    # Storage device for backing up
210   Address = server.int.mydomain.tld
211   SDPort = 9103
212   Password = "mysecretpassword"
213   Device = "autochanger1"
214   Media Type = AIT-1
215   Autochanger = yes
216 }
217 Storage {
218   Name = "autochanger1-ext"    # Storage device for backing up
219   Address = firewall.mydomain.tld
220   SDPort = 9103
221   Password = "mysecretpassword"
222   Device = "autochanger1"
223   Media Type = AIT-1
224   Autochanger = yes
225 }
226 \end{verbatim}
227 \normalsize
228
229 Note that BOTH of the above server-dir.conf Storage resources use the same
230 'autochanger1' Device resource from server-sd.conf. 
231
232 My backup jobs run consecutively, one after the other, so only one of the
233 above Storage resources is being used by Bacula file daemons at any given
234 time. I don't know if this would cause problems at a site that runs more than
235 one backup in parallel to a single tape device. 
236
237 In addition to the above, I have two Client resources defined in
238 server-dir.conf: 
239
240 \footnotesize
241 \begin{verbatim}
242 Client {
243   Name = private1-fd
244   Address = private1.int.mydomain.tld
245   FDPort = 9102
246   Catalog = MyCatalog
247   Password = "mysecretpassword"       # password for FileDaemon
248 }
249 Client {
250   Name = public1-fd
251   Address = public1.mydomain.tld
252   FDPort = 9102
253   Catalog = MyCatalog
254   Password = "mysecretpassword"       # password for FileDaemon
255 }
256 \end{verbatim}
257 \normalsize
258
259 And finally, to tie it all together, I have two Job resources defined in
260 server-dir.conf: 
261
262 \footnotesize
263 \begin{verbatim}
264 Job {
265   Name = "Private1-Backup"
266   Type = Backup
267   Client = private1-fd
268   FileSet = "Private1"
269   Schedule = "WeeklyCycle"
270   Storage = "autochanger1-int"
271   Messages = Standard
272   Pool = "Weekly"
273   Write Bootstrap = "/var/db/bacula/Private1-Backup.bsr"
274   Priority = 12
275 }
276 Job {
277   Name = "Public1-Backup"
278   Type = Backup
279   Client = public1-fd
280   FileSet = "Public1"
281   Schedule = "WeeklyCycle"
282   Storage = "autochanger1-ext"
283   Messages = Standard
284   Pool = "Weekly"
285   Write Bootstrap = "/var/db/bacula/Public1-Backup.bsr"
286   Priority = 13
287 }
288 \end{verbatim}
289 \normalsize
290
291 It is important to notice that because the 'Private1-Backup' Job is intended
292 to back up a machine on the internal network it uses the 'autochanger1-int'
293 Storage resource. On the other hand, the 'Public1-Backup' Job is intended to
294 back up a machine on the external network, so it uses the 'autochanger1-ext'
295 Storage resource. 
296
297 I have left the Pool, Catalog, Messages, FileSet, Schedule, and Director
298 resources out of the above server-dir.conf examples because they are not
299 pertinent to the discussion. 
300
301 \subsubsection*{How Does It Work?}
302 \index[general]{How Does It Work? }
303 \index[general]{Work!How Does It }
304 \addcontentsline{toc}{subsubsection}{How Does It Work?}
305
306 If I want to run a backup of private1.int.mydomain.tld and store that backup
307 using server-sd then my understanding of the order of events is this: 
308
309 \begin{enumerate}
310 \item I execute my Bacula 'console' command on server.int.mydomain.tld.  
311 \item console connects to server-dir.  
312 \item I tell console to 'run' backup Job 'Private1-Backup'.  
313 \item console relays this command to server-dir.  
314 \item server-dir connects to private1-fd at private1.int.mydomain.tld:9102  
315 \item server-dir tells private1-fd to start sending the files defined in  the
316    'Private1-Backup' Job's FileSet resource to the Storage resource 
317    'autochanger1-int', which we have defined in server-dir.conf as having the 
318 address:port of server.int.mydomain.tld:9103.  
319 \item private1-fd connects to server.int.mydomain.tld:9103 and begins sending 
320    files. 
321    \end{enumerate}
322
323 Alternatively, if I want to run a backup of public1.mydomain.tld and store
324 that backup using server-sd then my understanding of the order of events is
325 this: 
326
327 \begin{enumerate}
328 \item I execute my Bacula 'console' command on server.int.mydomain.tld.  
329 \item console connects to server-dir.  
330 \item I tell console to 'run' backup Job 'Public1-Backup'.  
331 \item console relays this command to server-dir.  
332 \item server-dir connects, through the NAT'd firewall, to public1-fd at 
333    public1.mydomain.tld:9102  
334 \item server-dir tells public1-fd to start sending the files defined in  the
335    'Public1-Backup' Job's FileSet resource to the Storage resource 
336    'autochanger1-ext', which we have defined in server-dir.conf as having the 
337 address:port of firewall.mydomain.tld:9103.  
338 \item public1-fd connects to firewall.mydomain.tld:9103 and begins sending 
339    files. 
340    \end{enumerate}
341
342 \subsubsection*{Important Note}
343 \index[general]{Important Note }
344 \index[general]{Note!Important }
345 \addcontentsline{toc}{subsubsection}{Important Note}
346
347 In order for the above 'Public1-Backup' Job to succeed,
348 firewall.mydomain.tld:9103 MUST be forwarded using the firewall's
349 configuration software to server.int.mydomain.tld:9103. Some firewalls call
350 this 'Server Publication'. Others may call it 'Port Forwarding'.