[7]The hostname may be used in other files as well so don't try to change the hostname by editing these files. Use the hostname command instead.One starting point might be to scan all the files in /etc and its subdirectories, trying to identify which ones are relevant. In the long run, you may want to know the role of all the files in /etc, but you don't need to do this all at once. There are a few files or groups of files that will be of particular interest. One of the most important is inetd.conf. While we can piece together what is probably being handled by inetd by using ps in combination with netstat, an examination of inetd.conf is usually much quicker and safer. On an unfamiliar system, this is one of the first places you will want to look. Be sure to compare this to the output provided by netstat. Services that you can't match to running processes or inetd are a cause for concern. You will also want to examine files like host.conf, resolv.conf, and nsswitch.conf to discover how name resolution is done. Be sure to examine files that establish trust relationships like hosts.allow. This is absolutely essential if you are having, or want to avoid, security problems. (There is more on some of these files in the discussion of tcpwrappers in Chapter 11, "Miscellaneous Tools".) Finally, there is one group of these files, the rc files, that deserve particular attention. These are discussed separately in the later section on startup files and scripts.
[8]You can also use make xconfig or make menuconfig. These are more interactive, allowing you to go back and change parameters once you have moved on. make config is unforgiving in this respect.As an example, on BSD-derived systems, the kernel configuration files are usually found in the directory /sys/arch/conf/kernelwhere arch corresponds to the architecture of the system and kernel is the name of the kernel. With FreeBSD, the file might be /sys/i386/conf/GENERIC if the kernel has not been recompiled. In Linux, the configuration file is .config in whatever directory the kernel was unpacked in, usually /usr/src/linux/. As you might expect, lines beginning with a # are comments. What you'll probably want to look for are lines specifying unusual options. For example, it is not difficult to guess that the following lines from a FreeBSD system indicate that the machine may be used as a firewall:
Some entries can be pretty cryptic, but hopefully there are some comments. The Unix manpages for a system may describe some options. Unfortunately, there is very little consistency from one version of Unix to the next on how such files are named, where they are located, what information they may contain, or how they are used. For example, Solaris uses the file /etc/system to hold some directives, although there is little of interest in this file for our purposes. IRIX keeps its files in the /var/sysgen/system directory. For Linux, take a look at /etc/conf.modules. The list goes on.[9]... # Firewall options options IPFIREWALL options IPFIREWALL_VERBOSE_LIMIT=25 ...
[9]While general configuration parameters should be in a single file, a huge number of files are actually involved. If you have access to FreeBSD, you might look at /sys/conf/files to get some idea of this. This is a list of the files FreeBSD uses.It is usually possible to examine or change selected system parameters for an existing kernel. For example, Solaris has the utilities sysdef, prtconf, and ndd. For our purposes, ndd is the most interesting and should provide the flavor of how such utilities work. Specifically, ndd allows you to get or set driver configuration parameters. You will probably want to begin by listing configurable options. Specifying the driver (i.e., /dev/arp, /dev/icmp, /dev/ip, /dev/tcp, and /dev/udp) with the ? option will return the parameters available for that driver. Here is an example:
This shows three parameters that can be examined, although only two can be changed. We can examine an individual parameter by using its name as an argument. For example, we can retrieve the ARP table as shown here:sol1# ndd /dev/arp ? ? (read only) arp_cache_report (read only) arp_debug (read and write) arp_cleanup_interval (read and write)
In this instance, it is fairly easy to guess the meaning of what's returned. (This output is for the same ARP table that we looked at with the arp command.) Sometimes, what's returned can be quite cryptic. This example returns the value of the IP forwarding parameter:sol1# ndd /dev/arp arp_cache_report ifname proto addr proto mask hardware addr flags elxl0 205.153.060.053 255.255.255.255 00:e0:29:21:3c:0b elxl0 205.153.060.055 255.255.255.255 00:90:27:43:72:70 elxl0 205.153.060.001 255.255.255.255 00:00:a2:c6:0e:42 elxl0 205.153.060.005 255.255.255.255 00:90:27:9c:2d:c6 elxl0 205.153.060.248 255.255.255.255 00:60:97:58:71:b7 PERM PUBLISH MYADDR elxl0 205.153.060.150 255.255.255.255 00:c0:05:04:2d:78 elxl0 224.000.000.000 240.000.000.000 01:00:5e:00:00:00 PERM MAPPING
It is far from obvious how to interpret this result. In fact, 0 means never forward, 1 means always forward, and 2 means forward only when two or more interfaces are up. I've never been able to locate a definitive source for this sort of information, although a number of the options are described in an appendix to W. Richard Stevens' TCP/IP Illustrated, vol. 1. If you want to change parameters, you can invoke the program interactively. Other versions of Unix will have their own files and utilities. For example, BSD has the sysctl command. This example shows that IP forwarding is disabled:# ndd /dev/ip ip_forwarding 0
The manpages provide additional guidance, but to know what to change, you may have to delve into the source code. With AIX, there is the no utility. As I have said before, the list goes on. This brief description should give you a general idea of what's involved in gleaning information about the kernel, but you will want to go to the appropriate documentation for your system. It should be clear that it takes a fair degree of experience to extract this kind of information. Occasionally, there is a bit of information that can be obtained only this way, but, in general, this is not the most profitable place to start. One last comment -- if you are intent on examining the behavior of the kernel, you will almost certainly want to look at the messages it produces when booting. On most systems, these can be retrieved with the dmesg command. These can be helpful in determining what network hardware your system has and what drivers it uses. For hardware, however, I generally prefer opening the case and looking inside. Accessing the CMOS is another approach for discovering the hardware that doesn't require opening the box.bsd1# sysctl net.inet.ip.forwarding net.inet.ip.forwarding: 0
WARNING: There is one serious catch with all this. When versions of operating systems change, sometimes the locations of files change. For backward compatibility, links may be created to old locations. For example, on recent versions of Solaris, the network configuration file /etc/hosts is actually a link to /etc/inet/hosts. There are other important network configuration files that are really in /etc/inet, not /etc. Similarly, some of the startup scripts are really links to files in /etc/init.d. If the link is somehow broken, you may find yourself editing the wrong version of a file and wondering why the system is ignoring your changes.
2. Host Configurations | 2.3. Microsoft Windows |
Copyright © 2002 O'Reilly & Associates. All rights reserved.