Debian Codegraph @

doc/howto/DNS.html

raw symbols SCIP
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <title>ProFTPD: DNS</title>
5 </head>
6
7 <body bgcolor=white>
8
9 <hr>
10 <center><h2><b>ProFTPD: DNS</b></h2></center>
11 <hr>
12
13 <p>
14 <b>FTP, DNS Names, and IP Addresses</b><br>
15 FTP is an IP address-based protocol. FTP clients connect to specific
16 IP address/port combinations; FTP servers handle client connections by
17 listening on IP addresses. No DNS or host names are exchanged by clients
18 and servers. FTP does not support name-based virtual hosts, as HTTP 1.1
19 does.
20
21 <p>
22 The above may seem obvious, but it must be reiterated often. Users can
23 become confused, since FTP clients and servers often use DNS names,
24 rather than explicit IP addresses. This is not surprising, as DNS names are
25 easier to use than IP addresses. The clients and servers resolve those
26 DNS names to their IP addresses, behind the users' backs.
27
28 <p>
29 All of this means that whenever <code>proftpd</code> is given a DNS name,
30 it will resolve that DNS name to its IP address, and then use the IP
31 address.
32
33 <p>
34 <b>When are DNS Names Resolved?</b><br>
35 When <code>proftpd</code> starts up and parses its configuration file,
36 it expects to handle DNS names in the following configuration directives,
37 if they are present:
38 <pre>
39 Allow
40 DefaultAddress
41 Deny
42 From
43 MasqueradeAddress
44 &lt;VirtualHost&gt;
45 </pre>
46 Note that if a DNS name resolves to an IPv6 address (and <code>proftpd</code>
47 has been compiled with IPv6 support via the <code>--enable-ipv6</code>
48 configure option), then <code>proftpd</code> will handle it properly.
49 Otherwise <code>proftpd</code> will attempt resolutions to IPv4 addresses
50 only.
51
52 <p>
53 Even if none of the above configuration directives are used,
54 <code>proftpd</code> will still perform at least one DNS lookup: it will
55 resolve the hostname of the server on which the daemon is running, <i>i.e.</i>
56 the name displayed by typing <code>`hostname`</code>. Why does
57 <code>proftpd</code> need to know this? There is always at least one
58 server that <code>proftpd</code> will handle: the &quot;server config&quot;
59 server (see the <a href="Vhost.html">virtual host</a> howto). This
60 &quot;server config&quot; server defaults to the IP address of the hostname of
61 the machine.
62
63 <p>
64 Once <code>proftpd</code> has the complete list of IP addresses with which
65 it work will while running, it completes its startup, and is ready to
66 handle connections from FTP clients. The running daemon will continue
67 doing DNS lookups when necessary. For example, every time connection is made
68 to a <code>proftpd</code> daemon, or <code>proftpd</code> connects back
69 to a client (as when handling active data transfers), the remote IP address
70 is resolved to its DNS name. <i>In addition</i>, once the DNS name is
71 found, that name is resolved back to an IP address. Why the additional
72 step, when we already have the original IP address? It is possible,
73 either through ignorance or maliciousness, to configure DNS such that an
74 IP address will map to a name, and that name will map back to a different
75 IP address. Configurations such this can be used to foil some DNS-based
76 ACLs. ProFTPD now deliberately checks for such configurations.
77
78 <p>
79 DNS resolution from an IP address and back can add noticeable
80 delays to the FTP session, particularly when there are many data transfers
81 occurring and <code>proftpd</code> is performing the reverse DNS lookup for
82 each one. This penalty can easily be removed by using the
83 <code>UseReverseDNS</code> configuration directive:
84 <pre>
85 UseReverseDNS off
86 </pre>
87 <b>However</b>, you should do this only if you do not have ACLs that
88 rely on DNS names. Otherwise, your ACLs will not work as you expect.
89 Also, if <code>UseReverseDNS</code> is <em>off</em>, <code>proftpd</code>
90 will log only IP addresses in its logs, rather than more legible
91 DNS names.
92
93 <p>
94 Clever users of ProFTPD know that you can use the <code>Port</code>
95 directive to &quot;disable&quot; a given virtual host (including the
96 &quot;server config&quot; host) by setting a port number of zero:
97 <pre>
98 Port 0
99 </pre>
100 By disabling the virtual host that way, can you prevent <code>proftpd</code>
101 from resolving the IP address for that host? No. Using the
102 <code>Port 0</code> trick like this is a hack that affects the process
103 used to lookup the configuration to use for a client connection; it does
104 <b>not</b> affect the parser, which handles the address lookup when
105 the daemon is starting up.
106
107 <p><a name="FAQ">
108 <b>Frequently Asked Questions</b><br>
109 <a name="DNSNoHostname">
110 <font color=red>Question</font>: Why do I see the following when my
111 <code>proftpd</code> starts up?
112 <pre>
113 getaddrinfo '<em>hostname</em>' error: No address associated with hostname
114 warning: unable to determine IP address of '<em>hostname</em>'
115 </pre>
116 <font color=blue>Answer</font>: This error is ProFTPD's way of reporting that
117 it was unsuccessful in resolving <em>hostname</em> to an IP address. Fixing
118 this is a matter of configuring DNS for that <em>hostname</em>: properly set
119 up an IP address for that DNS name in your DNS server, use a DNS name that has
120 an IP address, or (as a quick fix/last resort) add that DNS name to your
121 <code>/etc/hosts</code> file. The proper solution depends largely on
122 the circumstances.
123
124 <p><a name="DNSDynamicIPAddresses">
125 <font color=red>Question</font>: If <code>proftpd</code> resolves any DNS names to IP addresses when it starts up, and I am using dynamic IP addresses which
126 change after my <code>proftpd</code> has started, will <code>proftpd</code>
127 see my new IP addresses?<br>
128 <font color=blue>Question</font>: Unfortunately not. ProFTPD has no easy way
129 of handling dynamic IP addresses by itself. One way of dealing with this
130 situation is to restart <code>proftpd</code> periodically, which will force it
131 to re-parse its configuration and thus re-resolve all IP addresses.
132
133 <p><a name="DNSNoDNS">
134 <font color=red>Question</font>: What if I do not <i>want</i>
135 <code>proftpd</code> to use DNS to resolve the hostname to an IP address
136 because I am in an environment where there is no DNS at all?<br>
137 <font color=blue>Answer</font>: In ProFTPD 1.3.3rc1, support for a new
138 <code>-S</code> command-line option was added. This option can be used to
139 specify the IP address of the host machine. By default,
140 <code>proftpd</code> attempts to resolve the host IP address by using DNS
141 resolution of the hostname. However, in cases where DNS is not configured for
142 the host machine, this approach does not work.
143
144 <p>
145 To specify the desired IP address, use <code>-S</code> when starting
146 <code>proftpd</code>, <i>e.g.</i>:
147 <pre>
148 $ /usr/local/sbin/proftpd -S 1.2.3.4 ...
149 </pre>
150 And if you want <code>proftpd</code> to listen on all interfaces, you can
151 specify a wildcard socket using an IP address of 0.0.0.0:
152 <pre>
153 $ /usr/local/sbin/proftpd -S 0.0.0.0 ...
154 </pre>
155
156 <p>
157 Note that will also mean that, in your <code>proftpd.conf</code>, any
158 <code>&lt;VirtualHost&gt;</code> sections will need to use IP addresses,
159 not DNS names.
160
161 <p>
162 <hr>
163 <font size=2><b><i>
164 &copy; Copyright 2017 The ProFTPD Project<br>
165 All Rights Reserved<br>
166 </i></b></font>
167 <hr>
168
169 </body>
170 </html>