Configure a secure chrootDNS

Source: Internet
Author: User
Configure a secure chrootDNS-Linux Enterprise Application-Linux server application. For more information, see. Bind has been used on FreeBSD, but there is no chroot, and the server may be added recently. Therefore, we will start to collect chroot and redundant backup data these days and re-design and install it, DNS is the most important server.

Tianyuan recently used a lot of Red Hat operating systems and configured Bind 9 under a Red Hat 9 operating system, in the following example, we will introduce the Red Hat AS3 configuration platform. Tianyuan's Service DNS is a solaris operating system. Therefore, when I write a shell, I try to use Solaris as well. Due to various factors, I was not able to perform a test on Solaris myself. The following installation process is correct for Red Hat and other unix operating systems. The automatically installed shell script attached to the installation is successfully tested only under Red Hat, solaris is also basically taken into account. If you find that there is a problem with the use of the script in Solaris, please report it to the message in this article in a timely manner, so that I can make corrections in time to make it easier for other readers.

First, before we start, Let's explain the chroot and bind words in the title. First, chroot. In fact, in many English articles, it is called "jail" (prison, detention center, prison ). So what is "Jail? Simply put, a thing is restricted to a certain range. As we all know, sometimes an application may be controlled by attackers due to bugs, vulnerabilities, and other issues, so as to gain the permissions of the corresponding users and then the system administrator level. For example, Windows users may have heard about the situation that some iis vulnerabilities cause the system's highest permissions to fall into the hands of attackers. No matter what program, there may be bugs/vulnerabilities. To prevent the system from being stolen by the attacker due to a program vulnerability in the system, you need to restrict the permissions of the program.

The so-called restrictions do not prevent the program from running, but strictly control the system resources, user permissions, and directories that can be used when the program is running. In this way, after the program is illegally controlled by others, the permissions can be quite limited, which will not cause greater harm to the system. For example, anyone who has used an ftp server knows that users can use their usernames and passwords to access their own space to upload, download, add, and delete directories, however, you cannot perform any operations on directories of other users or other directories of the system (of course, these permissions are authorized by the Administrator). This can be seen as a Jail, restrict ftp users to their own directories. In computer terms, we call this Jail program "chroot ". Therefore, the chroot bind in the question can be understood as "bind with strict Permissions ".

It is worth mentioning that the chroot program cannot be said that the program itself is safer. Compared with programs without chroot, it still has the same number of bugs/vulnerabilities, attackers can exploit these bugs or vulnerabilities to launch attacks. So what do we do for chroot? To minimize the loss. For example, purchasing life insurance does not guarantee your life's safety, but it can reduce your losses when you are in trouble. The same is true for our chroot program. When attackers obtain the permissions of the program, the attackers cannot cause more damage because the permissions of the program are strictly limited, you cannot obtain the maximum permissions of the operating system. Because the DNS server is used for domain name resolution, it needs to cope with a lot of access from different regions, and generally does not limit the access ip address, so the security risk and the possibility of being attacked are quite high. As a DNS server, data can be found everywhere on the network. As a network administrator, what we need is not only domain name resolution, but also "security" (Tian Yuan mentioned in previous Network Management notes, "Security is a kind of consciousness". When doing anything, I should remind myself to pay attention to security, which is what a competent network manager should possess )!

Well, the second term is Bind ". Bind is the software of ISC, and it is also the most common and common DNS software in the world. If Apache and IIS are two-point Web servers, so Bind is the de facto standard of DNS Server.

Next, let's start our Bind installation journey. The chroot method is actually to restrict a software to a sub-directory under the root directory. That is, the software only has permissions in this directory, and once it jumps out of this directory, it does not have any permissions. In Bind 8, it was very troublesome to put all Bind files in a directory. in Bind 9, The Development Company ISC finally became popular, not only can Bind software be easily installed in the same directory for permission restriction operations, but also remote control software is added, which is really worth the money (not dry, will be detailed later ).

I would like to pay tribute to my friends who are here. Now we will start our discussion immediately:

   1. Install Bind 9

Although I use the rpm package in Red Hat AS3, we still install it in the source code package to make it easier for other operating systems. First from the ISC home page (http://www.isc.org/products/BIND/) under the Bind 9 software package.

Wget ftp://ftp.isc.org/isc/bind9/9.2.3/bind-9.2.3.tar.gz

(I have not got the latest version. The stable version is available. You can select it based on your needs)

Next, start decompression (simple description. The following operations are performed with root permissions without special declarations)
Tar vzxf bind-9.2.3.tar.gz

Uninstall the original Bind in Red Hat. There are three rpm packages.
Rpm-e bind-utils caching-nameserver

Enter this directory to start compilation and Installation
./Configure -- prefix =/usr/local -- disable-ipv6 -- disable-threads

# Because ipv6 and thread methods are not used, I will remove them and install Bind 9 under/usr/local.
Make; make install

By now, Bind 9 has been installed, and the installation of common DNS servers is complete, and it is just the beginning for our chroot.

   2. Build the chroot directory Environment

A. Create the Bind working directory/chroot/named and its subordinate working directory
CODE: rm-rf/chroot/named # Delete the old directory. The reason why I add this sentence is convenient for debugging when writing shell.

Mkdir-p/chroot/named
Cd/chroot/named
Mkdir dev (virtual/dev)
Mkdir etc (virtual/etc)
Mkdir logs (storing logs)
Mkdir-p var/run (a named. pid file will be placed below in the future)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.