mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-29 05:28:00 +00:00
Content, grammar, and clarity updates to security.rst
This commit is contained in:
parent
50ed136a04
commit
7c2136766b
@ -28,18 +28,18 @@ BIND 9 Security Considerations
|
|||||||
Access Control Lists
|
Access Control Lists
|
||||||
--------------------
|
--------------------
|
||||||
|
|
||||||
Access Control Lists (ACLs) are address match lists that you can set up
|
Access Control Lists (ACLs) are address match lists that can be set up
|
||||||
and nickname for future use in ``allow-notify``, ``allow-query``,
|
and nicknamed for future use in ``allow-notify``, ``allow-query``,
|
||||||
``allow-query-on``, ``allow-recursion``, ``blackhole``,
|
``allow-query-on``, ``allow-recursion``, ``blackhole``,
|
||||||
``allow-transfer``, ``match-clients``, etc.
|
``allow-transfer``, ``match-clients``, etc.
|
||||||
|
|
||||||
Using ACLs allows you to have finer control over who can access your
|
ACLs give users finer control over who can access the
|
||||||
name server, without cluttering up your config files with huge lists of
|
name server, without cluttering up config files with huge lists of
|
||||||
IP addresses.
|
IP addresses.
|
||||||
|
|
||||||
It is a *good idea* to use ACLs, and to control access to your server.
|
It is a *good idea* to use ACLs, and to control access.
|
||||||
Limiting access to your server by outside parties can help prevent
|
Limiting access to the server by outside parties can help prevent
|
||||||
spoofing and denial of service (DoS) attacks against your server.
|
spoofing and denial of service (DoS) attacks against the server.
|
||||||
|
|
||||||
ACLs match clients on the basis of up to three characteristics: 1) The
|
ACLs match clients on the basis of up to three characteristics: 1) The
|
||||||
client's IP address; 2) the TSIG or SIG(0) key that was used to sign the
|
client's IP address; 2) the TSIG or SIG(0) key that was used to sign the
|
||||||
@ -50,7 +50,7 @@ Here is an example of ACLs based on client addresses:
|
|||||||
|
|
||||||
::
|
::
|
||||||
|
|
||||||
// Set up an ACL named "bogusnets" that will block
|
// Set up an ACL named "bogusnets" that blocks
|
||||||
// RFC1918 space and some reserved space, which is
|
// RFC1918 space and some reserved space, which is
|
||||||
// commonly used in spoofing attacks.
|
// commonly used in spoofing attacks.
|
||||||
acl bogusnets {
|
acl bogusnets {
|
||||||
@ -77,9 +77,9 @@ Here is an example of ACLs based on client addresses:
|
|||||||
allow-query { any; };
|
allow-query { any; };
|
||||||
};
|
};
|
||||||
|
|
||||||
This allows authoritative queries for "example.com" from any address,
|
This allows authoritative queries for ``example.com`` from any address,
|
||||||
but recursive queries only from the networks specified in "our-nets",
|
but recursive queries only from the networks specified in ``our-nets``,
|
||||||
and no queries at all from the networks specified in "bogusnets".
|
and no queries at all from the networks specified in ``bogusnets``.
|
||||||
|
|
||||||
In addition to network addresses and prefixes, which are matched against
|
In addition to network addresses and prefixes, which are matched against
|
||||||
the source address of the DNS request, ACLs may include ``key``
|
the source address of the DNS request, ACLs may include ``key``
|
||||||
@ -87,32 +87,32 @@ elements, which specify the name of a TSIG or SIG(0) key.
|
|||||||
|
|
||||||
When BIND 9 is built with GeoIP support, ACLs can also be used for
|
When BIND 9 is built with GeoIP support, ACLs can also be used for
|
||||||
geographic access restrictions. This is done by specifying an ACL
|
geographic access restrictions. This is done by specifying an ACL
|
||||||
element of the form: ``geoip db database field value``
|
element of the form: ``geoip db database field value``.
|
||||||
|
|
||||||
The ``field`` indicates which field to search for a match. Available fields
|
The ``field`` parameter indicates which field to search for a match. Available fields
|
||||||
are "country", "region", "city", "continent", "postal" (postal code),
|
are ``country``, ``region``, ``city``, ``continent``, ``postal`` (postal code),
|
||||||
"metro" (metro code), "area" (area code), "tz" (timezone), "isp",
|
``metro`` (metro code), ``area`` (area code), ``tz`` (timezone), ``isp``,
|
||||||
"asnum", and "domain".
|
``asnum``, and ``domain``.
|
||||||
|
|
||||||
``value`` is the value to search for within the database. A string may be quoted
|
``value`` is the value to search for within the database. A string may be quoted
|
||||||
if it contains spaces or other special characters. An "asnum" search for
|
if it contains spaces or other special characters. An ``asnum`` search for
|
||||||
autonomous system number can be specified using the string "ASNNNN" or the
|
autonomous system number can be specified using the string "ASNNNN" or the
|
||||||
integer NNNN. When "country" search is specified with a string is two characters
|
integer NNNN. If a ``country`` search is specified with a string that is two characters
|
||||||
long, then it must be a standard ISO-3166-1 two-letter country code; otherwise
|
long, it must be a standard ISO-3166-1 two-letter country code; otherwise
|
||||||
it is interpreted as the full name of the country. Similarly, if this is a
|
it is interpreted as the full name of the country. Similarly, if
|
||||||
"region" search and the string is two characters long, then it treated as a
|
``region`` is the search term and the string is two characters long, it is treated as a
|
||||||
standard two-letter state or province abbreviation; otherwise it treated as the
|
standard two-letter state or province abbreviation; otherwise, it is treated as the
|
||||||
full name of the state or province.
|
full name of the state or province.
|
||||||
|
|
||||||
The ``database`` field indicates which GeoIP database to search for a match. In
|
The ``database`` field indicates which GeoIP database to search for a match. In
|
||||||
most cases this is unnecessary, because most search fields can only be found in
|
most cases this is unnecessary, because most search fields can only be found in
|
||||||
a single database. However, searches for "continent" or "country" can be
|
a single database. However, searches for ``continent`` or ``country`` can be
|
||||||
answered from either the "city" or "country" databases, so for these search
|
answered from either the ``city`` or ``country`` databases, so for these search
|
||||||
types, specifying a ``database`` will force the query to be answered from that
|
types, specifying a ``database`` forces the query to be answered from that
|
||||||
database and no other. If ``database`` is not specified, then these queries
|
database and no other. If a ``database`` is not specified, these queries
|
||||||
will be answered from the "city", database if it is installed, or the "country"
|
are first answered from the ``city`` database if it is installed, and then from the ``country``
|
||||||
database if it is installed, in that order. Valid database names are "country",
|
database if it is installed. Valid database names are ``country``,
|
||||||
"city", "asnum", "isp", and "domain".
|
``city``, ``asnum``, ``isp``, and ``domain``.
|
||||||
|
|
||||||
Some example GeoIP ACLs:
|
Some example GeoIP ACLs:
|
||||||
|
|
||||||
@ -132,11 +132,11 @@ ACLs use a "first-match" logic rather than "best-match": if an address
|
|||||||
prefix matches an ACL element, then that ACL is considered to have
|
prefix matches an ACL element, then that ACL is considered to have
|
||||||
matched even if a later element would have matched more specifically.
|
matched even if a later element would have matched more specifically.
|
||||||
For example, the ACL ``{ 10/8; !10.0.0.1; }`` would actually match a
|
For example, the ACL ``{ 10/8; !10.0.0.1; }`` would actually match a
|
||||||
query from 10.0.0.1, because the first element indicated that the query
|
query from 10.0.0.1, because the first element indicates that the query
|
||||||
should be accepted, and the second element is ignored.
|
should be accepted, and the second element is ignored.
|
||||||
|
|
||||||
When using "nested" ACLs (that is, ACLs included or referenced within
|
When using "nested" ACLs (that is, ACLs included or referenced within
|
||||||
other ACLs), a negative match of a nested ACL will the containing ACL to
|
other ACLs), a negative match of a nested ACL tells the containing ACL to
|
||||||
continue looking for matches. This enables complex ACLs to be
|
continue looking for matches. This enables complex ACLs to be
|
||||||
constructed, in which multiple client characteristics can be checked at
|
constructed, in which multiple client characteristics can be checked at
|
||||||
the same time. For example, to construct an ACL which allows queries
|
the same time. For example, to construct an ACL which allows queries
|
||||||
@ -148,11 +148,11 @@ signed with a particular key, use:
|
|||||||
allow-query { !{ !10/8; any; }; key example; };
|
allow-query { !{ !10/8; any; }; key example; };
|
||||||
|
|
||||||
Within the nested ACL, any address that is *not* in the 10/8 network
|
Within the nested ACL, any address that is *not* in the 10/8 network
|
||||||
prefix will be rejected, and this will terminate processing of the ACL.
|
prefix is rejected, which terminates processing of the ACL.
|
||||||
Any address that *is* in the 10/8 network prefix will be accepted, but
|
Any address that *is* in the 10/8 network prefix is accepted, but
|
||||||
this causes a negative match of the nested ACL, so the containing ACL
|
this causes a negative match of the nested ACL, so the containing ACL
|
||||||
continues processing. The query will then be accepted if it is signed by
|
continues processing. The query is accepted if it is signed by
|
||||||
the key "example", and rejected otherwise. The ACL, then, will only
|
the key ``example``, and rejected otherwise. The ACL, then, only
|
||||||
matches when *both* conditions are true.
|
matches when *both* conditions are true.
|
||||||
|
|
||||||
.. _chroot_and_setuid:
|
.. _chroot_and_setuid:
|
||||||
@ -160,12 +160,12 @@ matches when *both* conditions are true.
|
|||||||
``Chroot`` and ``Setuid``
|
``Chroot`` and ``Setuid``
|
||||||
-------------------------
|
-------------------------
|
||||||
|
|
||||||
On UNIX servers, it is possible to run BIND in a *chrooted* environment
|
On Unix servers, it is possible to run BIND in a *chrooted* environment
|
||||||
(using the ``chroot()`` function) by specifying the ``-t`` option for
|
(using the ``chroot()`` function) by specifying the ``-t`` option for
|
||||||
``named``. This can help improve system security by placing BIND in a
|
``named``. This can help improve system security by placing BIND in a
|
||||||
"sandbox", which will limit the damage done if a server is compromised.
|
"sandbox," which limits the damage done if a server is compromised.
|
||||||
|
|
||||||
Another useful feature in the UNIX version of BIND is the ability to run
|
Another useful feature in the Unix version of BIND is the ability to run
|
||||||
the daemon as an unprivileged user ( ``-u`` user ). We suggest running
|
the daemon as an unprivileged user ( ``-u`` user ). We suggest running
|
||||||
as an unprivileged user when using the ``chroot`` feature.
|
as an unprivileged user when using the ``chroot`` feature.
|
||||||
|
|
||||||
@ -179,17 +179,17 @@ Here is an example command line to load BIND in a ``chroot`` sandbox,
|
|||||||
The ``chroot`` Environment
|
The ``chroot`` Environment
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
In order for a ``chroot`` environment to work properly in a particular
|
For a ``chroot`` environment to work properly in a particular
|
||||||
directory (for example, ``/var/named``), you will need to set up an
|
directory (for example, ``/var/named``), the
|
||||||
environment that includes everything BIND needs to run. From BIND's
|
environment must include everything BIND needs to run. From BIND's
|
||||||
point of view, ``/var/named`` is the root of the filesystem. You will
|
point of view, ``/var/named`` is the root of the filesystem;
|
||||||
need to adjust the values of options like ``directory`` and ``pid-file``
|
the values of options like ``directory`` and ``pid-file``
|
||||||
to account for this.
|
must be adjusted to account for this.
|
||||||
|
|
||||||
Unlike with earlier versions of BIND, you typically will *not* need to
|
Unlike with earlier versions of BIND,
|
||||||
compile ``named`` statically nor install shared libraries under the new
|
``named`` does *not* typically need to be compiled statically, nor do shared libraries need to be installed under the new
|
||||||
root. However, depending on your operating system, you may need to set
|
root. However, depending on the operating system, it may be necessary to set
|
||||||
up things like ``/dev/zero``, ``/dev/random``, ``/dev/log``, and
|
up locations such as ``/dev/zero``, ``/dev/random``, ``/dev/log``, and
|
||||||
``/etc/localtime``.
|
``/etc/localtime``.
|
||||||
|
|
||||||
.. _setuid:
|
.. _setuid:
|
||||||
@ -199,13 +199,13 @@ Using the ``setuid`` Function
|
|||||||
|
|
||||||
Prior to running the ``named`` daemon, use the ``touch`` utility (to
|
Prior to running the ``named`` daemon, use the ``touch`` utility (to
|
||||||
change file access and modification times) or the ``chown`` utility (to
|
change file access and modification times) or the ``chown`` utility (to
|
||||||
set the user id and/or group id) on files to which you want BIND to
|
set the user id and/or group id) on files where BIND should
|
||||||
write.
|
write.
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
If the ``named`` daemon is running as an unprivileged user, it will
|
If the ``named`` daemon is running as an unprivileged user, it
|
||||||
not be able to bind to new restricted ports if the server is
|
cannot bind to new restricted ports if the server is
|
||||||
reloaded.
|
reloaded.
|
||||||
|
|
||||||
.. _dynamic_update_security:
|
.. _dynamic_update_security:
|
||||||
@ -219,10 +219,10 @@ address of the host requesting the update, by listing an IP address or
|
|||||||
network prefix in the ``allow-update`` zone option. This method is
|
network prefix in the ``allow-update`` zone option. This method is
|
||||||
insecure since the source address of the update UDP packet is easily
|
insecure since the source address of the update UDP packet is easily
|
||||||
forged. Also note that if the IP addresses allowed by the
|
forged. Also note that if the IP addresses allowed by the
|
||||||
``allow-update`` option include the address of a slave server which
|
``allow-update`` option include the address of a secondary server which
|
||||||
performs forwarding of dynamic updates, the master can be trivially
|
performs forwarding of dynamic updates, the primary can be trivially
|
||||||
attacked by sending the update to the slave, which will forward it to
|
attacked by sending the update to the secondary, which forwards it to
|
||||||
the master with its own source IP address causing the master to approve
|
the primary with its own source IP address - causing the primary to approve
|
||||||
it without question.
|
it without question.
|
||||||
|
|
||||||
For these reasons, we strongly recommend that updates be
|
For these reasons, we strongly recommend that updates be
|
||||||
@ -234,4 +234,4 @@ names, not IP addresses or network prefixes. Alternatively, the new
|
|||||||
Some sites choose to keep all dynamically-updated DNS data in a
|
Some sites choose to keep all dynamically-updated DNS data in a
|
||||||
subdomain and delegate that subdomain to a separate zone. This way, the
|
subdomain and delegate that subdomain to a separate zone. This way, the
|
||||||
top-level zone containing critical data such as the IP addresses of
|
top-level zone containing critical data such as the IP addresses of
|
||||||
public web and mail servers need not allow dynamic update at all.
|
public web and mail servers need not allow dynamic updates at all.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user