Sles Admin Fcs
Sles Admin Fcs
10
August04,2006
Contents
About This Guide Part I Deployment 1 Planning for SUSE Linux Enterprise
1.1 1.2 1.3 Considerations for Deployment of a SUSE Linux Enterprise Server . . . . Deployment of SUSE Linux Enterprise Server . . . . . . . . . . . . . Running SUSE Linux Enterprise Server . . . . . . . . . . . . . . . .
xv 19 21
23 23 24
2 Deployment Strategies
2.1 2.2 2.3 Deploying up to 10 Workstations . . . . . . . . . . . . . . . . . . Deploying up to 100 Workstations . . . . . . . . . . . . . . . . . . Deploying More than 100 Workstations . . . . . . . . . . . . . . .
25
25 27 34
35
35 36 38 40 40 42 43 43 43 57 67
4 Remote Installation
4.1 4.2 4.3 4.4 4.5 Installation Scenarios for Remote Installation . . . . . . . . . . . . . Setting Up the Server Holding the Installation Sources . . . . . . . . . Preparing the Boot of the Target System . . . . . . . . . . . . . . . Booting the Target System for Installation . . . . . . . . . . . . . . . Monitoring the Installation Process . . . . . . . . . . . . . . . . .
69
69 78 86 97 101
5 Automated Installation
5.1 5.2 5.3 Simple Mass Installation . . . . . . . . . . . . . . . . . . . . . . Rule-Based Autoinstallation . . . . . . . . . . . . . . . . . . . . For More Information . . . . . . . . . . . . . . . . . . . . . .
105
105 116 122
123
123 131
137
138 138 139 152 158 169 170 176 177 181 184 187 190 196 197
199
199 201 208
221 223
225 230 250
1 0 Multipath IO
10.1 10.2 10.3 10.4 Supported Hardware . System Configuration . Software Configuration Using the Devices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
251
252 253 253 256
259
259 264
269
269 271 272 273 275 276
279
279 280 280 280 283
285
285 292 296 297
299
299 301 301 302 310 310
311
312 312 313 315 316 319 321 322
323
324 326 328 330 332 335 338 342 343
345
346 358 361 372
Part III System 1 9 32-Bit and 64-Bit Applications in a 64-Bit System Environment
19.1 19.2 Runtime Support . . . . . . . . . . . . . . . . . . . . . . . . Software Development . . . . . . . . . . . . . . . . . . . . . .
377 379
380 380
19.3 19.4
381 383
385
385 389 398
401
402 402 411 416 416 417 418 420
421
421 428 428 429
435
436 437 438 439 439 442 446 447
2 4 Printer Operation
24.1 24.2 24.3 24.4 24.5 Workflow of the Printing System . . . . . . Methods and Protocols for Connecting Printers Installing the Software . . . . . . . . . . Configuring the Printer . . . . . . . . . . Configuration for Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
451
452 453 454 454 461
24.6 24.7
461 466
475
475 476 476 477 477 478 479 480 481
483
483 484 490 491 492
495
495 497 503 508
513
514 515 518 520
2 9 Power Management
29.1 29.2 29.3 29.4 29.5 29.6 Power Saving Functions . . . . . . APM . . . . . . . . . . . . . . ACPI . . . . . . . . . . . . . . Rest for the Hard Disk . . . . . . The powersave Package . . . . . . The YaST Power Management Module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
521
522 523 524 532 533 541
3 0 Wireless Communication
30.1 Wireless LAN . . . . . . . . . . . . . . . . . . . . . . . . . .
547
547
559 561
565 568 577 578 597 600 615
619
619 620 621 622 622
623
623 626 627
629
629 630 640 642 646 651 651 652 653
3 5 DHCP
35.1 Configuring a DHCP Server with YaST . . . . . . . . . . . . . . . .
655
656
DHCP Software Packages . . . . . . . . . . . . . . . . . . . . . The DHCP Server dhcpd . . . . . . . . . . . . . . . . . . . . . For More Information . . . . . . . . . . . . . . . . . . . . . .
3 6 Using NIS
36.1 36.2 Configuring NIS Servers . . . . . . . . . . . . . . . . . . . . . . Configuring NIS Clients . . . . . . . . . . . . . . . . . . . . . .
673
673 679
681
682 683 686 691 695 698 706 707
3 8 Samba
38.1 38.2 38.3 38.4 38.5 38.6 38.7 38.8 Terminology . . . . . . . . . . . . . . . . . Starting and Stopping Samba . . . . . . . . . Configuring a Samba Server . . . . . . . . . . Configuring Clients . . . . . . . . . . . . . . Samba as Login Server . . . . . . . . . . . . Samba Server in the Network with Active Directory Migrating a Windows NT Server to Samba . . . . For More Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
709
709 711 711 717 718 719 721 723
725
725 726 726 728
4 0 File Synchronization
40.1 40.2 40.3 40.4 40.5 Available Data Synchronization Software . . Determining Factors for Selecting a Program Introduction to Unison . . . . . . . . . Introduction to CVS . . . . . . . . . . Introduction to Subversion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
729
729 732 736 738 741
40.6 40.7
744 746
751
751 753 767 769 776 779 784 786 787
791
792 793 795 797 802 805 807 809 810
811 813
813 818
829
829 831 832 833 838
839
839 840 840 841 841 842 843
4 6 Network AuthenticationKerberos
46.1 46.2 46.3 46.4 Kerberos Terminology . How Kerberos Works . . Users' View of Kerberos . For More Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
845
845 847 850 851
853
853 854 855 855 858 861 863 865 866 867 868
873
874 876
879
880 880 882
889
889
50.2 50.3
Some General Security Tips and Tricks . . . . . . . . . . . . . . . Using the Central Security Reporting Address . . . . . . . . . . . .
898 901
903 905
905 909 910 910 911 911 912 913 913
917
917 918 926 928 935 939 951
Index
955
Security This edition of SUSE Linux Enterprise includes several security-related features. It ships with Novell AppArmor, which enables you to protect your applications by restricting privileges. Secure login, firewalling, and file system encryption are covered as well. Troubleshooting SUSE Linux Enterprise includes a wealth of applications, tools, and documentation should you need them in case of trouble. Some of the most common problems that can occur with SUSE Linux Enterprise and their solutions are discussed in detail.
1 Feedback
We want to hear your comments and suggestions about this manual and the other documentation included with this product. Please use the User Comments feature at the bottom of each page of the online documentation and enter your comments there.
2 Documentation Updates
For the latest version of this documentation, see the SUSE Linux Enterprise Server Web site [http://www.novell.com/documentation/sles10/index .html].
3 Additional Documentation
For additional documentation on this product, refer to http://www.novell.com/ documentation/sles10/index.html: Start-Up Guide Basic information about installation types and work flows. Architecture-Specific Information Architecture-specific information needed to prepare a SUSE Linux Enterprise Server target for installation.
xvi
Installation and Administration In-depth installation and administration for SUSE Linux Enterprise Server. For a documentation overview on the SUSE Linux Enterprise Desktop product, refer to http://www.novell.com/documentation/sled10/index.html. The following manuals are exclusively available for SUSE Linux Enterprise Desktop: GNOME User Guide A comprehensive guide to the GNOME desktop and its most important applications. KDE User Guide A comprehensive guide to the KDE desktop and its most important applications. Network Connectivity Guide An in-depth introduction to networking using NetworkManager. Novell AppArmor 2.0 Administration Guide An in-depth administration guide to Novell AppArmor that introduces you to application confinement for heightened security in your environment. Many chapters in this manual contain links to additional documentation resources. This includes additional documentation that is available on the system as well as documentation available on the Internet.
4 Documentation Conventions
The following typographical conventions are used in this manual: /etc/passwd: filenames and directory names placeholder: replace placeholder with the actual value PATH: the environment variable PATH ls, --help: commands, options, and parameters user: users or groups
Alt , Alt + F1 : a key to press or a key combination; keys are shown in uppercase as on a keyboard
xvii
File, File Save As: menu items, buttons amd64 em64t ipf: This paragraph is only relevant for the specified architectures. The arrows mark the beginning and the end of the text block. ipseries s390 zseries: This paragraph is only relevant for the specified architectures. The arrows mark the beginning and the end of the text block. Dancing Penguins (Chapter Penguins, Reference): This is a reference to a chapter in another book.
xviii
Part I. Deployment
21
OpenLDAP Novell AppArmor Harden your System with the Novell AppArmor technology. This service is described in depth in Novell AppArmor 2.0 Administration Guide (Novell AppArmor 2.0 Administration Guide). iSCSI iSCSI provides an easy and reasonably inexpensive solution for connecting Linux computers to central storage systems. Find more information about iSCSI in Chapter 11, Mass Storage over IP NetworksiSCSI (page 259). Network File System v4 Starting with version 10, SUSE Linux Enterprise Server supports NFS also in version 4. This gives you performance improvements, strong security, and a stateful protocol. Oracle Cluster File System 2 OCFS2 is a general-purpose journaling file system that is fully integrated in the Linux 2.6 kernel and later. Find an overview of OCFS2 in Chapter 14, Oracle Cluster File System 2 (page 285). Heartbeat 2 Heartbeat 2 provides a cluster membership and messaging infrastructure. The setup of such a cluster is described in Chapter 13, Installing a Heartbeat 2 Cluster Using YaST (page 279). Multipath I/O Device mapping multipath IO features automatic configuration of the subsystem for a large variety of setups. See also Chapter 10, Multipath IO (page 251). Linux Kernel Crash Dump Debugging kernel-related problems is now much more comfortable when using Kexec and Kdump. This technology is available on x86, AMD64, Intel EM64T, and POWER platforms.
22
23
Strategies (page 25) for more information. When using the Xen virtualization technologies, network root file systems or network storage solutions like iSCSI should be considered. See also Chapter 11, Mass Storage over IP NetworksiSCSI (page 259). SUSE Linux Enterprise Server provides you with a broad variety of services. Find an overview of the documentation in this book in About This Guide (page xv). Most of the needed configurations can be made with YaST, the SUSE configuration utility. In addition to that, many manual configurations are described in the corresponding chapters. In addition to the plain software installation, you should consider training the end users of the systems as well as help desk staff.
24
Deployment Strategies
There are several different ways to deploy SUSE Linux Enterprise. Choose from various approaches ranging from a local installation using physical media or a network installation server to a mass deployment using a remote-controlled, highly-customized, and automated installation technique. Select the method that best matches your requirements.
Deployment Strategies
25
Table 2.1
Installing from the SUSE Linux Enterprise Media SUSE Linux Enterprise media kit Inserting the installation media Booting the installation target Changing media Determining the YaST installation scope Configuring the system with YaST system
None Section Installing from the SUSE Linux Enterprise Media (page 37)
Table 2.2
Installing from a Network Server Using SLP Network installation server holding the SUSE Linux Enterprise installation media Inserting the boot disk Booting installation target Determining the YaST installation scope Configuring the system with YaST
Installation Source
None, but this method can be combined with VNC Section Installing from a Network Server Using SLP (page 37)
26
Table 2.3
Installing from a Network Server Network installation server holding the SUSE Linux Enterprise installation media Inserting the boot disk Providing boot options Booting the installation target Determining the YaST installation scope Configuring the system with YaST
Installation Source
Remotely Controlled Tasks None, but method can be combined with VNC Details Section Installing from a Network Server (page 37)
Deployment Strategies
27
Simple Remote Installation via VNCDynamic Network Configuration (page 29) Consider this approach in a small to medium scenario with dynamic network setup through DHCP. A network, network installation server, and VNC viewer application are required. Remote Installation via VNCPXE Boot and Wake on LAN (page 30) Consider this approach in a small to medium scenario that should be installed via network and without physical interaction with the installation targets. A network, a network installation server, network boot images, network bootable target hardware, and a VNC viewer application are required. Simple Remote Installation via SSHStatic Network Configuration (page 30) Consider this approach in a small to medium scenario with static network setup. A network, network installation server, and SSH client application are required. Remote Installation via SSHDynamic Network Configuration (page 31) Consider this approach in a small to medium scenario with dynamic network setup through DHCP. A network, network installation server, and SSH client application are required. Remote Installation via SSHPXE Boot and Wake on LAN (page 31) Consider this approach in a small to medium scenario that should be installed via network and without physical interaction with the installation targets. A network, a network installation server, network boot images, network bootable target hardware, and an SSH client application are required. Simple Mass Installation (page 32) Consider this approach for large deployments to identical machines. If configured to use network booting, physical interaction with the target systems is not needed at all. A network, a network installation server, a remote controlling application such as a VNC viewer or an SSH client, and an AutoYaST configuration profile are required. If using network boot, a network boot image and network bootable hardware are required as well. Rule-Based Autoinstallation (page 33) Consider this approach for large deployments to various types of hardware. If configured to use network booting, physical interaction with the target systems is not needed at all. A network, a network installation server, a remote controlling application such as a VNC viewer or an SSH client, and several AutoYaST configuration profiles as well as a rule setup for AutoYaST are required. If using network boot, a network boot image and network bootable hardware are required as well. 28 Installation and Administration
Table 2.4
Simple Remote Installation via VNCStatic Network Configuration Network Setting up an installation source Booting from the installation media
Remote: VNC small to medium scenarios with varying hardware Each machine must be set up individually Physical access is needed for booting
Details
Section 4.1.1, Simple Remote Installation via VNCStatic Network Configuration (page 70) Simple Remote Installation via VNCDynamic Network Configuration Network Setting up the installation source Booting from the installation media
Table 2.5
Remote: VNC Small to medium scenarios with varying hardware Each machine must be set up individually Physical access is needed for booting
Deployment Strategies
29
Details
Section 4.1.2, Simple Remote Installation via VNCDynamic Network Configuration (page 71) Remote Installation via VNCPXE Boot and Wake on LAN Network Setting up the installation source Configuring DHCP, TFTP, PXE boot, and WOL Booting from the network
Table 2.6
Remote: VNC Small to medium scenarios with varying hardware Completely remote installs; cross-site deployment
Drawbacks Details
Each machine must be set up manually Section 4.1.3, Remote Installation via VNCPXE Boot and Wake on LAN (page 73) Simple Remote Installation via SSHStatic Network Configuration Network Setting up the installation source Booting from the installation media
Table 2.7
30
Low bandwidth connections to target Drawbacks Each machine must be set up individually Physical access is needed for booting Details Section 4.1.4, Simple Remote Installation via SSHStatic Network Configuration (page 74) Remote Installation via SSHDynamic Network Configuration Network Setting up the installation source Booting from installation media Control and Monitoring Best Suited For Remote: SSH Small to medium scenarios with varying hardware Low bandwidth connections to target Drawbacks Each machine must be set up individually Physical access is needed for booting Details Section 4.1.5, Simple Remote Installation via SSHDynamic Network Configuration (page 75) Remote Installation via SSHPXE Boot and Wake on LAN Network Setting up the installation source
Table 2.8
Table 2.9
Deployment Strategies
31
Configuring DHCP, TFTP, PXE boot, and WOL Booting from the network Control and Monitoring Best Suited For Remote: SSH Small to medium scenarios with varying hardware Completely remote installs; cross-site deployment Low bandwidth connections to target Drawbacks Details Each machine must be set up individually Section 4.1.6, Remote Installation via SSHPXE Boot and Wake on LAN (page 77) Simple Mass Installation Preferably network Gathering hardware information Creating AutoYaST profile Setting up the installation server Distributing the profile Setting up network boot (DHCP, TFTP, PXE, WOL) or Booting the target from installation media Control and Monitoring Local or remote through VNC or SSH
Table 2.10
32
Applies only to machines with identical hardware Section 5.1, Simple Mass Installation (page 105) Rule-Based Autoinstallation Preferably network Gathering hardware information Creating AutoYaST profiles Creating AutoYaST rules Setting up the installation server Distributing the profile Setting up network boot (DHCP, TFTP, PXE, WOL) or Booting the target from installation media
Drawbacks
Deployment Strategies
33
Details
34
35
Floppy
PXE or BOOTP
Hard Disk
during the installation. The installation procedure is basically the same, no matter which installation source or method you prefer.
The installation program retrieves the location of the network installation source using OpenSLP and configures the network connection with DHCP. If the DHCP network configuration fails, you are prompted to enter the appropriate parameters manually. The installation then proceeds normally. 4 Finish the installation as if you had chosen to install from physical media.
37
1 Set up an installation server as described in Section 4.2, Setting Up the Server Holding the Installation Sources (page 78). 2 Insert the first CD or DVD of the media kit into the corresponding drive then reboot the machine. 3 At the boot screen, select Installation and use the boot options prompt to pass additional information, such as: Location of the installation server:
install=protocol:inst_source
Replace protocol with the protocol prefix for the service used by the installation server (nfs, http, or ftp). Replace inst_source with the IP address of the installation server. Network configuration parameters if your setup does not support DHCP configuration (see Section 4.4.3, Using Custom Boot Options (page 99) for reference). 4 Press Enter to boot for installation. If no network parameters have been specified at the boot options prompt, the installation routines try to set up the network using DHCP. If this fails, you are prompted for these parameters. After you have provided them, the installation proceeds. 5 Finish the installation as if you had chosen to install from the physical media.
38
InstallationACPI Disabled If the normal installation fails, this might be due to the system hardware not supporting ACPI (advanced configuration and power interface). If this seems to be the case, use this option to install without ACPI support. InstallationSafe Settings Boots the system with the DMA mode (for CD-ROM drives) and power management functions disabled. Experts can also use the command line to enter or change kernel parameters. Use the function keys indicated in the bar at the bottom of the screen to change a number of installation settings.
F1
Get context-sensitive help for the active element of the boot screen.
F2
Select various graphical display modes for the installation. Select the text mode if the graphical installation causes problems.
F4
Normally, the installation is performed from the inserted installation medium. Here, select other sources, like FTP or NFS servers. If the installation is carried out in a network with an SLP server, select one of the installation sources available on the server with this option. Information about SLP is available in Chapter 32, SLP Services in the Network (page 619).
F5
Use this to tell the system that you have an optional disk with a driver update for SUSE Linux Enterprise Server. You will be asked to insert the update disk at the appropriate point in the installation process. A few seconds after starting the installation, SUSE Linux Enterprise loads a minimal Linux system to run the installation procedure. If you want to know what is going on during the boot process, press Esc to see messages and copyright notices scroll by. At the end of the loading process, the YaST installation program starts. After a few more seconds, the screen should display the graphical installer.
39
The actual installation of SUSE Linux Enterprise begins at this point. All YaST screens have a common layout. All buttons, entry fields, and lists can be accessed with the mouse or the keyboard. If your mouse pointer does not move, the mouse has not been detected automatically. In this case, use the keyboard for the time being. Navigation with the keyboard is similar to the description in Section 7.11.1, Navigation in Modules (page 185).
40
Now specify the DASDs to use for the installation by selecting the corresponding entries in the list then clicking Select or Deselect. After that, activate and make the DASDs available for the installation by selecting Perform Action Activate (see Figure 3.2, IBM System z: Activating a DASD (page 41)). To format the DASDs, select Perform Action Format right away or use the YaST partitioner later as described in Section Partitioning with YaST (page 46). Figure 3.2 IBM System z: Activating a DASD
41
To use ZFCP disks for the SUSE Linux Enterprise Server installation, select Configure ZFCP Disks in the selection dialog. This opens a dialog with a list of the ZFCP disks available on the system. In this dialog, select Add to open another dialog in which to enter ZFCP parameters (see Figure 3.3, IBM System z: Overview of Available ZFCP Disks (page 42)). To make a ZFCP disk available for the SUSE Linux Enterprise Server installation, use the entry fields Channel Number, WWPN (World Wide Port Number), and FCP-LUN to specify the parameters identifying the corresponding disk. When you are done, exit the ZFCP dialog with Next and the general hard disk configuration dialog with Finish to continue with the rest of the configuration.
42
43
3.9.1 Partitioning
In most cases, YaST proposes a reasonable partitioning scheme that can be accepted without change. YaST can also be used to customize the partitioning. This section describes the necessary steps.
Partition Types
TIP: IBM System z: Hard Disks On the IBM System z platforms, SUSE Linux Enterprise Server supports SCSI hard disks as well as DASDs (direct access storage devices). While SCSI disks can be partitioned as described below, DASDs can have no more than three partition entries in their partition tables. Every hard disk has a partition table with space for four entries. An entry in the partition table can correspond to a primary partition or an extended partition. Only one extended partition entry is allowed, however.
44
A primary partition simply consists of a continuous range of cylinders (physical disk areas) assigned to a particular operating system. With primary partitions only, you would be limited to four partitions per hard disk, because more do not fit in the partition table. This is why extended partitions are used. Extended partitions are also continuous ranges of disk cylinders, but an extended partition may itself be subdivided into logical partitions. Logical partitions do not require entries in the partition table. In other words, an extended partition is a container for logical partitions. If you need more than four partitions, create an extended partition as the fourth partition or earlier. This extended partition should span the entire remaining free cylinder range. Then create multiple logical partitions within the extended partition. The maximum number of logical partitions is 15 on SCSI, SATA, and Firewire disks and 63 on (E)IDE disks. It does not matter which types of partitions are used for Linux. Primary and logical partitions both work fine. TIP: Hard Disks with a GPT Disk Label For architectures using the GPT disk label, the number of primary partitions is not restricted. Consequently, there are no logical partitions.
The partitions to create depend on the available space. The following are some basic partitioning guidelines: Up to 4 GB: One partition for the swap space and one root partition (/). In this case, the root partition must allow for those directories that often reside on their own partitions if more space is available. 4 GB or More: A swap partition, a root partition (1 GB), and one partition each for the following directories as needed: /usr (4 GB or more), /opt (4 GB or more), and /var (1 GB). If you do not want to have separate partitions for these directories, add the suggested disk space to the root partition. The rest of the available space can be used for /home. Depending on the hardware, it might also be useful to create a boot partition (/boot) to hold the boot mechanism and the Linux kernel. This partition should be located at the start of the disk and should be at least 8 MB or one cylinder. As a rule of thumb, always create such a partition if it was included in YaST's original proposal. If you are unsure about this, create a boot partition to be on the safe side. You should also be aware that some (mostly commercial) programs install their data in /opt. Therefore, either create a separate partition for /opt or make the root partition large enough.
46
The next step is to determine whether the entire disk should be used (Use Entire Hard Disk) or whether to use any existing partitions (if available) for the installation. If a Windows operating system was found on the disk, you are asked whether to delete or resize the partition. Before doing so, read Section Resizing a Windows Partition (page 47). If desired, go to the Expert Partitioner dialog to create a custom partition setup as described in Section 7.5.8, Partitioner (page 161). WARNING: Using the Entire Hard Disk for Installation If you choose Use Entire Hard Disk, all existing data on that disk is completely erased later in the installation process and is then lost. YaST checks during the installation whether the disk space is sufficient for the software selection made. If not, YaST automatically changes the software selection. The proposal dialog displays a notice to inform you about this. As long as there is sufficient disk space available, YaST simply accepts your settings and partitions the hard disk accordingly.
47
If you select Delete Windows Completely, the Windows partition is marked for deletion and the space is used for the installation of SUSE Linux Enterprise. WARNING: Deleting Windows If you delete Windows, all data will be lost beyond recovery as soon as the formatting starts. To shrink the Windows partition, interrupt the installation and boot Windows to prepare the partition from there. Although this step is not strictly required for FAT partitions, it speeds up the resizing process and also makes it safer. These steps are vital for NTFS partitions. FAT File System In Windows, first run scandisk to make sure that the FAT partition is free of lost file fragments and crosslinks. After that, run defrag to move files to the beginning of the partition. This accelerates the resizing procedure in Linux. If you have optimized virtual memory settings for Windows so a contiguous swap file is used with the same initial (minimum) and maximum size limit, consider another step. With these Windows settings, the resizing might split the swap file into
48
many small parts scattered all over the FAT partition. Also, the entire swap file would need to be moved during the resizing, which makes the process rather slow. It is therefore useful to disable these Windows optimizations for the time being and reenable them after the resizing has been completed. NTFS File System In Windows, run scandisk and defrag to move the files to the beginning of the hard disk. In contrast to the FAT file system, you must perform these steps. Otherwise the NTFS partition cannot be resized. IMPORTANT: Disabling the Windows Swap File If you operate your system with a permanent swap file on an NTFS file system, this file may be located at the end of the hard disk and remain there despite defrag. Therefore, it may be impossible to shrink the partition sufficiently. In this case, temporarily deactivate the swap file (the virtual memory in Windows). After the partition has been resized, reconfigure the virtual memory. After these preparations, return to the Linux partitioning setup and select Shrink Windows Partition. After a quick check of the partition, YaST opens a dialog with a suggestion for resizing the Windows partition. Figure 3.6 Resizing the Windows Partition
49
The first bar graph shows how much disk space is currently occupied by Windows and how much space is still available. The second bar graph shows how the space would be distributed after the resizing, according to YaST's current proposal. See Figure 3.6, Resizing the Windows Partition (page 49). Accept the proposed settings or use the slider to change the partition sizing (within certain limits). If you leave this dialog by selecting Next, the settings are stored and you are returned to the previous dialog. The actual resizing takes place later, before the hard disk is formatted. IMPORTANT: Windows Systems Installed on NTFS Partitions By default, the Windows versions NT, 2000, and XP use the NTFS file system. Unlike FAT file systems, NTFS file systems can only be read from Linux. This means you can read your Windows files from Linux, but you cannot edit them. If you want write access to your Windows data and do not need the NTFS file system, reinstall Windows on a FAT32 file system. In this case, you will have full access to your Windows data from SUSE Linux Enterprise.
3.9.2 Software
SUSE Linux Enterprise contains a number of software packages for various application purposes. Click Software in the suggestion window to start the software selection and modify the installation scope according to your needs. Select your categories from the list in the middle and see the description in the right window. Each category contains a number of software packages that meet most requirements for that category. For more detailed selection of software packages to install, select Details to switch to the YaST Package Manager. See Figure 3.7, Installing and Removing Software with the YaST Package Manager (page 51). NOTE: Default Desktop The default desktop of SUSE Linux Enterprise is GNOME. To install KDE, click Software and select KDE Desktop Environment from Graphical Environments.
50
Figure 3.7 Installing and Removing Software with the YaST Package Manager
51
listing all the possible status settings. To learn more about them, read the detailed description of this module in Section 7.3.1, Installing and Removing Software (page 139).
Other Filters
Click the filter selection box to view the other possible filters. The selection according to Package Groups can also be used for the installation. This filter sorts the program packages by subjects in a tree structure to the left. The more you expand the branches, the more specific the selection of packages is and the fewer packages are displayed in the list of associated packages to the right. Use Search to search for a specific package. This is explained in detail in Section 7.3.1, Installing and Removing Software (page 139).
3.9.3 Language
The language was selected at the beginning of the installation as described in Section 3.4, Language Selection (page 40). However, you can change this setting here and also select any additional languages to install on your system. In the upper part of this dialog, select the primary language. This is the language that will be activated after installation.
52
Adapt your keyboard and time zone settings to the selected primary language by selecting those options, if desired. Optionally, use Details to set the language for the user root. There are three options: ctype only The value of the variable LC_CTYPE in the file /etc/sysconfig/language is adopted for the user root. This sets the localization for language-specific function calls. yes The user root has the same language settings as the local user. no The language settings for the user root are not affected by the language selection. All locale variables are unset. Make the setting for the locale explicitly with Detailed Locale Setting. The list in the lower part of the language dialog allows for selection of additional languages to install. For all the languages selected in this list, YaST checks if there are any language-specific packages for any packages in your current software selection. If so, these packages are installed. Click Accept to complete the configuration.
3.9.4 System
This dialog presents all the hardware information YaST could obtain about your computer. Select any item in the list and click Details to see detailed information about the selected item. You may also add PCI IDs to device drivers with this dialog.
53
Select the keyboard layout from the list. By default, the layout corresponds to the selected language. After changing the layout, test the characters that are special to the selected language layout to make sure that the selection is correct. To set special options regarding keyboard behavior, click Expert Settings. Find more information about that in Section 7.4.8, Keyboard Layout (page 155). When finished, click Accept to return to the installation settings dialog.
3.9.6 Booting
TIP: IBM System z: Boot Loader Configuration The module described below cannot be used to configure the boot loader (zipl) on the IBM System z platforms. During the installation, YaST proposes a boot configuration for your system. Normally, you can leave these settings unchanged. However, if you need a custom setup, modify the proposal for your system. One possibility is to configure the boot mechanism to rely on a special boot floppy. Although this has the disadvantage that it requires the floppy to be in the drive when booting, it leaves an existing boot mechanism untouched. Normally this should not be necessary, however, because YaST can configure the boot loader to boot other existing operating systems as well. Another possibility with the configuration is to change the location of the boot mechanism on the hard disk. To change the boot configuration proposed by YaST, select Booting to open a dialog in which to change many details of the boot mechanism. For information, read Section 21.3, Configuring the Boot Loader with YaST (page 411).
54
Using X to Connect
When IPLing the installed system, make sure that the X server used for the first phase of the installation is still available. YaST opens on this X server to finish the installation.
56
A message in the 3270 terminal asks you to connect to the Linux system with an SSH client. This message is easily missed, however, because it is mixed with kernel messages and because the terminal process might quit before you become aware of the message. Now perform the following steps to complete the installation: 1 Use SSH to log into the Linux system as root. If the connection is denied or times out, wait a few minutes then try again. 2 Execute the command /usr/lib/YaST2/startup/YaST2.ssh. yast does not suffice in this case. After that, YaST starts to complete the installation of the remaining packages and create an initial system configuration.
3.10 Configuration
After completing the basic system setup and the installation of all selected software packages, provide a password for the account of the system administrator (the root user). You can then configure your Internet access and network connection. With a working Internet connection, you can perform an update of the system as part of the installation. You can also configure an authentication server for centralized user administration in a local network. Finally, configure the hardware devices connected to the machine.
3.10.1 Hostname
The hostname is the computer's name in the network. The fully qualified domain name, needed here, includes the name of the domain to which the computer belongs. Each server and client in the network should have a unique hostname. If you are located in a local network, you might receive your hostname over DHCP, in which case you should not modify the name. To receive the hostname over DHCP, select Change Hostname via DHCP.
57
58
NOTE: Network Devices and Update If you skip the network device configuration, your system will be offline and unable to retrieve any available updates or include them in the installation. As well as device configuration, configure network accessibilityrelated settings: Firewall Configuration When you connect to a network, a firewall is started automatically on the configured interface. The configuration proposal for the firewall is updated automatically every time the configuration of the interfaces or services is modified. To adapt the automatic settings to your own preferences, click Change Firewall. In the dialog that opens, determine whether the firewall should be started. If you do not want the firewall to be started, select the appropriate option and exit the dialog. To start and configure the firewall, click Next for a series of dialogs similar to those described in Section 44.4.1, Configuring the Firewall with YaST (page 834). VNC Remote Administration To administer your machine remotely by VNC, click Change VNC Remote Administration, enable remote administration, and open the port in the firewall. If you have multiple network devices and want to select on which to open the port, click Firewall Details and select the network device. You can also use SSH, a more secure option, for remote administration. Proxy If you have a proxy server in your network to control access to the network, enter the server name and all other required information to enable access to the Internet.
59
Back to return in the previous dialog and correct the configuration or skip the test. If you need more information about the test process, click View Logs. If you do not want to test the connection at this point, select No, Skip This Test then Next. This also skips downloading product updates and release notes. If you have multiple network interfaces in your system, verify that the the right card is used to connect to the Internet. To do so, click Change device.
3.10.6 Service
After testing the Internet connection and downloading the first updates, a dialog opens in which to enable and configure two important network services. See Figure 3.8, Proposed Setup for Network Services (page 61).
60
CA Management The purpose of a CA (certificate authority) is to guarantee a trust relationship among all network services communicating with each other. If you decide that you do not want to establish a CA, secure server communications with SSL and TLS, but separately for each individual service. By default, a CA is created and enabled during the installation. Find details about the creation of a CA with YaST in Chapter 43, Managing X.509 Certification (page 813) together with some background information. LDAP Server You can run an LDAP service on your host to have a central facility managing a range of configuration files. Typically, an LDAP server handles user account data, but with SUSE Linux Enterprise Server it can also be used for mail, DHCP, and DNS related data. By default, an LDAP server is set up during the installation. If you decide against the use of an LDAP server, the YaST mail server module will not work because it depends on LDAP functionality. Nevertheless, you can still set up a mail server on your system with the help of the Mail Transfer Agent module. Find details about LDAP and its configuration with YaST in Chapter 37, LDAPA Directory Service (page 681).
61
Like the general network configuration, you can skip this configuration proposal for now. After the installation is finished, you can still configure and start the same services with the help of YaST.
3.10.7 Users
This step has two parts. In the first part, choose the user authentication method. The second part depends on the selected authentication method.
User Authentication
If network access was configured successfully during the previous steps of the installation, you now have four possibilities for managing user accounts on your system. Local (/etc/passwd) Users are administered locally on the installed host. This is a suitable option for stand-alone workstations. User data is managed by the local file /etc/passwd. All users who are entered in this file can log in to the system even if no network is available. LDAP Users are administered centrally on an LDAP server for all systems in the network. NIS Users are administered centrally on a NIS server for all systems in the network. Windows Domain SMB authentication is often used in mixed Linux and Windows networks. NOTE: Content of the Authentication Menu If you use the custom package selection and one or more authentication methods are missing from the menu, you probably did not select the packages required for it. If all requirements are met, YaST opens a dialog in which to select the user administration method. If you do not have the necessary network connection, create local user accounts.
62
A local user account can be created using the dialog shown in Figure 3.9, Entering the Username and Password (page 63). After entering the first name and last name, specify a username (login). Click Suggestion for the system to generate a username automatically. Finally, enter a password for the user. Reenter it for confirmation (to ensure that you did not type something else by mistake).
63
To provide effective security, a password should be between five and eight characters long. The maximum length for a password is 128 characters. However, if no special security modules are loaded, only the first eight characters are used to discern the password. Passwords are case-sensitive. Special characters like umlauts are not allowed. Other special characters (7-bit ASCII) and the digits 0 to 9 are allowed. Two additional options are available for local users: Receive System Messages via E-Mail Checking this box sends the user messages created by the system services. These are usually only sent to root, the system administrator. This option is useful for the most frequently used account, because it is highly recommended to log in as root only in special cases. Automatic Login This option is only available if KDE is used as the default desktop. It automatically logs the current user into the system when it starts. This is mainly useful if the computer is operated by only one user. For automatic login to work, the option must be explicitly enabled. WARNING: Automatic Login With the automatic login enabled, the system boots straight into your desktop with no authentication at all. If you store sensitive data on your system, you should not enable this option if the computer can also be accessed by others. Click User Management to create more than one user. Refer to Section 7.9.1, User Management (page 177) for more information about user management.
dress. Choose the appropriate base DN from the search results given by YaST. If TLS or SSL protected communication with the server is required, select LDAP TLS/SSL. If the LDAP server still uses LDAPv2, explicitly enable the use of this protocol version by selecting LDAP Version 2. Select Start Automounter to mount remote directories on your client, such as a remotely managed home directory. Click Finish to apply your settings. LDAP client configuration is discussed in further detail in Section 37.6, Configuring an LDAP Client with YaST (page 698).
65
user logging in to the domain from your local machine. Click Finish to apply your settings and provide the necessary credentials.
3.10.8 Cleanup
This step does not require any user interaction. The installation program launches the SuSEconfig script to write the system configuration. Depending on the CPU and the amount of memory, this process can take some time.
67
Remote Installation
SUSE Linux Enterprise can be installed in several different ways. As well as the usual CD or DVD installation covered in Chapter 3, Installation with YaST (page 35), you can choose from various network-based approaches or even take a completely hands-off approach to the installation of SUSE Linux Enterprise. Each method is introduced by means of two short check lists: one listing the prerequisites for this method and the other illustrating the basic procedure. More detail is then provided for all the techniques used in these installation scenarios. NOTE In the following sections, the system to hold your new SUSE Linux Enterprise installation is referred to as target system or installation target. The term installation source is used for all sources of installation data. This includes physical media, such as CD and DVD, and network servers distributing the installation data in your network.
IMPORTANT The configuration of the X Window System is not part of any remote installation process. After the installation has finished, log in to the target system as root, enter telinit 3, and start SaX2 to configure the graphics hardware as described in Section 27.1, X11 Setup with SaX2 (page 495).
70
2 Boot the target system using the first CD or DVD of the SUSE Linux Enterprise media kit. 3 When the boot screen of the target system appears, use the boot options prompt to set the appropriate VNC options and the address of the installation source. This is described in detail in Section 4.4, Booting the Target System for Installation (page 97). The target system boots to a text-based environment, giving the network address and display number under which the graphical installation environment can be addressed by any VNC viewer application or browser. VNC installations announce themselves over OpenSLP and can be found using Konqueror in service:/ or slp:/ mode. 4 On the controlling workstation, open a VNC viewing application or Web browser and connect to the target system as described in Section 4.5.1, VNC Installation (page 101). 5 Perform the installation as described in Chapter 3, Installation with YaST (page 35). Reconnect to the target system after it reboots for the final part of the installation. 6 Finish the installation.
Remote Installation
71
Controlling system with working network connection and VNC viewer software or Java-enabled browser (Firefox, Konqueror, Internet Explorer, or Opera) Physical boot medium (CD, DVD, or custom boot disk) for booting the target system Running DHCP server providing IP addresses To perform this kind of installation, proceed as follows: 1 Set up the installation source as described in Section 4.2, Setting Up the Server Holding the Installation Sources (page 78). Choose an NFS, HTTP, or FTP network server. For an SMB installation source, refer to Section 4.2.5, Managing an SMB Installation Source (page 85). 2 Boot the target system using the first CD or DVD of the SUSE Linux Enterprise media kit. 3 When the boot screen of the target system appears, use the boot options prompt to set the appropriate VNC options and the address of the installation source. This is described in detail in Section 4.4, Booting the Target System for Installation (page 97). The target system boots to a text-based environment, giving the network address and display number under which the graphical installation environment can be addressed by any VNC viewer application or browser. VNC installations announce themselves over OpenSLP and can be found using Konqueror in service:/ or slp:/ mode. 4 On the controlling workstation, open a VNC viewing application or Web browser and connect to the target system as described in Section 4.5.1, VNC Installation (page 101). 5 Perform the installation as described in Chapter 3, Installation with YaST (page 35). Reconnect to the target system after it reboots for the final part of the installation. 6 Finish the installation.
72
Remote Installation
73
5 Initiate the boot process of the target system using Wake on LAN. This is described in Section 4.3.7, Wake on LAN (page 96). 6 On the controlling workstation, open a VNC viewing application or Web browser and connect to the target system as described in Section 4.5.1, VNC Installation (page 101). 7 Perform the installation as described in Chapter 3, Installation with YaST (page 35). Reconnect to the target system after it reboots for the final part of the installation. 8 Finish the installation.
74
To perform this kind of installation, proceed as follows: 1 Set up the installation source as described in Section 4.2, Setting Up the Server Holding the Installation Sources (page 78). Choose an NFS, HTTP, or FTP network server. For an SMB installation source, refer to Section 4.2.5, Managing an SMB Installation Source (page 85). 2 Boot the target system using the first CD or DVD of the SUSE Linux Enterprise media kit. 3 When the boot screen of the target system appears, use the boot options prompt to set the appropriate parameters for network connection, address of the installation source, and SSH enablement. This is described in detail in Section 4.4.3, Using Custom Boot Options (page 99). The target system boots to a text-based environment, giving the network address under which the graphical installation environment can be addressed by any SSH client. 4 On the controlling workstation, open a terminal window and connect to the target system as described in Section Connecting to the Installation Program (page 104). 5 Perform the installation as described in Chapter 3, Installation with YaST (page 35). Reconnect to the target system after it reboots for the final part of the installation. 6 Finish the installation.
Remote Installation
75
Remote installation source: NFS, HTTP, FTP, or SMB with working network connection Target system with working network connection Controlling system with working network connection and working SSH client software Physical boot medium (CD or DVD) for booting the target system Running DHCP server providing IP addresses To perform this kind of installation, proceed as follows: 1 Set up the installation source as described in Section 4.2, Setting Up the Server Holding the Installation Sources (page 78). Choose an NFS, HTTP, or FTP network server. For an SMB installation source, refer to Section 4.2.5, Managing an SMB Installation Source (page 85). 2 Boot the target system using the first CD or DVD of the SUSE Linux Enterprise media kit. 3 When the boot screen of the target system appears, use the boot options prompt to pass the appropriate parameters for network connection, location of the installation source, and SSH enablement. See Section 4.4.3, Using Custom Boot Options (page 99) for detailed instructions on the use of these parameters. The target system boots to a text-based environment, giving you the network address under which the graphical installation environment can be addressed by any SSH client. 4 On the controlling workstation, open a terminal window and connect to the target system as described in Section Connecting to the Installation Program (page 104). 5 Perform the installation as described in Chapter 3, Installation with YaST (page 35). Reconnect to the target system after it reboots for the final part of the installation. 6 Finish the installation.
76
Remote Installation
77
6 On the controlling workstation, start an SSH client and connect to the target system as described in Section 4.5.2, SSH Installation (page 103). 7 Perform the installation as described in Chapter 3, Installation with YaST (page 35). Reconnect to the target system after it reboots for the final part of the installation. 8 Finish the installation.
78
4 Select the server type (HTTP, FTP, or NFS). The selected server service is started automatically every time the system starts. If a service of the selected type is already running on your system and you want to configure it manually for the server, deactivate the automatic configuration of the server service with Do Not Configure Any Network Services. In both cases, define the directory in which the installation data should be made available on the server. 5 Configure the required server type. This step relates to the automatic configuration of server services. It is skipped when automatic configuration is deactivated. Define an alias for the root directory of the FTP or HTTP server on which the installation data should be found. The installation source will later be located under ftp://Server-IP/Alias/Name (FTP) or under http://Server-IP/Alias/Name (HTTP). Name stands for the name of the installation source, which is defined in the following step. If you selected NFS in the previous step, define wild cards and export options. The NFS server will be accessible under nfs://Server-IP/Name. Details of NFS and exports can be found in Chapter 39, Sharing File Systems with NFS (page 725). 6 Configure the installation source. Before the installation media are copied to their destination, define the name of the installation source (ideally, an easily remembered abbreviation of the product and version). YaST allows providing ISO images of the media instead of copies of the installation CDs. If you want this, activate the relevant check box and specify the directory path under which the ISO files can be found locally. Depending on the product to distribute using this installation server, it might be that more add-on CDs or service pack CDs are required to install the product completely. If you activate Prompt for Additional CDs, YaST automatically reminds you to supply these media. To announce your installation server in the network via OpenSLP, activate the appropriate option. TIP Consider announcing your installation source via OpenSLP if your network setup supports this option. This saves you from entering the network installation path on every target machine. The target systems are just booted using the SLP boot option and find the network installation source without any further configuration. For details on this option, refer to Section 4.4, Booting the Target System for Installation (page 97).
Remote Installation
79
7 Upload the installation data. The most lengthy step in configuring an installation server is copying the actual installation CDs. Insert the media in the sequence requested by YaST and wait for the copying procedure to end. When the sources have been fully copied, return to the overview of existing information sources and close the configuration by selecting Finish. Your installation server is now fully configured and ready for service. It is automatically started every time the system is started. No further intervention is required. You only need to configure and start this service correctly by hand if you have deactivated the automatic configuration of the selected network service with YaST as an initial step. To deactivate an installation source, select Change in the overview to reach a list of all available installation sources. Choose the entry to remove then select Delete. This delete procedure only relates to the deactivation of the server service. The installation data itself remains in the directory chosen. However, you can remove it manually. If your installation server should provide the installation data for more than one product of product version, start the YaST installation server module and select Configure in the overview of existing installation sources to configure the new installation source.
80
Replace product with an abbreviation of the product name and productversion with a string that contains the product name and version. 3 For each CD contained in the media kit execute the following commands: a Copy the entire content of the installation CD into the installation server directory:
cp -a /media/path_to_your_CD-ROM_drive .
Replace path_to_your_CD-ROM_drive with the actual path under which your CD or DVD drive is addressed. Depending on the type of drive used in your system, this can be cdrom, cdrecorder, dvd, or dvdrecorder. b Rename the directory to the CD number:
mv path_to_your_CD-ROM_drive CDx
Replace x with the actual number of your CD. On SUSE Linux and SUSE Linux Enterprise Server you can export the installation sources via NFS using YaST. Proceed as follows: 1 Log in as root. 2 Start YaST Network Services NFS Server. 3 Select Start NFS Server and Open Port in Firewall and click Next. 4 Select Add Directory and enter the path to the directory holding the installation data. In this case, it is /productversion. 5 Select Add Host and enter the hostnames of the machines to which to export the installation data. Instead of specifying hostnames here, you could also use wild cards, ranges of network addresses, or just the domain name of your network. Enter the appropriate export options or leave the default, which works fine in most setups. For more information about the syntax used in exporting NFS shares, read the exports man page. 6 Click Finish. The NFS server holding the SUSE Linux Enterprise installation sources is automatically started and integrated into the boot process. Remote Installation 81
If you prefer manually exporting the installation sources via NFS instead of using the YaST NFS Server module, proceed as follows: 1 Log in as root. 2 Open the file /etc/exports and enter the following line:
/productversion *(ro,root_squash,sync)
This exports the directory /productversion to any host that is part of this network or to any host that can connect to this server. To limit the access to this server, use netmasks or domain names instead of the general wild card *. Refer to the export man page for details. Save and exit this configuration file. 3 To add the NFS service to the list of servers started during system boot, execute the following commands:
insserv /etc/init.d/nfsserver insserv /etc/init.d/portmap
4 Start the NFS server with rcnfsserver start. If you need to change the configuration of your NFS server later, modify the configuration file and restart the NFS daemon with rcnfsserver restart. Announcing the NFS server via OpenSLP makes its address known to all clients in your network. 1 Log in as root. 2 Enter the directory /etc/slp.reg.d/. 3 Create a configuration file called install.suse.nfs.reg containing the following lines:
# Register the NFS Installation Server service:install.suse:nfs://$HOSTNAME/path_instsource/CD1,en,65535 description=NFS Installation Source
Replace path_instsource with the actual path to the installation source on your server. 4 Save this configuration file and start the OpenSLP daemon with rcslpd start.
82
For more information about OpenSLP, refer to the package documentation located under /usr/share/doc/packages/openslp/ or refer to Chapter 32, SLP Services in the Network (page 619).
c Create a subdirectory holding the installation sources in the FTP root directory:
mkdir instsource
Replace instsource with the product name. d Copy the contents of all installation CDs into the FTP server's root directory (similar to the procedure described in Section 4.2.2, Setting Up an NFS Installation Source Manually (page 80), Step 3 (page 81)). Alternatively, mount the contents of the already existing installation repository into the change root environment of the FTP server:
mount --bind path_to_instsource /srv/ftp/instsource
Replace path_to_instsource and instsource with values matching your setup. If you need to make this permanent, add it to /etc/ fstab.
Remote Installation
83
e Start pure-ftpd with pure-ftpd &. 3 Announce the installation source via OpenSLP, if this is supported by your network setup: a Create a configuration file called install.suse.ftp.reg under /etc/ slp/reg.d/ that contains the following lines:
# Register the FTP Installation Server service:install.suse:ftp://$HOSTNAME/srv/ftp/instsource/CD1,en,65535 description=FTP Installation Source
Replace instsource with the actual name to the installation source directory on your server. The service: line should be entered as one continuous line. b Save this configuration file and start the OpenSLP daemon with rcslpd start.
c Create a symbolic link from the location of the installation sources to the root directory of the Web server (/srv/www/htdocs):
ln -s /path_instsource /srv/www/htdocs/instsource
d Modify the configuration file of the HTTP server (/etc/apache2/ default-server.conf) to make it follow symbolic links. Replace the following line:
Options None
with
Options Indexes FollowSymLinks
e Reload the HTTP server configuration using rcapache2 reload. 3 Announce the installation source via OpenSLP, if this is supported by your network setup: a Create a configuration file called install.suse.http.reg under /etc/slp/reg.d/ that contains the following lines:
# Register the HTTP Installation Server service:install.suse:http://$HOSTNAME/srv/www/htdocs/instsource/CD1/,en,65535 description=HTTP Installation Source
Replace path_to_instsource with the actual path to the installation source on your server. The service: line should be entered as one continuous line. b Save this configuration file and start the OpenSLP daemon using rcslpd restart.
Remote Installation
85
1 Log in to your Windows machine. 2 Start Explorer and create a new folder that will hold the entire installation tree and name it INSTALL, for example. 3 Export this share according the procedure outlined in your Windows documentation. 4 Enter this share and create a subfolder, called product. Replace product with the actual product name. 5 Copy the contents of all SUSE Linux Enterprise CDs or DVDs to the INSTALL/ product directory. To use a SMB mounted share as installation source, proceed as follows: 1 Boot the installation target. 2 Select Installation. 3 Press
F4
4 Choose SMB and enter the Windows machine's name or IP address, the share name (INSTALL, in this example), username, and password. After you hit
Enter
86
Remote Installation
87
Replace ip_of_the_tftp_server with the actual IP address of the TFTP server. For more information about the options available in dhcpd.conf, refer to the dhcpd.conf manual page. 3 Restart the DHCP server by executing rcdhcpd restart. If you plan on using SSH for the remote control of a PXE and Wake on LAN installation, explicitly specify the IP address DHCP should provide to the installation target. To achieve this, modify the above-mentioned DHCP configuration according to the following example:
group { # PXE related stuff # # "next server" defines the tftp server that will be used next server ip_tftp_server: # # "filename" specifies the pxelinux image on the tftp server # the server runs in chroot under /srv/tftpboot filename "pxelinux.0"; host test { hardware ethernet mac_address; fixed-address some_ip_address; } }
88
The host statement introduces the hostname of the installation target. To bind the hostname and IP address to a specific host, you must know and specify the system's hardware (MAC) address. Replace all the variables used in this example with the actual values that match your environment. After restarting the DHCP server, it provides a static IP to the host specified, enabling you to connect to the system via SSH.
Remote Installation
89
2 If unavailable, create /srv/tftpboot and /srv/tftpboot/pxelinux .cfg directories. 3 Add the appropriate files needed for the boot image as described in Section 4.3.3, Using PXE Boot (page 90). 4 Modify the configuration of xinetd located under /etc/xinetd.d/ to make sure that the TFTP server is started on boot: a If it does not exist, create a file called tftp under this directory with touch tftp. Then run chmod 755 tftp. b Open the file tftp and add the following lines:
service tftp { socket_type protocol wait user server server_args disable }
= = = = = = =
2 Install the syslinux package directly from your installation CDs or DVDs with YaST. 90 Installation and Administration
3 Copy the /usr/share/syslinux/pxelinux.0 file to the /srv/ tftpboot directory by entering the following:
cp -a /usr/share/syslinux/pxelinux.0 /srv/tftpboot
4 Change to the directory of your installation repository and copy the isolinux .cfg file to /srv/tftpboot/pxelinux.cfg/default by entering the following:
cp -a boot/loader/isolinux.cfg /srv/tftpboot/pxelinux.cfg/default
5 Edit the /srv/tftpboot/pxelinux.cfg/default file and remove the lines beginning with gfxboot, readinfo, and framebuffer. 6 Insert the following entries in the append lines of the default failsafe and apic labels: insmod=kernel module By means of this entry, enter the network kernel module needed to support network installation on the PXE client. Replace kernel module with the appropriate module name for your network device. netdevice=interface This entry defines the client's network interface that must be used for the network installation. It is only necessary if the client is equipped with several network cards and must be adapted accordingly. In case of a single network card, this entry can be omitted. install=nfs://ip_instserver/path_instsource/CD1 This entry defines the NFS server and the installation source for the client installation. Replace ip_instserver with the actual IP address of your installation server. path_instsource should be replaced with the actual path to the installation sources. HTTP, FTP, or SMB sources are addressed in a similar manner, except for the protocol prefix, which should read http, ftp, or smb. IMPORTANT If you need to pass other boot options to the installation routines, such as SSH or VNC boot parameters, append them to the install
Remote Installation
91
entry. An overview of parameters and some examples are given in Section 4.4, Booting the Target System for Installation (page 97). An example /srv/tftpboot/pxelinux.cfg/default file follows. Adjust the protocol prefix for the installation source to match your network setup and specify your preferred method of connecting to the installer by adding the vnc and vncpassword or the ssh and sshpassword options to the install entry. The lines separated by \ must be entered as one continuous line without a line break and without the \.
default linux # default label linux kernel linux append initrd=initrd ramdisk_size=65536 insmod=e100 \ install=nfs://ip_instserver/path_instsource/product # failsafe label failsafe kernel linux append initrd=initrd ramdisk_size=65536 ide=nodma apm=off acpi=off \ insmod=e100 install=nfs://ip_instserver/path_instsource/product # apic label apic kernel linux append initrd=initrd ramdisk_size=65536 apic insmod=e100 \ install=nfs://ip_instserver/path_instsource/product # manual label manual kernel linux append initrd=initrd ramdisk_size=65536 manual=1 # rescue label rescue kernel linux append initrd=initrd ramdisk_size=65536 rescue=1 # memory test label memtest kernel memtest # hard disk label harddisk kernel linux append SLX=0x202 implicit 0
92
message 1 100
Replace ip_instserver and path_instsource with the values used in your setup. The following section serves as a short reference to the PXELINUX options used in this setup. Find more information about the options available in the documentation of the syslinux package located under /usr/share/doc/ packages/syslinux/.
Remote Installation
93
Labels are mangled as if they were filenames and they must be unique after mangling. For example, the two labels v2.1.30 and v2.1.31 would not be distinguishable under PXELINUX because both mangle to the same DOS filename. The kernel does not have to be a Linux kernel; it can be a boot sector or a COMBOOT file. APPEND Append nothing. APPEND with a single hyphen as argument in a LABEL section can be used to override a global APPEND. LOCALBOOT type On PXELINUX, specifying LOCALBOOT 0 instead of a KERNEL option means invoking this particular label and causes a local disk boot instead of a kernel boot. Argument 0 4 Description Perform a normal boot Perform a local boot with the Universal Network Driver Interface (UNDI) driver still resident in memory Perform a local boot with the entire PXE stack, including the UNDI driver, still resident in memory
All other values are undefined. If you do not know what the UNDI or PXE stacks are, specify 0.
94
TIMEOUT time-out Indicates how long to wait at the boot prompt until booting automatically, in units of 1/10 second. The time-out is canceled as soon as the user types anything on the keyboard, assuming the user will complete the command begun. A time-out of zero disables the time-out completely (this is also the default). The maximum possible time-out value is 35996 (just less than one hour). PROMPT flag_val If flag_val is 0, displays the boot prompt only if Shift or Alt is pressed or Caps Lock or Scroll Lock is set (this is the default). If flag_val is 1, always displays the boot prompt.
F2 filename F1 filename ..etc... F9 filename F10filename
Displays the indicated file on the screen when a function key is pressed at the boot prompt. This can be used to implement preboot online help (presumably for the kernel command line options). For backward compatibility with earlier releases, F10 can be also entered as F0 . Note that there is currently no way to bind filenames to F11 and F12 .
Remote Installation
95
96
See the table below for a complete set of the options available. Table 4.1 Key
F1 F2
F Keys During Installation Available Options None All supported languages Default Value None English
Purpose Provide help Select the installation language Change screen resolution for installation
F3
F4
CD-ROM or DVD
F5
None
98
Replace all the values (...) in this string with the values appropriate for your setup. Table 4.2 Installation (Boot) Scenarios Used in This Chapter Parameters Needed for Booting Boot Options
Installation Scenario
Chapter 3, Installation with YaST (page 35) Section 4.1.1, Simple Remote Installation via VNCStatic Network Configuration (page 70)
None: system boots au- None needed tomatically Location of the installation server Network device IP address Netmask Gateway VNC enablement VNC password install=(nfs,http, ftp,smb)://path_to _instmedia netdevice=some _netdevice (only needed if several network devices are available) hostip=some_ip netmask=some _netmask gateway=ip_gateway vnc=1 vncpassword=some _password
Remote Installation
99
Installation Scenario
Parameters Needed for Booting Location of the installation server VNC enablement VNC password
Boot Options
Section 4.1.2, Simple Remote Installation via VNCDynamic Network Configuration (page 71)
install=(nfs,http, ftp,smb)://path_to _instmedia vnc=1 vncpassword=some _password Not applicable; process managed through PXE and DHCP
Section 4.1.3, Remote Installation via VNCPXE Boot and Wake on LAN (page 73)
Location of the installation server Location of the TFTP server VNC enablement VNC password Location of the installation server Network device IP address Netmask Gateway SSH enablement SSH password
Section 4.1.4, Simple Remote Installation via SSHStatic Network Configuration (page 74)
install=(nfs,http, ftp,smb)://path_to _instmedia netdevice=some _netdevice (only needed if several network devices are available) hostip=some_ip netmask=some _netmask gateway=ip_gateway usessh=1 sshpassword=some _password install=(nfs,http, ftp,smb)://path_to _instmedia usessh=1
Section 4.1.5, Simple Remote Installation via SSHDynamic Network Configuration (page 75)
100
Installation Scenario
Boot Options
sshpassword=some _password Section 4.1.6, Remote Installation via SSHPXE Boot and Wake on LAN (page 77) Location of the installation server Location of the TFTP server SSH enablement SSH password Not applicable; process managed through PXE and DHCP
TIP: More Information about linuxrc Boot Options Find more information about the linuxrc boot options used for booting a Linux system in /usr/share/doc/packages/linuxrc/linuxrc.html.
Remote Installation
101
1 Start the VNC viewer. 2 Enter the IP address and display number of the installation target as provided by the SLP browser or the installation program itself:
ip_address:display_number
A window opens on your desktop displaying the YaST screens as in a normal local installation. Using a Web browser to connect to the installation program makes you totally independent of any VNC software or the underlying operating system. As long as the browser application has Java support enabled, you can use any browser (Firefox, Internet Explorer, Konqueror, Opera, etc.) to perform the installation of your Linux system. To perform a VNC installation, proceed as follows: 1 Launch your preferred Web browser. 2 Enter the following at the address prompt:
http://ip_address_of_target:5801
3 Enter your VNC password when prompted to do so. The browser window now displays the YaST screens as in a normal local installation.
Remote Installation
103
Replace ip_address_of_target with the actual IP address of the installation target. 3 When prompted for a username, enter root. 4 When prompted for the password, enter the password that has been set with the SSH boot option. After you have successfully authenticated, a command line prompt for the installation target appears. 5 Enter yast to launch the installation program. A window opens showing the normal YaST screens as described in Chapter 3, Installation with YaST (page 35).
104
Automated Installation
AutoYaST allows you to install SUSE Linux Enterprise on a large number of machines in parallel. The AutoYaST technology offers great flexibility to adjust deployments to heterogeneous hardware. This chapter tells you how to prepare a simple automated installation and lay out an advanced scenario involving different hardware types and installation purposes.
Automated Installation
105
4 Determine and set up the boot scenario for autoinstallation as described in Section 5.1.4, Setting Up the Boot Scenario (page 111). 5 Pass the command line to the installation routines by adding the parameters manually or by creating an info file as described in Section 5.1.5, Creating the info File (page 113). 6 Start the autoinstallation process as described in Section 5.1.6, Initiating and Monitoring the Autoinstallation (page 116).
106
3 Select Tools Create Reference Control File to prepare AutoYaST to mirror the current system configuration into an AutoYaST profile. 4 As well as the default resources, like boot loader, partitioning, and software selection, you can add various other aspects of your system to the profile by checking the items in the list in Create a Reference Control File. 5 Click Create to have YaST gather all the system information and write it to a new profile. 6 To proceed, choose one of the following: If the profile is complete and matches your requirements, select File Save as and enter a filename for the profile, such as autoyast.xml. Modify the reference profile by selecting the appropriate configuration aspects (such as Hardware/Printer) from the tree view to the left and clicking Configure. The respective YaST module starts but your settings are written to the AutoYaST profile instead of applied to your system. When done, select File Save as and enter a suitable name for the profile. 7 Leave the AutoYaST module with File Exit.
Automated Installation
107
autoyast=file:// path
Makes the installation routines look for the control file in specified path (relative to source root directoryfile:/// autoyast.xml if in the top directory of a CD-ROM).
108
Parameter
Description
autoyast=device:// Makes the installation routines look for the control file on a storage device. Only path the device name is needed/dev/sda1 is wrong, use sda1 instead. autoyast=floppy:// Makes the installation routines look for the control file on a floppy in the floppy path drive. This option is especially useful, if you want to boot from CD-ROM. autoyast=nfs:// server/path autoyast=http:// server/path autoyast=https:// server/path autoyast=tftp:// server/path autoyast=ftp:// server/path Has the installation routines retrieve the control file from an NFS server. Has the installation routines retrieve the control file from an HTTP server. Has the installation routines retrieve the control file from an HTTPS server. Has the installation routines retrieve the control file from a TFTP server. Has the installation routines retrieve the control file from an FTP server.
Floppy
NFS
HTTP
HTTPS
TFTP
FTP
Replace the server and path placeholders with values matching your actual setup. AutoYaST includes a feature that allows binding certain profiles to the client's MAC address. Without having to alter the autoyast= parameter, you can have the same setup install several different instances using different profiles. To use this, proceed as follows: 1 Create separate profiles with the MAC address of the client as the filename and put them on the HTTP server that holds your AutoYaST profiles.
Automated Installation
109
2 Omit the exact path including the filename when creating the autoyast= parameter, for example:
autoyast=http://192.0.2.91/
3 Start the autoinstallation. YaST tries to determine the location of the profile in the following way: 1. YaST searches for the profile using its own IP address in uppercase hexadecimal, for example, 192.0.2.91 is C000025B. If this file is not found, YaST removes one hex digit and tries again. This action is repeated eight times until the file with the correct name is found. If that still fails, it tries looking for a file with the MAC address of the clients as the filename. The MAC address of the example client is 0080C8F6484C. If the MAC addressnamed file cannot be found, YaST searches for a file named default (in lowercase). An example sequence of addresses where YaST searches for the AutoYaST profile looks as follows:
C000025B C000025 C00002 C0000 C000 C00 C0 C 0080C8F6484C default
2. 3.
4.
110
Server Using YaST (page 78). Use an info file to pass the server's location to the installation routines.
Automated Installation
111
install=http://192.168.0.22/install/suse-enterprise/ \ autoyast=nfs://192.168.0.23/profiles/autoyast.xml
Replace the example IP addresses and paths with the data used in your setup.
112
A floppy holding both the profile and the info file or Access to the boot prompt of the target to enter the autoyast= parameter Boot and Install from Custom Media, Get the Profile from the Media If you just need to install a limited number of software packages and the number of targets is relatively low, creating your own custom CD holding both the installation data and the profile itself might prove a good idea, especially if no network is available in your setup.
Automated Installation
113
Keyword netdevice
Value The network device to use for network setup (for BOOTP/DHCP requests). Only needed if several network devices are available. When empty, the client sends a BOOTP request. Otherwise the client is configured using the specified data. Netmask. Gateway. Name server. Location of the the control file to use for the automatic installation, such as autoyast=http://192.168.2.1/profiles/. Location of the installation source, such as install=nfs://192.168.2.1/CDs/. If set to 1, enables VNC remote controlled installation. The password for VNC. If set to 1, enables SSH remote controlled installation.
hostip
install
If your autoinstallation scenario involves client configuration via DCHP and a network installation source and you want to monitor the installation process using VNC, your info would look like this:
autoyast:profile_source install:install_source vnc:1 vncpassword:some_password
If you prefer a static network setup at installation time, your info file would look like the following:
autoyast:profile_source \ install:install_source \ hostip:some_ip \
114
netmask:some_netmask \ gateway:some_gateway
The \ indicate that the line breaks have only been added for the sake of readability. All options must be entered as one continuous string. The info data can be made available to linuxrc in various different ways: As a file in the root directory of a floppy that is in the client's floppy drive at installation time. As a file in the root directory of the initial RAM disk used for booting the system provided either from custom installation media or via PXE boot. As part of the AutoYaST profile. In this case, the AutoYaST file needs to be called info to enable linuxrc to parse it. An example for this approach is given below. linuxrc looks for a string (start_linuxrc_conf) in the profile that represents the beginning of the file. If it is found, it parses the content starting from that string and finishes when the string end_linuxrc_conf is found. The options are stored in the profile as follows:
.... <install> .... <init> <info_file> <![CDATA[ # # Don't remove the following line: # start_linuxrc_conf # install: nfs:server/path vnc: 1 vncpassword: test autoyast: file:///info # end_linuxrc_conf # Do not remove the above comment # ]]> </info_file> </init> ...... </install> ....
Automated Installation
115
linuxrc loads the profile containing the boot parameters instead of the traditional info file. The install: parameter points to the location of the installation sources. vnc and vncpassword indicate the use of VNC for installation monitoring. The autoyast parameter tells linuxrc to treat info as an AutoYaST profile.
116
Automated Installation
117
To prepare for a rule-based AutoYaST mass installation, proceed as follows: 1 Create several AutoYaST profiles that contain the installation details needed for your heterogeneous setup as described in Section 5.1.1, Creating an AutoYaST Profile (page 106). 2 Define rules to match the system attributes of your hardware setup as shown in Section 5.2.2, Example Scenario for Rule-Based Autoinstallation (page 118). 3 Determine the source of the AutoYaST profile and the parameter to pass to the installation routines as described in Section 5.1.2, Distributing the Profile and Determining the autoyast Parameter (page 108). 4 Determine the source of the SUSE Linux Enterprise installation data as described in Section 5.1.3, Providing the Installation Data (page 110) 5 Pass the command line to the installation routines by adding the parameters manually or by creating an info file as described in Section 5.1.5, Creating the info File (page 113). 6 Determine and set up the boot scenario for autoinstallation as described in Section 5.1.4, Setting Up the Boot Scenario (page 111). 7 Start the autoinstallation process as described in Section 5.1.6, Initiating and Monitoring the Autoinstallation (page 116).
118
Workstations in the Engineering Department These machines need a desktop environment and a broad set of development software. Laptops in the Sales Department These machines need a desktop environment and a limited set of specialized applications, such as office and calendaring software.
Automated Installation
119
Sales Profile
Merge Process
Print Server
120
In a first step, use one of the methods outlined in Section 5.1.1, Creating an AutoYaST Profile (page 106) to create profiles for each use case. In this example, you would create print.xml, engineering.xml, and sales.xml. In the second step, create rules to distinguish the three hardware types from one another and to tell AutoYaST which profile to use. Use an algorithm similar to the following to set up the rules: 1. 2. 3. Does the machine have an IP of 192.168.27.11? Then make it the print server. Does the machine have PCMCIA hardware and feature an Intel chipset? Then consider it an Intel laptop and install the sales department software selection. If none of the above is true, consider the machine a developer workstation and install accordingly.
Roughly sketched, this translates into a rules.xml file with the following content:
<?xml version="1.0"?> <!DOCTYPE autoinstall SYSTEM "/usr/share/autoinstall/dtd/rules.dtd"> <autoinstall xmlns="http://www.suse.com/1.0/yast2ns" xmlns:config="http://www.suse.com/1.0/configns"> <rules config:type="list"> <rule> <hostaddress> <match>192.168.27.11</match> <match_type>exact</match_type> </hostaddress> <result> <profile>print.xml</profile> <continue config:type="boolean">false</continue> </result> </rule> <rule> <haspcmcia> <match>1</match> <match_type>exact</match_type> </haspcmcia> <custom1> <script> if grep -i intel /proc/cpuinfo > /dev/null; then echo -n "intel" else echo -n "non_intel" fi; </script> <match>*</match> <match_type>exact</match_type> </custom1>
Automated Installation
121
<result> <profile>sales.xml</profile> <continue config:type="boolean">false</continue> </result> <operator>and</operator> </rule> <rule> <haspcmcia> <match>0</match> <match_type>exact</match_type> </haspcmcia> <result> <profile>engineering.xml</profile> <continue config:type="boolean">false</continue> </result> </rule> </rules> </autoinstall>
When distributing the rules file, make sure that the rules directory resides under the profiles directory specified in the autoyast=protocol: serverip/profiles/ URL. AutoYaST looks for a rules subdirectory containing a file named rules.xml first then loads and merges the profiles specified in the rules file. The rest of the autoinstallation procedure is carried out as usual.
122
123
VG 2
LV 1
LV 2
LV 3
LV 4
MP
MP
MP
MP
MP
MP
MP
Figure 6.1, Physical Partitioning versus LVM (page 124) compares physical partitioning (left) with LVM segmentation (right). On the left side, one single disk has been divided into three physical partitions (PART), each with a mount point (MP) assigned so that the operating system can access them. On the right side, two disks have been divided into two and three physical partitions each. Two LVM volume groups (VG 1 and VG 2) have been defined. VG 1 contains two partitions from DISK 1 and one from DISK 2.
124
VG 2 contains the remaining two partitions from DISK 2. In LVM, the physical disk partitions that are incorporated in a volume group are called physical volumes (PVs). Within the volume groups, four logical volumes (LV 1 through LV 4) have been defined, which can be used by the operating system via the associated mount points. The border between different logical volumes need not be aligned with any partition border. See the border between LV 1 and LV 2 in this example. LVM features: Several hard disks or partitions can be combined in a large logical volume. Provided the configuration is suitable, an LV (such as /usr) can be enlarged when the free space is exhausted. Using LVM, it is possible to add hard disks or LVs in a running system. However, this requires hot-swappable hardware that is capable of such actions. It is possible to activate a "striping mode" that distributes the data stream of a logical volume over several physical volumes. If these physical volumes reside on different disks, this can improve the reading and writing performance just like RAID 0. The snapshot feature enables consistent backups (especially for servers) in the running system. With these features, using LVM already makes sense for heavily used home PCs or small servers. If you have a growing data stock, as in the case of databases, music archives, or user directories, LVM is just the right thing for you. This would allow file systems that are larger than the physical hard disk. Another advantage of LVM is that up to 256 LVs can be added. However, keep in mind that working with LVM is different from working with conventional partitions. Instructions and further information about configuring LVM is available in the official LVM HOWTO at http://tldp.org/ HOWTO/LVM-HOWTO/. Starting from kernel version 2.6, LVM version 2 is available, which is downwardcompatible with the previous LVM and enables the continued management of old volume groups. When creating new volume groups, decide whether to use the new format or the downward-compatible version. LVM 2 does not require any kernel patches. It makes use of the device mapper integrated in kernel 2.6. This kernel only supports LVM version 2. Therefore, when talking about LVM, this section always refers to LVM version 2.
125
Instead of LVM 2, you can use EVMS (Enterprise Volume Management System), which offers a uniform interface for logical volumes and RAID volumes. Like LVM 2, EVMS makes use of the device mapper in kernel 2.6.
126
To add a previously unassigned partition to the selected volume group, first click the partition then Add Volume. At this point, the name of the volume group is entered next to the selected partition. Assign all partitions reserved for LVM to a volume group. Otherwise, the space on the partition remains unused. Before exiting the dialog, every volume group must be assigned at least one physical volume. After assigning all physical volumes, click Next to proceed to the configuration of logical volumes.
127
To create a new logical volume, click Add and fill out the pop-up that opens. As for partitioning, enter the size, file system, and mount point. Normally, a file system, such as reiserfs or ext2, is created on a logical volume and is then designated a mount point. The files stored on this logical volume can be found at this mount point on the installed system. Additionally it is possible to distribute the data stream in the logical volume among several physical volumes (striping). If these physical volumes reside on different hard disks, this generally results in a better reading and writing performance (like RAID 0). However, a striping LV with n stripes can only be created correctly if the hard disk space required by the LV can be distributed evenly to n physical volumes.
128
If, for example, only two physical volumes are available, a logical volume with three stripes is impossible. WARNING: Striping YaST has no chance at this point to verify the correctness of your entries concerning striping. Any mistake made here is apparent only later when the LVM is implemented on disk. Figure 6.5 Creating Logical Volumes
If you have already configured LVM on your system, the existing logical volumes can be entered now. Before continuing, assign appropriate mount points to these logical volumes too. With Next, return to the YaST Expert Partitioner and finish your work there.
129
partitioning. It shows the existing physical volumes and logical volumes in two lists and you can manage your LVM system using the methods already described.
EVMS Devices
The EVMS Administration Utility distinguishes five different levels of devices:
130
Disks This is the lowest level of device. All devices that may be accessed as a physical disk are treated as disks. Segments Segments consist of partitions and other memory regions on a disk, such as the master boot record (MBR). Containers These are the counterparts of volume groups in LVM. Regions The available devices are grouped into LVM2 and RAID here. Volumes All devices, regardless of whether they are represented by a real partition, a logical volume, or a RAID device are available with their respective mount points. If you choose to use EVMS, you must replace your device names with the EVMS device names. Simple partitions are found in /dev/evms/, logical volumes in /dev/evms/ lvm/, and RAID devices in /dev/evms/md. To activate EVMS at boot time, add boot.evms to the boot scripts in the YaST runlevel editor. See also Section 20.2.3, Configuring System Services (Runlevel) with YaST (page 396).
131
without the additional cost of hardware RAID controllers. However, this requires some CPU time and has memory requirements that make it unsuitable for real high performance computers.
132
parity disk and cannot service simultaneous multiple requests. Both levels are only rarely used. RAID 4 Level 4 provides block-level striping just like Level 0 combined with a dedicated parity disk. In the case of a data disk failure, the parity data is used to create a replacement disk. However, the parity disk may create a bottleneck for write access. Nevertheless, Level 4 is sometimes used. RAID 5 RAID 5 is an optimized compromise between Level 0 and Level 1 in terms of performance and redundancy. The hard disk space equals the number of disks used minus one. The data is distributed over the hard disks as with RAID 0. Parity blocks, created on one of the partitions, are there for security reasons. They are linked to each other with XOR, enabling the contents to be reconstructed by the corresponding parity block in case of system failure. With RAID 5, no more than one hard disk can fail at the same time. If one hard disk fails, it must be replaced as soon as possible to avoid the risk of losing data. Other RAID Levels Several other RAID levels have been developed (RAIDn, RAID 10, RAID 0+1, RAID 30, RAID 50, etc.), some of them being proprietary implementations created by hardware vendors. These levels are not very widespread, so are not explained here.
133
In the next dialog, choose between RAID levels 0, 1, and 5 (see Section 6.2.1, RAID Levels (page 132) for details). After Next is clicked, the following dialog lists all partitions with either the Linux RAID or Linux native type (see Figure 6.6, RAID Partitions (page 134)). No swap or DOS partitions are shown. If a partition is already assigned to a RAID volume, the name of the RAID device (for example, /dev/md0) is shown in the list. Unassigned partitions are indicated with --. Figure 6.6 RAID Partitions
To add a previously unassigned partition to the selected RAID volume, first click the partition then Add. At this point, the name of the RAID device is entered next to the selected partition. Assign all partitions reserved for RAID. Otherwise, the space on the partition remains unused. After assigning all partitions, click Next to proceed to the settings dialog where you can fine-tune the performance (see Figure 6.7, File System Settings (page 135)).
134
As with conventional partitioning, set the file system to use as well as encryption and the mount point for the RAID volume. Checking Persistent Superblock ensures that the RAID partitions are recognized as such when booting. After completing the configuration with Finish, see the /dev/md0 device and others indicated with RAID in the expert partitioner.
6.2.3 Troubleshooting
Check the file /proc/mdstats to find out whether a RAID partition has been destroyed. In the event of a system failure, shut down your Linux system and replace the defective hard disk with a new one partitioned the same way. Then restart your system and enter the command mdadm /dev/mdX --add /dev/sdX. Replace 'X' with your particular device identifiers. This integrates the hard disk automatically into the RAID system and fully reconstructs it.
135
136
137
To start YaST in text mode on another system, use ssh root@<system-to-configure> to open the connection. Then start YaST with yast. To save time, the individual YaST modules can be started directly. To start a module, enter yast2 module_name. View a list of all module names available on your system with yast2 -l or yast2 --list. Start the network module, for example, with yast2 lan.
This command changes the LANG setting only in your current session. The language setting of other users and your other sessions, like terminal windows, remains unchanged. If you run YaST remotely over SSH, YaST uses the language settings of your local system.
138
The left frame of most modules displays the help text, which offers suggestions for configuration and explains the required entries. To get help in modules without a help frame, press F1 or choose Help. After selecting the desired settings, complete the procedure by pressing Accept on the last page of the configuration dialog. The configuration is then saved. Figure 7.1 The YaST Control Center
7.3 Software
7.3.1 Installing and Removing Software
To install, uninstall, and update software on your machine, use Software Software Management. This opens a package manager dialog as shown in Figure 7.2, YaST Package Manager (page 140).
139
In SUSE Linux Enterprise, software is available in the form of RPM packages. Normally, a package contains everything needed for a program: the program itself, the configuration files, and all documentation. A list of individual packages is displayed to the right in the individual package window. The content of this list is determined by the currently selected filter. If, for example, the Patterns filter is selected, the individual package window displays all packages of the current selection. In the package manager, each package has a status that determines what to do with the package, such as Install or Delete. This status is shown by a symbol in a status box at the beginning of the line. Change the status by clicking or selecting the desired status from the menu that opens when the item is right-clicked. Depending on the current situation, some of the possible status flags may not be available for selection. For example, a package that has not yet been installed cannot be set to Delete. View the available status flags with Help Symbols. The font color used for various packages in the individual package window provides additional information. Installed packages for which a newer version is available on the installation media are displayed in blue. Installed packages whose version numbers are higher than those on the installation media are displayed in red. However, because the version numbering of packages is not always linear, the information may not be
140
perfect, but should be sufficient to indicate problematic packages. If necessary, check the version numbers.
Installing Packages
To install packages, select packages for installation and click Accept. Selected packages should have the Install status icon. The package manager automatically checks the dependencies and selects any other required packages (resolution of dependencies). To view other packages required for installation before clicking Accept, choose Extras Show Automatic Package Changes from the main menu. After installing packages, continue working with the package manager by clicking Install More or close it by clicking Finish. The package manager provides preselected groups for installation. You can select an entire group instead of single packages. To view these groups, use Filter in the left frame. TIP: List of All Available Packages To display all packages on your installation media, use the filter Package Groups and select zzz All at the bottom of the tree. SUSE Linux Enterprise contains a number of packages and it might take some time to display this long list. The Patterns filter groups the program packages according to their application purpose, such as multimedia or office applications. The various groups of the Patterns filter are listed with the installed packages preselected. Click the status box at the beginning of a line to install or uninstall this pattern. Select a status directly by right-clicking the pattern and using the context menu. From the individual package overview to the right, which displays the packages included in the current pattern, select and deselect individual packages. To find language-specific packages, such as translated texts for the user interface of programs, documentation, and fonts, use the Language filter. This filter shows a list of all languages supported by SUSE Linux Enterprise. If you select one of these, the right frame shows all packages available for this language. Among these, all packages applying to your current software selection are automatically tagged for installation.
141
NOTE Because language-specific packages may depend on other packages, the package manager may select additional packages for installation.
Removing Packages
To remove packages, assign the correct status to the packages to remove and click Accept. Selected packages should have the Delete status. If a package required by other installed packages is marked for deletion, the package manager issues an alert with detailed information and alternative solutions.
142
Reinstalling Packages
If you find damaged files that belong to package or you want to reinstall the original version of a package from your installation media, reinstall the package. To reinstall packages, select packages for reinstallation and click Accept. Selected packages should have the Update status. If any dependency issues arise with installed packages, the package manager issues an alert with detailed information and alternative solutions.
143
Installation Summary
After selecting the packages for installation, update, or deletion, view the installation summary with Installation Summary. It shows how packages will be affected when you click Accept. Use the check boxes to the left to filter the packages to view in the individual package window. For example, to check which packages are already installed, deactivate all check boxes except Keep. The package status in the individual package window can be changed as usual. However, the respective package may no longer meet the search criteria. To remove such packages from the list, update the list with Update List.
Disk Usage
During the selection of the software, the resource window at the bottom left of the module displays the prospective disk usage of all mounted file systems. The colored bar graph grows with every selection. As long as it remains green, there is sufficient space. The bar color slowly changes to red as you approach the limit of disk space. If you select too many packages for installation, an alert is displayed.
Checking Dependencies
Some packages depend on other packages. This means that the software of the package only works properly if another package is also installed. There are some packages with identical or similar functionalities. If these packages use the same system resource, they should not be installed at the same time (package conflict).
144
When the package manager starts, it examines the system and displays installed packages. When you select to install and remove packages, the package manager automatically checks the dependencies and selects any other required packages (resolution of dependencies). If you select or deselect conflicting packages, the package manager indicates this and submits suggestions for solving the problem (resolution of conflicts). Check Dependencies and Autocheck are located under the information window. If you click Check Dependencies, the package manager checks if the current package selection results in any unresolved package dependencies or conflicts. In the event of unresolved dependencies, the required additional packages are selected automatically. For package conflicts, the package manager opens a dialog that shows the conflict and offers various options for solving the problem. If you activate Autocheck, any change of a package status triggers an automatic check. This is a useful feature, because the consistency of the package selection is monitored permanently. However, this process consumes resources and can slow down the package manager. For this reason, the autocheck is not activated by default. In either case, a consistency check is performed when you confirm your selection with Accept. For example, sendmail and postfix may not be installed concurrently. Figure 7.3, Conflict Management of the Package Manager (page 146) shows the conflict message prompting you to make a decision. postfix is already installed. Accordingly, you can refrain from installing sendmail, remove postfix, or take the risk and ignore the conflict. WARNING: Handling Package Conflicts Unless you are very experienced, follow the suggestions of YaST when handling package conflicts, because otherwise the stability and functionality of your system could be endangered by the existing conflict.
145
list of all packages from the selected installation source, select the filter Installation Sources and choose the installation source to view. To view packages from a selected add-on by package groups, select the secondary filter Package Groups.
Binary Drivers
Some hardware needs binary-only drivers for correct function. If you have such hardware, refer to the release notes for more information about availability of binary drivers for your system. To read the release notes, open YaST and select Miscellaneous Release Notes.
147
this list. Sources can be CDs, DVDs, or network sources, such as NFS and FTP servers. Even directories on the local hard disk can be selected as the installation medium. See the detailed YaST help text for more details. All registered sources have an activation status in the first column of the list. Enable or disable individual installation sources by clicking Activate or Deactivate. During the installation of software packages or updates, YaST selects a suitable entry from the list of activated installation sources. When you exit the module with Close, the current settings are saved and applied to the configuration modules Software Management and System Update.
148
Update Options
Set the update method for your system. Two options are available.
149
Update with Installation of New Software and Features Based on the Selection To update the entire system to the latest versions of software, select one of the predefined selections. These selections ensure that packages that did not exist previously are also installed. Only Update Installed Packages This option merely updates packages that already exist on the system. No new features are installed. Additionally, you can use Delete Outdated Packages to remove packages that do not exist in the new version. By default, this option is preselected to prevent outdated packages from unnecessarily occupying hard disk space.
Packages
Click Packages to start the package manager and select or deselect individual packages for update. Any package conflicts should be resolved with the consistency check. The use of the package manager is covered in detail in Section 7.3.1, Installing and Removing Software (page 139).
Backup
During the update, the configuration files of some packages may be replaced by those of the new version. Because you may have modified some of the files in your current system, the package manager normally makes backup copies of the replaced files. With this dialog, determine the scope of these backups. IMPORTANT: Scope of the Backup This backup does not include the software. It only contains configuration files.
Language
Primary and other languages currently installed on the system are listed here. Change them by clicking Language in the displayed configuration or with Change Language. Optionally, adapt the keyboard layout and time zone to the region where the primary language is spoken. Find more about language selection in Section 7.5.16, Language Selection (page 168).
150
151
7.4 Hardware
New hardware must first be installed or connected as directed by the vendor. Turn on external devices and start the appropriate YaST module. Most devices are automatically 152 Installation and Administration
detected by YaST and the technical data is displayed. If the automatic detection fails, YaST offers a list of devices (model, vendor, etc.) from which to select the suitable device. Consult the documentation enclosed with your hardware for more information. IMPORTANT: Model Designations If your model is not included in the device list, try a model with a similar designation. However, in some cases the model must match exactly, because similar designations do not always indicate compatibility.
7.4.3 Printer
Configure a printer with Hardware Printer. If a printer is properly connected to the system, it should be detected automatically. Find detailed instructions for configuring printers with YaST in Section 24.4, Configuring the Printer (page 454).
153
WARNING: Configuration of the Hard Disk Controller It is advised to test the settings before making them permanent in the system. Incorrect settings can prevent the system from booting.
154
7.4.7 Joystick
Configure a joystick connected to the sound card with Hardware Joystick. Select your joystick type in the list provided. If your joystick is not listed, select Generic Analog Joystick. After selecting your joystick, make sure that it is connected then click Test to test the functionality. Click Continue and YaST installs the required files. After the Joystick Test window appears, test the joystick by moving it in all directions and pressing all buttons. Each movement should be displayed in the window. If you are satisfied with the settings, click OK to return to the module and Finish to complete configuration. If you have a USB device, this configuration is not necessary. Plug in the joystick and start using it.
155
To configure your mouse for the text environment, use YaST in text mode. After entering text mode and selecting Hardware Mouse Model, use the keyboard arrow keys to choose your mouse from the provided list. Then click Accept to save the settings and exit the module.
7.4.10 Sound
Use Hardware Sound to configure a sound card. Most sound cards are detected automatically and listed. Select the one to configure or modify then click Edit. Use Delete to remove a sound card. This deactivates existing entries of configured sound cards in /etc/modprobe.d/sound. Click Other to open a dialog in which to customize the sound module options manually. With Add, configure additional sound cards. If YaST detects another sound card, select it then use Edit. The volume and configuration of all sound cards installed are saved when you click Finish. The mixer settings are saved to the file /etc/asound.conf and the ALSA configuration data is appended at the end of the files /etc/modprobe.d/sound and /etc/sysconfig/hardware. If YaST is unable to detect your sound card automatically, proceed as follows: 1 Click Add to open a dialog in which to select a sound card vendor and model. Refer to your sound card documentation for the information required. Find a reference list of sound cards supported by ALSA with their corresponding sound modules in /usr/share/doc/packages/alsa/cards.txt and at http://www.alsa-project.org/~goemon/. After making your selection, click Next. 2 In Setup Dialog, choose the configuration level in the first setup screen. With Quick Automatic Setup, you are not required to go through any of the further configuration steps and no sound test is performed. The sound card is configured automatically. With Normal Setup, you can adjust the output volume and play a test sound. Advanced setup with possibility to change options allows you to customize the sound card options manually. In this dialog, there is also a shortcut to joystick configuration. Click it and select the joystick type in the following dialog. Click Next to continue.
156
3 In Sound Card Volume, test your sound configuration and make adjustments to the volume. You should start at about ten percent to avoid damage to your speakers or hearing. A test sound should be audible when you click Test. If you cannot hear anything, increase the volume. Press Continue to complete the sound configuration. The volume setting is then saved. If you use a Creative Soundblaster Live or AWE sound card, copy SF2 sound fonts to your hard disk from the original Soundblaster driver CD-ROM with Install Sound Fonts. The sound fonts are saved in the directory /usr/share/sfbank/ creative/. For playback of MIDI files, check Start Sequencer. This way, the modules for sequencer support are loaded along with the sound modules.
Replace 0.0.0150 with the actual channel number to which the DASD is attached. The last zero of the command line should be 1 if the DASD should be accessed in DIAG mode. NOTE In either case, you must run the commands
mkinitrd zipl
157
7.5 System
This group of modules is designed to help you manage your system. All modules in this group are system-related and serve as valuable tools for ensuring that your system runs properly and your data is managed efficiently. TIP: IBM System z: Continuing For IBM System z, continue with Section 7.5.4, Boot Loader Configuration (page 160).
7.5.1 Backup
Create a backup of both your system and data using System System Backup. However, the backup created by the module does not include the entire system. The system is backed up by saving important storage areas on your hard disk that may be crucial when trying to restore a system, such as the partition table or master boot record (MBR). It can also include the XML configuration acquired from the installation of the system, which is used for AutoYaST. Data is backed up by saving changed files of packages accessible on installation media, entire packages that are unaccessible (such as online updates), and files not belonging to packages, such as many of the configuration files in /etc or the directories under /home. 158 Installation and Administration
7.5.2 Restoration
With System System Restoration, restore your system from a backup archive created with System Backup. First, specify where the archives are located (removable media, local hard disks, or network file systems). Click Next to view the description and contents of the individual archives and select what to restore from the archives. You can also uninstall packages that were added since the last backup and reinstall packages that were deleted since the last backup. These two steps enable you to restore the exact system state at the time of the last backup. WARNING: System Restoration Because this module normally installs, replaces, or uninstalls many packages and files, use it only if you have experience with backups. Otherwise you may lose data.
159
Rescue Floppy This disk contains a special environment that allows you to perform maintenance tasks in your installed system, such as checking and repairing the file system and updating the boot loader. To start the rescue system, boot with the standard boot disks then select Manual Installation Start Installation or System Rescue System. Insert the rescue disk when prompted. Custom Floppy Use this to write any existing floppy disk image from the hard disk to a floppy disk. Download Floppy Image With this, enter a URL and authentication data to download a floppy disk image from the Internet. To create one of these floppy disks, select the corresponding option and click Next. Insert a floppy disk when prompted. Click Next again to create the floppy disk.
7.5.5 Clustering
Information about Heartbeat and high availability configuration with YaST are provided in Chapter 13, Installing a Heartbeat 2 Cluster Using YaST (page 279) and Chapter 12, High Availability under Linux (page 269).
7.5.6 LVM
The logical volume manager (LVM) is a tool for custom partitioning of hard disks with logical drives. Find information about LVM in Section 6.1, LVM Configuration (page 123).
160
7.5.7 EVMS
The enterprise volume management system (EVMS) is, like LVM, a tool for custom partitioning and grouping of hard disks into virtual volumes. It is flexible, extensible, and can be tailored using a plug-in model to individual needs of various volume management systems. EVMS is compatible with existing memory and volume management systems, like DOS, Linux LVM, GPT (GUID partition table), IBM System z, Macintosh, and BSD partitions. More information is provided at http://evms.sourceforge.net/.
7.5.8 Partitioner
With the expert dialog, shown in Figure 7.4, The YaST Partitioner (page 162), manually modify the partitioning of one or several hard disks. Partitions can be added, deleted, resized, and edited. Also access the soft RAID, EVMS, and LVM configuration from this YaST module. WARNING Although it is possible to modify the partitions in the installed system, this should be handled only by experts. Otherwise the risk of making a mistake that causes data loss is very high. If you repartition a hard disk in use, reboot the system right afterwards. It is safer to use the rescue system than repartition the system while running.
161
TIP: IBM System z: Device Names IBM System z recognize only DASD and SCSI hard disks. IDE hard disks are not supported. This is why these devices appear in the partition table as dasda or sda for the first recognized device. All existing or suggested partitions on all connected hard disks are displayed in the list of the YaST Expert Partitioner dialog. Entire hard disks are listed as devices without numbers, such as /dev/hda or /dev/sda (or /dev/dasda). Partitions are listed as parts of these devices, such as /dev/hda1 or /dev/sda1 (or /dev/dasda1, respectively). The size, type, file system, and mount point of the hard disks and their partitions are also displayed. The mount point describes where the partition appears in the Linux file system tree. If you run the expert dialog during installation, any free hard disk space is also listed and automatically selected. To provide more disk space to SUSE Linux Enterprise Server, free the needed space starting from the bottom toward the top of the list (starting from the last partition of a hard disk toward the first). For example, if you have three partitions, you cannot use the second exclusively for SUSE Linux Enterprise Server and retain the third and first for other operating systems.
162
Creating a Partition
Select Create. If several hard disks are connected, a selection dialog appears in which to select a hard disk for the new partition. Then specify the partition type (primary or extended). Create up to four primary partitions or up to three primary partitions and one extended partition. Within the extended partition, create several logical partitions (see Section Partition Types (page 44)). Select the file system to use and a mount point, if necessary. YaST suggests a mount point for each partition created. Details of the parameters are provided in the next section. Select OK to apply your changes. The new partition is then listed in the partition table. If you click Next, the current values are adopted. During installation you are then returned to the suggestion screen.
Partitioning Parameters
When you create a new partition or modify an existing partition, set various parameters. For new partitions, suitable parameters are set by YaST and usually do not require any modification. To make manual settings, proceed as follows: 1. 2. Select the partition. Click Edit to edit the partition and set the parameters: File System ID Even if you do not want to format the partition at this stage, assign it a file system ID to ensure that the partition is registered correctly. Possible values include Linux, Linux swap, Linux LVM, Linux EVMS, and Linux RAID. For LVM and RAID details, refer to Section 6.1, LVM Configuration (page 123) and Section 6.2, Soft RAID Configuration (page 131). File System To format the partition immediately within the scope of the installation, specify one of the following file systems for the partition: Swap, Ext2, Ext3, ReiserFS, or JFS. Refer to Chapter 26, File Systems in Linux (page 483) for details on the various file systems. File System Options Set various parameters for the selected file system here.
163
Encrypt File System If you activate the encryption, all data is written to the hard disk in encrypted form. This increases the security of sensitive data, but slightly reduces the system speed, because the encryption takes some time. More information about the encryption of file systems is provided in Chapter 48, Encrypting Partitions and Files (page 873). Fstab Options Here, specify various parameters for the administration file of the file systems (/etc/fstab). For example, change the file system identification from the device name, which is default, to a volume label. In the volume label, you can use all characters except / and space. Mount Point Specify the directory at which the partition should be mounted in the file system tree. Select from various YaST proposals or enter any other name. 3. Select Next to activate the partition.
If you partition manually, create a swap partition of at least 256 MB. The swap partition is used to free the main memory of data that is not used at the present moment. This keeps the main memory free for the most frequently-used data.
Expert Options
Expert opens a menu containing the following commands: Reread Partition Table Rereads the partitioning from disk. For example, you need this after manual partitioning in the text console. Delete Partition Table and Disk Label This completely overwrites the old partition table. For example, this can be helpful if you have problems with unconventional disk labels. Using this method, all data on the hard disk is lost.
data. This file contains all partitions in the system with their properties, such as the file system, mount point, and user permissions. Example 7.1 /etc/fstab: Partition Data
/dev/sda1 /dev/sda5 /dev/sda6 /data1 /data2 /data3 auto auto auto noauto,user 0 0 noauto,user 0 0 noauto,user 0 0
The partitions, regardless of whether they are Linux or FAT partitions, are specified with the options noauto and user. This allows any user to mount or unmount these partitions as needed. For security reasons, YaST does not automatically enter the exec option here, which is needed for executing programs from the location. However, to run programs from there, you can enter this option manually. This measure is necessary if you encounter system messages such as bad interpreter or Permission denied.
165
To add an ID, click Add and select how to assign it: by selecting a PCI device from a list or by manually entering PCI values. In the first option, select the PCI device from the provided list then enter the driver or directory name. If the directory is left empty, the driver name is used as the directory name. When assigning PCI ID values manually, enter the appropriate data to set up a PCI ID. Click OK to save your changes.
166
To edit a PCI ID, select the device driver from the list and click Edit. Edit the information and click OK to save your changes. To delete an ID, select the driver and click Delete. The ID immediately disappears from the list. When finished, click OK.
168
Select the main language to use for your system in Primary Language. To adjust the keyboard or time zone to this setting, enable Adapt Keyboard Layout or Adapt Time Zone. Set how locale variables are set for the root user with Details. Also use Details to set the primary language to a dialect not available in the main list. These settings are written into the file /etc/sysconfig/language.
169
select it from the list then click Edit. If your device has not been detected, click Add and select it manually. To edit an existing device, select it then click Edit. For more detailed information, see Section 31.4, Configuring a Network Connection with YaST (page 578). For wireless network interfaces, see Chapter 30, Wireless Communication (page 547). TIP: CDMA and GPRS Modems You can configure supported CDMA and GPRS modems as regular modems in the YaST modem module.
170
No Connection If you do not have access to the Internet and are not located in a network, you cannot send or receive e-mail. Activate virus scanning for your incoming and outgoing e-mail with AMaViS by selecting that option. The package is installed automatically as soon as you activate the mail filtering feature. In the following dialogs, specify the outgoing mail server (usually the SMTP server of your provider) and the parameters for incoming mail. Set the diverse POP or IMAP servers for mail reception by various users. Using this dialog, you can also assign aliases, use masquerading, or set up virtual domains. Click Finish to exit the mail configuration.
171
Fetching Mail Configures mail pick-up from external mail accounts over various protocols. Mail Server Domains This determines for which domains the mail server should be responsible. At least one master domain must be configured if the server should not run as a null client used exclusively for sending mail without receiving any. Distinguish among three domain types: main Main or master domain of the local mail server local All users who can receive mail in a master domain can also receive mail in a local domain. In the case of a message within the local domain, only the portion before the @ is evaluated. virtual Only users with an explicit address within a virtual domain receive mail. Virtual mail addresses are set up in the user management module of YaST.
172
name and domain name. If the provider has been configured correctly for DSL, modem, or ISDN access, the list of name servers contains the entries that were extracted automatically from the provider data. If you are located in a local network, you might receive your hostname via DHCP, in which case you should not modify the name. HTTP Server To run your own Web server, configure Apache in HTTP Server. Find more information in Chapter 41, The Apache HTTP Server (page 751). Hostnames When booting and in small networks, you can use Hostnames for hostname resolution instead of DNS. The entries in this module reflect the data of the file /etc/ hosts. For more information, read Section /etc/hosts (page 605). Kerberos Client If you have a Kerberos server in your network for network authentication, use Kerberos Client. A detailed description of the client configuration with YaST is available in Section 47.6, Configuring a Kerberos Client with YaST (page 861). LDAP Client If using LDAP for user authentication in the network, configure the client in LDAP Client. Information about LDAP and a detailed description of the client configuration with YaST are available in Section 37.6, Configuring an LDAP Client with YaST (page 698). LDAP Server The LDAP server can keep various data in a central directory and distribute it to all clients in your network. Mostly it is used to store shared contact information but its function is not limited to that. An LDAP server can be used also for authentication. Information about LDAP and a detailed description of the server configuration with YaST are available in Chapter 37, LDAPA Directory Service (page 681). NFS Client With NFS client, mount directories provided by NFS server in your own file trees. Use NFS Client to configure your system to access an NFS server in the network. A description of the YaST module and background information about NFS are provided in Chapter 39, Sharing File Systems with NFS (page 725).
173
NFS Server With NFS, run a file server that all members of your network can access. This file server can be used to make certain applications, files, and storage space available to users. In NFS Server, you can configure your host as an NFS server and determine the directories to export for general use by the network users. All users with the appropriate permissions can mount these directories in their own file trees. A description of the YaST module and background information about NFS are provided in Chapter 39, Sharing File Systems with NFS (page 725). NIS Client If you run NIS server to administer user data on a central place and distribute it to the clients, configure the client here. Detailed information about NIS client and configuration with YaST is available in Section 36.2, Configuring NIS Clients (page 679). NIS Server If you run more than one system, local user administration (using the files /etc/ passwd and /etc/shadow) is impractical and requires a lot of maintenance. In this case, administer user data on a central server and distribute it to the clients from there. NIS is one option for this. Detailed information about NIS and its configuration with YaST is available in Section 36.1.1, Configuring a NIS Master Server (page 674). NTP Client NTP (network time protocol) is a protocol for synchronizing hardware clocks over a network. Information about NTP and instructions for configuring it with YaST are available in Chapter 33, Time Synchronization with NTP (page 623). Network Services (xinetd) Configure the network services (such as finger, talk, and ftp) to start when SUSE Linux Enterprise boots using Network Services. These services enable external hosts to connect to your computer. Various parameters can be configured for every service. By default, the master service that manages the individual services (inetd or xinetd) is not started. When this module starts, choose whether to start inetd or xinetd. The selected daemon can be started with a standard selection of services. Alternatively, compose your own selection of services with Add, Delete, and Edit.
174
WARNING: Configuring Network Services (xinetd) The composition and adjustment of network services on a system is a complex procedure that requires a comprehensive understanding of the concept of Linux services. The default settings are usually sufficient. Proxy Configure Internet proxy client settings in Proxy. Click Enable Proxy then enter the desired proxy settings. You can test these settings by clicking Test Proxy Settings. A small window informs you whether your proxy settings work correctly. After your settings have been entered and tested, save them by clicking Accept. Remote Administration To administer your machine remotely from another machine, use Remote Administration. To maintain your system remotely, use a VNC client, such as krdc, or a Java-enabled browser. Although remote administration using VNC is simple and fast, it is less secure than using SSH, so you should always keep this in mind when using a VNC server. Find detailed information about installing with a VNC client in Section 4.1.1, Simple Remote Installation via VNCStatic Network Configuration (page 70). Allow remote administration by selecting Allow Remote Administration in Remote Administration Settings. Selecting Do Not Allow Remote Administration disables this function. Click Open Port in Firewall to allow access to your computer. Clicking Firewall Details displays network interfaces with open ports in the firewall. Select the desired interface and click OK to return to the main dialog. Click Accept to complete the configuration. The YaST Remote Administration module is highly recommended for configuring VNC on your machine. Although the SaX2 interface also allows you to set remote access properties, it is not a substitute for YaST. It only enables you to configure your X server as a host for VNC sessions. For more information, refer to Section 7.13.6, Remote Access Properties (page 196). Routing Use Routing to configure the paths data takes over the network. In most cases, only enter the IP address of the system through which to send all data in Default Gateway. To create more complicated configurations, use Expert Configuration.
175
Samba Server In a heterogeneous network consisting of Linux and Windows hosts, Samba controls the communication between the two worlds. Information about Samba and the configuration of servers is provided in Chapter 38, Samba (page 709). SLP Server With service location protocol (SLP), you can configure clients in your network without knowledge of server names and services that these servers provide. Detailed information about SLP servers and configuration with YaST are described in Chapter 32, SLP Services in the Network (page 619). TFTP Server A TFTP server in not an FTP server. While an FTP server uses the File Transfer Protocol (FTP), a TFTP server uses the much simpler Trivial File Transfer Protocol (TFTP) without security features. TFTP servers are usually used to boot diskless workstations, X terminals, and routers. Detailed information about TFTP servers and configuration with YaST are described in Section 4.3.2, Setting Up a TFTP Server (page 89). WOL WOL (wake on LAN) refers to the possibility of waking up a computer from standby mode over the network using special packages. It only works with motherboards that support this functionality in their BIOS. WOL configuration with YaST is described in Section 4.3.7, Wake on LAN (page 96). Windows Domain Membership In a heterogeneous network consisting of Linux and Windows hosts, Samba controls the communication between the two worlds. With the Samba Client module, you can configure your computer as member of a Windows domain. Find information about Samba and the configuration of clients in Chapter 38, Samba (page 709).
7.8 AppArmor
Novell AppArmor is designed to provide easy-to-use application security for both servers and workstations. Novell AppArmor is an access control system that lets you specify which files each program may read, write, and execute. To enable or disable Novell AppArmor on your system, use AppArmor Control Panel. Information about Novell AppArmor and a detailed description of the configuration with YaST are
176
available in Novell AppArmor 2.0 Administration Guide (Novell AppArmor 2.0 Administration Guide).
177
overview. Click Write Changes Now to save all changes without exiting the configuration module.
178
Boot Settings Set how the key combination Ctrl + Alt + Del should be interpreted by selecting the desired action. Normally, this combination, when entered in the text console, causes the system to reboot. Do not modify this setting unless your machine or server is publicly accessible and you are afraid someone could carry out this action without authorization. If you select Stop, this key combination causes the system to shut down. With Ignore, this key combination is ignored. If you use the KDE login manager (KDM), set permissions for shutting down the system in Shutdown Behavior of KDM. Give permission to Only root (the system administrator), All Users, Nobody, or Local Users. If Nobody is selected, the system can only be shut down from the text console. Login Settings Typically, following a failed login attempt, there is a waiting period lasting a few seconds before another login is possible. This makes it more difficult for password sniffers to log in. Optionally activate Record Successful Login Attempts and Allow Remote Graphical Login. If you suspect someone is trying to discover your password, check the entries in the system log files in /var/log. To grant other users access to your graphical login screen over the network, enable Allow Remote Graphical Login. Because this access possibility represents a potential security risk, it is inactive by default. User Addition Every user has a numerical and an alphabetical user ID. The correlation between these is established using the file /etc/passwd and should be as unique as possible. Using the data in this screen, define the range of numbers assigned to the numerical part of the user ID when a new user is added. A minimum of 500 is suitable for users. Automatically generated system users start with 1000. Proceed in the same way with the group ID settings. Miscellaneous Settings To use predefined file permission settings, select Easy, Secure, or Paranoid. Easy should be sufficient for most users. The setting Paranoid is extremely restrictive and can serve as the basic level of operation for custom settings. If you select Paranoid, remember that some programs might not work correctly or even at all, because users no longer have permission to access certain files. Also set which user should launch the updatedb program, if installed. This program, which automatically runs on a daily basis or after booting, generates a
179
database (locatedb) in which the location of each file on your computer is stored. If you select Nobody, any user can find only the paths in the database that can be seen by any other (unprivileged) user. If root is selected, all local files are indexed, because the user root, as superuser, may access all directories. Make sure that the options Current Directory in root's Path and Current Directory in Path of Regular Users are deactivated. Only advanced users should consider using these options because these settings may pose a significant security risk if used incorrectly. To have some control over the system even if it crashes, click Enable Magic SysRq Keys. Click Finish to complete your security configuration.
7.9.5 Firewall
SuSEfirewall2 can protect your machine against attacks from the Internet. Configure it with Security and Users Firewall. Find detailed information about SuSEfirewall2 in Chapter 44, Masquerading and Firewalls (page 829). TIP: Automatic Activation of the Firewall YaST automatically starts a firewall with suitable settings on every configured network interface. Start this module only if you want to reconfigure the firewall with custom settings or deactivate it.
180
7.10 Miscellaneous
The YaST Control Center has several modules that cannot easily be classified into the first six module groups. They can be used for things like viewing log files and installing drivers from a vendor CD.
7.10.4 Autoinstallation
The part of SUSE Linux Enterprise is the AutoYaST tool for automated installation. In Miscellaneous Autoinstallation, prepare profiles for this tool. Find detailed information about automated installation with AutoYaST in Chapter 5, Automated Installation (page 105). Information about using the Autoinstallation module is provided in Section 5.1.1, Creating an AutoYaST Profile (page 106).
181
182
/proc/cpuinfo This displays processor information, including its type, make, model, and performance. /proc/dma This shows which DMA channels are currently being used. /proc/interrupts This shows which interrupts are in use and how many of each have been in use. /proc/iomem This displays the status of input/output memory. /proc/ioports This shows which I/O ports are in use at the moment. /proc/meminfo This displays memory status. /proc/modules This displays the individual modules. /proc/mounts This displays devices currently mounted. /proc/partitions This shows the partitioning of all hard disks. /proc/version This displays the current version of Linux. /var/log/YaST2/y2log This displays all YaST log messages. /var/log/boot.msg This displays information concerning the start-up of the system. /var/log/faillog This displays login failures. /var/log/warn This displays all system warnings. System Configuration with YaST 183
When the YaST Control Center is started, the category Software is selected automatically. Use and to change the category. To start a module from the selected category, press . The module selection now appears with a thick border. Use and to select
184
the desired module. Keep the arrow keys pressed to scroll through the list of available modules. When a module is selected, the module title appears with a colored background and a brief description is displayed in the bottom frame. Press Enter to start the desired module. Various buttons or selection fields in the module contain a letter with a different color (yellow by default). Use Alt + yellow_letter to select a button directly instead of navigating there with Tab . Exit the YaST Control Center by pressing the Exit button or by selecting Exit in the category overview and pressing Enter .
185
because the different modules offer different buttons (Details, Info, Add, Delete, etc.). Use F10 for OK, Next, and Finish. Press F1 to access the YaST help, which shows the functions mapped to the individual F keys. Figure 7.8 The Software Installation Module
Esc
Alt
Esc
Backward and Forward Navigation with Ctrl + F and Ctrl + B If the Alt and Shift combinations are occupied by the window manager or the terminal, use the combinations Ctrl + F (forward) and Ctrl + B (backward) instead.
186
Restriction of Function Keys The F keys are also used for functions. Certain function keys might be occupied by the terminal and may not be available for YaST. However, the Alt key combinations and function keys should always be fully available on a pure text console.
View a list of all module names available on your system with yast -l or yast --list. Start the network module, for example, with yast lan.
187
rug Commands Function List the catalogs Add a service Register a service Subscribe to a catalog Refresh the lists of patches
188
view This allows the user to see which software is installed on the machine and which software is in available channels. The option is relevant only to remote users, local users are normally permitted to view installed and available packages. superuser Permits all rug commands except user management and settings, which must be done locally. To give a user permission to update the system, use the command rug ua username upgrade. Replace username with the name of the user. To revoke the privileges of a user, use command rug ud username. To list users with their rights, use rug ul. To change the current privileges of a user, use rug ue username. Replace username with name of the desired user. The edit command is interactive. It lists privileges of the selected user and the offers you a prompt. Enter the plus (+) or minus (-) symbol and the name of the privilege then press Enter . For example, to permit the user to delete software, enter +remove. To save and quit, press Enter on a blank line.
189
but the computer is behind a proxy server. Before downloading updates, send your username and password to the proxy server. To do so, use the commands:
rug set proxy-url url_path rug set proxy-username name rug set proxy-password password
Replace url_path with the name of your proxy server. Replace name with your username. Replace password with your password.
7.13 SaX2
Configure the graphical environment of your system with Hardware Graphics Card and Monitor. This opens the SUSE Advanced X11 Configuration interface (SaX2), where you can configure devices such as your mouse, keyboard, or display devices. This interface can also accessed from the main menu by clicking System Configuration SaX2.
190
TIP: Autodetecting New Display Hardware If you change your display hardware after installation, use sax2 -r on the command line to cause SaX2 to detect your hardware. You must be root to run SaX2 from the command line.
Graphics Card
It is not possible to change the graphics card because only known models are supported and these are detected automatically. However, you can change many options that affect the behavior of the card. Normally, this should not be necessary because the system already has set them up appropriately during installation. If you are an expert and want to tweak some of the options, click Options next to the graphics card and select the option to change. To assign a value needed to a certain option, enter this value in the dialog that appears after selecting that option. Click OK to close the options dialog.
191
Monitor
To change the current settings for the monitor, click Change next to the monitor. A new dialog opens in which to adjust various monitor-specific settings. This dialog has several tabs for various aspects of monitor operation. Select the first tab to manually select the vendor and model of the display device in two lists. If your monitor is not listed, you can choose one of the VESA or LCD modes that suit your needs or, if you have a vendor driver disk or CD, click Utility Disk and follow the instructions on the screen to use it. Check Activate DPMS to use display power management signaling. Display Size, with the geometrical properties of the monitor, and Sync Frequencies, with the ranges for the horizontal and vertical sync frequencies of your monitor, are normally set up correctly by the system, but you can modify these values manually. After making all adjustments, click OK to close this dialog. WARNING: Changing Monitor Frequencies Although there are safety mechanisms, you should still be very careful when changing the allowed monitor frequencies manually. Incorrect values might destroy your monitor. You should always refer to the monitor's manual before changing frequencies.
Dual Head
If you have a graphics card with two outputs installed in your computer, you can connect two screens to your system. Two screens that are attached to the same graphics card are referred to as dual head. SaX2 automatically detects multiple display devices in the system and prepares the configuration accordingly. To use the dual head mode of a graphics card, check Activate Dual Head Mode at the bottom of the dialog and click Configure to set the dual head options and the arrangement of the screens in the dual head dialog.
192
The tabs in the row at the top of the dialog each correspond to a graphics card in your system. Select the card to configure and set its multihead options in the dialog below. In the upper part of the multihead dialog, click Change to configure the additional screen. The possible options are the same as for the first screen. Choose the resolution to use for this screen from the list. Select one of three possible multihead modes. Traditional Multihead Each monitor represents an individual unit. The mouse pointer can switch between the screens. Cloned Multihead In this mode, all monitors display the same contents. The mouse is only visible on the main screen. Xinerama Multihead All screens combine to form a single large screen. Program windows can be positioned freely on all screens or scaled to a size that fills more than one monitor. NOTE Linux currently does not offer 3D support for Xinerama multihead environments. In this case, SaX2 deactivates the 3D support. The arrangement of the dual head environment describes the sequence of the individual screens. By default, SaX2 configures a standard layout that follows the sequence of the detected screens, arranging all screens in a row from left to right. In the Arrangement part of the dialog, determine the way the monitors are arranged by selecting one of the sequence buttons. Click OK to close the dialog. TIP: Using a Beamer with Laptop Computers To connect a beamer to a laptop computer, activate dual head mode. In this case, SaX2 configures the external output with a resolution of 1024x768 and a refresh rate of 60 Hz. These values suit most beamers very well.
Multihead
If you have more than one graphics card installed in your computer, you can connect more than one screen to your system. Two or more screens that are attached to different
193
graphics cards are referred to as multihead. SaX2 automatically detects multiple graphics cards in the system and prepares the configuration accordingly. By default, SaX2 configures a standard layout that follows the sequence of the detected graphics cards, arranging all screens in a row from left to right. The additional Arrangement tab allows for changing this layout manually. Drag the icons representing the individual screens in the grid and click OK to close the dialog.
194
Emulate Wheel with Mouse Button If your mouse does not have a scroll wheel but you want to use similar functionality, you can assign an additional button for this. Select the button to use. While pressing this button, any movement of the mouse is translated into scroll wheel commands. This feature is especially useful with trackballs. When you are satisfied with your settings, click OK to confirm your changes. NOTE Any changes you make here take effect only after you restart the X server.
When you are satisfied with the settings, click OK to confirm your changes.
7.14 Troubleshooting
All error messages and alerts are logged in the directory /var/log/YaST2. The most important file for finding YaST problems is y2log.
196
197
8.1.1 Preparations
Before updating, copy the old configuration files to a separate medium, such as streamer, removable hard disk, USB stick, or ZIP drive, to secure the data. This primarily applies to files stored in /etc as well as some of the directories and files in /var and /opt. You may also want to write the user data in /home (the HOME directories) to a backup medium. Back up this data as root. Only root has read permission for all local files.
199
Before starting your update, make note of the root partition. The command df / lists the device name of the root partition. In Example 8.1, List with df -h (page 200), the root partition to write down is /dev/hda3 (mounted as /). Example 8.1 List with df -h
Filesystem /dev/hda3 tmpfs /dev/hda5 /dev/hda1 /dev/hda2 Size 74G 506M 116G 39G 4.6G Used Avail Use% Mounted on 22G 53G 29% / 0 506M 0% /dev/shm 5.8G 111G 5% /home 1.6G 37G 4% /windows/C 2.6G 2.1G 57% /windows/D
PostgreSQL
Before updating PostgreSQL (postgres), dump the databases. See the manual page of pg_dump. This is only necessary if you actually used PostgreSQL prior to your update.
2 Boot the system as for the installation, described in Section 3.2, System StartUp for Installation (page 36). In YaST, choose a language and select Update in the Installation Mode dialog. Do not select New Installation. 3 YaST determines whether there are multiple root partitions. If there is only one, continue with the next step. If there are several, select the right partition and confirm with Next (/dev/hda3 was selected in the example in Section 8.1.1, Preparations (page 199)). YaST reads the old fstab on this partition to analyze and mount the file systems listed there. 4 In the Installation Settings dialog, adjust the settings according to your requirements. Normally, you can leave the default settings untouched, but if you intend to enhance your system, check the packages offered in the Software Selection submenus or add support for additional languages. You also have the possibility to make backups of various system components. Selecting backups slows down the update process. Use this option if you do not have a recent system backup. 5 In the following dialog, choose to update only the software that is already installed or to add new software components to the system (upgrade mode). It is advisable to accept the suggested composition. Adjustments can be made later with YaST.
201
3 Create a new subdirectory called, for example, SLE-10-SP-x-arch (replacing x with the number of the SP and arch with the name of your hardware architecture) by entering
mkdir SLE-10-SP-x-arch
202
4 Copy the contents of each SP installation medium to its own subdirectory. Once done the directory hierarchy is as follows:
/install/sle/SLE-10-arch/CD1 /CD2 /CD3 /CD4 /install/sle/SLE-10-SP-x-arch/CD1 /CD2 /CD3
5 In SLE-10-arch/CD1, create a file called add_on_products. The contents of add_on_products determines which Service Pack should be added to your SUSE Linux Enterprise 10 as an add-on product. The format of the file is as follows:
media_url [path_on_media [product_1 [product_2 [....]]]
For example, if you want to offer the SP via NFS from sun.example.com write the following in add_on_products (specifying path_on_media, product_1, etc., is not required for Service Packs):
nfs://sun.example.com/install/sle/SLE-10-SP-x-arch/CD1
Replace x with the actual number of the Service Pack and arch with the name of your architecture. 6 Make the sources available via NFS, FTP, or HTTP as described in Section 4.2, Setting Up the Server Holding the Installation Sources (page 78).
203
204
5 Click Yes, Install to start the installation. 6 Insert the appropriate media when prompted. Both the SP media and the original product media are required, depending on the software installed. 7 Continue as usual with the installation (entering a password for root, completing the network configuration, testing your Internet connection, activating the ZENworks Online Update Service, selecting the user authentication method, and entering a username and password).
Network Installation
Before starting a network installation of an SUSE Linux Enterprise SP, make sure that the following requirements are met: A network installation source set up according to Section 8.2.1, Setting Up a Network Installation Source for Service Pack Media (page 202). A working network connection both on the installation server and the target machine that includes a name service, DHCP (optional, but needed for PXE boot), and OpenSLP (optional). The SUSE Linux Enterprise SP CD or DVD number 1 to boot the target system or a target system set up for PXE boot according to Section 4.3.5, Preparing the Target System for PXE Boot (page 95).
3 Provide the appropriate path information or select SLP as the installation source.
205
4 Select the appropriate installation server from those offered or use the boot options prompt to provide the type of installation source and its actual location as in Section Installing from a Network Server (page 37). YaST starts. 5 Accept the license agreement then select a language, default desktop, and other installation settings. 6 Click Yes, Install to start the installation. 7 Continue as usual with the installation (entering a password for root, completing the network configuration, testing your Internet connection, activating the Online Update service, selecting the user authentication method, and entering a username and password). For detailed instructions for installing SUSE Linux Enterprise, see Chapter 3, Installation with YaST (page 35).
206
6 Click Yes, Install to start the installation. 7 Continue as usual with the installation (entering a password for root, completing the network configuration, testing your Internet connection, activating the Online Update service, selecting the user authentication method, and entering a username and password). For detailed instructions for installing SUSE Linux Enterprise, see Chapter 3, Installation with YaST (page 35).
207
208
The following kernel module package was changed internally: km_wlanVarious drivers for wireless LAN cards. The madwifi driver for Atheros WLAN cards from km_wlan was removed. For technical reasons, it was necessary to drop support for Ralink WLAN cards. The following modules were not part of the distribution and will not be added in the future: ati-fglrxATI FireGL Graphics Cards nvidia-gfxNVIDIA gfx driver km_smartlink-softmodemSmart Link Soft Modem
209
The client configuration (/etc/krb5.conf) is very similar to the one of heimdal. If nothing special was configured, it is enough to replace the parameter kpasswd_server with admin_server.
210
It is not possible to copy the server-related (kdc and kadmind) data. After the system update, the old heimdal database is still available under /var/heimdal. MIT kerberos maintains the database under /var/lib/kerberos/krb5kdc. For more information, see Chapter 46, Network AuthenticationKerberos (page 845) and Chapter 47, Installing and Administering Kerberos (page 853).
211
would lead to error messages while browsing the Web and delays while displaying Web pages.
212
XFree86.0.log XFree86.0.log.old
In the course of the change to X.Org, the packages were renamed from XFree86* to xorg-x11*.
213
The wrapper now supports the option --icons-set for switching between KDE and GNOME icons. The following options are no longer supported:
214
--default-configuration, --gui, --java-path, --skip-check, --lang (the language is now determined by means of locales), --messages-in-window, and --quiet. KDE and GNOME Support KDE and GNOME extensions are available in the OpenOffice_org-kde and OpenOffice_org-gnome packages.
215
use_first_pass use_authtok
216
pam_make.so pam_unix2.so
/var/yp
217
/etc/powersave.conf has become obsolete. Existing variables have been moved to the files listed in Table 8.5, Split Configuration Files in /etc/sysconfig/powersave (page 217). If you changed the event variables in /etc/powersave.conf, these must now be adapted in /etc/sysconfig/powersave/events. The names of sleep states have changed from: suspend (ACPI S4, APM suspend) standby (ACPI S3, APM standby) To: suspend to disk (ACPI S4, APM suspend) suspend to ram (ACPI S3, APM suspend) standby (ACPI S1, APM standby)
8.3.27 PCMCIA
cardmgr no longer manages PC cards. Instead, as with Cardbus cards and other subsystems, a kernel module manages them. All necessary actions are executed by hotplug. The pcmcia start script has been removed and cardctl is replaced by pccardctl. For more information, see /usr/share/doc/packages/ pcmciautils/README.SUSE.
218
219
FAM daemon. For remote file systems, run FAM on both the server and client and open the firewall for RPC calls by FAM. GNOME (gnome-vfs2 and libgda) contains a wrapper that picks gamin or fam to provide file system change notification: If the FAM daemon is not running, gamin is preferred (Rationale: Inotify is supported only by gamin and it is more efficient for local file systems). If the FAM daemon is running, FAM is preferred (Rationale: If FAM is running, you probably want remote notification, which is supported only by FAM).
220
OpenWBEM
Novell has embraced the open standard strategies of Web-Based Enterprise Management (WBEM) proposed by the Distributed Management Task Force (DTMF) [http://www.dmtf.org/home]. Implementing these strategies can substantially reduce the level of complexity associated with managing disparate systems in your network. The following information describes a few of the components proposed by the DTMF standards. Understanding what these are and how they relate to each other can help you understand what OpenWBEM is and how you most effectively use it in your network. Web-Based Enterprise Management (WBEM) is a set of management and Internet standard technologies developed to unify the management of enterprise computing environments. WBEM provides the ability for the industry to deliver a well-integrated set of standards-based management tools leveraging the emerging Web technologies. The DMTF has developed a core set of standards that make up WBEM: A data model: the Common Information Model (CIM) standard An encoding specification: CIM-XML Encoding Specification A transport mechanism: CIM operations over HTTP The Common Information Model (CIM) is a conceptual information model that describes management and is not bound to a particular implementation. This allows for the interchange of management information between management systems and applications. This can be either agent-to-manager or manager-to-manager commu-
OpenWBEM
223
nications that provide for distributed system management. There are two parts to CIM: the CIM Specification and the CIM Schema. The CIM Specification describes the language, naming, and meta schema. The meta schema is a formal definition of the model. It defines the terms used to express the model and their usage and semantics. The elements of the meta schema are Classes, Properties, and Methods. The meta schema also supports Indications and Associations as types of Classes, and References as types of Properties. The CIM Schema provides the actual model descriptions. The CIM Schema supplies a set of classes with properties and associations that provide a well understood conceptual framework within which it is possible to organize the available information about the managed environment. The Common Information Model Object Manager (CIMOM) is a CIM object manager or, more specifically, an application that manages objects according to the CIM standard. CIMOM providers are software that performs specific tasks within the CIMOM that are requested by client applications. Each provider instruments one or more aspects of the CIMOM's schema. SUSE Linux Enterprise Server contains the open source CIMOM from the OpenWBEM project [http://openwbem.org]. The Web-Based Enterprise Management software selection includes a set of packages that contain basic Novell providers, including some sample providers, and a base set of accompanying Novell schemas. As Novell moves forward with OpenWBEM and development of specific providers, it will provide tools that offer the following important features: Efficient monitoring of network systems Recording of alterations within existing management configurations Hardware inventory and asset management Understanding how the OpenWBEM CIMOM is set up and how to configure it can help you monitor and manage disparate systems in your network with more confidence and ease.
224
OpenWBEM
225
Stop owcimomd
226
Certificates
Secure Socket Layers (SSL) transports require a certificate for secure communications to occur. When OES is installed, OpenWBEM has a self-signed certificate generated for it. If desired, you can replace the path for the default certificate with a path to a commercial certificate that you have purchased or with a different certificate that you have generated in the http_server.SSL_cert = path_filename setting in the openwbem .conf file. The default generated certificate is in the following location: /etc/openwbem/servercert.pem If you want to generate a new certificate, use the following command. Running this command replaces the current certificate, so Novell recommends making a copy of the old certificate before generating a new one. As root in a console shell, enter sh/etc/openwbem/owgencert. If you want to change the certificate that OpenWBEM uses, see Section 9.2.2, Changing the Certificate Configuration (page 238).
Ports
OpenWBEM is configured by default to accept all communications through a secure port, 5989. The following table explains the port communication setup and recommended configuration. Table 9.2 Port 5989 Port Communication Setup and Recommended Configurations Notes and Recommendations The secure port that OpenWBEM communications use via HTTPS services. This is the default configuration.
Type Secure
OpenWBEM
227
Port
Type
Notes and Recommendations With this setting, all communications between the CIMOM and client applications are encrypted when sent over the Internet between servers and workstations. Users must authenticate through the client application to view this information. Novell recommends that you maintain this setting in the configuration file. In order for the OpenWBEM CIMOM to communicate with the necessary applications, this port must be open in routers and firewalls if they are present between the client application and the nodes being monitored.
5988
Unsecure
The unsecure port that OpenWBEM communications use via HTTP services. This setting is disabled by default. With this setting, all communications between the CIMOM and client applications are open for review when sent over the Internet between servers and workstations by anyone without any authentication. Novell recommends that you use this setting only when attempting to debug a problem with the CIMOM. As soon as the problem is resolved, set the non-secure port option back to Disabled. In order for the OpenWBEM CIMOM to communicate with the necessary applications that require non-secure access, this port must be open in routers and firewalls if they are present between the client application and the nodes being monitored.
If you want to change the default port assignments, see Section 9.2.3, Changing the Port Configuration (page 238).
228
Authentication
The following authentication settings are set and enabled as the default for OpenWBEM in SUSE Linux Enterprise Server. You can change any of the default settings. See Section 9.2.1, Changing the Authentication Configuration (page 230). http_server.allow_local_authentication = true http_server.ssl_client_verification = disabled http_server.use_digest = false owcimomd.allow_anonymous = false owcimomd.allowed_users = root owcimomd.authentication_module = /usr/lib/openwbem/authentication/libpamauthentication.so The OpenWBEM CIMOM is PAM enabled by default; therefore the local root user can authenticate to the OpenWBEM CIMOM with local root user credentials.
OpenWBEM
229
230
See the following settings: Section http_server.allow_local_authentication (page 231) Section http_server.digest_password_file (page 232) Section http_server.ssl_client_verification (page 232) Section http_server.ssl_trust_store (page 233) Section http_server.use_digest (page 234) Section owcimomd.ACL_superuser (page 235) Section owcimomd.allow_anonymous (page 235) Section owcimomd.allowed_users (page 236) Section owcimomd.authentication_module (page 237) Section simple_auth.password_file (page 237)
http_server.allow_local_authentication
Purpose
Directs the http_server to allow local authentication without supplying a password, relying on local system file permissions. You can use this setting with the Basic or Digest settings.
Syntax
http_server.allow_local_authentication = option Option true Description Enables local authentication. This is the default setting.
OpenWBEM
231
Option false
Example
http_server.allow_local_authentication = true
http_server.digest_password_file
Purpose
Specifies a location for the password file. This is required if the http_server.use_digest setting is enabled.
Syntax
http_server.digest_password_file = path_filename The following is the default path and filename for the digest password file: /etc/openwbem/digest_auth.passwd
Example
http_server.digest_password_file = /etc/openwbem/digest_auth.passwd
http_server.ssl_client_verification
Purpose
Determines whether the server should attempt to authenticate clients with SSL Client Certificate verification. This setting is disabled by default.
232
Syntax:
http_server.ssl_client_verification = option Option autoupdate Description Specifies the same functionality as the Optional option; however, previously unknown client certificates that pass HTTP authentication are added to a trust store so that subsequent client connections with the same certificate do not require HTTP authentication. Disables client certificate checking. This is the default setting. optional Allows a trusted certificate to be authenticated (no HTTP authentication is necessary). Also allows an untrusted certificate to pass the SSL handshake if the client passes the HTTP authentication. required Requires a trusted certificate for the SSL handshake to succeed.
disabled
Example
http_server.ssl_client_verification = disabled
http_server.ssl_trust_store
Purpose
Specifies a directory containing the OpenSSL trust store.
Syntax
http_server.ssl_trust_store = path The following is the default path for the trust store file. OpenWBEM 233
/etc/openwbem/truststore
Example
http_server.ssl_trust_store = /etc/openwbem/truststore
http_server.use_digest
Purpose
Directs the HTTP server to use Digest authentication, which bypasses the Basic authentication mechanism. To use digest, you must set up the digest password file using owdigestgenpass. Digest doesnt use the authentication module specified by the owcimomd.authentication_module configuration setting.
Syntax
http_server.use_digest = option Option false Description Enables the Basic authentication mechanism. This is the default setting. true Disables the Basic authentication mechanism.
Example
http_server.use_digest = false
234
owcimomd.ACL_superuser
Purpose
Specifies the username of the user that has access to all Common Information Model (CIM) data in all namespaces maintained by the owcimomd. This user can be used to administer the /root/security name space, which is where all ACL user rights are stored. ACL processing is not enabled until the OpenWBEM_Acl1.0.mof file has been imported.
Syntax
owcimomd.ACL_superuser = username
Example
owcimomd.ACL_superuser = root
owcimomd.allow_anonymous
Purpose
Enables or disables anonymous logins to owcimomd.
Syntax
owcimomd.allow_anonymous = option Option false Description Requires login with a username and password to access owcimomd data. This is the default and recommended setting. true Allows anonymous logins to owcimomd.
OpenWBEM
235
Option
Description This disables authentication. No username or password is required to access owcimomd data.
Example
owcimomd.allowed_anonymous = false
owcimomd.allowed_users
Purpose
Specifies a list of users who are allowed to access owcimomd data.
Syntax
owcimomd.allowed_users = option Option username Description Specifies one or more users who are allowed to access the owcimomd data. Separate each username with a space. * Allows all users to authenticate (for example, if you choose to control access with ACLs instead). This option is enforced for all authentication methods unless owcimomd.allow_anonymous is set to True. This is the default setting.
Example
owcimomd.allowed_users = bcwhitely jkcarey jlanderson
236
owcimomd.authentication_module
Purpose
Specifies the authentication module that is used by owcimomd. This setting should be an absolute path to the shared library containing the authentication module.
Syntax
owcimomd.authentication_module = path_filename The following is the default path and filename for the authentication modules: /usr/lib/openwbem/authentication/libpamauthentication.so
Example
owcimomd.authentication_module = /usr/lib/openwbem/authentication/libpamauthentication.so
simple_auth.password_file
Purpose
Specifies the path to the password file when the simple authentication module is used. This setting is disabled by default.
Syntax
simple_auth.password_file = path_filename
Example
simple_auth.password_file = /etc/openwbem/simple_auth.passwd
OpenWBEM
237
Syntax
http_server.SSL_cert = path_filename or http_server.SSL_key = path_filename NOTE Both the key and certificate can be in the same file. In this case, the values of http_server.SSL_cert and http_server.SSL_key would be the same.
Examples
http_server.SSL_cert = /etc/openwbem/servercert.pem http_server.SSL_key = /etc/openwbem/servercert.pem http_server.SSL_key = /etc/openwbem/serverkey.pem
238
Syntax
http_server.http_port = option or http_server.https_port = option Option Description
Specific_port_number Specify the specific port for HTTP or HTTPS communications. For HTTP, the default port is 5988. For HTTPS, the default port is 5989. -1 Disables HTTP or HTTPS connections (for example, if you only want to support HTTPS connections). Dynamically assigns a port number at runtime.
Example
These settings disable the HTTP port and enable port 5989 for HTTPS communications: http_server.http_port = -1 http_server.https_port = 5989
OpenWBEM
239
Section log.main.components (page 241) Section log.main.format (page 242) Section log.main.level (page 245) Section log.main.location (page 245) Section log.main.max_backup_index (page 246) Section log.main.max_file_size (page 246) Section log.main.type (page 247) If you want to set up debug logging, see Section 9.2.5, Configuring Debug Logging (page 248). If you want to set up additional logs, see Section 9.2.6, Configuring Additional Logs (page 249).
log.main.categories
Purpose
Specifies the categories the log outputs.
Syntax
log.main.categories = option Option Description
category_name Specifies the categories to be logged using a space delimited list. The categories used in owcimomd are: DEBUG ERROR
240
Option
Description FATAL INFO For more information about these options, see Section log.main.level (page 245). If specified in this option, the predefined categories are not treated as levels, but as independent categories. No default is available; and if a category is not set, no categories are logged and the log.main.level setting is used.
Example
log.main.categories = FATAL ERROR INFO
log.main.components
Purpose
Specifies the components that the log outputs.
Syntax
log.main.components = option Option component_name Description Specifies the components to be logged (such as owcimomd) using a space-delimited list. Providers can use their own components.
OpenWBEM
241
Option *
Description Specifies that all components are logged. This is the default setting.
Example
log.main.components = owcimomd nssd
log.main.format
Purpose
Specifies the format (text mixed with printf() style conversion specifiers) of the log messages.
Syntax
log.main.format = conversion_specifier Option %% %c %d Specifies % Component (such as owcimomd) Date Can be followed by a date format specifier enclosed between braces. For example, %d{%H:%M:%S} or %d{%d %b %Y %H:%M:%S}. If no date format specifier is given, then ISO 8601 format is assumed. The only addition is %Q, which is the number of milliseconds.
242
Option
Specifies For more information about the date format specifiers, see the documentation for the strftime() function found in the <ctime> header.
%e
Message as XML CDATA. This includes the <![CDATA[ and ending ]]> Filename Filename and line number. For example, file.cpp(100) Line number Method name where the logging request was issued (only works on C++ compilers which support __PRETTY_FUNCTION__ or C99s __func__). Message Platform-dependent line separator character (\n) or characters (\r\n). Category, also known as level or priority. Number of milliseconds elapsed between the start of the application and the creation of the logging event. Thread ID New line Tab Line feed \
%F %l %L %M
%m %n
%p %r
%t \n \t \r \\
OpenWBEM
243
Option \x<hexDigits>
It is possible to change the minimum field width, the maximum field width, and justification. The optional format modifier is placed between the percent sign (%) and the conversion character. The first optional format modifier is the left justification flag, which is the minus (-) character. The optional minimum field width modifier follows, which is an integer that represents the minimum number of characters to output. If the data item requires fewer characters, it is padded with spaces on either the left or the right, according to the justification flag. If the data item is larger than the minimum field width, the field is expanded to accommodate the data. The maximum field width modifier is designated by a period (.) followed by a decimal constant. If the data item is longer than the maximum field, then the extra characters are removed from the beginning of the data item (by default) or from the end (if the left justification flag was specified).
Examples
Log4j TTCC layout: "%r [%t] %-5p %c - %m" Similar to TTCC but with some fixed-size fields: "%-6r [%15.15t] %-5p %30.30c - %m" XML output conforming to log4j.dtd 1.2, which can be processed by Chainsaw (if used, this must be on one line; it is split up here for readability): "<log4j:event logger="%c" timestamp="%d{%s%Q}" level="%p" thread="%t"> <log4j:message>%e</log4j:message> <log4j:locationInfo class="" method="" file="%F" line="%L"/></log4j:event>" The following is the default: log.main.format = [%t]%m
244
log.main.level
Purpose
Specifies the level the log outputs. If set, the log outputs all predefined categories at and above the specified level.
Syntax
log.main.level = option Option DEBUG ERROR Description Logs all Debug, Info, Error, and Fatal error messages. Logs all Error and Fatal error messages. This is the default setting. FATAL INFO Logs only Fatal error messages. Logs all Info, Error, and Fatal error messages.
Example
log.main. level = ERROR
log.main.location
Purpose
Specifies the location of the log file owcimomd uses when the log.main.type setting option specifies that logging is sent to a file.
Syntax
log.main.location = path_filename
OpenWBEM
245
Example
log.main.location = /system/cimom/var/owcimomd.log
log.main.max_backup_index
Purpose
Specifies the amount of backup logs that are kept before the oldest is erased.
Syntax
log.main.backup_index = option Option Description
unsigned_integer_above_0 Specifies the number of backup logs kept. The default setting is 1 log file. 0 No backup logs are made and the log is truncated when it reaches the maximum file size.
Example
log.main.max_backup_index = 1
log.main.max_file_size
Purpose
Specifies the maximum size (in KB) that the owcimomd log can grow to.
Syntax
log.main.max_file_size = option
246
Lets the log grow to an unlimited size. This is the default setting.
Example
log.main.max_file_size = 0
log.main.type
Purpose
Specifies the type of main log owcimomd uses.
Syntax
log.main.type = option Option file Description Sends all messages to a file that is identified in the log.main.location configuration setting. Disables logging. Sends all messages to the syslog interface. This is the default setting.
null syslog
Example
log.main.type = syslog
OpenWBEM
247
248
Color dark yellow blue dark blue purple dark purple cyan dark cyan white dark white gray reset color
Codes \x1b[0;33;40m \x1b[1;34;40m \x1b[0;34;40m \x1b[1;35;40m \x1b[0;35;40m \x1b[1;36;40m \x1b[0;36;40m \x1b[1;37;40m \x1b[0;37;40m \x1b[0;37;40m \x1b[0;37;40m
Syntax
owcimomd.additional_logs = logname For each log, the following settings apply:
OpenWBEM
249
Example
owcimomd.additional_logs = errorlog1 errorlog2 errorlog3
250
Multipath IO
Linux multipathing provides IO failover and path load sharing for multipathed block devices. The multipath IO support in SUSE Linux Enterprise Server is based on the Device Mapper multipath module of the Linux kernel and the multipath-tools userspace package.
10
Device mapping multipath IO features automatic configuration of the subsystem for a large variety of setups. Active/passive or active/active (with round-robin load balancing) configurations of up to eight paths to each device are supported. multipath-tools take care of automatic path discovery and grouping as well as automated path retesting, so that a previously failed path is automatically reinstated when it becomes healthy again. This minimizes the need for administrator attention in a production environment. Device mapping multipath IO supports partitions (with limitations) and LVM2. Software RAID is also supported, but automatic discovery is not available. To use software RAID with mdadm, /etc/mdadm.conf must be set up correctly. See Section 10.4, Using the Devices (page 256) for more information. Currently, device mapping multipath IO is not available for the boot partition, because the boot loader cannot handle multipath IO. Therefore it is recommended to set up a separate boot partition when using multipath IO.
Multipath IO
251
252
Because the Qlogic driver is not automatically loaded on start-up, add it here:
INITRD_MODULES="cciss qla2xxx"
After having changed /etc/sysconfig/kernel, recreate the INITRD on your system with the command mkinitrd. When you are using LILO as a boot manager, reinstall it with the command /sbin/lilo. No further action is required if you are using GRUB.
Multipath IO
253
3600601607cf30e00184589a37a31d911 [size=127 GB] [features="0"] [hwhandler="1 emc"] \_ round-robin 0 [first] \_ 1:0:1:2 sdav 66:240 [ready ] \_ 0:0:1:2 sdr 65:16 [ready ] \_ round-robin 0 \_ 1:0:0:2 sdag 66:0 [ready ] \_ 0:0:0:2 sdc 8:32 [ready ]
Name of the device Size of the device Features of the device Hardware handlers involved Priority group 1 Priority group 2
Paths are grouped into priority groups. There is only ever one priority group in active use. To model an active/active configuration, all paths end up in the same group. To model active/passive, the paths that should not be active in parallel are placed in several distinct priority groups. This normally happens completely automatically on device discovery. The output shows the order, the scheduling policy used to balance IO within the group, and the paths for each priority group. For each path, its physical address (host:bus:target:lun), device node name, major:minor number, and state is shown.
The multipath devices should now show up automatically under /dev/disk/ by-name/. The default name is the WWN (World Wide Name) of the logical unit, which you can override using /var/lib/multipath/bindings by setting user_friendly_names in /etc/multipath.conf to yes.
254
To permanently add multipath IO services to the boot sequence, run the following command:
insserv boot.multipath multipathd
Multipath IO
255
Because this leads to IO being queued forever unless a path is reinstated, make sure that multipathd is running and works for your scenario. Otherwise, IO might be stalled forever on the affected MPIO device until reboot or until you manually issue
dmsetup message <NAME> 0 fail_if_no_path
This immediately cause all queued IO to fail (replace <NAME> with the the correct map name). You can reactivate queueing by issuing the following command:
dmsetup message <NAME> 0 queue_if_no_path
You can also use these two commands to switch between modes for testing before committing the command to /etc/multipath.conf.
256
This allows LVM2 to scan only the by-name paths and reject everything else. If you are also using LVM2 on non-multipath IO devices, make the necessary adjustments to suit your setup.
10.4.4 Partitions
Currently it is not possible to partition multipath IO devices themselves. If the underlying physical device is already partitioned, the multipath IO device reflects those partitions and the layer provides /dev/disk/by-name/>name<p1 ... pN devices so you can access the partitions through the multipath IO layer. As a consequence, the devices need to be partitioned prior to enabling multipath IO. If you change the partitioning in the running system, Multipath IO does not automatically detect and reflect these changes. It must be reinitialized, which usually requires a reboot.
Multipath IO
257
11
linux-iSCSI provides an easy and reasonably inexpensive solution for connecting Linux computers to central storage systems. In principle, iSCSI represents a transfer of SCSI commands on the IP level. If a program starts an inquiry for such a device, the operating system produces the necessary SCSI commands. These are then embedded in IP packages and encrypted as necessary by software that is commonly known as an iSCSI initiator. The packages are then transferred to the corresponding iSCSI remote station, also called iSCSI target. Many storage solutions provide access over iSCSI, but it is also possible to run a Linux server that provides an iSCSI target. In this case, it is important to set up the Linux server optimized for file system services. The iSCSI target just accesses block devices in Linux. Therefore it is possible to use RAID solutions to increase disk space as well as a lot of memory to improve data caching. For more information about RAID, also see Section 6.2, Soft RAID Configuration (page 131).
259
To configure the iSCSI target, run the iSCSI Target module in YaST. The configuration is split into three tabs. In the Service tab, select the start mode and the firewall settings. If you want to access the iSCSI target from a remote machine, select Open Port in Firewall. The Global tab provides settings for the iSCSI server. The authentication set here is used for the discovery of services, not for accessing the targets. If you do not want to restrict the access to the discovery, use No Authentication. If authentication is needed, there are two possibilities to consider. One is that an initiator must prove that it has the permissions to run a discovery on the iSCSI target. This is done with Incoming Authentication. The other is that the iSCSI target must prove to the initiator that it is the expected target. Therefore, the iSCSI target can also provide a username and password. This is done with Outgoing Authentication. Find more information about authentication in RFC 3720 (see http://www.ietf.org/rfc/ rfc3720.txt). The targets are defined in the Targets tab. Use Add to create a new iSCSI target. The first dialog asks for information about the device to export. Target The Target line has a fixed syntax that looks like the following:
iqn.yyyy-mm.<reversed domain name>
It always starts with iqn. yyyy-mm is the format of the date when this target is activated. Find more about naming conventions in RFC 3722 (see http://www .ietf.org/rfc/rfc3722.txt).
260
Identifier The Identifier is freely selectable. It should follow some scheme to make the whole system more structured. LUN It is possible to assign several LUNs to a target. However, this is not supported with YaST. Therefore, this should always be the number 0. Path Add the path to the block device or file system image to export. The next menu configures the access restrictions of the target. The configuration is very similar to the configuration of the discovery authentication. In this case, at least an incoming authentication should be setup. Next finishes the configuration of the new target, and brings you back to the overview page of the Target tab. Activate your changes by clicking on Finish.
The authentication is followed by one or several target definitions. For each target, add a Target section. This section always starts with a Target identifier followed by definitions of logical unit numbers:
Target iqn.yyyy-mm.<reversed domain name>[:identifier] Lun 0 Path=/dev/mapper/system-v3 Lun 1 Path=/dev/hda4 Lun 2 Path=/var/lib/xen/images/xen-1,Type=fileio
261
In the Target line, yyyy-mm is the date when this target is activated, and identifier is freely selectable. Find more about naming conventions in RFC 3722 (see http:// www.ietf.org/rfc/rfc3722.txt). Three different block devices are exported in this example. The first one is a logical volume (see also Section 6.1, LVM Configuration (page 123)), the second is an IDE partition, and the third is an image available in the local file system. All these look like block devices to an iSCSI initiator. Before activating the iSCSI target, add at least one IncomingUser after the Lun definitions. It does the authentication for the use of this target. To activate all your changes, restart the iscsitarget daemon with rciscsi restart. Check your configuration in the /proc file system:
cat /proc/net/iet/volume tid:1 name:iqn.2006-02.com.example.iserv:systems lun:0 state:0 iotype:fileio path:/dev/mapper/system-v3 lun:1 state:0 iotype:fileio path:/dev/hda4 lun:2 state:0 iotype:fileio path:/var/lib/xen/images/xen-1
There are many more options that control the behavior of the iSCSI target. Find them in the manual page of ietd.conf. Active sessions are also displayed in the /proc file system. For each connected initiator, an extra entry is added to /proc/net/iet/session:
cat /proc/net/iet/session tid:1 name:iqn.2006-02.com.example.iserv:system-v3 sid:562949957419520 initiator:iqn.2005-11.de.suse:cn=rome.example.com,01.9ff842f5645 cid:0 ip:192.168.178.42 state:active hd:none dd:none sid:281474980708864 initiator:iqn.2006-02.de.suse:01.6f7259c88b70 cid:0 ip:192.168.178.72 state:active hd:none dd:none
262
To create a new iSCSI target with a LUN, first update your configuration file. The additional entry could be:
Target iqn.2006-02.com.example.iserv:system2 Lun 0 Path=/dev/mapper/system-swap2 IncomingUser joe secret
To set up this configuration manually, proceed as follows: 1 Create a new target with the command ietadm --op new --tid=2 --params Name=iqn.2006-02.com.example.iserv:system2. 2 Add a logical unit with ietadm --op new --tid=2 --lun=0 --params Path=/dev/mapper/system-swap2. 3 Set the username and password combination on this target with ietadm --op new --tid=2 --user --params=IncomingUser=joe,Password=secret. 4 Check the configuration with cat /proc/net/iet/volume. It is also possible to delete active connections. First, check all active connections with the command cat /proc/net/iet/session. This may look like:
cat /proc/net/iet/session tid:1 name:iqn.2006-03.com.example.iserv:system sid:281474980708864 initiator:iqn.1996-04.com.example:01.82725735af5 cid:0 ip:192.168.178.72 state:active hd:none dd:none
To delete the session with the session ID 281474980708864, use the command ietadm --op delete --tid=1 --sid=281474980708864 --cid=0. Be aware that this makes the device unaccessible on the client system and processes accessing this device are likely to hang. ietadm can also be used to change various configuration parameters. Obtain a list of the global variables with ietadm --op show --tid=1 --sid=0. The output looks like:
InitialR2T=Yes ImmediateData=Yes MaxConnections=1 MaxRecvDataSegmentLength=8192 MaxXmitDataSegmentLength=8192 MaxBurstLength=262144 FirstBurstLength=65536 DefaultTime2Wait=2
263
DefaultTime2Retain=20 MaxOutstandingR2T=1 DataPDUInOrder=Yes DataSequenceInOrder=Yes ErrorRecoveryLevel=0 HeaderDigest=None DataDigest=None OFMarker=No IFMarker=No OFMarkInt=Reject IFMarkInt=Reject
All of these parameters may be changed easily. For example, if you want to change the maximum number of connections to two, use ietadm --op update --tid=1 --params=MaxConnections=2. In the file /etc/ietd.conf, the associated line should look like MaxConnections 2. WARNING: Update ietd.conf According to Changes with ietadm The changes that you make with the command ietadm are not permanent for the system. These changes are lost at the next reboot if they are not added to the configuration file /etc/ietd.conf. Depending on the usage of iSCSI in your network, this may lead to severe problems. There are several more options available for the command ietadm. Find an overview with ietadm -h. The abbreviations there are target ID (tid), session ID (sid), and connection ID (cid). They can also be found in /proc/net/iet/session.
264
265
The discovery stores all received values in an internal persistent database. In addition, it displays all detected targets. Run this discovery with the command iscsiadm -m discovery --type=st --portal=<targetip>. The output should look like:
[bd0ac2] 149.44.171.99:3260,1 iqn.2006-02.com.example.iserv:systems
For each target defined on the iSCSI target, one line appears. In the previous example, the ID of the target is bd0ac2. This ID is used to access the target. Learn how to obtain more information about the stored data in Section 11.2.3, The iSCSI Client Databases (page 266). For now, just modify the authentication credentials in this database to be able to access target bd0ac2. Assume that you access a target with incoming user <username> and password <password>:
iscsiadm -m node --record=bd0ac2 --op=update \ --name=node.session.auth.authmethod --value=CHAP iscsiadm -m node --record=bd0ac2 --op=update \ --name=node.session.auth.username --value=<username> iscsiadm -m node --record=bd0ac2 --op=update \ --name=node.session.auth.password --value=<password>
Now, the initiator is prepared for its activation. The special --login option of iscsiadm creates all needed devices:
iscsiadm -m node --record=bd0ac2 --login
The newly generated devices show up in the output of lsscsi and can now be accessed by mount.
266
The record ID in this example is bd0ac2. This ID is needed for all actions that relate to this special data set. To examine the content of the data record with the ID bd0c2, use the following command:
iscsiadm -m node --record=bd0ac2 node.name = iqn.2006-02.com.example.iserv:systems node.transport_name = tcp node.tpgt = 1 node.active_conn = 1 node.startup = manual node.session.initial_cmdsn = 0 node.session.reopen_max = 32 node.session.auth.authmethod = CHAP node.session.auth.username = joe node.session.auth.password = ******** node.session.auth.username_in = <empty> node.session.auth.password_in = <empty> node.session.timeo.replacement_timeout = 0 node.session.err_timeo.abort_timeout = 10 node.session.err_timeo.reset_timeout = 30 node.session.iscsi.InitialR2T = No node.session.iscsi.ImmediateData = Yes ....
To edit the value of one of these variables, use the command iscsiadm with the update operation. For example, if you want iscsid to log in to the iSCSI target when it initializes, set the variable node.startup to the value automatic:
iscsiadm -m node --record=bd0ac2 --op=update --name=node.startup --value=automatic
Remove obsolete data sets with the operation delete. If the record bd0ac2 is no longer a valid record, delete this record with the command iscsiadm -m node --record=bd0ac2 --op=delete. Use caution because this deletes the record without any additional confirmation prompt.
267
http://www.open-iscsi.org/cgi-bin/wiki.pl http://www.novell.com/coolsolutions/appnote/15394.html There is also some online documentation available. See the manual pages of iscsiadm, iscsid, ietd.conf, and ietd and the example configuration file /etc/iscsid .conf.
268
12
This chapter contains a short overview of the key concepts and tools from the area of high availability under Linux. It also offers suggested further reading for all the topics mentioned. High availability describes systems that can mask certain malfunctionsin particular, the failure of individual computersso the service can be made available to the user again after only a short downtime. Hardware and software are carefully coordinated and laid out for redundancy, enabling an automatic switch to the other components in the event of a malfunction. High availability differs from error tolerance because the service is temporarily unavailable for the short service switchover phase, which can be noticed in delays or short losses in connection. A high availability system particularly means when the overall availability of the service is between 99.999 percent and 99.99999 percent. This corresponds to a downtime of between five minutes and three seconds over an entire year. The most important factor is not just the software and hardware side, but, primarily, well-conceived system administration with well-documented and understandable processes for minimizing faults. In every case, it involves weighing risks and costs. Different requirements and solutions may be appropriate, depending on the application scenario. Your Novell partner will be happy to advise you.
269
SPOF Single Point of Failure: Component of a system whose failure impairs the functioning of the whole system. Failover Another similar system component automatically takes over the function of a failed component. Cold Standby The alternative hardware is on cold standby. The failover must be performed manually, so the failure will be clearly apparent. Warm Standby The backup system runs in the background, so the transfer can take place automatically. The data on both systems is automatically synchronized. For the user, the failover is like a very fast automatic service reboot. However, the current transaction may be aborted because it was not possible to synchronize the data prior to failure. Hot Standby Both systems permanently run in paralleldata on both systems is one hundred percent synchronized. Users will not be aware of any failures. This level cannot usually be reached without making a corresponding modification to the client. To run both systems completely synchronously, the connections to the client must be mirrored one hundred percent. This normally requires clients that have connections with two or more servers at the same time and that communicate with all of them. A normal Web browser cannot do this. Load Balancing The distribution of load within a cluster of computers. Load balancing is used in an LVS scenario (Linux virtual server), for example (see Section 12.5.2, Linux Virtual Server (page 275)). STONITH Shot the other node in the head: Special hardware and software that ensures that a faulty node does not write-access distributed media within a cluster, threatening data consistency in the entire cluster. This involves simply disconnecting the system from the main power supply.
270
SAN
Primary
Interruption
Secondary
Migrated data
Client application
The two servers (primary and backup) are both connected to a SAN (storage area network). Depending on the mode, this is only accessed by the active node. The servers communicate with each other in such a way that they regularly emit a sign of life (heartbeat). The communication channels (or heartbeat links) are also laid out in a redundant way, so independent channels can be used by means of a variety of network cards and cable channels. If one of the links fails, its backups continue to report correctly that the relevant server is still alive. If there is no sign of life from the main system, the standby system is activated, so it takes over the services of the failed partner and removes it from the network completely (STONITH).
271
272
Applications All important data and applications that form the outer face of your systems must be arranged in such a way that they will not prevent a restart. If an application does not release its lock files after a crash, this prevents the relevant process from restarting. This means that the application is not suitable for a high availability environment. Ideally, the health of certain applications, operating system processes, and network connections should be monitored with a suitable monitoring tool. Data After a system fails, all key data must be available to the failover system complete and intact. This type of high availability is achieved by distributing stored data over several systems or hard disks. For this, the contents of a disk are regularly mirrored on another disk (or several disks), which can take over with the intact data record if a failure occurs. Use a journaling file system to ensure that a file system restarts in a consistent state after a system crash. Network All network infrastructure should be configured for redundancy, from the router and switch infrastructure down to the simple network cable.
12.4.1 heartbeat
heartbeat is a package that is used to monitor all the nodes used in the cluster. heartbeat exchanges heartbeats on the network interfaces of the members of the cluster to find out which nodes in the cluster are active. If a node fails, it does not emit a signal. In this case, heartbeat ensures that another node takes over the relevant tasks and identity and makes the failover known within the network. This means that the cluster remains consistent. See also Chapter 13, Installing a Heartbeat 2 Cluster Using YaST (page 279).
273
12.4.2 RAID
RAID (redundant array of independent disks) brings together several hard disk partitions to form a large virtual hard disk. RAID can be used to optimize the performance and data security of your system. RAID levels 1 and 5 offer protection against the failure of a disk because the data is recorded on several disks at the same time. This ensures that the complete data record is always available on another disk in the system should a disk fail. Find more information about RAID with SUSE Linux Enterprise Server in Section 6.2, Soft RAID Configuration (page 131).
12.4.3 rsync
rsync can be used to synchronize large amounts of data between a server and its backup. rsync has sophisticated mechanisms for only transferring changes to files. This applies not only to text files, but also to binary files. To enable the differences between files to be identified, rsync divides the files into blocks and calculates checksums for these blocks. Find more information about rsync in Section 40.6, Introduction to rsync (page 744).
12.4.4 DRBD
Distributed replicated block device (drbd) mirrors (RAID1) partitions and logical volumes (data areas) by means of a normal network on the basis of TCP/IP. Each node has a particular drbd resource active and all changes are mirrored as secure transactions. drbd has additional features in comparison with RAID1 for local disks that enable the resynchronization time to be minimized after the two nodes have been disconnected briefly and a robust check after various malfunctions to establish which side has the latest, consistent data.
274
12.5 Clustering
12.5.1 Cluster Alias
The cluster alias is a technology that allows several nodes to be configured with a shared IP address, while also permitting TCP/IP connections to be established at this address. Inbound TCP/IP connections are automatically distributed. Unlike the Linux virtual server, a dedicated load balancer is not required. However, because of the type of implementation, the cluster alias is less efficient when there is a large number of nodes. In the case of the cluster alias, all IP packages are distributed to all nodes, which then filter out the packages intended for them. In the case of LVS, this decision is only taken once by the load balancer. For further information about how to configure this feature, see the iptables manual page.
275
12.6.2 DRBD
The home page for the DRBD project is http://www.drbd.org/. A useful article in the Linux magazine is available at http://www.linux-mag.com/2003-11/ drbd_01.html.
12.6.3 RAID
A detailed collection of links relating to the topic of RAID: http://linas.org/ linux/raid.html
276
12.6.4 Clustering
The Linux Clustering Information Center home page offers further information about clustering at http://www.lcic.org/. The home page for the Linux Virtual Server project is http://www.linuxvirtualserver.org/. Find information about the Oracle cluster file system on the project home page at http://oss.oracle.com/projects/ocfs/ and detailed documentation under http://oss.oracle.com/projects/ocfs/documentation/.
277
13
Heartbeat 2 is now part of SUSE Linux Enterprise 10. A Heartbeat 2 cluster can be installed and configured using the YaST setup tool. During the Heartbeat 2 installation, you are prompted for information that is necessary for Heartbeat 2 to function properly. This section contains information to help you install and configure a Heartbeat 2 cluster. This cluster installation program does not copy the Heartbeat software package to cluster nodes. Prior to running this installation program, the Heartbeat software package must be installed on all nodes that will be part of your cluster. This can be done during the SUSE Linux Enterprise 10 installation, or after. This installation program lets you create a new cluster or add nodes to an existing cluster. To add new nodes to an existing cluster, you must run this installation program from a node that is already in the cluster, not on a node that you want to add to the cluster.
279
At least one communications medium (Ethernet, etc.) that allows cluster nodes to communicate with each other
280
2 On the Node Configuration screen, add a node to the cluster by specifying the node name of the node you want to add, then click Add. Repeat this process for each node you want to add to the cluster, then click Next. You can find node names for servers by entering uname -n on each node. If after adding a node to the cluster, you need to specify a different node name for that node, double click the node you want to edit, change the node name, and then click Edit. 3 On the Authentication Keys screen, specify the authentication method the cluster will use for communication between cluster nodes, and if necessary an authentication key (password). Then click Next. Both the MD5 and SHA1 methods require a shared secret, which is used to protect and authenticate messages. The CRC method does not perform message authentication, and only protects against corruption, not against attacks. The SHA1 method is recommended, because it provides the strongest authentication scheme available. The authentication key (password) you specify will be used on all nodes in the cluster. 4 On the Media Configuration screen, specify the method Heartbeat 2 will use for internal communication between cluster nodes. This provides a way for cluster nodes to signal that they are alive to other nodes in the cluster. For proper redundancy, you should specify at least two heartbeat mediums if possible. Choose at least one Heartbeat Medium, and if possible, more than one. If you choose Broadcast, select one of the available network devices in the device list. For multicast, choose a network device, multicast group to join (class D multicast address 224.0.0.0 - 239.255.255.255) and the ttl value (1-255). UDP Port sets the UDP port that is used for the broadcast media. Leave this set to the default value (694) unless you are running multiple Heartbeat clusters on the same network segment, in which case you need to run each cluster on a different port number.
281
5 After specifying a heartbeat medium, click Add to add that medium type to Heartbeat. 6 On the STONITH Configuration screen, enter or select the name of the node in the Host from field, choose the STONITH T ype, specify any necessary parameters, then click Add. Repeat this process for each desired node. To protect shared data, STONITH must be configured. Heartbeat is capable of controlling a number of serial and network power switches, and can prevent a potentially faulty node from corrupting shared data by cutting the power to that node. The node names you specify in the Host from field are the nodes that can access the network power switch. For a serial power switch, this is a specific node name. For a network power switch you should typically type an asterisk * to indicate that it is accessible from all nodes. The STONITH Type is the name of the module that is used to control the power switch. Parameters are specific to the module specified. See the stonith -h command line tool for a list of supported modules and the parameters they accept. 7 On the Start-up Configuration screen, choose whether you want to start the Heartbeat software on this cluster server each time it is booted. If you select Off, you must start Heartbeat manually each time this cluster server is booted. You can start the heartbeat server manually using the /etc/init.d/heartbeat start command. To start the Heartbeat server immediately, click Start Heartbeat Server Now. To start Heartbeat on the other servers in the cluster when they are booted, enter chkconfig heartbeat on at the server console of each of those servers. You can also enter chkconfig heartbeat off at the server console to have Heartbeat not start automatically when the server is rebooted.
282
283
14
285
Oracle RAC and other databases General applications and workloads XEN image store in a cluster XEN virtual machines and virtual servers can be stored on OCFS2 volumes that are mounted by cluster servers to provide quick and easy portability of XEN virtual machines between servers. LAMP (Linux, Apache, MySQL, and PHP | Pearl | Python) stacks In addition, it is fully integrated with Heartbeat 2. As a high-performance, symmetric, parallel cluster file system, OCFS2 supports the following functions: An applications files are available to all nodes in the cluster. Users simply install it once on an OCFS2 volume in the cluster. All nodes can concurrently read and write directly to storage via the standard file system interface, enabling easy management of applications that run across a cluster. File access is coordinated through the Distributed Lock Manager (DLM). DLM control is good for most cases, but an applications design might limit scalability if it contends with the DLM to coordinate file access. Storage backup functionality is available on all back-end storage. An image of the shared application files can be easily created, which can help provide effective disaster recovery. OCFS2 also provides the following capabilities: Metadata caching Metadata journaling Cross-node file data consistency A GTK GUI-based administration via the ocfs2console utility
286
Operation as a shared-root file system Support for multiple-block sizes (each volume can have a different block size) up to 4 KB, for a maximum volume size of 16 TB Support for up to 255 cluster nodes Context-dependent symbolic link (CDSL) support for node-specific local files Asynchronous and direct I/O support for database files for improved database performance
Heartbeat (HB)
TCP
Distributed Lock Manager Keeps track of all locks and their owners and status (DLM) CONFIGFS User space configuration file system. For details, see Section 14.1.4, In-Memory File Systems (page 288).
287
Service DLMFS
Description User space interface to the kernel space DLM. For details, see Section 14.1.4, In-Memory File Systems (page 288).
For example, if the O2CB_HEARTBEAT_THRESHOLD value is set at the default value of 7, the wait time is 12 seconds ((7 - 1) * 2 = 12).
288
Table 14.2
Communicates the list of nodes in the cluster to the in-kernel node manager, and communicates the resource used for the heartbeat to the in-kernel heartbeat thread Communicates locking and unlocking for clusterwide locks on resources to the in-kernel distributed lock manager that keeps track of all locks and their owners and status
ocfs2_dlmfs
/dlm
fsck.ocfs2
289
Description Creates an OCFS2 file system on a device, usually a partition on a shared physical or logical disk. This tool requires the O2CB cluster service to be up. Detects and lists all OCFS2 volumes on a clustered system. Detects and lists all nodes on the system that have mounted an OCFS2 device or lists all OCFS2 devices. Creates a context-dependent symbolic link (CDSL) for a specified filename (file or directory) for a node. A CDSL filename has its own image for a specific node, but has a common name in the OCFS2. Changes OCFS2 file system parameters, including the volume label, number of node slots, journal size for all node slots, and volume size.
mounted.ocfs2
ocfs2cdsl
tune.ocfs2
Use the following commands to manage O2CB services. For more information about the o2cb command syntax, see its man page. Table 14.4 Command /etc/init.d/o2cb status O2CB Commands Description Reports whether the o2cb services are loaded and mounted Loads the O2CB modules and in-memory file systems Onlines the cluster named ocfs2 At least one node in the cluster must be active for the cluster to be online. /etc/init.d/o2cb offline ocfs2 Offlines the cluster named ocfs2
290
/etc/init.d/o2cb start ocfs2 If the cluster is set up to load on boot, starts the cluster named ocfs2 by loading o2cb and onlining the cluster At least one node in the cluster must be active for the cluster to be online. /etc/init.d/o2cb stop ocfs2 If the cluster is set up to load on boot, stops the cluster named ocfs2 by offlining the cluster and unloading the O2CB modules and in-memory file systems
The software packages ocfs2-tools and ocfs2console should be listed in the right panel. If they are selected, the packages are already installed. 4 If you need to install the packages, select them, then click Install and follow the on-screen instructions.
291
14.2.1 Prerequisites
Before you begin, do the following: Initialize, carve, or configure RAIDs on the SAN disks, as needed, to prepare the devices you plan to use for your OCFS2 volumes. Leave the devices as free space. We recommend that you store application files and data files on different OCFS2 volumes, but it is only mandatory to do so if your application volumes and data volumes have different requirements for mounting. For example, the Oracle RAC database volume requires the datavolume and nointr mounting options, but the Oracle Home volume should never use these options. Make sure that the ocfs2console, and ocfs2-tools packages are installed. Use YaST or command line methods to install them if they are not. For YaST instructions, see Section 14.1.6, OCFS2 Packages (page 291).
When you add a new service, chkconfig ensures that the service has either a start or a kill entry in every run level.
292
(yes) to enable load on boot. c At the Cluster to start on boot (Enter none to clear) [ocfs2] prompt, enter
none
This choice presumes that you are setting up OCFS2 for the first time or resetting the service. You specify a cluster name in the next step when you set up the /etc/ocfs2/cluster.conf file. 5 Use the ocfs2console utility to set up and save the /etc/ocfs2/cluster .conf file to all member nodes of the cluster. This file should be the same on all the nodes in the cluster. Use the following steps to set up the first node. Later, you can use the ocfs2console to add new nodes to the cluster dynamically and to propagate the modified cluster.conf file to all nodes. However, if you change other settings, such as the cluster name and IP address, you must restart the cluster for the changes to take effect, as described in Step 6 (page 294). a Open the ocfs2console GUI by entering
ocfs2console
293
If cluster.conf is not present, the console will create one with a default cluster name of ocfs2. Modify the cluster name as desired. c In the Node Configuration dialog box, click Add to open the Add Node dialog box. d In the Add Node dialog box, specify the unique name of your primary node, a unique IP address (such as 192.168.1.1), and the port number (optional, default is 7777), then click OK. The ocfs2console console assigns node slot numbers sequentially from 0 to 254. e In the Node Configuration dialog box, click Apply, then click Close to dismiss the Add Node dialog box. f Click Cluster Propagate Configuration to save the cluster.conf file to all nodes. 6 If you need to restart the OCFS2 cluster for the changes to take effect, enter the following lines, waiting in between for the process to return a status of OK.
/etc/init.d/o2cb stop /etc/init.d/o2cb start
Replace ocfs2 with the actual cluster name of your OCFS2 cluster.
294
The OCFS2 cluster must be online, because the format operation must first ensure that the volume is not mounted on any node in the cluster. 3 Create and format the volume using one of the following methods: In EVMSGUI, go to the Volumes page, select Make a file system OCFS2, then specify the configuration settings. Use the mkfs.ocfs2 utility. For information about the syntax for this command, refer to the mkfs.ocfs2 man page. In the ocfs2console, click Tasks Format, select a device in the Available Devices list that you want to use for your OCFS2 volume, specify the configuration settings for the volume, then click OK to format the volume. See the following table for recommended settings. OCFS2 Parameter Volume label Description and Recommendation
A descriptive name for the volume to make it uniquely identifiable when it is mounted on different nodes. Use the tunefs.ocfs2 utility to modify the label as needed.
Cluster size
Cluster size is the smallest unit of space allocated to a file to hold the data. Options are 4, 8, 16, 32, 64, 128, 256, 512, and 1024 KB. Cluster size cannot be modified after the volume is formatted. Oracle recommends a cluster size of 128 KB or larger for database volumes. Oracle also recommends a cluster size of 32 or 64 KB for Oracle Home.
The maximum number of nodes that can concurrently mount a volume. On mounting, OCFS2 creates separate system files, such as the journals, for each of the nodes. Nodes that access the volume can be a combination of little-endian architectures
295
OCFS2 Parameter
(such as x86, x86-64, and ia64) and big-endian architectures (such as ppc64 and s390x). Node-specific files are referred to as local files. A node slot number is appended to the local file. For example: journal:0000 belongs to whatever node is assigned to slot number 0. Set each volumes maximum number of node slots when you create it, according to how many nodes that you expect to concurrently mount the volume. Use the tunefs.ocfs2 utility to increase the number of node slots as needed; the value cannot be decreased. Block size The smallest unit of space addressable by the file system. Specify the block size when you create the volume. Options are 512 bytes (not recommended), 1 KB, 2 KB, or 4 KB (recommended for most volumes). Block size cannot be modified after the volume is formatted.
Replace ocfs2 with the actual cluster name of your OCFS2 cluster. The OCFS2 cluster must be online, because the format operation must ensure that the volume is not mounted on any node in the cluster. 3 Use one of the following methods to mount the volume.
296
In the ocfs2console, select a device in the Available Devices list, click Mount, specify the directory mount point and mount options (optional), then click OK. Mount the volume from the command line, using the mount command. Mount the volume from the /etc/fstab file on system boot. Mounting an OCFS2 volume takes about 5 seconds, depending on how long it takes for the heartbeat thread to stabilize. On a successful mount, the device list in the ocfs2console shows the mount point along with the device. For information about mounting an OCFS2 volume using any of these methods, see the OCFS2 User Guide [http://oss.oracle.com/projects/ ocfs2/documentation/] on the OCFS2 project at Oracle [http://oss .oracle.com/projects/ocfs2/]. When running Oracle RAC, make sure to use the datavolume and nointr mounting options for OCFS2 volumes that contain the Voting diskfile (CRS), Cluster registry (OCR), Data files, Redo logs, Archive logs, and Control files. Do not use these options when mounting the Oracle Home volume. Option
datavolume
Description Ensures that the Oracle processes open the files with the o_direct flag. No interruptions. Ensures the IO is not interrupted by signals.
nointr
297
15
The term POSIX ACL suggests that this is a true POSIX (portable operating system interface) standard. The respective draft standards POSIX 1003.1e and POSIX 1003.2c have been withdrawn for several reasons. Nevertheless, ACLs as found on many systems belonging to the UNIX family are based on these drafts and the implementation of file system ACLs as described in this chapter follows these two standards as well. They can be viewed at http://wt.xpilot.org/publications/posix.1e/.
299
would not be able to change passwd, because it would be too dangerous to grant all users direct access to this file. A possible solution to this problem is the setuid mechanism. setuid (set user ID) is a special file attribute that instructs the system to execute programs marked accordingly under a specific user ID. Consider the passwd command:
-rwsr-xr-x 1 root shadow 80036 2004-10-02 11:08 /usr/bin/passwd
You can see the s that denotes that the setuid bit is set for the user permission. By means of the setuid bit, all users starting the passwd command execute it as root.
You can see the s that denotes that the setgid bit is set for the group permission. The owner of the directory and members of the group archive may access this directory. Users that are not members of this group are mapped to the respective group. The effective group ID of all written files will be archive. For example, a backup program that runs with the group ID archive is able to access this directory even without root privileges.
300
15.3 Definitions
user class The conventional POSIX permission concept uses three classes of users for assigning permissions in the file system: the owner, the owning group, and other users. Three permission bits can be set for each user class, giving permission to read (r), write (w), and execute (x). access ACL The user and group access permissions for all kinds of file system objects (files and directories) are determined by means of access ACLs.
301
default ACL Default ACLs can only be applied to directories. They determine the permissions a file system object inherits from its parent directory when it is created. ACL entry Each ACL consists of a set of ACL entries. An ACL entry contains a type, a qualifier for the user or group to which the entry refers, and a set of permissions. For some entry types, the qualifier for the group or users is undefined.
302
ACL Entry Types Text Form user::rwx user:name:rwx group::rwx group:name:rwx mask::rwx other::rwx Masking Access Permissions Text Form user:geeko:r-x mask::rweffective permissions: Permissions r-x rwr--
owning group named group mask other Table 15.2 Entry Type named user mask
303
ACL entry owner. Other class permissions are mapped to the respective ACL entry. However, the mapping of the group class permissions is different in the two cases. Figure 15.1 Minimum ACL: ACL Entries Compared to Permission Bits
In the case of a minimum ACLwithout maskthe group class permissions are mapped to the ACL entry owning group. This is shown in Figure 15.1, Minimum ACL: ACL Entries Compared to Permission Bits (page 304). In the case of an extended ACLwith maskthe group class permissions are mapped to the mask entry. This is shown in Figure 15.2, Extended ACL: ACL Entries Compared to Permission Bits (page 304). Figure 15.2 Extended ACL: ACL Entries Compared to Permission Bits
This mapping approach ensures the smooth interaction of applications, regardless of whether they have ACL support. The access permissions that were assigned by means of the permission bits represent the upper limit for all other fine adjustments made with an ACL. Changes made to the permission bits are reflected by the ACL and vice versa.
Before creating the directory, use the umask command to define which access permissions should be masked each time a file object is created. The command umask 027 sets the default permissions by giving the owner the full range of permissions (0), denying the group write access (2), and giving other users no permissions at all (7). umask actually masks the corresponding permission bits or turns them off. For details, consult the umask man page. mkdir mydir creates the mydir directory with the default permissions as set by umask. Use ls -dl mydir to check whether all permissions were assigned correctly. The output for this example is:
drwxr-x--- ... tux project3 ... mydir
With getfacl mydir, check the initial state of the ACL. This gives information like:
# file: mydir # owner: tux # group: project3 user::rwx group::r-x other::---
The first three output lines display the name, owner, and owning group of the directory. The next three lines contain the three ACL entries owner, owning group, and other. In fact, in the case of this minimum ACL, the getfacl command does not produce any information you could not have obtained with ls. Modify the ACL to assign read, write, and execute permissions to an additional user geeko and an additional group mascots with:
setfacl -m user:geeko:rwx,group:mascots:rwx mydir
The option -m prompts setfacl to modify the existing ACL. The following argument indicates the ACL entries to modify (multiple entries are separated by commas). The final part specifies the name of the directory to which these modifications should be applied. Use the getfacl command to take a look at the resulting ACL.
# file: mydir # owner: tux # group: project3 user::rwx user:geeko:rwx group::r-x group:mascots:rwx
305
mask::rwx other::---
In addition to the entries initiated for the user geeko and the group mascots, a mask entry has been generated. This mask entry is set automatically so that all permissions are effective. setfacl automatically adapts existing mask entries to the settings modified, unless you deactivate this feature with -n. mask defines the maximum effective access permissions for all entries in the group class. This includes named user, named group, and owning group. The group class permission bits displayed by ls -dl mydir now correspond to the mask entry.
drwxrwx---+ ... tux project3 ... mydir
The first column of the output contains an additional + to indicate that there is an extended ACL for this item. According to the output of the ls command, the permissions for the mask entry include write access. Traditionally, such permission bits would mean that the owning group (here project3) also has write access to the directory mydir. However, the effective access permissions for the owning group correspond to the overlapping portion of the permissions defined for the owning group and for the maskwhich is r-x in our example (see Table 15.2, Masking Access Permissions (page 303)). As far as the effective permissions of the owning group in this example are concerned, nothing has changed even after the addition of the ACL entries. Edit the mask entry with setfacl or chmod. For example, use chmod g-w mydir. ls -dl mydir then shows:
drwxr-x---+ ... tux project3 ... mydir
After executing the chmod command to remove the write permission from the group class bits, the output of the ls command is sufficient to see that the mask bits must have changed accordingly: write permission is again limited to the owner of mydir.
306
The output of the getfacl confirms this. This output includes a comment for all those entries in which the effective permission bits do not correspond to the original permissions, because they are filtered according to the mask entry. The original permissions can be restored at any time with chmod g+w mydir.
307
The option -d of the setfacl command prompts setfacl to perform the following modifications (option -m) in the default ACL. Take a closer look at the result of this command:
getfacl mydir # file: mydir # owner: tux # group: project3 user::rwx user:geeko:rwx group::r-x group:mascots:rwx mask::rwx other::--default:user::rwx default:group::r-x default:group:mascots:r-x default:mask::r-x default:other::---
getfacl returns both the access ACL and the default ACL. The default ACL is formed by all lines that start with default. Although you merely executed the setfacl command with an entry for the mascots group for the default ACL, setfacl automatically copied all other entries from the access ACL to create a valid default ACL. Default ACLs do not have an immediate effect on access permissions. They only come into play when file system objects are created. These new objects inherit permissions only from the default ACL of their parent directory. 2. In the next example, use mkdir to create a subdirectory in mydir, which inherits the default ACL.
mkdir mydir/mysubdir getfacl mydir/mysubdir # file: mydir/mysubdir # owner: tux # group: project3 user::rwx group::r-x group:mascots:r-x mask::r-x other::--default:user::rwx default:group::r-x default:group:mascots:r-x
308
default:mask::r-x default:other::---
As expected, the newly-created subdirectory mysubdir has the permissions from the default ACL of the parent directory. The access ACL of mysubdir is an exact reflection of the default ACL of mydir. The default ACL that this directory will hand down to its subordinate objects is also the same. 3. Use touch to create a file in the mydir directory, for example, touch mydir/myfile. ls -l mydir/myfile then shows:
-rw-r-----+ ... tux project3 ... mydir/myfile
touch uses a mode with the value 0666 when creating new files, which means that the files are created with read and write permissions for all user classes, provided no other restrictions exist in umask or in the default ACL (see Section Effects of a Default ACL (page 307)). In effect, this means that all access permissions not contained in the mode value are removed from the respective ACL entries. Although no permissions were removed from the ACL entry of the group class, the mask entry was modified to mask permissions not set in mode. This approach ensures the smooth interaction of applications, such as compilers, with ACLs. You can create files with restricted access permissions and subsequently mark them as executable. The mask mechanism guarantees that the right users and groups can execute them as desired.
309
access is handled in accordance with the entry that best suits the process. Permissions do not accumulate. Things are more complicated if a process belongs to more than one group and would potentially suit several group entries. An entry is randomly selected from the suitable entries with the required permissions. It is irrelevant which of the entries triggers the final result access granted. Likewise, if none of the suitable group entries contains the required permissions, a randomly selected entry triggers the final result access denied.
310
16
Essentially, rpm has five modes: installing, uninstalling, or updating software packages; rebuilding the RPM database; querying RPM bases or individual RPM archives; integrity checking of packages; and signing packages. rpmbuild can be used to build installable packages from pristine sources. Installable RPM archives are packed in a special binary format. These archives consist of the program files to install and certain meta information used during the installation by rpm to configure the software package or stored in the RPM database for documentation purposes. RPM archives normally have the extension .rpm. TIP: Software Development Packages For a number of packages, the components needed for software development (libraries, headers, include files, etc.) have been put into separate packages. These development packages are only needed if you want to compile software yourself, for example, the most recent GNOME packages. They can be identified by the name extension -devel, such as the packages alsa-devel, gimp-devel, and kdelibs3-devel.
311
The command rpm --checksig package-1.2.3.rpm can be used to verify the signature of an RPM package to determine whether it really originates from SUSE or from another trustworthy facility. This is especially recommended for update packages from the Internet. The SUSE public package signature key normally resides in /root/ .gnupg/. The key is additionally located in the directory /usr/lib/rpm/gnupg/ to enable normal users to verify the signature of RPM packages.
312
If a configuration file was changed by the system administrator before the update, rpm saves the changed file with the extension .rpmorig or .rpmsave (backup file) and installs the version from the new package, but only if the originally installed file and the newer version are different. If this is the case, compare the backup file (.rpmorig or .rpmsave) with the newly installed file and make your changes again in the new file. Afterwards, be sure to delete all .rpmorig and .rpmsave files to avoid problems with future updates. .rpmnew files appear if the configuration file already exists and if the noreplace label was specified in the .spec file. Following an update, .rpmsave and .rpmnew files should be removed after comparing them, so they do not obstruct future updates. The .rpmorig extension is assigned if the file has not previously been recognized by the RPM database. Otherwise, .rpmsave is used. In other words, .rpmorig results from updating from a foreign format to RPM. .rpmsave results from updating from an older RPM to a newer RPM. .rpmnew does not disclose any information as to whether the system administrator has made any changes to the configuration file. A list of these files is available in /var/adm/rpmconfigcheck. Some configuration files (like /etc/ httpd/httpd.conf) are not overwritten to allow continued operation. The -U switch is not just an equivalent to uninstalling with the -e option and installing with the -i option. Use -U whenever possible. To remove a package, enter rpm -e package. rpm only deletes the package if there are no unresolved dependencies. It is theoretically impossible to delete Tcl/Tk, for example, as long as another application requires it. Even in this case, RPM calls for assistance from the database. If such a deletion isfor whatever reason and under unusual circumstancesimpossible, even if no additional dependencies exist, it may be helpful to rebuild the RPM database using the option --rebuilddb.
313
result in large amounts of data. However the SUSE RPM offers a feature enabling the installation of patches in packages. The most important considerations are demonstrated using pine as an example: Is the patch RPM suitable for my system? To check this, first query the installed version of the package. For pine, this can be done with
rpm -q pine pine-4.44-188
Then check if the patch RPM is suitable for this version of pine:
rpm -qp --basedon pine-4.44-224.i586.patch.rpm pine = 4.44-188 pine = 4.44-195 pine = 4.44-207
This patch is suitable for three different versions of pine. The installed version in the example is also listed, so the patch can be installed. Which files are replaced by the patch? The files affected by a patch can easily be seen in the patch RPM. The rpm parameter -P allows selection of special patch features. Display the list of files with the following command:
rpm -qpPl pine-4.44-224.i586.patch.rpm /etc/pine.conf /etc/pine.conf.fixed /usr/bin/pine
How can a patch RPM be installed in the system? Patch RPMs are used just like normal RPMs. The only difference is that a suitable RPM must already be installed.
314
Which patches are already installed in the system and for which package versions? A list of all patches installed in the system can be displayed with the command rpm -qPa. If only one patch is installed in a new system (as in this example), the list appears as follows:
rpm -qPa pine-4.44-224
If, at a later date, you want to know which package version was originally installed, this information is also available in the RPM database. For pine, this information can be displayed with the following command:
rpm -q --basedon pine pine = 4.44-188
More information, including information about the patch feature of RPM, is available in the man pages of rpm and rpmbuild.
Finally, remove the temporary working files old.cpio, new.cpio, and delta. Using applydeltarpm, you can reconstruct the new RPM from the file system if the old package is already installed:
315
To derive it from the old RPM without accessing the file system, use the -r option:
applydeltarpm -r old.rpm new.delta.rpm new.rpm
-s -d -c --dump
--provides
--requires, -R --scripts
316
For example, the command rpm -q -i wget displays the information shown in Example 16.1, rpm -q -i wget (page 317). Example 16.1 rpm -q -i wget
Name : wget Relocations: (not relocatable) Version : 1.9.1 Vendor: SUSE LINUX AG, Nuernberg, Germany Release : 50 Build Date: Sat 02 Oct 2004 03:49:13 AM CEST Install date: Mon 11 Oct 2004 10:24:56 AM CEST Build Host: f53.suse.de Group : Productivity/Networking/Web/Utilities Source RPM: wget-1.9.1-50.src.rpm Size : 1637514 License: GPL Signature : DSA/SHA1, Sat 02 Oct 2004 03:59:56 AM CEST, Key ID a84edae89c800aca Packager : http://www.suse.de/feedback URL : http://wget.sunsite.dk/ Summary : A tool for mirroring FTP and HTTP servers Description : Wget enables you to retrieve WWW documents or FTP files from a server. This can be done in script files or via the command line. [...]
The option -f only works if you specify the complete filename with its full path. Provide as many filenames as desired. For example, the following command
rpm -q -f /bin/rpm /usr/bin/wget
results in:
rpm-4.1.1-191 wget-1.9.1-50
If only part of the filename is known, use a shell script as shown in Example 16.2, Script to Search for Packages (page 317). Pass the partial filename to the script shown as a parameter when running it. Example 16.2 Script to Search for Packages
#! /bin/sh for i in $(rpm -q -a -l | grep $1); do echo "\"$i\" is in package:" rpm -q -f $i echo "" done
317
The command rpm -q --changelog rpm displays a detailed list of change information about a specific package, sorted by date. This example shows information about the package rpm. With the help of the installed RPM database, verification checks can be made. Initiate these with -V, -y, or --verify. With this option, rpm shows all files in a package that have been changed since installation. rpm uses eight character symbols to give some hints about the following changes: Table 16.2 5 S L T D U G M RPM Verify Options MD5 check sum File size Symbolic link Modification time Major and minor device numbers Owner Group Mode (permissions and file type)
In the case of configuration files, the letter c is printed. For example, for changes to /etc/wgetrc (wget):
rpm -V wget S.5....T c /etc/wgetrc
The files of the RPM database are placed in /var/lib/rpm. If the partition /usr has a size of 1 GB, this database can occupy nearly 30 MB, especially after a complete update. If the database is much larger than expected, it is useful to rebuild the database with the option --rebuilddb. Before doing this, make a backup of the old database. The cron script cron.daily makes daily copies of the database (packed with gzip) and stores them in /var/adm/backup/rpmdb. The number of copies is controlled
318
by the variable MAX_RPMDB_BACKUPS (default: 5) in /etc/sysconfig/backup. The size of a single backup is approximately 1 MB for 1 GB in /usr.
319
When you install a source package with YaST, all the necessary components are installed in /usr/src/packages: the sources and the adjustments in SOURCES and the relevant .spec file in SPECS. WARNING Do not experiment with system components (glibc, rpm, sysvinit, etc.), because this endangers the operability of your system. The following example uses the wget.src.rpm package. After installing the package with YaST, you should have files similar to the following listing:
/usr/src/packages/SOURCES/nops_doc.diff /usr/src/packages/SOURCES/toplev_destdir.diff /usr/src/packages/SOURCES/wget-1.9.1+ipvmisc.patch /usr/src/packages/SOURCES/wget-1.9.1-brokentime.patch /usr/src/packages/SOURCES/wget-1.9.1-passive_ftp.diff /usr/src/packages/SOURCES/wget-LFS-20040909.tar.bz2 /usr/src/packages/SOURCES/wget-wrong_charset.patch /usr/src/packages/SPECS/wget.spec
rpmbuild -b X /usr/src/packages/SPECS/wget.spec starts the compilation. X is a wild card for various stages of the build process (see the output of --help or the RPM documentation for details). The following is merely a brief explanation: -bp Prepare sources in /usr/src/packages/BUILD: unpack and patch. -bc Do the same as -bp, but with additional compilation. -bi Do the same as -bp, but with additional installation of the built software. Caution: if the package does not support the BuildRoot feature, you might overwrite configuration files. -bb Do the same as -bi, but with the additional creation of the binary package. If the compile was successful, the binary should be in /usr/src/packages/RPMS.
320
-ba Do the same as -bb, but with the additional creation of the source RPM. If the compilation was successful, the binary should be in /usr/src/packages/ SRPMS. --short-circuit Skip some steps. The binary RPM created can now be installed with rpm -i or, preferably, with rpm -U. Installation with rpm makes it appear in the RPM database.
Subsequently, a minimum environment is established at /var/tmp/build-root. The package is built in this environment. Upon completion, the resulting packages are located in /var/tmp/build-root/usr/src/packages/RPMS. The build script offers a number of additional options. For example, cause the script to prefer your own RPMs, omit the initialization of the build environment, or limit the rpm command to one of the above-mentioned stages. Access additional information with build --help and by reading the build man page.
321
322
17
A number of programs and mechanisms, some of which are presented here, can be used to examine the status of your system. Also described are some utilities that are useful for routine work, along with their most important parameters. For each of the commands introduced, examples of the relevant outputs are presented. In these examples, the first line is the command itself (after the > or # sign prompt). Omissions are indicated with square brackets ([...]) and long lines are wrapped where necessary. Line breaks for long lines are indicated by a backslash (\).
# command -x -y output line 1 output line 2 output line 3 is annoyingly long, so long that \ we have to break it output line 3 [...] output line 98 output line 99
The descriptions have been kept short to allow as many utilities as possible to be mentioned. Further information for all the commands can be found in the man pages. Most of the commands also understand the parameter --help, which produces a brief list of the possible parameters.
323
17.1 Debugging
17.1.1 Specifying the Required Library: ldd
Use the command ldd to find out which libraries would load the dynamic executable specified as argument.
tester@linux:~> ldd /bin/ls linux-gate.so.1 => (0xffffe000) librt.so.1 => /lib/librt.so.1 (0xb7f97000) libacl.so.1 => /lib/libacl.so.1 (0xb7f91000) libc.so.6 => /lib/libc.so.6 (0xb7e79000) libpthread.so.0 => /lib/libpthread.so.0 (0xb7e67000) /lib/ld-linux.so.2 (0xb7fb6000) libattr.so.1 => /lib/libattr.so.1 (0xb7e63000)
324
For example, to trace all attempts to open a particular file, use the following:
tester@linux:~> strace -e open ls .bashrc open("/etc/ld.so.cache", O_RDONLY) = open("/lib/librt.so.1", O_RDONLY) = open("/lib/libacl.so.1", O_RDONLY) = open("/lib/libc.so.6", O_RDONLY) = open("/lib/libpthread.so.0", O_RDONLY) = open("/lib/libattr.so.1", O_RDONLY) = [...] 3 3 3 3 3 3
To trace all the child processes, use the parameter -f. The behavior and output format of strace can be largely controlled. For information, see man strace. System Monitoring Utilities 325
The parameter -f list specifies a file with a list of filenames to examine. The -z allows file to look inside compressed files:
tester@linux:~> file /usr/share/man/man1/file.1.gz usr/share/man/man1/file.1.gz: gzip compressed data, from Unix, max compression tester@linux:~> file -z /usr/share/man/man1/file.1.gz /usr/share/man/man1/file.1.gz: ASCII troff or preprocessor input text \ (gzip compressed data, from Unix, max compression)
Obtain information about total usage of the file systems with the command df. The parameter -h (or --human-readable) transforms the output into a form understandable for common users.
tester@linux:~> df -h Filesystem Size /dev/hda3 11G Used Avail Use% Mounted on 3.2G 6.9G 32% /
326
Display the total size of all the files in a given directory and its subdirectories with the command du. The parameter -s suppresses the output of detailed information. -h again transforms the data into a human-readable form:
tester@linux:~> du -sh /local 1.7M /local
IO Block: 4096
regular file
327
303h/771d Inode: 40657 Links: 1 (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 2006-01-06 16:45:43.000000000 +0100 2005-11-21 14:54:35.000000000 +0100 2005-12-19 09:51:04.000000000 +0100
0/
root)
The parameter --filesystem produces details of the properties of the file system in which the specified file is located:
tester@linux:~> stat /etc/profile --filesystem File: "/etc/profile" ID: 0 Namelen: 255 Type: reiserfs Block size: 4096 Fundamental block size: 4096 Blocks: Total: 2622526 Free: 1809771 Available: 1809771 Inodes: Total: 0 Free: 0
328
Information about device name resolution is obtained from the file /usr/share/ pci.ids. PCI IDs not listed in this file are marked Unknown device. The parameter -vv produces all the information that could be queried by the program. To view the pure numeric values, use the parameter -n.
329
command lsscsi). The following is the output of scsiinfo -i /dev/sda, which gives information about a hard disk. The option -a gives even more information.
linux:/ # scsiinfo -i /dev/sda Inquiry command --------------Relative Address 0 Wide bus 32 0 Wide bus 16 1 Synchronous neg. 1 Linked Commands 1 Command Queueing 1 SftRe 0 Device Type 0 Peripheral Qualifier 0 Removable? 0 Device Type Modifier 0 ISO Version 0 ECMA Version 0 ANSI Version 3 AENC 0 TrmIOP 0 Response Data Format 2 Vendor: FUJITSU Product: MAS3367NP Revision level: 0104A0K7P43002BE
The option -d puts out a defects list with two tables of bad blocks of a hard disk: first the one supplied by the vendor (manufacturer table) and second the list of bad blocks that appeared in operation (grown table). If the number of entries in the grown table increases, it might be a good idea to replace the hard disk.
17.4 Networking
17.4.1 Show the Network Status: netstat
netstat shows network connections, routing tables (-r), interfaces (-i), masquerade connections (-M), multicast memberships (-g), and statistics (-s).
tester@linux:~> netstat -r Kernel IP routing table Destination Gateway 192.168.22.0 * link-local *
Flags U U
MSS Window 0 0 0 0
330
loopback default
* 192.168.22.254
255.0.0.0 0.0.0.0
U UG
0 0 0 0
0 lo 0 eth0
tester@linux:~> netstat -i Kernel Interface table Iface MTU Met RX-OK RX-ERR RX-DRP RX-OVR eth0 1500 0 1624507 129056 0 0 lo 16436 0 23728 0 0 0
When displaying network connections or statistics, you can specify the socket type to display: TCP (-t), UDP (-u), or raw (-r). The -p option shows the PID and name of the program to which each socket belongs. The following example lists all TCP connections and the programs using these connections.
linux:~ # netstat -t -p Active Internet connections (w/o servers) Proto Recv-Q Send-Q Local Address Foreign Address tcp tcp tcp 0 0 0 0 linux:33513 352 linux:ssh 0 localhost:ssh
State
PID/Pro
331
Query the allocation and use of interrupts with the following command:
tester@linux:~> cat /proc/interrupts CPU0 0: 3577519 XT-PIC timer 1: 130 XT-PIC i8042 2: 0 XT-PIC cascade 5: 564535 XT-PIC Intel 82801DB-ICH4 7: 1 XT-PIC parport0 8: 2 XT-PIC rtc 9: 1 XT-PIC acpi, uhci_hcd:usb1, ehci_hcd:usb4 10: 0 XT-PIC uhci_hcd:usb3 11: 71772 XT-PIC uhci_hcd:usb2, eth0 12: 101150 XT-PIC i8042 14: 33146 XT-PIC ide0 15: 149202 XT-PIC ide1 NMI: 0 LOC: 0 ERR: 0 MIS: 0
Some of the important files and their contents are: /proc/devices Available devices /proc/modules Kernel modules loaded
332
/proc/cmdline Kernel command line /proc/meminfo Detailed information about memory usage /proc/config.gz gzip-compressed configuration file of the kernel currently running Further information is available in the text file /usr/src/linux/ Documentation/filesystems/proc.txt. Find information about processes currently running in the /proc/NNN directories, where NNN is the process ID (PID) of the relevant process. Every process can find its own characteristics in /proc/self/ :
tester@linux:~> ls -l /proc/self lrwxrwxrwx 1 root root 64 2006-01-09 13:03 /proc/self -> 5356 tester@linux:~> ls -l /proc/self/ total 0 dr-xr-xr-x 2 tester users 0 2006-01-09 17:04 attr -r-------- 1 tester users 0 2006-01-09 17:04 auxv -r--r--r-- 1 tester users 0 2006-01-09 17:04 cmdline lrwxrwxrwx 1 tester users 0 2006-01-09 17:04 cwd -> /home/tester -r-------- 1 tester users 0 2006-01-09 17:04 environ lrwxrwxrwx 1 tester users 0 2006-01-09 17:04 exe -> /bin/ls dr-x------ 2 tester users 0 2006-01-09 17:04 fd -rw-r--r-- 1 tester users 0 2006-01-09 17:04 loginuid -r--r--r-- 1 tester users 0 2006-01-09 17:04 maps -rw------- 1 tester users 0 2006-01-09 17:04 mem -r--r--r-- 1 tester users 0 2006-01-09 17:04 mounts -rw-r--r-- 1 tester users 0 2006-01-09 17:04 oom_adj -r--r--r-- 1 tester users 0 2006-01-09 17:04 oom_score lrwxrwxrwx 1 tester users 0 2006-01-09 17:04 root -> / -rw------- 1 tester users 0 2006-01-09 17:04 seccomp -r--r--r-- 1 tester users 0 2006-01-09 17:04 smaps -r--r--r-- 1 tester users 0 2006-01-09 17:04 stat -r--r--r-- 1 tester users 0 2006-01-09 17:04 statm -r--r--r-- 1 tester users 0 2006-01-09 17:04 status dr-xr-xr-x 3 tester users 0 2006-01-09 17:04 task -r--r--r-- 1 tester users 0 2006-01-09 17:04 wchan
The address assignment of executables and libraries is contained in the maps file:
tester@linux:~> cat /proc/self/maps 08048000-0804c000 r-xp 00000000 03:03 0804c000-0804d000 rw-p 00004000 03:03 0804d000-0806e000 rw-p 0804d000 00:00 b7d27000-b7d5a000 r--p 00000000 03:03 b7d5a000-b7e32000 r--p 00000000 03:03 17753 17753 0 11867 11868 /bin/cat /bin/cat [heap] /usr/lib/locale/en_GB.utf8/ /usr/lib/locale/en_GB.utf8/
333
b7e32000-b7e33000 b7e33000-b7f45000 b7f45000-b7f46000 b7f46000-b7f48000 b7f48000-b7f4c000 b7f52000-b7f53000 [...] b7f5b000-b7f61000 b7f61000-b7f62000 b7f62000-b7f76000 b7f76000-b7f78000 bfd61000-bfd76000 ffffe000-fffff000
rw-p r-xp r--p rw-p rw-p r--p r--s r--p r-xp rw-p rw-p ---p
b7e32000 00000000 00112000 00113000 b7f48000 00000000 00000000 00000000 00000000 00013000 bfd61000 00000000
00:00 03:03 03:03 03:03 00:00 03:03 03:03 03:03 03:03 03:03 00:00 00:00
/lib/libc-2.3.6.so /lib/libc-2.3.6.so /lib/libc-2.3.6.so /usr/lib/locale/en_GB.utf8/ /usr/lib/gconv/gconv-module /usr/lib/locale/en_GB.utf8/ /lib/ld-2.3.6.so /lib/ld-2.3.6.so [stack] [vdso]
17.5.1 procinfo
Important information from the /proc file system is summarized by the command procinfo:
tester@linux:~> procinfo Linux 2.6.15-rc5-git3-2-default (geeko@buildhost) (gcc 4.1.0 20051129) #1 Wed Memory: Mem: Swap: Total 515584 658656 Used 509472 0 Free 6112 658656 Shared 0 Buffers 73024
Bootup: Mon Jan user : nice : system: IOwait: hw irq: sw irq: idle : uptime: irq irq irq irq irq irq irq irq 0: 1: 2: 3: 4: 5: 6: 7:
Load average: 0.10 0.04 0.05 1/86 5406 page in : page out: page act: page dea: page flt: swap in : swap out: context : irq irq irq irq irq irq irq 442638 134950 70577 11696 1423622 0 0 3813145 8: 9: 10: 11: 12: 14: 15: disk 1: 20125r 134
0:02:07.98 0:02:20.91 0:00:42.93 0:01:25.40 0:00:08.94 0:00:01.29 4:06:30.54 4:13:20.72 3799268 130 0 8 8 564535 9 1
To see all the information, use the parameter -a. The parameter -nN produces updates of the information every N seconds. In this case, terminate the program by pressing Q .
334
By default, the cumulative values are displayed. The parameter -d produces the differential values. procinfo -dn5 displays the values that have changed in the last five seconds:
17.6 Processes
17.6.1 Interprocess Communication: ipcs
The command ipcs produces a list of the IPC resources currently in use:
------ Shared Memory Segments -------key shmid owner perms 0x00000000 58261504 tester 600 0x00000000 58294273 tester 600 0x00000000 83886083 tester 666 0x00000000 83951622 tester 666 0x00000000 83984391 tester 666 0x00000000 84738056 root 644 ------ Semaphore Arrays -------key semid owner perms 0x4d038abf 0 tester 600 ------ Message Queues -------key msqid owner bytes 393216 196608 43264 192000 282464 151552 nattch 2 2 2 2 2 2 status dest dest
dest
nsems 8
perms
used-bytes
messages
335
1.0 15996 5160 ? 3.7 130988 19172 ? 0.3 4192 1812 pts/0 0.1 2324 816 pts/0
Ss SLl Ss R+
To check how many sshd processes are running, use the option -p together with the command pidof, which lists the process IDs of the given processes.
tester@linux:~> ps -p PID TTY STAT 3524 ? Ss 4813 ? Ss 4817 ? R `pidof sshd` TIME COMMAND 0:00 /usr/sbin/sshd -o PidFile=/var/run/sshd.init.pid 0:00 sshd: tester [priv] 0:00 sshd: tester@pts/0
The process list can be formatted according to your needs. The option -L returns a list of all keywords. Enter the following command to issue a list of all processes sorted by memory usage:
tester@linux:~> ps ax --format pid,rss,cmd --sort rss PID RSS CMD 2 0 [ksoftirqd/0] 3 0 [events/0] 4 0 [khelper] 5 0 [kthread] 11 0 [kblockd/0] 12 0 [kacpid] 472 0 [pdflush] 473 0 [pdflush] [...] 4028 17556 nautilus --no-default-window --sm-client-id default2 4118 17800 ksnapshot 4114 19172 sound-juicer 4023 25144 gnome-panel --sm-client-id default1 4047 31400 mono-best --debug /usr/lib/beagle/Best.exe --autostarted 3973 31520 mono-beagled --debug /usr/lib/beagle/BeagleDaemon.exe --bg --aut
336
|-dhcpcd |-events/0 |-gpg-agent |-hald-+-hald-addon-acpi | `-hald-addon-stor |-kded |-kdeinit-+-kdesu---su---kdesu_stub---yast2---y2controlcenter | |-kio_file | |-klauncher | |-konqueror | |-konsole-+-bash---su---bash | | `-bash | `-kwin |-kdesktop---kdesktop_lock---xmatrix |-kdesud |-kdm-+-X | `-kdm---startkde---kwrapper [...]
The parameter -p adds the process ID to a given name. To have the command lines displayed as well, use the -a parameter:
337
839 923 1343 1587 1746 1752 2151 2165 2166 2171 2235 2289 2403 2709 2714
root root root root root root root messageb root root root root root root root
10 13 10 20 15 15 16 16 15 16 15 16 23 19 16
-5 -4 -5 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 S 1712 552 344 S 0 0 0 S 0 0 0 S 0 0 0 S 0 0 0 S 1464 496 416 S 3340 1048 792 S 1840 752 556 S 1600 516 320 S 1736 800 652 S 4192 2852 1444 S 1756 600 524 S 2668 1076 944 S 1756 648 564 S
0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
0.0 0.1 0.0 0.0 0.0 0.0 0.1 0.2 0.1 0.1 0.2 0.6 0.1 0.2 0.1
0:00.02 0:00.67 0:00.00 0:00.00 0:00.00 0:00.00 0:00.00 0:00.64 0:00.01 0:00.00 0:00.10 0:02.05 0:00.00 0:00.00 0:00.56
reiserfs/0 udevd khubd shpchpd_event w1_control w1_bus_master1 acpid dbus-daemon syslog-ng klogd resmgrd hald hald-addon-acpi NetworkManagerD hald-addon-stor
If you press F while top is running, a menu opens with which to make extensive changes to the format of the output. The parameter -U UID monitors only the processes associated with a particular user. Replace UID with the user ID of the user. top -U `id -u` returns the UID of the user on the basis of the username and displays his processes.
338
shared 0
buffers 73040
cached 334592
The options -b,-k,-m,-g show output in bytes, KB, MB, or GB, respectively. The parameter -d delay ensures that the display is refreshed every delay seconds. For example, free -d 1.5 produces an update every 1.5 seconds.
/mnt/notes.txt
Following termination of the less process, which was running on another terminal, the file system can successfully be unmounted.
339
The special shell variable $$, whose value is the process ID of the shell, has been used. The command lsof lists all the files currently open when used without any parameters. Because there are often thousands of open files, listing all of them is rarely useful. However, the list of all files can be combined with search functions to generate useful lists. For example, list all used character devices:
tester@linux:~> lsof | grep CHR bash 3838 tester 0u bash 3838 tester 1u CHR CHR 136,0 136,0 2 /dev/pts/0 2 /dev/pts/0
340
bash bash bash bash bash bash X lsof lsof grep grep
3838 3838 5552 5552 5552 5552 5646 5673 5673 5674 5674
tester tester tester tester tester tester root tester tester tester tester
CHR CHR CHR CHR CHR CHR CHR CHR CHR CHR CHR
136,0 136,0 136,5 136,5 136,5 136,5 1,1 136,5 136,5 136,5 136,5
2 2 7 7 7 7 1006 7 7 7 7
/dev/pts/0 /dev/pts/0 /dev/pts/5 /dev/pts/5 /dev/pts/5 /dev/pts/5 /dev/mem /dev/pts/5 /dev/pts/5 /dev/pts/5 /dev/pts/5
341
206K total, All: Other 13K 33K 4K 4K 3K 3K 3K 3K 12K 12K 18K 9K 20K 9K 3K 1K 3K 8K 3K 2K 6K 2K 624B 3K 1K 888B Total 18175K 4600K 3816K 2820K 2378K 2344K 1775K 1775K 1123K 1052K 796K 520K 506K 111K 66K 55K 54K 48K 45K 36K 26K 24K 15K 11K 10K 8K
42219K total
PID Identifier ? NOVELL: SU ? amaroK - S ? KDE Deskto ? Linux Shel ? Linux Shel ? Linux Shel ? Root - Kon ? Root - Kon ? Trekstor25 ? kicker ? kwin ? de.comp.la ? [opensuse? Kopete ? YaST Contr 22061 suseplugge 22016 kded ? EMACS ? SUSEWatche 16489 kdesu ? KMix 22242 knotify ? KPowersave 22236 konqueror ? klipper ? KDE Wallet
tester@linux:~> w 16:33:03 up 3:33, 2 users, load average: 0.14, 0.06, 0.02 USER TTY LOGIN@ IDLE JCPU PCPU WHAT tester :0 16:33 ?xdm? 9.42s 0.15s /bin/sh /opt/kde3/bin/startk tester pts/0 15:59 0.00s 0.19s 0.00s w
If any users of other systems have logged in remotely, the parameter -f shows the computers from which they have established the connection.
343
18
When booting your Linux system, you are usually directed to a graphical user interface that guides you through the login process and the following interactions with the system. Although graphical user interfaces have become very important and user-friendly, using them is not the only way to communicate with your system. You can also use a textoriented communication like a command line interpreter, usually called the shell, where you can enter commands. Because Linux provides options to start shell windows from the graphical user interface, you can easily use both methods. In administration, shell-based applications are especially important for controlling computers over slow network links or if you want to perform tasks as root on the command line. For Linux newbies it might be rather unusual to enter commands in a shell, but you will soon realize that the shell is not only for administratorsin fact, using the shell is often the quickest and easiest way to perform some daily tasks. There are several shells for UNIX or Linux. The default shell in SUSE Linux Enterprise is Bash (GNU Bourne-Again Shell). This chapter deals with a couple of basics you need to know for using the shell. This includes the following topics: how to enter commands, the directory structure of Linux, how to work with files and directories and how to use some basic functions, the user and permission concept of Linux, an overview of important shell commands, and a short introduction to the vi editor, which is a default editor always available in Unix and Linux systems.
345
346
IMPORTANT: No News Is Good News The shell is not verbose: in contrast to some graphical user interfaces, it usually does not provide confirmation messages when commands have been executed. Messages only appear in case of problems or errors. Also keep this in mind for commands to delete objects. Before entering a command like rm for removing a file, you should know if you really want to get rid of the object: it will be deleted irretrievably, without enquiry.
Unlike in other operating systems, files in Linux may have a file extension, such as .txt, but do not need to have one. This makes it difficult to differentiate between files and folders in this output of the ls. By default, the colors can give you a hint: directories are usually shown in blue, files in black.
347
and are prefixed with a hyphen. The ls -l command shows the contents of the same directory in full detail (long listing format): Figure 18.3 The ls -l Command
On the left of each object name, information about the object is shown in several columns. The most important are the following: The first column shows the file type of the object (in this example, d for directory or - for normal files). The next nine columns show the user permissions for the object. Columns 11 and 12 show the name of the file owner and the group (in this case, tux and users). Find information about user permissions and the user concept of Linux in Section 18.2, Users and Access Permissions (page 358). The next column shows the file size in bytes. Then date and time of the last change are displayed. The last column shows the object name. If you want to see even more, you can combine two options for the ls command and enter ls -la. The shell now also shows hidden files in the directory, indicated by a dot in front (for example, .hiddenfile).
Getting Help
Nobody is expected to know all options of all commands by heart. If you remember the command name but are not sure about the options, you can enter the command followed by a blank and --help. This --help option exists for many commands. Entering ls --help displays all the options for the ls command.
348
349
bin vmlinuz
boot
dev
etc
home
lib
media
mnt kde
opt gnome
proc
root
sbin
srv
sys
tmp
usr
var
ld.so hda sda st0 yxz linux tux X11R6 bin etc lib local sbin share
bin
xdm
xterm
xv
bin
lib
pub
faq
howto
packages
Overview of a Standard Directory Tree Root directory, starting point of the directory tree Personal directories of users Device files that represent hardware components Important files for system configuration Boot scripts Programs needed early in the boot process (/bin) and for the administrator (/sbin) All application programs and local, distribution-independent extensions (/usr/local)
/usr, /usr/local
350
Generally accessible programs (/usr/bin) and reserved for the system administrator ( /usr/sbin) Various documentation files Temporary files (do not save files in this directory unless you do not need them) Optional software, larger add-on program packages (such as KDE, GNOME, and Netscape) Process file system System file system where all device information for the kernel is gathered System log files
/opt
/proc /sys
/var/log
351
To switch to your home directory, enter cd. Refer to the current directory with a dot (.). This is mainly useful for other commands (cp, mv, ). The next higher level in the tree is represented by two dots (..). For example, to switch to the parent directory of your current directory, enter cd ...
352
d Check this by entering ls -l /tmp/test. The file myfile.txt should appear in the list of contents for /tmp/test. To list the contents of home directories of other users, enter ls ~username . In the example directory tree in Figure 18.4, Excerpt from a Standard Directory Tree (page 350), one of the sample users is tux. In this case, ls ~tux would list the contents of the home directory of tux. NOTE: Handling Blanks in Filenames or Directory Names If a filename contains a space, either escape the space using a back slash (\) in front of the blank or enclose the filename in single or double quotes. Otherwise Bash interprets a filename like My Documents as the names of two files or directories. The difference between single and double quotes is that variable expansion takes place within double quotes. Single quotes ensure that the shell sees the quoted string literally.
353
essary. If the filename or path cannot be uniquely identified (because there are several filenames starting with the same letters), the filename or path is only completed up to the point where again several options are possible. You can then obtain a list of them by pressing | a second time. After this, you can enter the next letters of the file or path then try completion again by pressing | . When completing filenames and paths with the help of | , you can simultaneously check whether the file or path you want to enter really exists (and you can be sure of getting the spelling right).
Wild Cards
Another convenience offered by the shell is wild cards for pathname expansion. Wild cards are characters that can stand for other characters. There are three different types of these in Bash: ? Matches exactly one arbitrary character * Matches any number of characters [set] Matches one of the characters from the group specified inside the square brackets, which is represented here by the string set. As part of set you can also specify character classes using the syntax [:class:], where a class is one of alnum, alpha, ascii, etc. Using ! or ^ at the beginning of the group ([!set]) matches one character other than those identified by set. Assuming that your test directory contains the files Testfile, Testfile1, Testfile2, and datafile. The command ls Testfile? lists the files Testfile1 and Testfile2. The command ls Testfile? lists the files Testfile1 and Testfile2. With ls Test*, the list also includes Testfile. The command ls *fil* shows all the sample files.
354
Use the set wild card to address all sample files whose last character is a number: ls Testfile[1-9] or, using classes, ls Testfile[[:digit:]]. Of the four types of wild cards, the most inclusive one is the asterisk. It could be used to copy all files contained in one directory to another one or to delete all files with one command. The command rm *fil*, for instance, would delete all files in the current directory whose name includes the string fil.
355
Sometimes it is also useful to use a file as the input for a command. For example, with the tr command, you can replace characters redirected from a file and write the result to the standard output, your screen. Suppose you want to replace all characters t of your file.txt from the example above with x and print this to your screen. Do so by entering tr t x < file.txt. Just like the standard output, the standard error output is sent to the console. To redirect the standard error output to a file named errors, append 2> errors to the corresponding command. Both standard output and standard error are saved to one file named alloutput if you append >& alloutput. Using pipelines or pipes is also a sort redirection, although the use of the pipe is not constrained to files. With a pipe (|), you can combine several commands, using the output of one command as input for the next command. For example, to view the contents or your current directory in less, enter ls | less. This only makes sense if the normal output with ls would be too lengthy. For instance, if you view the contents of the dev directory with ls /dev, you only see a small portion in the window. View the entire list with ls /dev | less.
356
-f (for file) Choose a filename for the archive file. When creating an archive, this option must always be given as the last one. To pack the test directory with all its files and subdirectories into an archive named testarchive.tar, do the following: 1 Open a shell. 2 Use cd to your home directory where the test directory is located. 3 Enter tar -cvf testarchive.tar test. The -c option creates the archive, making it a file as directed by -f. The -v option lists the files as they are processed. 4 View the contents of the archive file with tar -tf testarchive.tar. The test directory with all its files and directories has remained unchanged on your hard disk. To unpack the archive, enter tar -xvf testarchive.tar, but do not try this yet. For file compression, the obvious choice is gzip or, for a even better compression ratio, bzip2. Just enter gzip testarchive.tar (or bzip2 testarchive.tar, but gzip is used in this example). With ls, now see that the file testarchive.tar is no longer there and that the file testarchive.tar.gz has been created instead. This file is much smaller and therefore much better suited for transfer via e-mail or storage on a USB stick. Now, unpack this file in the test2 directory created earlier. To do so, enter cp testarchive.tar.gz test2 to copy the file to that directory. Change to the directory with cd test2. A compressed archive with the .tar.gz extension can be unzipped with the gunzip command. Enter gunzip testarchive.tar.gz, which results in the file testarchive.tar, which then needs to be extracted or untarred with tar -xvf testarchive.tar. You can also unzip and extract a compressed archive in one step with tar -xvf testarchive.tar.gz (adding the -z option is no longer required). With ls, you can see that a new test directory has been created with the same contents as your test directory in your home directory.
357
18.1.6 Cleaning Up
After this crash course, you should be familiar with the basics of the Linux shell or command line. You may want to clean up your home directory by deleting the various test files and directories using the rm and rmdir commands. In Section 18.3, Important Linux Commands (page 361), find a list of the most important commands and a brief description of their functions.
358
File Access The organization of permissions in the file system differs for files and directories. File permission information can be displayed with the command ls -l. The output could appear as in Example 18.1, Sample Output Showing File Permissions (page 359). Example 18.1 Sample Output Showing File Permissions
-rw-r----- 1 tux project3 14197 Jun 21 15:03 Roadmap
As shown in the third column, this file belongs to user tux. It is assigned to the group project3. To discover the user permissions of the Roadmap file, the first column must be examined more closely. Type rwUsers Permissions r----
This column consists of one leading character followed by nine characters grouped in threes. The first of the ten letters stands for the type of file system component. The hyphen () shows that this is a file. A directory (d), a link (l), a block device (b), or a character device could also be indicated. The next three blocks follow a standard pattern. The first three characters refer to whether the file is readable (r) or not (). A w in the middle portion symbolizes that the corresponding object can be edited and a hyphen () means it is not possible to write to the file. An x in the third position denotes that the object can be executed. Because the file in this example is a text file and not one that is executable, executable access for this particular file is not needed. In this example, tux has, as owner of the file Roadmap, read (r) and write access (w) to it, but cannot execute it (x). The members of the group project3 can read the file, but they cannot modify it or execute it. Other users do not have any access to this file. Other permissions can be assigned by means of ACLs (access control lists). Directory Permissions Access permissions for directories have the type d. For directories, the individual permissions have a slightly different meaning.
359
In Example 18.2, Sample Output Showing Directory Permissions (page 360), the owner (tux) and the owning group (project3) of the directory ProjectData are easy to recognize. In contrast to the file access permissions from File Access (page 359), the set reading permission (r) means that the contents of the directory can be shown. The write permission (w) means that new files can be created. The executable permission (x) means that the user can change to this directory. In the above example, the user tux as well as the members of the group project3 can change to the ProjectData directory (x), view the contents (r), and add or delete files (w). The rest of the users, on the other hand, are given less access. They may enter the directory (x) and browse through it (r), but not insert any new files (w).
u (user)owner of the file g (group)group that owns the file o (others)additional users (if no parameter is given, the changes apply to all categories) 2. 3. A character for deletion (), setting (=), or insertion (+) The abbreviations
rread wwrite
360
If, for example, the user tux in Example 18.2, Sample Output Showing Directory Permissions (page 360) also wants to grant other users write (w) access to the directory ProjectData, he can do this using the command chmod o+w ProjectData. If, however, he wants to deny all users other than himself write permissions, he can do this by entering the command chmod go-w ProjectData. To prohibit all users from adding a new file to the folder ProjectData, enter chmod -w ProjectData. Now, not even the owner can create a new file in the directory without first reestablishing write permissions. Changing Ownership Permissions Other important commands to control the ownership and permissions of the file system components are chown (change owner) and chgrp (change group). The command chown can be used to transfer ownership of a file to another user. However, only root is permitted to perform this change. Suppose the file Roadmap from Example 18.2, Sample Output Showing Directory Permissions (page 360) should no longer belong to tux, but to the user geeko. root should then enter chown geeko Roadmap. chgrp changes the group ownership of the file. However, the owner of the file must be a member of the new group. In this way, the user tux from Example 18.1, Sample Output Showing File Permissions (page 359) can switch the group owning the file ProjectData to project4 with the command chgrp project4 ProjectData, as long as he is a member of this new group.
In the man pages, move up and down with PgUp and PgDn . Move between the beginning and the end of a document with Home and End . End this viewing mode by pressing Q . Learn more about the man command itself with man man. In the following overview, the individual command elements are written in different typefaces. The actual command and its mandatory options are always printed as command option. Specifications or parameters that are not required are placed in [square brackets]. Adjust the settings to your needs. It makes no sense to write ls file if no file named file actually exists. You can usually combine several parameters, for example, by writing ls -la instead of ls -l -a.
File Administration
ls [options] [files] If you run ls without any additional parameters, the program lists the contents of the current directory in short form. -l Detailed list -a Displays hidden files cp [options] source target Copies source to target. -i Waits for confirmation, if necessary, before an existing target is overwritten -r Copies recursively (includes subdirectories)
362
mv [options] source target Copies source to target then deletes the original source. -b Creates a backup copy of the source before moving -i Waits for confirmation, if necessary, before an existing targetfile is overwritten rm [options] files Removes the specified files from the file system. Directories are not removed by rm unless the option -r is used. -r Deletes any existing subdirectories -i Waits for confirmation before deleting each file ln [options] source target Creates an internal link from source to target. Normally, such a link points directly to source on the same file system. However, if ln is executed with the -s option, it creates a symbolic link that only points to the directory in which source is located, enabling linking across file systems. -s Creates a symbolic link cd [options] [directory] Changes the current directory. cd without any parameters changes to the user's home directory. mkdir [options] directory Creates a new directory. rmdir [options] directory Deletes the specified directory if it is already empty. chown [options] username[:[group]] files Transfers ownership of a file to the user with the specified username.
363
-R Changes files and directories in all subdirectories chgrp [options] groupname files Transfers the group ownership of a given file to the group with the specified group name. The file owner can only change group ownership if a member of both the current and the new group. chmod [options] mode files Changes the access permissions. The mode parameter has three parts: group, access, and access type. group accepts the following characters: u User g Group o Others For access, grant access with + and deny it with -. The access type is controlled by the following options: r Read w Write x Executeexecuting files or changing to the directory s Setuid bitthe application or program is started as if it were started by the owner of the file
364
As an alternative, a numeric code can be used. The four digits of this code are composed of the sum of the values 4, 2, and 1the decimal result of a binary mask. The first digit sets the set user ID (SUID) (4), the set group ID (2), and the sticky (1) bits. The second digit defines the permissions of the owner of the file. The third digit defines the permissions of the group members and the last digit sets the permissions for all other users. The read permission is set with 4, the write permission with 2, and the permission for executing a file is set with 1. The owner of a file would usually receive a 6 or a 7 for executable files. gzip [parameters] files This program compresses the contents of files using complex mathematical algorithms. Files compressed in this way are given the extension .gz and need to be uncompressed before they can be used. To compress several files or even entire directories, use the tar command. -d Decompresses the packed gzip files so they return to their original size and can be processed normally (like the command gunzip) tar options archive files tar puts one or more files into an archive. Compression is optional. tar is a quite complex command with a number of options available. The most frequently used options are: -f Writes the output to a file and not to the screen as is usually the case -c Creates a new tar archive -r Adds files to an existing archive -t Outputs the contents of an archive -u Adds files, but only if they are newer than the files already contained in the archive
365
-x Unpacks files from an archive (extraction) -z Packs the resulting archive with gzip -j Compresses the resulting archive with bzip2 -v Lists files processed The archive files created by tar end with .tar. If the tar archive was also compressed using gzip, the ending is .tgz or .tar.gz. If it was compressed using bzip2, the ending is .tar.bz2. Application examples can be found in Section 18.1.5, Archives and Data Compression (page 356). locate patterns This command is only available if you have installed the findutils-locate package. The locate command can find in which directory a specified file is located. If desired, use wild cards to specify filenames. The program is very speedy, because it uses a database specifically created for the purpose (rather than searching through the entire file system). This very fact, however, also results in a major drawback: locate is unable to find any files created after the latest update of its database. The database can be generated by root with updatedb. updatedb [options] This command performs an update of the database used by locate. To include files in all existing directories, run the program as root. It also makes sense to place it in the background by appending an ampersand (&), so you can immediately continue working on the same command line (updatedb &). This command usually runs as a daily cron job (see cron.daily). find [options] With find, search for a file in a given directory. The first argument specifies the directory in which to start the search. The option -name must be followed by a search string, which may also include wild cards. Unlike locate, which uses a database, find scans the actual directory.
366
367
diff [options] file1 file2 The diff command compares the contents of any two files. The output produced by the program lists all lines that do not match. This is frequently used by programmers who need only send their program alterations and not the entire source code. -q Only reports whether the two files differ -u Produces a unified diff, which makes the output more readable
File Systems
mount [options] [device] mountpoint This command can be used to mount any data media, such as hard disks, CD-ROM drives, and other drives, to a directory of the Linux file system. -r Mount read-only -t filesystem Specify the file system, commonly ext2 for Linux hard disks, msdos for MS-DOS media, vfat for the Windows file system, and iso9660 for CDs For hard disks not defined in the file /etc/fstab, the device type must also be specified. In this case, only root can mount it. If the file system should also be mounted by other users, enter the option user in the appropriate line in the /etc/ fstab file (separated by commas) and save this change. Further information is available in the mount(1) man page. umount [options] mountpoint This command unmounts a mounted drive from the file system. To prevent data loss, run this command before taking a removable data medium from its drive. Normally, only root is allowed to run the commands mount and umount. To enable other users to run these commands, edit the /etc/fstab file to specify the option user for the respective drive.
368
System Information
df [options] [directory] The df (disk free) command, when used without any options, displays information about the total disk space, the disk space currently in use, and the free space on all the mounted drives. If a directory is specified, the information is limited to the drive on which that directory is located. -h Shows the number of occupied blocks in gigabytes, megabytes, or kilobytesin human-readable format -T Type of file system (ext2, nfs, etc.) du [options] [path] This command, when executed without any parameters, shows the total disk space occupied by files and subdirectories in the current directory. -a Displays the size of each individual file -h Output in human-readable form -s Displays only the calculated total size free [options] The command free displays information about RAM and swap space usage, showing the total and the used amount in both categories. See Section 22.1.6, The free Command (page 426) for more information. -b Output in bytes Working with the Shell 369
-k Output in kilobytes -m Output in megabytes date [options] This simple program displays the current system time. If run as root, it can also be used to change the system time. Details about the program are available in the date(1) man page.
Processes
top [options] top provides a quick overview of the currently running processes. Press H to access a page that briefly explains the main options for customizing the program. ps [options] [process ID] If run without any options, this command displays a table of all your own programs or processesthose you started. The options for this command are not preceded by hyphen. aux Displays a detailed list of all processes, independent of the owner kill [options] process ID Unfortunately, sometimes a program cannot be terminated in the normal way. In most cases, you should still be able to stop such a runaway program by executing the kill command, specifying the respective process ID (see top and ps). kill sends a TERM signal that instructs the program to shut itself down. If this does not help, the following parameter can be used: -9 Sends a KILL signal instead of a TERM signal, bringing the specified process to an end in almost all cases killall [options] processname This command is similar to kill, but uses the process name (instead of the process ID) as an argument, killing all processes with that name.
370
Network
ping [options] hostname or IP address The ping command is the standard tool for testing the basic functionality of TCP/IP networks. It sends a small data packet to the destination host, requesting an immediate reply. If this works, ping displays a message to that effect, which indicates that the network link is basically functioning. -c number Determines the total number of packages to send and ends after they have been dispatched (by default, there is no limitation set) -f flood ping: sends as many data packages as possible; a popular means, reserved for root, to test networks -i value Specifies the interval between two data packages in seconds (default: one second) nslookup The domain name system resolves domain names to IP addresses. With this tool, send queries to name servers (DNS servers). telnet [options] hostname or IP address [port] Telnet is actually an Internet protocol that enables you to work on remote hosts across a network. telnet is also the name of a Linux program that uses this protocol to enable operations on remote computers. WARNING Do not use telnet over a network on which third parties can eavesdrop. Particularly on the Internet, use encrypted transfer methods, such as ssh, to avoid the risk of malicious misuse of a password (see the man page for ssh).
371
Miscellaneous
passwd [options] [username] Users may change their own passwords at any time using this command. The administrator root can use the command to change the password of any user on the system. su [options] [username] The su command makes it possible to log in under a different username from a running session. Specify a username and the corresponding password. The password is not required from root, because root is authorized to assume the identity of any user. When using the command without specifying a username, you are prompted for the root password and change to the superuser (root). Use su - to start a login shell for the different user halt [options] To avoid loss of data, you should always use this program to shut down your system. reboot [options] Does the same as halt except the system performs an immediate reboot. clear This command cleans up the visible area of the console. It has no options.
372
Insert Mode to Command Mode Press Esc to exit the insert mode. vi cannot be terminated in insert mode, so it is important to get used to pressing Esc . Command Mode to Extended Mode The extended mode of vi can be activated by entering a colon (:). The extended or ex mode is similar to an independent line-oriented editor that can be used for various simple and more complex tasks. Extended Mode to Command Mode After executing a command in extended mode, the editor automatically returns to command mode. If you decide not to execute any command in extended mode, delete the colon with < . The editor returns to command mode. It is not possible to switch directly from insert mode to extended mode without first switching to command mode. vi, like other editors, has its own procedure for terminating the program. You cannot terminate vi while in insert mode. First, exit insert mode by pressing Esc . Subsequently, you have two options:
373
1.
Exit without saving: To terminate the editor without saving the changes, enter : Q ! in command mode. The exclamation mark (!) causes vi to ignore any changes. Save and exit: There are several possibilities to save your changes and terminate the editor. In command mode, use Shift + Z Shift + Z . To exit the program saving all changes using the extended mode, enter : W Q . In extended mode, w stands for write and q for quit.
2.
18.4.2 vi in Action
vi can be used as a normal editor. In insert mode, enter text and delete text with the < and Del keys. Use the arrow keys to move the cursor. However, these control keys often cause problems, because there are many terminal types that use special key codes. This is where the command mode comes into play. Press Esc to switch from insert mode to command mode. In command mode, move the cursor with H , J , K , and L . The keys have the following functions:
H
Move one character to the right The commands in command mode allow diverse variations. To execute a command several times, simply enter the number of repetitions before entering the actual command. For example, enter 5 L to move the cursor five characters to the right. A selection of important commands is shown in Table 18.2, Simple Commands of the vi Editor (page 375) This list is far from complete. More complete lists are available in the documentation found in Section 18.4.3, For More Information (page 376)
374
Table 18.2
Esc I
Simple Commands of the vi Editor Change to command mode Change to insert mode (characters appear at the current cursor position) Change to insert mode (characters are inserted after the current cursor position)
Shift
Change to insert mode (characters are added at the end of the line) Change to replace mode (overwrite the old text) Replace the character under the cursor Change to insert mode (a new line is inserted after the current one)
Shift R O
Shift
Change to insert mode (a new line is inserted before the current one) Delete the current character
X D D C
D W W
Delete the current line Delete up to the end of the current word Change to insert mode (the rest of the current word is overwritten by the next entries you make) Undo the last command
U Ctrl Shift .
+ +
R J
Redo the change that was undone Join the following line with the current one Repeat the last command
375
376
19
SUSE Linux Enterprise is available for several 64-bit platforms. This does not necessarily mean that all the applications included have already been ported to 64-bit platforms. SUSE Linux Enterprise supports the use of 32-bit applications in a 64-bit system environment. This chapter offers a brief overview of how this support is implemented on 64-bit SUSE Linux Enterprise platforms. It explains how 32-bit applications are executed (runtime support) and how 32-bit applications should be compiled to enable them to run both in 32-bit and 64-bit system environments. Additionally, find information about the kernel API and an explanation of how 32-bit applications can run under a 64bit kernel. NOTE: 31-Bit Applications on IBM System z: s390 on IBM System z uses a 31-bit environment. References to 32-bit applications in the following also apply to 31-bit applications. SUSE Linux Enterprise for the 64-bit platforms ia64, ppc64, s390x, and x86_64 is designed so that existing 32-bit applications run in the 64-bit environment out-of-thebox. The corresponding 32-bit platforms are x86 for ia64, ppc for ppc64, s390 for s390x, and x86 for x86_64. This support means that you can continue to use your preferred 32-bit applications without waiting for a corresponding 64-bit port to become available. The current ppc64 system runs most applications in 32-bit mode, but you can run 64-bit applications.
379
380
options for the tool chain from GCC (GNU Compiler Collection) and Binutils, which include the assembler as and the linker ld: Biarch Compiler Both 32-bit and 64-bit objects can be generated with a biarch development tool chain. The compilation of 64-bit objects is the default on almost all platforms. 32bit objects can be generated if special flags are used. This special flag is -m32 for GCC (-m31 for generating s390 binaries). The flags for the binutils are architecturedependent, but GCC transfers the correct flags to linkers and assemblers. A biarch development tool chain currently exists for amd64 (supports development for x86 and amd64 instructions), for s390x, and for ppc64. 32-bit objects are normally created on the ppc64 platform. The -m64 flag must be used to generate 64-bit objects. No Support SUSE Linux Enterprise does not support the direct development of 32-bit software on all platforms. To develop applications for x86 under ia64, use the corresponding 32-bit version of SUSE Linux Enterprise. All header files must be written in an architecture-independent form. The installed 32bit and 64-bit libraries must have an API (application programming interface) that matches the installed header files. The normal SUSE Linux Enterprise environment is designed according to this principle. In the case of manually updated libraries, resolve these issues yourself.
381
For example, to compile a program that uses libaio on a system whose second architecture is a 32-bit architecture (x86_64 or s390x), you need the following RPMs: libaio-32bit 32-bit runtime package libaio-devel-32bit Headers and libraries for 32-bit development libaio 64-bit runtime package libaio-devel 64-bit development headers and libraries Most open source programs use an autoconf-based program configuration. To use autoconf for configuring a program for the second architecture, overwrite the normal compiler and linker settings of autoconf by running the configure script with additional environment variables. The following example refers to an x86_64 system with x86 as the second architecture. Examples for s390x with s390 as the second architecture or ppc64 with ppc as the second architecture would be similar. This example does not apply to ia64 where you do not build 32-bit packages. 1 Use the 32-bit compiler:
CC="gcc -m32"
2 Instruct the linker to process 32-bit objects (always use gcc as the linker frontend):
LD="gcc -m32"
4 Determine that the libraries for libtool and so on come from /usr/lib:
LDFLAGS="-L/usr/lib"
382
Not all of these variables are needed for every program. Adapt them to the respective program. An example configure call to compile a native 32-bit application on x86_64, ppc64, or s390x could appear as follows:
CC="gcc -m32" \ LDFLAGS="-L/usr/lib;" \ .configure \ --prefix=/usr \ --libdir=/usr/lib make make install
383
TIP Some applications require separate kernel-loadable modules. If you intend to use such a 32-bit application in a 64-bit system environment, contact the provider of this application and Novell to make sure that the 64-bit version of the kernel-loadable module and the 32-bit compiled version of the kernel API are available for this module.
384
20
2.
385
hard disk are referred to as the Master Boot Record (MBR). The boot loader then passes control to the actual operating system, in this case, the Linux kernel. More information about GRUB, the Linux boot loader, can be found in Chapter 21, The Boot Loader (page 401). For a network boot, the BIOS acts as the boot loader. It gets the image to start from the boot server then starts the system. This is completely independent of local hard disks. 3. Kernel and initramfs To pass system control, the boot loader loads both the kernel and an initial RAMbased file system (initramfs) into memory. The contents of the initramfs can be used by the kernel directly. initramfs contains a small executable called init that handles the mounting of the real root file system. In former versions of SUSE Linux, these tasks were handled by initrd and linuxrc, respectively. For more information about initramfs, refer to Section 20.1.1, initramfs (page 386). If the system does not have a local hard disk, the initramfs must provide the root file system to the kernel. This can be done with the help of a network block device like iSCSI or SAN, but it is also possible to use NFS as the root device. init on initramfs This program performs all actions needed to mount the proper root file system, like providing kernel functionality for the needed file system and device drivers for mass storage controllers with udev. After the root file system has been found, it is checked for errors and mounted. If this has been successful, the initramfs is cleaned and the init program on the root file system is executed. For more information about init, refer to Section 20.1.2, init on initramfs (page 387). Find more information about udev in Chapter 25, Dynamic Kernel Device Management with udev (page 475). init init handles the actual booting of the system through several different levels providing different functionality. init is described in Section 20.2, The init Process (page 389).
4.
5.
20.1.1 initramfs
initramfs is a small cpio archive that the kernel can load to a RAM disk. It provides a minimal Linux environment that enables the execution of programs before the actual root file system is mounted. This minimal Linux environment is loaded into memory by BIOS routines and does not have specific hardware requirements other than sufficient memory. initramfs must always provide an executable named init that should execute the actual init program on the root file system for the boot process to proceed.
386
Before the root file system can be mounted and the operating system can be started, the kernel needs the corresponding drivers to access the device on which the root file system is located. These drivers may include special drivers for certain kinds of hard drives or even network drivers to access a network file system. The needed modules for the root file system may be loaded by init on initramfs. After the modules are loaded, udev provides the initramfs with the needed devices. Later in the boot process, after changing the root file system, it is necessary to regenerate the devices. This is done by init. If you need to change hardware (hard disks) in an installed system and this hardware requires different drivers to be present in the kernel at boot time, you must update initramfs. This is done in the same way as with its predecessor, initrdby calling mkinitrd. Calling mkinitrd without any argument creates an initramfs. Calling mkinitrd -R creates an initrd. In SUSE Linux Enterprise, the modules to load are specified by the variable INITRD_MODULES in /etc/sysconfig/kernel. After installation, this variable is automatically set to the correct value. The modules are loaded in exactly the order in which they appear in INITRD_MODULES. This is only important if you rely on the correct setting of the device files /dev/sd?. However, in current systems you also may use the device files below /dev/disk/ that are sorted in several subdirectories, named by-id, by-path and by-uuid, and always represent the same disk. IMPORTANT: Updating initramfs or initrd The boot loader loads initramfs or initrd in the same way as the kernel. It is not necessary to reinstall GRUB after updating initramfs or initrd, because GRUB searches the directory for the right file when booting.
387
your hard drive). To access the final root file system, the kernel needs to load the proper file system drivers. Providing Special Block Files For each loaded module, the kernel generates device events. udev handles these events and generates the needed device special files on a RAM file system in /dev. Without those special files, the file system would not be accessible. Managing RAID and LVM Setups If you configured your system to hold the root file system under RAID or LVM, init sets up LVM or RAID to enable access to the root file system later. Find information about RAID in Section 6.2, Soft RAID Configuration (page 131). Find information about LVM in Section 6.1, LVM Configuration (page 123). Managing Network Configuration If you configured your system to use a network-mounted root file system (mounted via NFS), init must make sure that the proper network drivers are loaded and that they are set up to allow access to the root file system. If the file system resides on a networked block device like iSCSI or SAN, connection to the storage server is also set up by the initramfs. When init is called during the initial boot as part of the installation process, its tasks differ from those mentioned earlier: Finding the Installation Medium As you start the installation process, your machine loads an installation kernel and a special initrd with the YaST installer from the installation medium. The YaST installer, which is run in a RAM file system, needs to have information about the location of the installation medium to access it and install the operating system. Initiating Hardware Recognition and Loading Appropriate Kernel Modules As mentioned in Section 20.1.1, initramfs (page 386), the boot process starts with a minimum set of drivers that can be used with most hardware configurations. init starts an initial hardware scanning process that determines the set of drivers suitable for your hardware configuration. The names of the modules needed for the boot process are written to INITRD_MODULES in /etc/sysconfig/kernel. These names are used to generate a custom initramfs that is needed to boot the system. If the modules are not needed for boot but for coldplug, the modules are written to /etc/sysconfig/hardware/hwconfig-*. All devices that are described with configuration files in this directory are initialized in the boot process. 388 Installation and Administration
Loading the Installation System or Rescue System As soon as the hardware has been properly recognized, the appropriate drivers have been loaded, and udev has created the device special files, init starts the installation system, which contains the actual YaST installer, or the rescue system. Starting YaST Finally, init starts YaST, which starts package installation and system configuration.
20.2.1 Runlevels
In Linux, runlevels define how the system is started and what services are available in the running system. After booting, the system starts as defined in /etc/inittab in the line initdefault. Usually this is 3 or 5. See Table 20.1, Available Runlevels (page 390). As an alternative, the runlevel can be specified at boot time (at the boot prompt, for instance). Any parameters that are not directly evaluated by the kernel itself are passed to init.
389
Available Runlevels Description System halt Single user mode; from the boot prompt, only with US keyboard mapping Single user mode Local multiuser mode without remote network (NFS, etc.) Full multiuser mode with network Not used Full multiuser mode with network and X display managerKDM, GDM, or XDM System reboot
1 2 3 4 5
IMPORTANT: Avoid Runlevel 2 with a Partition Mounted via NFS You should not use runlevel 2 if your system mounts a partition like /usr via NFS. The system might behave unexpectedly if program files or libraries are missing because the NFS service is not available in runlevel 2 (local multiuser mode without remote network). To change runlevels while the system is running, enter telinit and the corresponding number as an argument. Only the system administrator is allowed to do this. The following list summarizes the most important commands in the runlevel area. telinit 1 or shutdown now The system changes to single user mode. This mode is used for system maintenance and administration tasks.
390
telinit 3 All essential programs and services (including network) are started and regular users are allowed to log in and work with the system without a graphical environment. telinit 5 The graphical environment is enabled. Usually a display manager like XDM, GDM, or KDM is started. If autologin is enabled, the local user is logged in to the preselected window manager (GNOME or KDE or any other window manager). telinit 0 or shutdown -h now The system halts. telinit 6 or shutdown -r now The system halts then reboots. Runlevel 5 is the default runlevel in all SUSE Linux Enterprise standard installations. Users are prompted for login with a graphical interface or the default user is logged in automatically. If the default runlevel is 3, the X Window System must be configured properly, as described in Chapter 27, The X Window System (page 495), before the runlevel can be switched to 5. If this is done, check whether the system works in the desired way by entering telinit 5. If everything turns out as expected, you can use YaST to set the default runlevel to 5. WARNING: Errors in /etc/inittab May Result in a Faulty System Boot If /etc/inittab is damaged, the system might not boot properly. Therefore, be extremely careful while editing /etc/inittab. Always let init reread /etc/inittab with the command telinit q before rebooting the machine. Generally, two things happen when you change runlevels. First, stop scripts of the current runlevel are launched, closing down some programs essential for the current runlevel. Then start scripts of the new runlevel are started. Here, in most cases, a number of programs are started. For example, the following occurs when changing from runlevel 3 to 5: 1. The administrator (root) requests init to change to a different runlevel by entering telinit 5.
391
2.
init consults its configuration file (/etc/inittab) and determines it should start /etc/init.d/rc with the new runlevel as a parameter. Now rc calls the stop scripts of the current runlevel for which there is no start script in the new runlevel. In this example, these are all the scripts that reside in /etc/init.d/rc3.d (old runlevel was 3) and start with a K. The number following K specifies the order to start, because there are some dependencies to consider. The last things to start are the start scripts of the new runlevel. These are, in this example, in /etc/init.d/rc5.d and begin with an S. The same procedure regarding the order in which they are started is applied here.
3.
4.
When changing into the same runlevel as the current runlevel, init only checks /etc/ inittab for changes and starts the appropriate steps, for example, for starting a getty on another interface. The same functionality may be achieved with the command telinit q.
392
start and stop. The scripts also understand the restart, reload, force-reload, and status options. These different options are explained in Table 20.2, Possible init Script Options (page 393). Scripts that are run directly by init do not have these links. They are run independently from the runlevel when needed. Table 20.2 Option start stop restart Possible init Script Options Description Start service. Stop service. If the service is running, stop it then restart it. If it is not running, start it. Reload the configuration without stopping and restarting the service. Reload the configuration if the service supports this. Otherwise, do the same as if restart had been given. Show the current status of service.
reload
force-reload
status
Links in each runlevel-specific subdirectory make it possible to associate scripts with different runlevels. When installing or uninstalling packages, these links are added and removed with the help of the program insserv (or using /usr/lib/lsb/install _initd, which is a script calling this program). See the insserv(8) man page for details. All of these settings may also be changed with the help of the YaST module. If you need to check the status on the command line, use the tool chkconfig, described in the chkconfig(8) man page. A short introduction to the boot and stop scripts launched first or last, respectively, follows as well as an explanation of the maintaining script. boot Executed while starting the system directly using init. It is independent of the chosen runlevel and is only executed once. Here, the proc and pts file systems are mounted and blogd (boot logging daemon) is activated. If the system is booted Booting and Configuring a Linux System 393
for the first time after an update or an installation, the initial system configuration is started. The blogd daemon is a service started by boot and rc before any other one. It is stopped after the actions triggered by these scripts (running a number of subscripts, for example) are completed. blogd writes any screen output to the log file /var/ log/boot.msg, but only if and when /var is mounted read-write. Otherwise, blogd buffers all screen data until /var becomes available. Get further information about blogd on the blogd(8) man page. The script boot is also responsible for starting all the scripts in /etc/init.d/ boot.d with a name that starts with S. There, the file systems are checked and loop devices are configured if needed. The system time is also set. If an error occurs while automatically checking and repairing the file system, the system administrator can intervene after first entering the root password. Last executed is the script boot.local. boot.local Here, enter additional commands to execute at boot before changing into a runlevel. It can be compared to AUTOEXEC.BAT on DOS systems. boot.setup This script is executed when changing from single user mode to any other runlevel and is responsible for a number of basic settings, such as the keyboard layout and initialization of the virtual consoles. halt This script is only executed while changing into runlevel 0 or 6. Here, it is executed either as halt or as reboot. Whether the system shuts down or reboots depends on how halt is called. rc This script calls the appropriate stop scripts of the current runlevel and the start scripts of the newly selected runlevel. You can create your own scripts and easily integrate them into the scheme described above. For instructions about formatting, naming, and organizing custom scripts, refer to the specifications of the LSB and to the man pages of init, init.d, chkconfig, and insserv. Additionally consult the man pages of startproc and killproc.
394
WARNING: Faulty init Scripts May Halt Your System Faulty init scripts may hang your machine. Edit such scripts with great care and, if possible, subject them to heavy testing in the multiuser environment. Find some useful information about init scripts in Section 20.2.1, Runlevels (page 389). To create a custom init script for a given program or service, use the file /etc/init .d/skeleton as a template. Save a copy of this file under the new name and edit the relevant program and filenames, paths, and other details as needed. You may also need to enhance the script with your own parts, so the correct actions are triggered by the init procedure. The INIT INFO block at the top is a required part of the script and must be edited. See Example 20.1, A Minimal INIT INFO Block (page 395). Example 20.1 A Minimal INIT INFO Block
### BEGIN INIT INFO # Provides: # Required-Start: # Required-Stop: # Default-Start: # Default-Stop: # Description: ### END INIT INFO FOO $syslog $remote_fs $syslog $remote_fs 3 5 0 1 2 6 Start FOO to allow XY and provide YZ
In the first line of the INFO block, after Provides:, specify the name of the program or service controlled by this init script. In the Required-Start: and Required-Stop: lines, specify all services that need to be started or stopped before the service itself is started or stopped. This information is used later to generate the numbering of script names, as found in the runlevel directories. After Default-Start: and Default-Stop:, specify the runlevels in which the service should automatically be started or stopped. Finally, for Description:, provide a short description of the service in question. To create the links from the runlevel directories (/etc/init.d/rc?.d/) to the corresponding scripts in /etc/init.d/, enter the command insserv new-script-name. The insserv program evaluates the INIT INFO header to create the necessary links for start and stop scripts in the runlevel directories (/etc/init .d/rc?.d/). The program also takes care of the correct start and stop order for each runlevel by including the necessary numbers in the names of these links. If you prefer
395
a graphical tool to create such links, use the runlevel editor provided by YaST, as described in Section 20.2.3, Configuring System Services (Runlevel) with YaST (page 396). If a script already present in /etc/init.d/ should be integrated into the existing runlevel scheme, create the links in the runlevel directories right away with insserv or by enabling the corresponding service in the runlevel editor of YaST. Your changes are applied during the next rebootthe new service is started automatically. Do not set these links manually. If something is wrong in the INFO block, problems will arise when insserv is run later for some other service. The manually-added service will be removed with the next run of insserv.
396
For detailed control over the runlevels in which a service is started or stopped or to change the default runlevel, first select Expert Mode. The current default runlevel or initdefault (the runlevel into which the system boots by default) is displayed at the top. Normally, the default runlevel of a SUSE Linux Enterprise system is runlevel 5 (full multiuser mode with network and X). A suitable alternative might be runlevel 3 (full multiuser mode with network). This YaST dialog allows the selection of one of the runlevels (as listed in Table 20.1, Available Runlevels (page 390)) as the new default. Additionally use the table in this window to enable or disable individual services and daemons. The table lists the services and daemons available, shows whether they are currently enabled on your system, and, if so, for which runlevels. After selecting one of the rows with the mouse, click the check boxes representing the runlevels (B, 0, 1, 2, 3, 5, 6, and S) to define the runlevels in which the selected service or daemon should be running. Runlevel 4 is undefined to allow creation of a custom runlevel. A brief description of the currently selected service or daemon is provided below the table overview. With Start, Stop, or Refresh, decide whether a service should be activated. Refresh status checks the current status. Set or Reset lets you select whether to apply your changes to the system or to restore the settings that existed before starting the runlevel editor. Selecting Finish saves the changed settings to disk.
397
WARNING: Faulty Runlevel Settings May Damage Your System Faulty runlevel settings may render a system unusable. Before applying your changes, make absolutely sure that you know their consequences.
20.3.1 Changing the System Configuration Using the YaST sysconfig Editor
The YaST sysconfig editor provides an easy-to-use front-end to system configuration. Without any knowledge of the actual location of the configuration variable you need to change, you can just use the built-in search function of this module, change the value of the configuration variable as needed, and let YaST take care of applying these changes, updating configurations that depend on the values set in sysconfig and restarting services.
398
WARNING: Modifying /etc/sysconfig/* Files Can Damage Your Installation Do not modify the /etc/sysconfig files if you lack previous experience and knowledge. It could do considerable damage to your system. The files in /etc/sysconfig include a short comment for each variable to explain what effect they actually have. Figure 20.2 System Configuration Using the sysconfig Editor
The YaST sysconfig dialog is split into three parts. The left part of the dialog shows a tree view of all configurable variables. When you select a variable, the right part displays both the current selection and the current setting of this variable. Below, a third window displays a short description of the variable's purpose, possible values, the default value, and the actual configuration file from which this variable originates. The dialog also provides information about which configuration script is executed after changing the variable and which new service is started as a result of the change. YaST prompts you to confirm your changes and informs you which scripts will be executed after you leave the dialog by selecting Finish. Also select the services and scripts to skip for now, so they are started later. YaST applies all changes automatically and restarts any services involved for your changes to take an effect.
399
400
21
This chapter describes how to configure GRUB, the boot loader used in SUSE Linux Enterprise. A special YaST module is available for performing all settings. If you are not familiar with the subject of booting in Linux, read the following sections to acquire some background information. This chapter also describes some of the problems frequently encountered when booting with GRUB and their solutions. This chapter focuses on boot management and the configuration of the boot loader GRUB. The boot procedure as a whole is outlined in Chapter 20, Booting and Configuring a Linux System (page 385). A boot loader represents the interface between machine (BIOS) and the operating system (SUSE Linux Enterprise). The configuration of the boot loader directly impacts the start of the operating system. The following terms appear frequently in this chapter and might need some explanation: Master Boot Record The structure of the MBR is defined by an operating systemindependent convention. The first 446 bytes are reserved for the program code. They typically hold part of a boot loader program or an operating system selector. The next 64 bytes provide space for a partition table of up to four entries (see Section Partition Types (page 44)). The partition table contains information about the partitioning of the hard disk and the file system types. The operating system needs this table for handling the hard disk. With conventional generic code in the MBR, exactly one partition must be marked active. The last two bytes of the MBR must contain a static magic number (AA55). An MBR containing a different value is regarded as invalid by some BIOSs, so is not considered for booting.
401
Boot Sectors Boot sectors are the first sectors of hard disk partitions with the exception of the extended partition, which merely serves as a container for other partitions. These boot sectors have 512 bytes of space for code used to boot an operating system installed in the respective partition. This applies to boot sectors of formatted DOS, Windows, and OS/2 partitions, which also contain some important basic data of the file system. In contrast, the boot sectors of Linux partitions are initally empty after setting up a file system other than XFS. Therefore, a Linux partition is not bootable by itself, even if it contains a kernel and a valid root file system. A boot sector with valid code for booting the system has the same magic number as the MBR in its last two bytes (AA55).
402
GRUB can access file systems of supported BIOS disk devices (floppy disks or hard disks, CD drives, and DVD drives detected by the BIOS). Therefore, changes to the GRUB configuration file (menu.lst) do not require a reinstallation of the boot manager. When the system is booted, GRUB reloads the menu file with the valid paths and partition data of the kernel or the initial RAM disk (initrd) and locates these files. The actual configuration of GRUB is based on three files that are described below: /boot/grub/menu.lst This file contains all information about partitions or operating systems that can be booted with GRUB. Without this information, the GRUB command line prompts the user for how to proceed (see Section Editing Menu Entries during the Boot Procedure (page 407) for details). /boot/grub/device.map This file translates device names from the GRUB and BIOS notation to Linux device names. /etc/grub.conf This file contains the commands, parameters, and options the GRUB shell needs for installing the boot loader correctly. GRUB can be controlled in various ways. Boot entries from an existing configuration can be selected from the graphical menu (splash screen). The configuration is loaded from the file menu.lst. In GRUB, all boot parameters can be changed prior to booting. For example, errors made when editing the menu file can be corrected in this way. Boot commands can also be entered interactively at a kind of input prompt (see Section Editing Menu Entries during the Boot Procedure (page 407)). GRUB offers the possibility of determining the location of the kernel and the initrd prior to booting. In this way, you can even boot an installed operating system for which no entry exists in the boot loader configuration. GRUB actually exists in two versions: as a boot loader and as a normal Linux program in /usr/sbin/grub. This program is referred to as the GRUB shell. It provides an emulation of GRUB in the installed system and can be used to install GRUB or test new settings before applying them. The functionality to install GRUB as the boot loader on a hard disk or floppy disk is integrated in GRUB in the form of the commands install and setup. This is available in the GRUB shell when Linux is loaded.
403
The device names in GRUB are explained in Section Naming Conventions for Hard Disks and Partitions (page 405). This example specifies the first block of the fourth partition of the first hard disk. Use the command kernel to specify a kernel image. The first argument is the path to the kernel image in a partition. The other arguments are passed to the kernel on its command line. If the kernel does not have built-in drivers for access to the root partition or a recent Linux system with advanced hotplug features is used, initrd must be specified with a separate GRUB command whose only argument is the path to the initrd file. Because the loading address of the initrd is written into the loaded kernel image, the command initrd must follow after the kernel command.
404
The command root simplifies the specification of kernel and initrd files. The only argument of root is a device or a partition. This device is used for all kernel, initrd, or other file paths for which no device is explicitly specified until the next root command. The boot command is implied at the end of every menu entry, so it does not need to be written into the menu file. However, if you use GRUB interactively for booting, you must enter the boot command at the end. The command itself has no arguments. It merely boots the loaded kernel image or the specified chain loader. After writing all menu entries, define one of them as the default entry. Otherwise, the first one (entry 0) is used. You can also specify a time-out in seconds after which the default entry should boot. timeout and default usually precede the menu entries. An example file is described in Section An Example Menu File (page 406).
Being dependent on BIOS devices, GRUB does not distinguish between IDE, SATA, SCSI, and hardware RAID devices. All hard disks recognized by the BIOS or other controllers are numbered according to the boot sequence preset in the BIOS. Unfortunately, it is often not possible to map the Linux device names to BIOS device names exactly. It generates this mapping with the help of an algorithm and saves it to the file device.map, which can be edited if necessary. Information about the file device.map is available in Section 21.2.2, The File device.map (page 408). The Boot Loader 405
A complete GRUB path consists of a device name written in parentheses and the path to the file in the file system in the specified partition. The path begins with a slash. For example, the bootable kernel could be specified as follows on a system with a single IDE hard disk containing Linux in its first partition:
(hd0,0)/boot/vmlinuz
The first block defines the configuration of the splash screen: gfxmenu (hd0,4)/message The background image message is located in the top directory of the /dev/ hda5 partition. color white/blue black/light-gray Color scheme: white (foreground), blue (background), black (selection), and light gray (background of the selection). The color scheme has no effect on the splash screen, only on the customizable GRUB menu that you can access by exiting the splash screen with Esc .
406
default 0 The first menu entry title linux is the one to boot by default. timeout 8 After eight seconds without any user input, GRUB automatically boots the default entry. To deactivate automatic boot, delete the timeout line. If you set timeout 0, GRUB boots the default entry immediately. The second and largest block lists the various bootable operating systems. The sections for the individual operating systems are introduced by title. The first entry (title linux) is responsible for booting SUSE Linux Enterprise. The kernel (vmlinuz) is located in the first logical partition (the boot partition) of the first hard disk. Kernel parameters, such as the root partition and VGA mode, are appended here. The root partition is specified according to the Linux naming convention (/dev/hda7/), because this information is read by the kernel and has nothing to do with GRUB. The initrd is also located in the first logical partition of the first hard disk. The second entry is responsible for loading Windows. Windows is booted from the first partition of the first hard disk (hd0,0). The command chainloader +1 causes GRUB to read and execute the first sector of the specified partition. The next entry enables booting from floppy disk without modifying the BIOS settings. The boot option failsafe starts Linux with a selection of kernel parameters that enables Linux to boot even on problematic systems. The menu file can be changed whenever necessary. GRUB then uses the modified settings during the next boot. Edit the file permanently using YaST or an editor of your choice. Alternatively, make temporary changes interactively using the edit function of GRUB. See Section Editing Menu Entries during the Boot Procedure (page 407).
407
the GRUB text-based menu then press E . Changes made in this way only apply to the current boot and are not adopted permanently. IMPORTANT: Keyboard Layout during the Boot Procedure The US keyboard layout is the only one available when booting. See Figure 52.1, US Keyboard Layout (page 922) for a figure. Editing menu entries facilitates the repair of a defective system that can no longer be booted, because the faulty configuration file of the boot loader can be circumvented by manually entering parameters. Manually entering parameters during the boot procedure is also useful for testing new settings without impairing the native system. After activating the editing mode, use the arrow keys to select the menu entry of the configuration to edit. To make the configuration editable, press E again. In this way, edit incorrect partitions or path specifications before they have a negative effect on the boot process. Press Enter to exit the editing mode and return to the menu. Then press B to boot this entry. Further possible actions are displayed in the help text at the bottom. To enter changed boot options permanently and pass them to the kernel, open the file menu.lst as the user root and append the respective kernel parameters to the existing line, separated by spaces:
title linux kernel (hd0,0)/vmlinuz root=/dev/hda3 additional parameter initrd (hd0,0)/initrd
GRUB automatically adopts the new parameters the next time the system is booted. Alternatively, this change can also be made with the YaST boot loader module. Append the new parameters to the existing line, separated by spaces.
408
Because the order of IDE, SCSI, and other hard disks depends on various factors and Linux is not able to identify the mapping, the sequence in the file device.map can be set manually. If you encounter problems when booting, check if the sequence in this file corresponds to the sequence in the BIOS and use the GRUB prompt to modify it temporarily if necessary. After the Linux system has booted, the file device.map can be edited permanently with the YaST boot loader module or an editor of your choice. IMPORTANT: SATA Disks Depending on the controller, SATA disks are either recognized as IDE (/dev/hdx) or SCSI (/dev/sdx) devices. After manually changing device.map, execute the following command to reinstall GRUB. This command causes the file device.map to be reloaded and the commands listed in grub.conf to be executed:
grub --batch < /etc/grub.conf
Meaning of the individual entries: root (hd0,4) This command tells GRUB to apply the following commands to the first logical partition of the first hard disk (the location of the boot files). install parameter The command grub should be run with the parameter install. stage1 of the boot loader should be installed in the the extended partition container The Boot Loader 409
(/grub/stage1 (hd0,3)). This is a slightly esoteric configuration, but it is known to work in many cases. stage2 should be loaded to the memory address 0x8000 (/grub/stage2 0x8000). The last entry ((hd0,4)/grub/menu.lst) tells GRUB where to look for the menu file.
2 Paste the encrypted string into the global section of the file menu.lst:
gfxmenu (hd0,4)/message color white/blue black/light-gray default 0 timeout 8 password --md5 $1$lS2dv/$JOYcdxIn7CJk9xShzzJVw/
Now GRUB commands can only be executed at the boot prompt after pressing P and entering the password. However, users can still boot all operating systems from the boot menu. 3 To prevent one or several operating systems from being booted from the boot menu, add the entry lock to every section in menu.lst that should not be bootable without entering a password. For example:
title linux kernel (hd0,4)/vmlinuz root=/dev/hda7 vga=791
410
After rebooting the system and selecting the Linux entry from the boot menu, the following error message is displayed:
Error 32: Must be authenticated
Press Enter to enter the menu. Then press P to get a password prompt. After entering the password and pressing Enter , the selected operating system (Linux in this case) should boot.
411
Use the Section Management tab to edit, change, and delete boot loader sections for the individual operating systems. To add an option, click Add. To change the value of an existing option, select it with the mouse and click Edit. If you do not want to use an existing option at all, select it and click Delete. If you are not familiar with boot loader options, read Section 21.2, Booting with GRUB (page 402) first. Use the Boot Loader Installation tab to view and change settings related to type, location, and advanced loader settings.
412
During the conversion, the old GRUB configuration is saved to disk. To use it, simply change the boot loader type back to GRUB and choose Restore Configuration Saved before Conversion. This action is available only on an installed system. NOTE: Custom Boot Loader If you want use a boot loader other than GRUB or LILO, select Do Not Install Any Boot Loader. Read the documentation of your boot loader carefully before choosing this option.
Boot Sector of Boot Partition /dev/hdXY The boot sector of the /boot partition. This option is the default if you have several operating systems installed on your hard drive. The Y stands for the partition (1, 2, 3, 4, 5, etc.) as in:
/dev/hda1
Boot Sector of Root Partition /dev/hdXY The boot sector of the / (root) partition. Unless a /boot partition is necessary or the MBR needs to be used, this is the preferred default. Other Use this option to specify the location of the boot loader manually.
413
414
Set for the boot menu should be displayed permanently without timing out by disabling Continue Booting after a Time-Out.
415
5 Click Finish to save the changes. Using this module, you can also replace the master boot record with generic code, which boots the active partition. Click Replace MBR with Gerneric Code in Disk System Area Update. Enable Activate Boot Loader Partition to activate the partition that contains the boot loader. Click Finish to save the changes.
mkdir -p iso/boot/grub
3 Copy the kernel, the files stage2_eltorito, initrd, menu.lst, and /boot/message to iso/boot/:
cp cp cp cp /boot/vmlinuz iso/boot/ /boot/initrd iso/boot/ /boot/message iso/boot/ /boot/grub/menu.lst iso/boot/grub
4 Adjust the path entries in iso/boot/menu.lst to make them point to a CDROM device. Do this by replacing the device name of the hard disks, listed in the format (hd*), in the pathnames with the device name of the CD-ROM drive, which is (cd):
gfxmenu (cd)/boot/message timeout 8 default 0 title Linux kernel (cd)/boot/vmlinuz root=/dev/hda5 vga=794 resume=/dev/hda1 \ splash=verbose showopts initrd (cd)/boot/initrd
417
Disabling the SUSE screen by default. Add the kernel parameter splash=0 to your boot loader configuration. Chapter 21, The Boot Loader (page 401) provides more information about this. However, if you prefer the text mode, which was the default in earlier versions, set vga=normal. Completely Disabling the SUSE Screen Compile a new kernel and disable the option Use splash screen instead of boot logo in framebuffer support. TIP Disabling framebuffer support in the kernel automatically disables the splash screen as well. SUSE cannot provide any support for your system if you run it with a custom kernel.
21.7 Troubleshooting
This section lists some of the problems frequently encountered when booting with GRUB and a short description of possible solutions. Some of the problems are covered in articles in the Support Database at http://portal.suse.de/sdb/en/index .html. If your specific problem is not included in this list, use the search dialog of the Support Database at https://portal.suse.com/PM/page/search.pm to search for keywords like GRUB, boot, and boot loader. GRUB and XFS XFS leaves no room for stage1 in the partition boot block. Therefore, do not specify an XFS partition as the location of the boot loader. This problem can be solved by creating a separate boot partition that is not formatted with XFS. GRUB and JFS Although technically possible, the combination of GRUB with JFS is problematic. In this case, create a separate boot partition (/boot) and format it with Ext2. Install GRUB in this partition. GRUB Reports GRUB Geom Error GRUB checks the geometry of connected hard disks when the system is booted. Sometimes, the BIOS returns inconsistent information and GRUB reports a GRUB Geom Error. If this is the case, use LILO or update the BIOS. Detailed information
418
about the installation, configuration, and maintenance of LILO is available in the Support Database under the keyword LILO. GRUB also returns this error message if Linux was installed on an additional hard disk that is not registered in the BIOS. stage1 of the boot loader is found and loaded correctly, but stage2 is not found. This problem can be remedied by registering the new hard disk in the BIOS. System Containing IDE and SCSI Hard Disks Does Not Boot During the installation, YaST may have incorrectly determined the boot sequence of the hard disks. For example, GRUB may regard /dev/hda as hd0 and /dev/ sda as hd1, although the boot sequence in the BIOS is reversed (SCSI before IDE). In this case, correct the hard disks during the boot process with the help of the GRUB command line. After the system has booted, edit device.map to apply the new mapping permanently. Then check the GRUB device names in the files /boot/grub/menu.lst and /boot/grub/device.map and reinstall the boot loader with the following command:
grub --batch < /etc/grub.conf
Booting Windows from the Second Hard Disk Some operating systems, such as Windows, can only boot from the first hard disk. If such an operating system is installed on a hard disk other than the first hard disk, you can effect a logical change for the respective menu entry.
... title windows map (hd0) (hd1) map (hd1) (hd0) chainloader(hd1,0)+1 ...
In this example, Windows is started from the second hard disk. For this purpose, the logical order of the hard disks is changed with map. This change does not affect the logic within the GRUB menu file. Therefore, the second hard disk must be specified for chainloader.
419
420
22
This chapter starts with information about various software packages, the virtual consoles, and the keyboard layout. We talk about software components like bash, cron, and logrotate, because they were changed or enhanced during the last release cycles. Even if they are small or considered of minor importance, users may want to change their default behavior, because these components are often closely coupled with the system. The chapter is finished by a section about language and country-specific settings (I18N and L10N).
421
2. 3. 4.
Custom settings can be made in ~/.profile or in ~/.bashrc. To ensure the correct processing of these files, it is necessary to copy the basic settings from /etc/skel/ .profile or /etc/skel/.bashrc into the home directory of the user. It is recommended to copy the settings from /etc/skel following an update. Execute the following shell commands to prevent the loss of personal adjustments:
mv cp mv cp ~/.bashrc ~/.bashrc.old /etc/skel/.bashrc ~/.bashrc ~/.profile ~/.profile.old /etc/skel/.profile ~/.profile
You cannot edit /etc/crontab by calling the command crontab -e. This file must be loaded directly into an editor, modified, then saved. A number of packages install shell scripts to the directories /etc/cron.hourly, /etc/cron.daily, /etc/cron.weekly, and /etc/cron.monthly, whose execution is controlled by /usr/lib/cron/run-crons. /usr/lib/cron/
422
run-crons is run every 15 minutes from the main table (/etc/crontab). This guarantees that processes that may have been neglected can be run at the proper time. To run the hourly, daily, or other periodic maintenance scipts at custom times, remove the time stamp files regulary using /etc/crontab entries (see Example 22.2, /etc/crontab: Remove Time Stamp Files (page 423), which removes the hourly one before every full hour, the daily one once a day at 2:14 a.m., etc.). Example 22.2 /etc/crontab: Remove Time Stamp Files
59 14 29 44 * 2 2 2 * * * 1 * * * * * * 6 * root root root root rm rm rm rm -f -f -f -f /var/spool/cron/lastrun/cron.hourly /var/spool/cron/lastrun/cron.daily /var/spool/cron/lastrun/cron.weekly /var/spool/cron/lastrun/cron.monthly
The daily system maintenance jobs have been distributed to various scripts for reasons of clarity. They are contained in the package aaa_base. /etc/cron.daily contains, for example, the components suse.de-backup-rpmdb, suse .de-clean-tmp, or suse.de-cron-local.
423
logrotate is controlled through cron and is called daily by /etc/cron.daily/ logrotate. IMPORTANT The create option reads all settings made by the administrator in /etc/ permissions*. Ensure that no conflicts arise from any personal modifications.
424
Systemwide entries can be made in /etc/profile. There, enable creation of core files, needed by programmers for debugging. A normal user cannot increase the values specified in /etc/profile by the system administrator, but can make special entries in ~/.bashrc. Example 22.4 ulimit: Settings in ~/.bashrc
# Limits of physical memory: ulimit -m 98304 # Limits of virtual memory: ulimit -v 98304
Memory amounts must be specified in KB. For more detailed information, see man bash.
425
IMPORTANT Not all shells support ulimit directives. PAM (for instance, pam_limits) offers comprehensive adjustment possibilities if you depend on encompassing settings for these restrictions.
426
427
The components of Emacs are divided into several packages: The base package emacs. emacs-x11 (usually installed): the program with X11 support. emacs-nox: the program without X11 support. emacs-info: online documentation in info format. emacs-el: the uncompiled library files in Emacs Lisp. These are not required at runtime. Numerous add-on packages can be installed if needed: emacs-auctex (for LaTeX), psgml (for SGML and XML), gnuserv (for client and server operation), and others.
Alt
F1
to
Ctrl
428
These changes only affect applications that use terminfo entries or whose configuration files are changed directly (vi, less, etc.). Applications not shipped with SUSE Linux Enterprise should be adapted to these defaults. Under X, the compose key (multikey) can be accessed using Ctrl + Shift (right). Also see the corresponding entry in /usr/X11R6/lib/X11/Xmodmap. Further settings are possible using the X Keyboard Extension (XKB). This extension is also used by the desktop environments GNOME (gswitchit) and KDE (kxkb). TIP: For More Information Information about XKB is available in /etc/X11/xkb/README and the documents listed there. Detailed information about the input of Chinese, Japanese, and Korean (CJK) is available at Mike Fabian's page: http://www.suse.de/~mfabian/ suse-cjk/input.html.
429
RC_LC_MESSAGES, RC_LC_CTYPE, RC_LC_COLLATE, RC_LC_TIME, RC_LC_NUMERIC, RC_LC_MONETARY These variables are passed to the shell without the RC_ prefix and represent the listed categories. The shell profiles concerned are listed below. The current setting can be shown with the command locale. RC_LC_ALL This variable, if set, overwrites the values of the variables already mentioned. RC_LANG If none of the previous variables are set, this is the fallback. By default, SUSE Linux only sets RC_LANG. This makes it easier for users to enter their own values. ROOT_USES_LANG A yes or no variable. If it is set to no, root always works in the POSIX environment. The variables can be set with the YaST sysconfig editor (see Section 20.3.1, Changing the System Configuration Using the YaST sysconfig Editor (page 398)). The value of such a variable contains the language code, country code, encoding, and modifier. The individual components are connected by special characters:
LANG=<language>[[_<COUNTRY>].<Encoding>[@<Modifier>]]
430
LANG=en_US.UTF-8 This is the default setting if American English is selected during installation. If you selected another language, that language is enabled but still with UTF-8 as the character encoding. LANG=en_US.ISO-8859-1 This sets the language to English, country to United States, and the character set to ISO-8859-1. This character set does not support the Euro sign, but it can be useful sometimes for programs that have not been updated to support UTF-8. The string defining the charset (ISO-8859-1 in this case) is then evaluated by programs like Emacs. LANG=en_IE@euro The above example explicitly includes the Euro sign in a language setting. Strictly speaking, this setting is obsolete now, because UTF-8 also covers the Euro symbol. It is only useful if an application does not support UTF-8, but ISO-8859-15. SuSEconfig reads the variables in /etc/sysconfig/language and writes the necessary changes to /etc/SuSEconfig/profile and /etc/SuSEconfig/ csh.cshrc. /etc/SuSEconfig/profile is read or sourced by /etc/ profile. /etc/SuSEconfig/csh.cshrc is sourced by /etc/csh.cshrc. This makes the settings available systemwide. Users can override the system defaults by editing their ~/.bashrc accordingly. For instance, if you do not want to use the systemwide en_US for program messages, include LC_MESSAGES=es_ES so messages are displayed in Spanish instead.
in /usr/share/locale/en_US/LC_MESSAGES does not exist, it falls back to /usr/share/locale/en/LC_MESSAGES. A fallback chain can also be defined, for example, for Breton to French or for Galician to Spanish to Portuguese: LANGUAGE="br_FR:fr_FR" LANGUAGE="gl_ES:es_ES:pt_PT" If desired, use the Norwegian variants Nynorsk and Bokml instead (with additional fallback to no): LANG="nn_NO" LANGUAGE="nn_NO:nb_NO:no" or LANG="nb_NO" LANGUAGE="nb_NO:nn_NO:no" Note that in Norwegian, LC_TIME is also treated differently. One problem that can arise is a separator used to delimit groups of digits not being recognized properly. This occurs if LANG is set to only a two-letter language code like de, but the definition file glibc uses is located in /usr/share/lib/de_DE/LC _NUMERIC. Thus LC_NUMERIC must be set to de_DE to make the separator definition visible to the system.
432
433
23
SUSE Linux includes virtual machine technology that allows a single computer to run as a virtual machine server (VM Server). A VM Server can host one or more virtual machines (VMs). NOTE This section contains introductory information and basic setup instructions for virtual machine technology. For the most current and comprehensive information about virtualization, see Novell VM Server Technology [http://www .novell.com/documentation/technology/vm_server]. This section includes: Section 23.1, System Requirements (page 436) Section 23.2, Benefits of Virtual Machines (page 437) Section 23.3, Terminology (page 438) Section 23.4, Virtual Machine Modes (page 439) Section 23.5, Virtual Machine Server (page 439) Section 23.6, Setting up the Virtual Machine Server (page 442) Section 23.7, Creating Virtual Machines (page 446)
435
Disk Space Required In addition to the disk space required for SUSE Linux, additional disk space might be required, depending on the needs of each VM.
436
VM Server Compo- Requirement nent Operating Systems VM Server can host the following VM-aware operating sysfor Virtual Machines tems in paravirtual mode: SUSE Linux 10.1 SUSE Linux Enterprise Server 10 SUSE Linux Enterprise Desktop 10 With hardware-assisted virtualization, VM Server provides a full virtual environment that can host most popular operating systems. If the VM Server is running kernel-xenpae to access memory above 4 GB, the VM operating systems must also be PAE enabled. Device Drivers for the Virtual Machine Environment On hardware-assisted virtual machines, the following devices are emulated and require native OS drivers: Network card: AMD PCNet, NE2000 Disk drive: IDE Graphics card: VESA-compliant VGA, Cirrus Logic GD5446 Input: PS/2 mouse and keyboard Sound: Creative Sound Blaster 16, ENSONIQ ES1370
437
Consolidate servers in the data center. Servers running in the data center are often underutilized. One study showed that data center CPU time averages about 12 percent of capacity. By consolidating several physical servers as VMs running on a virtual machine server, data centers are lowering hardware, maintenance, and electrical costs. Consolidate and host legacy applications. Isolate applications on the same physical server. Balance the computing load across data center resources. Provide application portability and flexibility across hardware platforms.
23.3 Terminology
The following clarifications can help you understand this document and virtualization technology. The term virtual machine refers to an instance of virtual hardware environment and the operating system that runs on that instance of virtual hardware. A virtual machine could be running any type of software, such as server, client, or desktop. It is often called a virtual computer, guest, domain U, domU, or unprivileged domain. The term virtual machine server or VM Server refers to a physical computer and software that combines to host, create, and control virtual machines. It is sometimes referred to as a host, domain 0, or privileged domain. The term virtual machine monitor (VMM) refers to the software layer that enables SUSE Linux to host virtual machines. It is sometimes referred to as a hypervisor. The VMM consists of software developed and maintained by the Xen open source community. The VMM is extended for full hardware emulation with QEMU software. The term VM-aware refers to an operating system that is optimized for the virtual machine environment. It is often called a paravirtualized, Xen-enabled, modified or optimized guest.
438
Operating systems not optimized for the virtual machine environment are often called shrink-wrapped, out-of-the-box, unmodified, or fully-virtualized guest.
439
VM Server Desktop
Virtual machines are defined and stored on the VM Server. The definitions (called VM definitions) are stored in a configuration file located at /etc/xen/vm/vm_name. The configuration file defines the virtual resources, such as CPU, memory, network card, and block devices, the operating system sees when it is installed and booted on the virtual machine. Figure 23.2 Virtual Machine Definitions and Virtual Machine Monitor
VM Definition
In both full virtualization and paravirtual modes, a VMs operating system uses device drivers to interact with the VMM. In full virtualization mode, the operating system uses its native OS device drivers for a standard set of emulated devices, such as an AMD PCNet or NE2000 network card, an IDE disk drive, and a VGA graphics card. In paravirtual mode, the VM-aware operating systems include special device drivers (called Xen drivers) to communicate through the VMM and VM Server to the physical devices in the computer.
440
Applications Operating System Memory Management Disk Driver (Xen) NIC Driver (Xen)
Applications Operating System Disk Driver (standard) NIC Driver (standard) Memory Management
If, for example, a VMs operating system running in full-virtualization mode needs to save a file on its virtual 20-GB disk drive, the operating system passes its request through the device driver to the VMM. The VMM understands which portion of the 500-GB physical disk the VM has access to and passes instructions to the VM Server. The VM Server accesses the disk drive and writes the file to the pre-defined location on the 500GB disk. Depending on your computing needs and available computer resources, any number of VMs can be created and can simultaneously run on the VM Server. The operating system of each VM interacts independently with the VMM and VM Server platform to consume virtual or emulated CPU, memory, block device, and network resources. Figure 23.4 VM Server and Virtual Machines
Virtual Machine 1 VM Server Virtual Machine 2 Virtual Machine 3
Applications Operating System Memory NIC Driver Disk Driver VM Server Desktop
SUSE Linux
Device Drivers
VM 1 Definition
VM 2 Definition
VM 3 Definition
441
VMs can be viewed and managed from the VM Server desktop. Figure 23.5 VM Server Desktop and Three Virtual Machines
442
443
23.6.2 Verifying That the GRUB Boot Loader Boots the VM Server
When the Xen software packages are installed, the GRUB boot loader is automatically updated to present the VM Server as a boot option. The GRUB boot loader configuration file is usually saved to /boot/grub/menu.lst. You might want to compare your GRUB boot loader configuration file with the sample below to confirm that it was updated to correctly boot VM Server. The first example shows a typical GRUB boot loader file updated to load the Xen software. The second file shows a GRUB boot loader file that loads a PAE-enabled kernel, which allows 32bit computers to access memory over 4 GB.
The title line specifies the name of the GRUB module. Do not change this line because YaST looks for the word Xen to verify that packages are installed. The root line specifies which partition holds the boot partition and /boot directory. Replace (hd0,5) with the correct partition. For example, if hda1 holds the /boot directory, the entry would be (hd0,0). The kernel line specifies the directory and filename of the hypervisor software. Replace hype_parameters with the parameters to pass to the hypervisor. A common parameter is dom0_mem=amount_of_memory, which specifies how much memory to allocate to the VM Server. The amount of memory is specified in KB, or you can specify the units, for example 128M. If the amount is not specified, the VM Server
444
takes the maximum possible memory for its operations. For more information about hypervisor parameters, see the XenSource Web Site [http://www.xensource .com/] . The first module line specifies the directory and filename of the Linux kernel to load. Replace kernel_parameters with the parameters to pass to the kernel. These parameters are the same parameters as those that can be passed to a standard Linux kernel on physical computer hardware. The second module line specifies the directory and filename of the RAM disk used to boot the VM Server. When the computer boots, the GRUB boot loader should now present the VM Server as a boot option.
VM Server Troubleshooting
The following information can be helpful if the computer does not successfully boot as a VM Server. Verify that the computer meets the minimum hardware requirements.
445
Enter the command rpm -qa | grep xen and make sure that you have installed the software packages listed in Section 23.1, System Requirements (page 436). Make sure the parameters in the GRUB boot loader configuration file are correct. Compare your file to the example given in Section Sample GRUB Boot Loader File (Typical) (page 444).
446
10 (Optional) To customize or verify that definitions were correctly recorded and saved, compare them to definitions in the example files located in /etc/ xen/examples. 11 (Conditional) Depending on the installation method you select, the operating systems installation program might start. If so, complete the installation program as prompted. The virtual machine is now defined and its operating system installed. Proceed to Section 23.8, Managing Virtual Machines (page 447) for instructions on how to start and manage virtual machines.
To view a list of parameters available for the xm xm help command To view a list of all running virtual machines To start and view a VM (paravirtual) (The VM starts and displays in the terminal window) To start and view a VM (fully virtual) (The VM starts and displays in a separate SDL viewer window) xm create /etc/xen/vm/vm_name xm list xm create /etc/xen/vm/vm_name -c
447
Task To view the console of an already-running VM (paravirtual) To change the memory available to a VM (paravirtual)
To do a normal shutdown of the VMs operating xm shutdown vm_name system (paravirtual) To do a normal shutdown of the VMs operating Access the operating systems system (fully virtual) console. Complete the steps to shut down the system. To terminate a VM immediately To terminate a VM immediately (fully virtual) xm destroy vm_name Close the SDL viewer window.
SDL is the default viewer for fully virtual VMs, but you might want to change to VNC. Although SDL is faster for viewing desktops on the same computer, VNC is faster for viewing desktops over the network. Table 23.2 Task To set the default viewer to be VNC instead of SDL (fully virtual) Changing Viewer Preferences Command Edit the /etc/xen/vm/vm_name file. Add or change lines to the following: vnc=1 vncviewer=1 sdl=0 To use VNC to view the console of an vncviewer already-running VM (fully virtual) vm_server_ip_address:vm_id To set the default viewer back to SDL Edit the /etc/xen/vm/vm_name file. Add (fully virtual) or change lines to the following: vnc=0 vncviewer=0 sdl=1
448
NOTE Closing the VNC viewer window does not terminate the VM.
449
Printer Operation
24
CUPS is the standard print system in SUSE Linux Enterprise. CUPS is highly useroriented. In many cases, it is compatible with LPRng or can be adapted with relatively little effort. LPRng is included in SUSE Linux Enterprise only for reasons of compatibility. Printers can be distinguished by interface, such as USB or network, and printer language. When buying a printer, make sure that the printer has an interface that is supported by the hardware and a suitable printer language. Printers can be categorized on the basis of the following three classes of printer languages: PostScript Printers PostScript is the printer language in which most print jobs in Linux and Unix are generated and processed by the internal print system. This language is already quite old and very efficient. If PostScript documents can be processed directly by the printer and do not need to be converted in additional stages in the print system, the number of potential error sources is reduced. Because PostScript printers are subject to substantial license costs, these printers usually cost more than printers without a PostScript interpreter. Standard Printer (languages like PCL and ESC/P) Although these printer languages are quite old, they are still undergoing expansion to address new features in printers. In the case of known printer languages, the print system can convert PostScript jobs to the respective printer language with the help of Ghostscript. This processing stage is referred to as interpreting. The bestknown languages are PCL, which is mostly used by HP printers and their clones, and ESC/P, which is used by Epson printers. These printer languages are usually supported by Linux and produce a decent print result. Linux may not be able to Printer Operation 451
address some functions of extremely new and fancy printers, because the open source developers may still be working on these features. Except for the hpijs drivers developed by HP, there are currently no printer manufacturers who develop Linux drivers and make them available to Linux distributors under an open source license. Most of these printers are in the medium price range. Proprietary Printers (usually GDI printers) Usually only one or several Windows drivers are available for proprietary printers. These printers do not support any of the common printer languages and the printer languages they use are subject to change when a new edition of a model is released. See Section 24.7.1, Printers without Standard Printer Language Support (page 467) for more information. Before you buy a new printer, refer to the following sources to check how well the printer you intend to buy is supported: http://www.linuxprinting.org/the LinuxPrinting.org printer database http://www.cs.wisc.edu/~ghost/the Ghostscript Web page /usr/share/doc/packages/ghostscript/catalog.deviceslist of included drivers The online databases always show the latest Linux support status. However, a Linux distribution can only integrate the drivers available at production time. Accordingly, a printer currently rated as perfectly supported may not have had this status when the latest SUSE Linux Enterprise version was released. Thus, the databases may not necessarily indicate the correct status, but only provide an approximation.
452
The filter converts the data the user wants to print (ASCII, PostScript, PDF, JPEG, etc.) into printer-specific data (PostScript, PCL, ESC/P, etc.). The features of the printer are described in the PPD files. A PPD file contains printer-specific options with the parameters needed to enable them on the printer. The filter system makes sure that options selected by the user are enabled. If you use a PostScript printer, the filter system converts the data into printer-specific PostScript. This does not require a printer driver. If you use a non-PostScript printer, the filter system converts the data into printer-specific data using Ghostscript. This requires a Ghostscript printer driver suitable for your printer. The back-end receives the printer-specific data from the filter passes it to the printer.
Printer Operation
453
454
Automatic Configuration
YaST is able to configure the printer automatically if the parallel or USB port can be set up automatically and the connected printer can be detected. The printer database must also contain the ID string of the printer that YaST retrieves during the automatic hardware detection. If the hardware ID differs from the model designation, select the model manually. To make sure that everything works properly, each configuration should be checked with the print test function of YaST. The test page also provides important information about the configuration tested.
Manual Configuration
If the requirements for automatic configuration are not met or if you want a custom setup, configure the printer manually. Depending on how successful the autodetection is and how much information about the printer model is found in the database, YaST may be able to determine the right settings automatically or at least make a reasonable preselection. The following parameters must be configured:
Printer Operation
455
Hardware Connection (Port) The configuration of the hardware connection depends on whether YaST has been able to find the printer during hardware autodetection. If YaST is able to detect the printer model automatically, it can be assumed that the printer connection works on the hardware level and no settings need to be changed in this respect. If YaST is unable to autodetect the printer model, there may be some problem with the connection on the hardware level. In this case, some manual intervention is required to configure the connection. In the Printer Configuration dialog, press Add to start the manual configuration workflow. Here, select your Printer Type (for example USB printer) and, with Next, enter the Printer Connection and select the device. Name of the Queue The queue name is used when issuing print commands. The name should be relatively short and consist of lowercase letters and numbers only. Enter the Name for printing in the next dialog (Queue name). Printer Model and PPD File All printer-specific parameters, such as the Ghostscript driver to use and the printer filter parameters for the driver, are stored in a PPD (PostScript Printer Description) file. See Section 24.3, Installing the Software (page 454) for more information about PPD files. For many printer models, several PPD files are available, for example, if several Ghostscript drivers work with the given model. When you select a manufacturer and a model in the next dialog (Printer model), YaST selects the PPD file that corresponds to the printer. If several PPD files are available for the model, YaST defaults to one of them (normally the one marked recommended). You can change the chosen PPD file in the next dialog with Edit. For non-PostScript models, all printer-specific data is produced by the Ghostscript driver. For this reason, the driver configuration is the single most important factor determining the output quality. The printout is affected both by the kind of Ghostscript driver (PPD file) selected and the options specified for it. If necessary, change additional options (as made available by the PPD file) after selecting Edit.
456
Always check whether your settings work as expected by printing the test page. If the output is garbled, for example, with several pages almost empty, you should be able to stop the printer by first removing all paper then stopping the test from YaST. If the printer database does not include an entry for your model, you can either add a new PPD file by selecting Add PPD File to Database, or use a collection of generic PPD files to make the printer work with one of the standard printer languages. To do so, select UNKNOWN MANUFACTURER as your printer manufacturer. Advanced Settings Normally, you do not need to change any of these settings.
Printer Operation
457
standard. Manufacturers then provide drivers for only a few operating systems, eliminating difficulties with those systems. Unfortunately, Linux drivers are rarely provided. The current situation is such that you cannot act on the assumption that every protocol works smoothly in Linux. Therefore, you may have to experiment with various options to achieve a functional configuration. CUPS supports the socket, LPD, IPP, and smb protocols. Here is some detailed information about these protocols: socket Socket refers to a connection in which the data is sent to an Internet socket without first performing a data handshake. Some of the socket port numbers that are commonly used are 9100 or 35. An example device URI is socket://host-printer:9100/. LPD (line printer daemon) The proven LPD protocol is described in RFC 1179. Under this protocol, some job-related data, such as the ID of the printer queue, is sent before the actual print data is sent. Therefore, a printer queue must be specified when configuring the LPD protocol for the data transmission. The implementations of diverse printer manufacturers are flexible enough to accept any name as the printer queue. If necessary, the printer manual should indicate what name to use. LPT, LPT1, LP1, or similar names are often used. An LPD queue can also be configured on a different Linux or Unix host in the CUPS system. The port number for an LPD service is 515. An example device URI is lpd://host-printer/LPT1. IPP (Internet printing protocol) IPP is a relatively new (1999) protocol based on the HTTP protocol. With IPP, more job-related data is transmitted than with the other protocols. CUPS uses IPP for internal data transmission. This is the preferred protocol for a forwarding queue between two CUPS servers. The name of the print queue is necessary to configure IPP correctly. The port number for IPP is 631. Example device URIs are ipp://host-printer/ps and ipp://host-cupsserver/printers/ps. SMB (Windows share) CUPS also supports printing on printers connected to Windows shares. The protocol used for this purpose is SMB. SMB uses the port numbers 137, 138, and 139. Example device URIs are
458
smb://user:password@workgroup/server/printer, smb://user:password@host/printer, and smb://server/printer. The protocol supported by the printer must be determined before configuration. If the manufacturer does not provide the needed information, the command nmap, which comes with the nmap package, can be used to guess the protocol. nmap checks a host for open ports. For example:
nmap -p 35,137-139,515,631,9100-10000 printerIP
Then the device (-v) will be available as queue (-p), using the specified PPD file (-P). This means that you must know the PPD file and the name of the device if you want to configure the printer manually.
Printer Operation
459
Do not use -E as the first option. For all CUPS commands, -E as the first argument sets use of an encrypted connection. To enable the printer, -E must be used as shown in the following example:
lpadmin -p ps -v parallel:/dev/lp0 -P \ /usr/share/cups/model/Postscript.ppd.gz -E
For more options of lpadmin, see the lpadmin(1) man page. During printer setup, certain options are set as default. These options can be modified for every print job (depending on the print tool used). Changing these default options with YaST is also possible. Using command line tools, set default options as follows: 1 First, list all options:
lpoptions -p queue -l
Example:
Resolution/Output Resolution: 150dpi *300dpi 600dpi
The activated default option is evident from the preceding asterisk (*). 2 Change the option with lpadmin:
lpadmin -p queue -o Resolution=600dpi
Settings are written to ~/.lpoptions when a normal user runs lpoptions. root settings are written to /etc/cups/lpoptions.
460
Printer Operation
461
1.
For every queue on the network server, you can configure a local queue through which to forward all jobs to the corresponding network server (forwarding queue). Usually, this approach is not recommended, because all client machines must be reconfigured whenever the configuration of the network server changes. Print jobs can also be forwarded directly to one network server. For this type of configuration, do not run a local CUPS daemon. lp or corresponding library calls of other programs can send jobs directly to the network server. However, this configuration does not work if you also want to print on a local printer. The CUPS daemon can listen to IPP broadcast packets that other network servers send to announce available queues. This is the best CUPS configuration for printing over remote CUPS servers. However, there is a risk that an attacker sends IPP broadcasts with queues and the local daemon accesses a counterfeit queue. If it then displays the queue with the same name as another queue on the local server, the owner of the job may believe the job is sent to a local server, while in reality it is sent to the attacker's server.
2.
3.
YaST can find CUPS servers by either scanning local network hosts to see if they offer the IPP service or by listening to IPP broadcasts. This requires the firewall to let incoming packets on port 631/UDP (service IPP client) pass through. This is automatically enabled when you have configured your machine to be in the internal firewall zone. Opening a port to configure access to remote queues in the external zone can be a security risk because an attacker could broadcast a server that might be accepted by users. By default IPP broadcasts are rejected in the external zone. See Section 44.4.1, Configuring the Firewall with YaST (page 834) for details on firewall configuration. Alternatively, the user can detect CUPS servers by actively scanning the local network hosts or configure all queues manually. However, because of the reasons mentioned in the beginning of this section, this method is not recommended.
462
This setting is also essential if you want to use the CUPS administration Web front-end or the KDE printer administration tool. When cupsd runs as lp, /etc/printcap cannot be generated, because lp is not permitted to create files in /etc/. Therefore, cupsd generates /etc/cups/ printcap. To ensure that applications that can only read queue names from /etc/ printcap continue to work properly, /etc/printcap is a symbolic link pointing to /etc/cups/printcap. When cupsd runs as lp, port 631 cannot be opened. Therefore, cupsd cannot be reloaded with rccups reload. Use rccups restart instead.
and
<Location /> Order Deny,Allow Deny From All Allow From 127.0.0.1
Printer Operation
463
In this way, only LOCAL hosts can access cupsd on a CUPS server. LOCAL hosts are hosts whose IP addresses belong to a non-PPP interface (interfaces whose IFF_POINTOPOINT flags are not set) and whose IP addresses belong to the same network as the CUPS server. Packets from all other hosts are rejected immediately.
464
Printer Operation
465
The vendor and model determined during the hardware detection match the vendor and model in a PPD file from the manufacturer-PPDs package. The PPD file from the manufacturer-PPDs package is the only suitable PPD file for the printer model or a there is a Foomatic PPD file with a *NickName: ... Foomatic/Postscript (recommended) entry that also matches the printer model. Accordingly, YaST does not use any PPD file from the manufacturer-PPDs package in the following cases: The PPD file from the the manufacturer-PPDs package does not match the vendor and model. This may happen if the manufacturer-PPDs package contains only one PPD file for similar models, for example, if there is no separate PPD file for the individual models of a model series, but the model name is specified in a form like Funprinter 1000 series in the PPD file. The Foomatic PostScript PPD file is not recommended. This may be because the printer model does not operate efficiently enough in PostScript mode, for example, the printer may be unreliable in this mode because it has too little memory or the printer is too slow because its processor is too weak. Furthermore, the printer may not support PostScript by default, for example, because PostScript support is only available as an optional module. If a PPD file from the manufacturer-PPDs package is suitable for a PostScript printer, but YaST cannot configure it for these reasons, select the respective printer model manually in YaST.
24.7 Troubleshooting
The following sections cover some of the most frequently encountered printer hardware and software problems and ways to solve or circumvent these problems.
466
Printer Operation
467
problem spots reported by cupstestppd should be eliminated. If necessary, ask the printer manufacturer for a suitable PPD file.
468
Checking the TCP/IP Network The TCP/IP network and name resolution must be functional. Checking a Remote lpd Use the following command to test if a TCP connection can be established to lpd (port 515) on host:
netcat -z host 515 && echo ok || echo failed
If the connection to lpd cannot be established, lpd may not be active or there may be basic network problems. As the user root, use the following command to query a (possibly very long) status report for queue on remote host, provided the respective lpd is active and the host accepts queries:
echo -e "\004queue" \ | netcat -w 2 -p 722 host 515
If lpd does not respond, it may not be active or there may be basic network problems. If lpd responds, the response should show why printing is not possible on the queue on host. If you receive a response like that in Example 24.2, Error Message from the lpd (page 469), the problem is caused by the remote lpd. Example 24.2 Error Message from the lpd
lpd: your host does not have line printer access lpd: queue does not exist printer: spooling disabled printer: printing disabled
Checking a Remote cupsd By default, the CUPS network server should broadcast its queues every 30 seconds on UDP port 631. Accordingly, the following command can be used to test whether there is a CUPS network server in the network.
netcat -u -l -p 631 & PID=$! ; sleep 40 ; kill $PID
If a broadcasting CUPS network server exists, the output appears as shown in Example 24.3, Broadcast from the CUPS Network Server (page 469). Example 24.3 Broadcast from the CUPS Network Server
ipp://host.domain:631/printers/queue
Printer Operation
469
zseries: Take into account that IBM System z ethernet devices do not receive broadcasts by default. The following command can be used to test if a TCP connection can be established to cupsd (port 631) on host:
netcat -z host 631 && echo ok || echo failed
If the connection to cupsd cannot be established, cupsd may not be active or there may be basic network problems. lpstat -h host -l -t returns a (possibly very long) status report for all queues on host, provided the respective cupsd is active and the host accepts queries. The next command can be used to test if the queue on host accepts a print job consisting of a single carriage-return character. Nothing should be printed. Possibly, a blank page may be ejected.
echo -en "\r" \ | lp -d queue -h host
Troubleshooting a Network Printer or Print Server Box Spoolers running in a print server box sometimes cause problems when they have to deal with a lot of print jobs. Because this is caused by the spooler in the print server box, there is nothing you can do about it. As a work-around, circumvent the spooler in the print server box by addressing the printer connected to the print server box directly via TCP socket. See Section 24.4.2, Network Printers (page 457). In this way, the print server box is reduced to a converter between the various forms of data transfer (TCP/IP network and local printer connection). To use this method, you need to know the TCP port on the print server box. If the printer is connected to the print server box and powered on, this TCP port can usually be determined with the nmap utility from the nmap package some time after the print server box is powered on. For example, nmap IP-address may deliver the following output for a print server box:
Port 23/tcp 80/tcp 515/tcp 631/tcp 9100/tcp State open open open open open Service telnet http printer cups jetdirect
470
This output indicates that the printer connected to the print server box can be addressed via TCP socket on port 9100. By default, nmap only checks a number of commonly known ports listed in /usr/share/nmap/nmap-services. To check all possible ports, use the command nmap -p from_port-to_port IP-address. This may take some time. For further information, refer to the nmap man page. Enter a command like
echo -en "\rHello\r\f" | netcat -w 1 IP-address port cat file | netcat -w 1 IP-address port
to send character strings or files directly to the respective port to test if the printer can be addressed on this port.
Printer Operation
471
from applications and forwards them to the cupsd on the server. When cupsd accepts a print job, it is assigned a new job number. Therefore, the job number on the client host is different from the job number on the server. Because a print job is usually forwarded immediately, it cannot be deleted with the job number on the client host, because the client cupsd regards the print job as completed as soon as it has been forwarded to the server cupsd. To delete the print job on the server, use a command such as lpstat -h print-server -o to determine the job number on the server, provided the server has not already completed the print job (that is, sent it to the printer). Using this job number, the print job on the server can be deleted:
cancel -h print-server queue-jobnnumber
472
nate all processes that are still accessing the printer (more precisely: the parallel port). 4 Reset the printer completely by switching it off for some time. Then insert the paper and turn on the printer.
Printer Operation
473
25
Since version 2.6, the kernel is capable of adding or removing almost any device in the running system. Changes in device state (whether a device is plugged in or removed) need to be propagated to userspace. Devices need to be configured as soon as they are plugged in and discovered. Users of a certain device need to be informed about any state changes of this device. udev provides the needed infrastructure to dynamically maintain the device node files and symbolic links in the /dev directory. udev rules provide a way to plug external tools into the kernel device event processing. This enables you to customize udev device handling, for example, by adding certain scripts to execute as part of kernel device handling, or request and import additional data to evaluate during device handling.
Every device driver carries a list of known aliases for devices it can handle. The list is contained in the kernel module file itself. The program depmod reads the ID lists and creates the file modules.alias in the kernel's /lib/modules directory for all currently available modules. With this infrastructure, module loading is as easy as calling modprobe for every event that carries a MODALIAS key. If modprobe $MODALIAS is called, it matches the device alias composed for the device with the
476
aliases provided by the modules. If a matching entry is found, that module is loaded. All this is triggered by udev and happens automatically.
477
The UEVENT lines show the events the kernel has sent over netlink. The UDEV lines show the finished udev event handlers. The timing is printed in microseconds. The time between UEVENT and UDEV is the time udev took to process this event or the udev daemon has delayed its execution to synchronize this event with related and already running events. For example, events for hard disk partitions always wait for the main disk device event to finish, because the partition events may rely on the data the main disk event has queried from the hardware. udevmonitor --env shows the complete event environment:
UDEV [1132633002.937243] add@/class/input/input7 UDEV_LOG=3 ACTION=add DEVPATH=/class/input/input7 SUBSYSTEM=input SEQNUM=1043 PHYSDEVPATH=/devices/pci0000:00/0000:00:1d.1/usb2/2-2/2-2:1.0 PHYSDEVBUS=usb PHYSDEVDRIVER=usbhid PRODUCT=3/46d/c03e/2000 NAME="Logitech USB-PS/2 Optical Mouse" PHYS="usb-0000:00:1d.1-2/input0" UNIQ="" EV=7 KEY=70000 0 0 0 0 0 0 0 0 REL=103
udev also sends messages to syslog. The default syslog priority that controls which messages are sent to syslog is specified in the udev configuration file /etc/udev/ udev.conf. The log priority of the running daemon can be changed with udevcontrol log_priority=level/number.
478
and the assignment keys are assigned the specified value. A matching rule may specify the name of the device node, add symlinks pointing to the node, or run a specified program as part of the event handling. If no matching rule is found, the default device node name is used to create the device node. The rule syntax and the provided keys to match or import data are described in the udev man page.
479
480
481
26
26.1 Terminology
metadata A file systeminternal data structure that assures all the data on disk is properly organized and accessible. Essentially, it is data about the data. Almost every file system has its own structure of metadata, which is part of why the file systems show different performance characteristics. It is extremely important to maintain metadata intact, because otherwise all data on the file system could become inaccessible. inode Inodes contain various information about a file, including size, number of links, pointers to the disk blocks where the file contents are actually stored, and date and time of creation, modification, and access. journal In the context of a file system, a journal is an on-disk structure containing a kind of log in which the file system stores what it is about to change in the file system's metadata. Journaling greatly reduces the recovery time of a Linux system because
483
it obsoletes the lengthy search process that checks the entire file system at system start-up. Instead, only the journal is replayed.
26.2.1 ReiserFS
Officially one of the key features of the 2.4 kernel release, ReiserFS has been available as a kernel patch for 2.2.x SUSE kernels since version 6.4. ReiserFS was designed by Hans Reiser and the Namesys development team. It has proven itself to be a powerful alternative to Ext2. Its key assets are better disk space utilization, better disk access performance, and faster crash recovery. ReiserFS's strengths, in more detail, are: Better Disk Space Utilization In ReiserFS, all data is organized in a structure called B*-balanced tree. The tree structure contributes to better disk space utilization because small files can be stored
484
directly in the B* tree leaf nodes instead of being stored elsewhere and just maintaining a pointer to the actual disk location. In addition to that, storage is not allocated in chunks of 1 or 4 kB, but in portions of the exact size needed. Another benefit lies in the dynamic allocation of inodes. This keeps the file system more flexible than traditional file systems, like Ext2, where the inode density must be specified at file system creation time. Better Disk Access Performance For small files, file data and stat_data (inode) information are often stored next to each other. They can be read with a single disk I/O operation, meaning that only one access to disk is required to retrieve all the information needed. Fast Crash Recovery Using a journal to keep track of recent metadata changes makes a file system check a matter of seconds, even for huge file systems. Reliability through Data Journaling ReiserFS also supports data journaling and ordered data modes similar to the concepts outlined in the Ext3 section, Section 26.2.3, Ext3 (page 486). The default mode is data=ordered, which ensures both data and metadata integrity, but uses journaling only for metadata.
26.2.2 Ext2
The origins of Ext2 go back to the early days of Linux history. Its predecessor, the Extended File System, was implemented in April 1992 and integrated in Linux 0.96c. The Extended File System underwent a number of modifications and, as Ext2, became the most popular Linux file system for years. With the creation of journaling file systems and their astonishingly short recovery times, Ext2 became less important. A brief summary of Ext2's strengths might help understand why it wasand in some areas still isthe favorite Linux file system of many Linux users. Solidity Being quite an old-timer, Ext2 underwent many improvements and was heavily tested. This may be the reason why people often refer to it as rock-solid. After a system outage when the file system could not be cleanly unmounted, e2fsck starts to analyze the file system data. Metadata is brought into a consistent state and pending files or data blocks are written to a designated directory (called lost
485
+found). In contrast to journaling file systems, e2fsck analyzes the entire file system and not just the recently modified bits of metadata. This takes significantly longer than checking the log data of a journaling file system. Depending on file system size, this procedure can take half an hour or more. Therefore, it is not desirable to choose Ext2 for any server that needs high availability. However, because Ext2 does not maintain a journal and uses significantly less memory, it is sometimes faster than other file systems. Easy Upgradability The code for Ext2 is the strong foundation on which Ext3 could become a highlyacclaimed next-generation file system. Its reliability and solidity were elegantly combined with the advantages of a journaling file system.
26.2.3 Ext3
Ext3 was designed by Stephen Tweedie. Unlike all other next-generation file systems, Ext3 does not follow a completely new design principle. It is based on Ext2. These two file systems are very closely related to each other. An Ext3 file system can be easily built on top of an Ext2 file system. The most important difference between Ext2 and Ext3 is that Ext3 supports journaling. In summary, Ext3 has three major advantages to offer: Easy and Highly Reliable Upgrades from Ext2 Because Ext3 is based on the Ext2 code and shares its on-disk format as well as its metadata format, upgrades from Ext2 to Ext3 are incredibly easy. Unlike transitions to other journaling file systems, such as ReiserFS or XFS, which can be quite tedious (making backups of the entire file system and recreating it from scratch), a transition to Ext3 is a matter of minutes. It is also very safe, because recreating an entire file system from scratch might not work flawlessly. Considering the number of existing Ext2 systems that await an upgrade to a journaling file system, you can easily figure out why Ext3 might be of some importance to many system administrators. Downgrading from Ext3 to Ext2 is as easy as the upgrade. Just perform a clean unmount of the Ext3 file system and remount it as an Ext2 file system. Reliability and Performance Some other journaling file systems follow the metadata-only journaling approach. This means your metadata is always kept in a consistent state, but the same cannot be automatically guaranteed for the file system data itself. Ext3 is designed to take care of both metadata and data. The degree of care can be customized. Enabling
486
Ext3 in the data=journal mode offers maximum security (data integrity), but can slow down the system because both metadata and data are journaled. A relatively new approach is to use the data=ordered mode, which ensures both data and metadata integrity, but uses journaling only for metadata. The file system driver collects all data blocks that correspond to one metadata update. These data blocks are written to disk before the metadata is updated. As a result, consistency is achieved for metadata and data without sacrificing performance. A third option to use is data=writeback, which allows data to be written into the main file system after its metadata has been committed to the journal. This option is often considered the best in performance. It can, however, allow old data to reappear in files after crash and recovery while internal file system integrity is maintained. Unless you specify something else, Ext3 is run with the data=ordered default.
487
26.2.5 Reiser4
Right after kernel 2.6 had been released, the family of journaling file systems was joined by another member: Reiser4. Reiser4 is fundamentally different from its predecessor ReiserFS (version 3.6). It introduces the concept of plug-ins to tweak the file system functionality and a finer grained security concept. Fine Grained Security Concept In designing Reiser4, its developers put an emphasis on the implementation of security-relevant features. Reiser4 therefore comes with a set of dedicated security plug-ins. The most important one introduces the concept of file items. Currently, file access controls are defined per file. If there is a large file containing information relevant to several users, groups, or applications, the access rights had be fairly imprecise to include all parties involved. In Reiser4, you can split those files into smaller portions (the items). Access rights can then be set for each item and each user separately, allowing a much more precise file security management. A perfect example would be /etc/passwd. To date, only root can read and edit the file while non-root users only get read access to this file. Using the item concept of Reiser4, you could split this file in a set of items (one item per user) and allow users or applications to modify their own data but not access other users' data. This concept adds both to security and flexibility. Extensibility through Plug-Ins Many file system functions and external functions normally used by a file system are implemented as plug-ins in Reiser4. These plug-ins can easily be added to the base system. You no longer need to recompile the kernel or reformat the hard disk to add new functionalities to your file system. Better File System Layout through Delayed Allocation Like XFS, Reiser4 supports delayed allocation. See Section 26.2.6, XFS (page 488). Using delayed allocation even for metadata can result in better overall layout.
26.2.6 XFS
Originally intended as the file system for their IRIX OS, SGI started XFS development in the early 1990s. The idea behind XFS was to create a high-performance 64-bit journaling file system to meet the extreme computing challenges of today. XFS is very
488
good at manipulating large files and performs well on high-end hardware. However, even XFS has a drawback. Like ReiserFS, XFS takes great care of metadata integrity, but less of data integrity. A quick review of XFS's key features explains why it may prove a strong competitor for other journaling file systems in high-end computing. High Scalability through the Use of Allocation Groups At the creation time of an XFS file system, the block device underlying the file system is divided into eight or more linear regions of equal size. Those are referred to as allocation groups. Each allocation group manages its own inodes and free disk space. Practically, allocation groups can be seen as file systems in a file system. Because allocation groups are rather independent of each other, more than one of them can be addressed by the kernel simultaneously. This feature is the key to XFS's great scalability. Naturally, the concept of independent allocation groups suits the needs of multiprocessor systems. High Performance through Efficient Management of Disk Space Free space and inodes are handled by B+ trees inside the allocation groups. The use of B+ trees greatly contributes to XFS's performance and scalability. XFS uses delayed allocation. It handles allocation by breaking the process into two pieces. A pending transaction is stored in RAM and the appropriate amount of space is reserved. XFS still does not decide where exactly (speaking of file system blocks) the data should be stored. This decision is delayed until the last possible moment. Some short-lived temporary data may never make its way to disk, because it may be obsolete by the time XFS decides where actually to save it. Thus XFS increases write performance and reduces file system fragmentation. Because delayed allocation results in less frequent write events than in other file systems, it is likely that data loss after a crash during a write is more severe. Preallocation to Avoid File System Fragmentation Before writing the data to the file system, XFS reserves (preallocates) the free space needed for a file. Thus, file system fragmentation is greatly reduced. Performance is increased because the contents of a file are not distributed all over the file system.
489
hpfs
iso9660 minix
msdos
ncpfs nfs
smbfs
sysv
ufs
490
umsdos
UNIX on MSDOS: Applied on top of a normal fat file system, achieves UNIX functionality (permissions, links, long filenames) by creating special files. Virtual FAT: Extension of the fat file system (supports long filenames). Windows NT file system, read-only.
vfat
ntfs
Ext2 or Ext3 (8 kB block size) (systems with 8 kB pages, like Alpha) ReiserFS v3
491
File System Size (Bytes) 263 (8 EB) 263 (8 EB) 263 (8 EB)
IMPORTANT: Linux Kernel Limits Table 26.2, Maximum Sizes of File Systems (On-Disk Format) (page 491) describes the limitations regarding the on-disk format. The 2.6 kernel imposes its own limits on the size of files and file systems handled by it. These are as follows: File Size 41 On 32-bit systems, files may not exceed the size of 2 TB (2 bytes). File System Size 73 File systems may be up to 2 bytes in size. However, this limit is still out of reach for the currently available hardware.
492
A comprehensive multipart tutorial about Linux file systems can be found at IBM developerWorks: http://www-106.ibm.com/developerworks/library/ l-fs.html. For a comparison of the different journaling file systems in Linux, look at Juan I. Santos Florido's article at Linuxgazette: http://www.linuxgazette .com/issue55/florido.html. Those interested in an in-depth analysis of LFS in Linux should try Andreas Jaeger's LFS site: http://www.suse.de/~aj/linux _lfs.html.
493
27
The X Window System (X11) is the de facto standard for graphical user interfaces in UNIX. X is network-based, enabling applications started on one host to be displayed on another host connected over any kind of network (LAN or Internet). This chapter describes the setup and optimization of the X Window System environment, provides background information about the use of fonts in SUSE Linux Enterprise, and explains the configuration of OpenGL and 3D. The following text contains several references to documentation that can be found below /usr/share/doc/packages/Xorg and /usr/share/doc/howto/en. This material along with respective manual pages is available only if the appropriate documentation packages are installed (xorg-x11-doc, xorg-x11-man, and howtoenh). TIP: IBM System z: Configuring the Graphical User Interface IBM System z do not have any input and output devices supported by X.Org. Therefore, none of the configuration procedures described in this section apply. More relevant information for IBM System z can be found in Section 7.6, Network Devices (page 169).
is initially configured during installation. To change the settings afterwards, use the respective module from the YaST control center or run SaX2 manually from the command line with the command sax2. The SaX2 main window provides a common interface for the individual modules from the YaST control center. Figure 27.1 The Main Window of SaX2
In the left navigation bar, there are six items, each of them showing the respective configuration dialog from the YaST control center. Find the sections mentioned below in Chapter 7, System Configuration with YaST (page 137). Monitor For a description of the monitor and graphics card configuration, see Section 7.13.1, Card and Monitor Properties (page 190). Mouse For a description of the mouse configuration in the graphical environment, see Section 7.13.2, Mouse Properties (page 194). Keyboard For a description of the keyboard configuration in the graphical environment, see Section 7.13.3, Keyboard Properties (page 195).
496
Tablet For a description of the graphics tablet configuration, see Section 7.13.4, Tablet Properties (page 195). Touchscreen For a description of the touchscreen configuration, see Section 7.13.5, Touchscreen Properties (page 196). VNC For a description of the VNC configuration, see Section 7.13.6, Remote Access Properties (page 196).
497
The following sections describe the structure of the configuration file /etc/X11/ xorg.conf. It consists of several sections, each one dealing with a certain aspect of the configuration. Each section starts with the keyword Section <designation> and ends with EndSection. The sections have the form:
Section designation entry 1 entry 2 entry n EndSection
The available section types are listed in Table 27.1, Sections in /etc/X11/xorg.conf (page 498). Table 27.1 Type Files Sections in /etc/X11/xorg.conf Meaning This section describes the paths used for fonts and the RGB color table. General switches are set here. Input devices, like keyboards and special input devices (touchpads, joysticks, etc.), are configured in this section. Important parameters in this section are Driver and the options defining the Protocol and Device. Describes the monitor used. The individual elements of this section are the name, which is referred to later in the Screen definition, the bandwidth, and the synchronization frequency limits (HorizSync and VertRefresh). Settings are given in MHz, kHz, and Hz. Normally, the server refuses any modeline that does not correspond with the specification of the monitor. This prevents too high frequencies from being sent to the monitor by accident. The modeline parameters are stored here for the specific screen resolutions. These parameters can be calculated by SaX2 on the basis of the values given by the user and normally do not need to be changed. Intervene manually at this point if, for example,
ServerFlags InputDevice
Monitor
Modes
498
Type
Meaning you want to connect a fixed frequency monitor. Find details of the meaning of individual number values in the HOWTO files in /usr/share/doc/howto/en/html/ XFree86-Video-Timings-HOWTO.
Device
This section defines a specific graphics card. It is referenced by its descriptive name. This section puts together a Monitor and a Device to form all the necessary settings for X.Org. In the Display subsection, specify the size of the virtual screen (Virtual), the ViewPort, and the Modes used with this screen.
Screen
ServerLayout This section defines the layout of a single or multihead configuration. This section binds the input devices InputDevice and the display devices Screen. Monitor, Device, and Screen are explained in more detail below. Further information about the other sections can be found in the manual pages of X.Org and xorg .conf. There can be several different Monitor and Device sections in xorg.conf. Even multiple Screen sections are possible. The following ServerLayout section determines which one is used.
499
The Identifier line (here Screen[0]) gives this section a defined name with which it can be uniquely referenced in the following ServerLayout section. The lines Device and Monitor specify the graphics card and the monitor that belong to this definition. These are just links to the Device and Monitor sections with their corresponding names or identifiers. These sections are discussed in detail below. Use the DefaultDepth setting to select the color depth the server should use unless it is started with a specific color depth. There is a Display subsection for each color depth. The keyword Depth assigns the color depth valid for this subsection. Possible values for Depth are 8, 15, 16, and 24. Not all X server modules support all these values. After the color depth, a list of resolutions is set in the Modes section. This list is checked by the X server from left to right. For each resolution, the X server searches for a suitable Modeline in the Modes section. The Modeline depends on the capability of both the monitor and the graphics card. The Monitor settings determine the resulting Modeline. The first resolution found is the Default mode. With Ctrl + pad), switch to the next resolution in the list to the right. With
Alt Ctrl
500
number pad), switch to the left. This enables you to vary the resolution while X is running. The last line of the Display subsection with Depth 16 refers to the size of the virtual screen. The maximum possible size of a virtual screen depends on the amount of memory installed on the graphics card and the desired color depth, not on the maximum resolution of the monitor. Because modern graphics cards have a large amount of video memory, you can create very large virtual desktops. However, you may no longer be able to use 3D functionality if you fill most of the video memory with a virtual desktop. If the card has 16 MB video RAM, for example, the virtual screen can be up to 4096x4096 pixels in size at 8-bit color depth. Especially for accelerated cards, however, it is not recommended to use all your memory for the virtual screen, because this memory on the card is also used for several font and graphics caches.
If you use SaX2 for configuration, the device section should look something like the above example. Both the Driver and BusID are dependent on the hardware installed in your computer and are detected by SaX2 automatically. The BusID defines the PCI or AGP slot in which the graphics card is installed. This matches the ID displayed by the command lspci. The X server needs details in decimal form, but lspci displays these in hexadecimal form. Wit the Driver parameter, specify the driver to use for this graphics card. If the card is a Matrox Millennium, the driver module is called mga. The X server then searches
501
through the ModulePath defined in the Files section in the drivers subdirectory. In a standard installation, this is the directory /usr/X11R6/lib/modules/ drivers. _drv.o is added to the name, so, in the case of the mga driver, the driver file mga_drv.o is loaded. The behavior of the X server or of the driver can also be influenced through additional options. An example of this is the option sw_cursor, which is set in the device section. This deactivates the hardware mouse cursor and depicts the mouse cursor using software. Depending on the driver module, there are various options available, which can be found in the description files of the driver modules in the directory /usr/X11R6/ lib/X11/doc. Generally valid options can also be found in the manual pages (man xorg.conf and man X.Org).
configuration section. If this is not possible for some reason, use one of the VESA modes included in the X server. This will function with practically all graphics card and monitor combinations.
scalable fonts with glyphs for many languages may take a long time. Unicode fonts are also supported, but their use may be slow and require more memory. The X11 core font system has a few inherent weaknesses. It is outdated and can no longer be extended in a meaningful fashion. Although it must be retained for reasons of backward compatibility, the more modern Xft and fontconfig system should be used if at all possible. For its operation, the X server needs to know what fonts it has available and where in the system it can find them. This is handled by a FontPath variable, which contains the path to all valid system font directories. In each of these directories, a file named fonts .dir lists the available fonts in this directory. The FontPath is generated by the X server at start-up. It searches for a valid fonts.dir file in each of the FontPath entries in the configuration file /etc/X11/xorg.conf. These entries are found in the Files section. Display the actual FontPath with xset q. This path may also be changed at runtime with xset. To add an additional path, use xset +fp <path>. To remove an unwanted path, use xset -fp <path>. If the X server is already active, newly installed fonts in mounted directories can be made available with the command xset fp rehash. This command is executed by SuSEconfig --module fonts. Because the command xset needs access to the running X server, this only works if SuSEconfig --module fonts is started from a shell that has access to the running X server. The easiest way to achieve this is to assume root permissions by entering su and the root password. su transfers the access permissions of the user who started the X server to the root shell. To check if the fonts were installed correctly and are available by way of the X11 core font system, use the command xlsfonts to list all available fonts. By default, SUSE Linux Enterprise uses UTF-8 locales. Therefore, Unicode fonts should be preferred (font names ending with iso10646-1 in xlsfonts output). All available Unicode fonts can be listed with xlsfonts | grep iso10646-1. Nearly all Unicode fonts available in SUSE Linux Enterprise contain at least the glyphs needed for European languages (formerly encoded as iso-8859-*).
27.3.2 Xft
From the outset, the programmers of Xft made sure that scalable fonts including antialiasing are supported well. If Xft is used, the fonts are rendered by the application using the fonts, not by the X server as in the X11 core font system. In this way, the re-
504
spective application has access to the actual font files and full control of how the glyphs are rendered. This constitutes the basis for the correct display of text in a number of languages. Direct access to the font files is very useful for embedding fonts for printing to make sure that the printout looks the same as the screen output. In SUSE Linux Enterprise, the two desktop environments KDE and GNOME, Mozilla, and many other applications already use Xft by default. Xft is already used by more applications than the old X11 core font system. Xft uses the fontconfig library for finding fonts and influencing how they are rendered. The properties of fontconfig are controlled by the global configuration file /etc/ fonts/fonts.conf and the user-specific configuration file ~/.fonts.conf. Each of these fontconfig configuration files must begin with
<?xml version="1.0"?> <!DOCTYPE fontconfig SYSTEM "fonts.dtd"> <fontconfig>
To add directories to search for fonts, append lines such as the following:
<dir>/usr/local/share/fonts/</dir>
However, this is usually not necessary. By default, the user-specific directory ~/.fonts is already entered in /etc/fonts/fonts.conf. Accordingly, all you need to do to install additional fonts is to copy them to ~/.fonts. You can also insert rules that influence the appearance of the fonts. For example, enter
<match target="font"> <edit name="antialias" mode="assign"> <bool>false</bool> </edit> </match>
505
</edit> </match>
to disable antialiasing for specific fonts. By default, most applications use the font names sans-serif (or the equivalent sans), serif, or monospace. These are not real fonts but only aliases that are resolved to a suitable font, depending on the language setting. Users can easily add rules to ~/.fonts.conf to resolve these aliases to their favorite fonts:
<alias> <family>sans-serif</family> <prefer> <family>FreeSans</family> </prefer> </alias> <alias> <family>serif</family> <prefer> <family>FreeSerif</family> </prefer> </alias> <alias> <family>monospace</family> <prefer> <family>FreeMono</family> </prefer> </alias>
Because nearly all applications use these aliases by default, this affects almost the entire system. Thus, you can easily use your favorite fonts almost everywhere without having to modify the font settings in the individual applications. Use the command fc-list to find out which fonts are installed and available for use. For instance, the command fc-list returns a list of all fonts. To find out which of the available scalable fonts (:scalable=true) contain all glyphs required for Hebrew (:lang=he), their font names (family), their style (style), their weight (weight), and the name of the files containing the fonts, enter the following command:
fc-list ":lang=he:scalable=true" family style weight
FreeSansBold.ttf: FreeSans:style=Bold:weight=200
506
FreeMonoBoldOblique.ttf: FreeMono:style=BoldOblique:weight=200 FreeSerif.ttf: FreeSerif:style=Medium:weight=80 FreeSerifBoldItalic.ttf: FreeSerif:style=BoldItalic:weight=200 FreeSansOblique.ttf: FreeSans:style=Oblique:weight=80 FreeSerifItalic.ttf: FreeSerif:style=Italic:weight=80 FreeMonoOblique.ttf: FreeMono:style=Oblique:weight=80 FreeMono.ttf: FreeMono:style=Medium:weight=80 FreeSans.ttf: FreeSans:style=Medium:weight=80 FreeSerifBold.ttf: FreeSerif:style=Bold:weight=200 FreeSansBoldOblique.ttf: FreeSans:style=BoldOblique:weight=200 FreeMonoBold.ttf: FreeMono:style=Bold:weight=200
Important parameters that can be queried with fc-list: Table 27.2 Parameter family foundry style Parameters of fc-list Meaning and Possible Values Name of the font family, for example, FreeSans. The manufacturer of the font, for example, urw. The font style, such as Medium, Regular, Bold, Italic, or Heavy. The language that the font supports, for example, de for German, ja for Japanese, zh-TW for traditional Chinese, or zh-CN for simplified Chinese. The font weight, such as 80 for regular or 200 for bold. The slant, usually 0 for none and 100 for italic. The name of the file containing the font. true for outline fonts or false for other fonts. true for scalable fonts or false for other fonts. true for bitmap fonts or false for other fonts.
lang
507
Parameter pixelsize
Meaning and Possible Values Font size in pixels. In connection with fc-list, this option only makes sense for bitmap fonts.
DRI
508
OpenGL Driver
If you are installing with YaST for the first time, 3D acceleration can be activated during installation, provided YaST detects 3D support. For nVidia graphics chips, the nVidia driver must be installed first. To do this, select the nVidia driver patch in YOU (YaST Online Update). Due to license restrictions, the nVidia driver is not included in the distribution. If you update your system instead, the procedure for configuring 3D hardware support is different. This depends on which OpenGL driver is used. Further details are provided in the following section.
509
the instructions of 3Ddiag if you receive failed messages. If everything is correct, you only see done messages on the screen.
27.4.5 Troubleshooting
If the OpenGL 3D test results are negative (the games cannot be smoothly played), use 3Ddiag to make sure no errors exist in the configuration (failed messages). If correcting these does not help or if failed messages have not appeared, take a look at the X.Org log files. Often, you will find the line DRI is disabled in the X.Org file /var/log/Xorg .0.log. The exact cause can only be discovered by closely examining the log filea task requiring some experience. In such cases, no configuration error exists, because this would have already been detected by 3Ddiag. Consequently, at this point, the only choice is to use the software rendering fallback of the DRI driver, which does not provide 3D hardware support. You should also go without 3D support if you get OpenGL representation errors or instability. Use SaX2 to disable 3D support completely.
of the graphical user interface (X Window System) does not include 3D hardware acceleration configuration. If you experience problems with 3D hardware acceleration, it is recommended to disable 3D support completely.
511
28
Linux uses PAM (pluggable authentication modules) in the authentication process as a layer that mediates between user and application. PAM modules are available on a systemwide basis, so they can be requested by any application. This chapter describes how the modular authentication mechanism works and how it is configured. System administrators and programmers often want to restrict access to certain parts of the system or to limit the use of certain functions of an application. Without PAM, applications must be adapted every time a new authentication mechanism, such as LDAP or SAMBA, is introduced. This process, however, is rather time-consuming and error-prone. One way to avoid these drawbacks is to separate applications from the authentication mechanism and delegate authentication to centrally managed modules. Whenever a newly required authentication scheme is needed, it is sufficient to adapt or write a suitable PAM module for use by the program in question. Every program that relies on the PAM mechanism has its own configuration file in the directory /etc/pam.d/programname. These files define the PAM modules used for authentication. In addition, there are global configuration files for most PAM modules under /etc/security, which define the exact behavior of these modules (examples include pam_env.conf, pam_pwcheck.conf, pam_unix2.conf, and time.conf). Every application that uses a PAM module actually calls a set of PAM functions, which then process the information in the various configuration files and return the result to the calling application.
513
PAM modules are processed as stacks. Different types of modules have different purposes, for example, one module checks the password, another one verifies the location from which the system is accessed, and yet another one reads user-specific settings. PAM knows about four different types of modules: auth The purpose of this type of module is to check the user's authenticity. This is traditionally done by querying a password, but it can also be achieved with the help of a chip card or through biometrics (fingerprints or iris scan). account Modules of this type check whether the user has general permission to use the requested service. As an example, such a check should be performed to ensure that no one can log in under the username of an expired account. password The purpose of this type of module is to enable the change of an authentication token. In most cases, this is a password. session Modules of this type are responsible for managing and configuring user sessions. They are started before and after authentication to register login attempts in system logs and configure the user's specific environment (mail accounts, home directory, system limits, etc.). The second column contains control flags to influence the behavior of the modules started: required A module with this flag must be successfully processed before the authentication may proceed. After the failure of a module with the required flag, all other
514
modules with the same flag are processed before the user receives a message about the failure of the authentication attempt. requisite Modules having this flag must also be processed successfully, in much the same way as a module with the required flag. However, in case of failure a module with this flag gives immediate feedback to the user and no further modules are processed. In case of success, other modules are subsequently processed, just like any modules with the required flag. The requisite flag can be used as a basic filter checking for the existence of certain conditions that are essential for a correct authentication. sufficient After a module with this flag has been successfully processed, the calling application receives an immediate message about the success and no further modules are processed, provided there was no preceding failure of a module with the required flag. The failure of a module with the sufficient flag has no direct consequences, in the sense that any subsequent modules are processed in their respective order. optional The failure or success of a module with this flag does not have any direct consequences. This can be useful for modules that are only intended to display a message (for example, to tell the user that mail has arrived) without taking any further action. include If this flag is given, the file specified as argument is inserted at this place. The module path does not need to be specified explicitly, as long as the module is located in the default directory /lib/security (for all 64-bit platforms supported by SUSE Linux Enterprise, the directory is /lib64/security). The fourth column may contain an option for the given module, such as debug (enables debugging) or nullok (allows the use of empty passwords).
515
The typical PAM configuration of an application (sshd, in this case) contains four include statements referring to the configuration files of four module types: common-auth, common-account, common-password, and common-session. These four files hold the default configuration for each module type. By including them instead of calling each module separately for each PAM application, automatically get an updated PAM configuration if the administrator changes the defaults. In former times, you had to adjust all configuration files manually for all applications when changes to PAM occurred or a new application was installed. Now the PAM configuration is made with central configuration files and all changes are automatically inherited by the PAM configuration of each service. The first include file (common-auth) calls two modules of the auth type: pam_env and pam_unix2. See Example 28.2, Default Configuration for the auth Section (page 516). Example 28.2 Default Configuration for the auth Section
auth auth required required pam_env.so pam_unix2.so
The first one, pam_env, loads the file /etc/security/pam_env.conf to set the environment variables as specified in this file. This can be used to set the DISPLAY variable to the correct value, because the pam_env module knows about the location from which the login is taking place. The second one, pam_unix2, checks the user's login and password against /etc/passwd and /etc/shadow. After the modules specified in common-auth have been successfully called, a third module called pam_nologin checks whether the file /etc/nologin exists. If it does, no user other than root may log in. The whole stack of auth modules is processed before sshd gets any feedback about whether the login has succeeded. Given that all modules of the stack have the required control flag, they must all be processed successfully before sshd receives a message about the positive result. If one of the 516 Installation and Administration
modules is not successful, the entire module stack is still processed and only then is sshd notified about the negative result. As soon as all modules of the auth type have been successfully processed, another include statement is processed, in this case, that in Example 28.3, Default Configuration for the account Section (page 517). common-account contains just one module, pam_unix2. If pam_unix2 returns the result that the user exists, sshd receives a message announcing this success and the next stack of modules (password) is processed, shown in Example 28.4, Default Configuration for the password Section (page 517). Example 28.3 Default Configuration for the account Section
account required pam_unix2.so
Again, the PAM configuration of sshd involves just an include statement referring to the default configuration for password modules located in common-password. These modules must successfully be completed (control flag required) whenever the application requests the change of an authentication token. Changing a password or another authentication token requires a security check. This is achieved with the pam _pwcheck module. The pam_unix2 module used afterwards carries over any old and new passwords from pam_pwcheck, so the user does not need to authenticate again. This also makes it impossible to circumvent the checks carried out by pam _pwcheck. The modules of the password type should be used wherever the preceding modules of the account or the auth type are configured to complain about an expired password. Example 28.5 Default Configuration for the session Section
session required session required pam_limits.so pam_unix2.so
As the final step, the modules of the session type, bundled in the common-session file are called to configure the session according to the settings for the user in question. Although pam_unix2 is processed again, it has no practical consequences due to its none option specified in the respective configuration file of this module, pam_unix2 .conf. The pam_limits module loads the file /etc/security/limits.conf,
517
which may define limits on the use of certain system resources. The session modules are called a second time when user logs out.
28.3.1 pam_unix2.conf
The traditional password-based authentication method is controlled by the PAM module pam_unix2. It can read the necessary data from /etc/passwd, /etc/shadow, NIS maps, NIS+ tables, or an LDAP database. The behavior of this module can be influenced by configuring the PAM options of the individual application itself or globally by editing /etc/security/pam_unix2.conf. A very basic configuration file for the module is shown in Example 28.6, pam_unix2.conf (page 518). Example 28.6 pam_unix2.conf
auth: nullok account: password: session:
nullok none
The nullok option for module types auth and password specifies that empty passwords are permitted for the corresponding type of account. Users are also allowed to change passwords for their accounts. The none option for the module type session specifies that no messages are logged on its behalf (this is the default). Learn about additional configuration options from the comments in the file itself and from the manual page pam_unix2(8).
28.3.2 pam_env.conf
This file can be used to define a standardized environment for users that is set whenever the pam_env module is called. With it, preset environment variables using the following syntax: 518 Installation and Administration
VARIABLE
[DEFAULT=[value]]
[OVERRIDE=[value]]
VARIABLE Name of the environment variable to set. [DEFAULT=[value]] Default value the administrator wants set. [OVERRIDE=[value]] Values that may be queried and set by pam_env, overriding the default value. A typical example of how pam_env can be used is the adaptation of the DISPLAY variable, which is changed whenever a remote login takes place. This is shown in Example 28.7, pam_env.conf (page 519). Example 28.7 pam_env.conf
REMOTEHOST DISPLAY DEFAULT=localhost OVERRIDE=@{PAM_RHOST} DEFAULT=${REMOTEHOST}:0.0 OVERRIDE=${DISPLAY}
The first line sets the value of the REMOTEHOST variable to localhost, which is used whenever pam_env cannot determine any other value. The DISPLAY variable in turn contains the value of REMOTEHOST. Find more information in the comments in the file /etc/security/pam_env.conf.
28.3.3 pam_pwcheck.conf
This configuration file is for the pam_pwcheck module, which reads options from it for all password type modules. Settings stored in this file take precedence over the PAM settings of an individual application. If application-specific settings have not been defined, the application uses the global settings. Example 28.8, pam_pwcheck.conf (page 519) tells pam_pwcheck to allow empty passwords and modification of passwords. More options for the module are mentioned in the file /etc/security/pam _pwcheck.conf. Example 28.8 pam_pwcheck.conf
password: nullok
519
28.3.4 limits.conf
System limits can be set on a user or group basis in the file limits.conf, which is read by the pam_limits module. The file allows you to set hard limits, which may not be exceeded at all, and soft limits, which may be exceeded temporarily. To learn about the syntax and the available options, read the comments included in the file.
520
Power Management
29
Power management is especially important on laptop computers, but is also useful on other systems. Two technologies are available: APM (advanced power management) and ACPI (advanced configuration and power interface). In addition to these, it is also possible to control CPU frequency scaling to save power or decrease noise. These options can be configured manually or using a special YaST module. zseries: The features and hardware described in this chapter do not exist on IBM System z, making this chapter irrelevant for these platforms. Unlike APM, which was previously used on laptops for power management only, the hardware information and configuration tool ACPI is available on all modern computers (laptops, desktops, and servers). All power management technologies require suitable hardware and BIOS routines. Most laptops and many modern desktops and servers meet these requirements. APM had been used in many older computers. Because APM largely consists of a function set implemented in the BIOS, the level of APM support may vary depending on the hardware. This is even more true of ACPI, which is even more complex. For this reason, it is virtually impossible to recommend one over the other. Simply test the various procedures on your hardware then select the technology that is best supported. IMPORTANT: Power Management for AMD64 Processors AMD64 processors with a 64-bit kernel only support ACPI.
Power Management
521
522
Shutdown of System Components Switching off the hard disk is the greatest single aspect of the power saving potential of the overall system. Depending on the reliability of the overall system, the hard disk can be put to sleep for some time. However, the risk of losing data increases with the duration of the sleep periods. Other components, like PCI devices that can be put into a special power saving mode, can be deactivated with ACPI (at least theoretically) or permanently disabled in the BIOS setup. Processor Speed Control In connection with the CPU, energy can be saved in three different ways: frequency and voltage scaling (also known as PowerNow! or Speedstep), throttling, and putting the processor to sleep (C states). Depending on the operating mode of the computer, these methods can also be combined.
29.2 APM
Some of the power saving functions are performed by the APM BIOS itself. On many laptops, standby and suspend states can be activated with key combinations or by closing the lid without any special operating system function. However, to activate these modes with a command, certain actions must be triggered before the system is suspended. To view the battery charge level, you need special program packages and a suitable kernel. SUSE Linux Enterprise kernels have built-in APM support. However, APM is only activated if ACPI is not implemented in the BIOS and an APM BIOS is detected. To activate APM support, ACPI must be disabled with acpi=off at the boot prompt. Enter cat /proc/apm to check if APM is active. An output consisting of various numbers indicates that everything is OK. You should now be able to shut down the computer with the command shutdown -h. BIOS implementations that are not fully standard-compliant can cause problems with APM. Some problems can be circumvented with special boot parameters. All parameters are entered at the boot prompt in the form of apm=parameter. parameter is one of: on or off Enable or disable APM support.
Power Management
523
(no-)allow-ints Allow interrupts during the execution of BIOS functions. (no-)broken-psr The GetPowerStatus function of the BIOS does not work properly. (no-)realmode-power-off Reset processor to real mode prior to shutdown. (no-)debug Log APM events in system log. (no-)power-off Power system off after shutdown. bounce-interval=n Time in hundredths of a second after a suspend event during which additional suspend events are ignored. idle-threshold=n System inactivity percentage from which the BIOS function idle is executed (0=always, 100=never). idle-period=n Time in hundredths of a second after which the system activity is measured. The APM daemon (apmd) is no longer used. Its functionality is now handled by the new powersaved, which also supports ACPI and provides many other features.
29.3 ACPI
ACPI (advanced configuration and power interface) was designed to enable the operating system to set up and control the individual hardware components. ACPI supersedes both PnP and APM. It delivers information about the battery, AC adapter, temperature, fan, and system events, like close lid or battery low. The BIOS provides tables containing information about the individual components and hardware access methods. The operating system uses this information for tasks like assigning interrupts or activating and deactivating components. Because the operating
524
system executes commands stored in the BIOS, the functionality depends on the BIOS implementation. The tables ACPI can detect and load are reported in /var/log/boot .msg. See Section 29.3.4, Troubleshooting (page 530) for more information about troubleshooting ACPI problems.
Power Management
525
/proc/acpi/event All events are reported here and processed by the Powersave daemon (powersaved). If no daemon accesses this file, events, such as a brief click on the power button or closing the lid, can be read with cat /proc/acpi/event (terminate with Ctrl + C ). /proc/acpi/dsdt and /proc/acpi/fadt These files contain the ACPI tables DSDT (differentiated system description table) and FADT (fixed ACPI description table). They can be read with acpidmp, acpidisasm, and dmdecode. These programs and their documentation are located in the package pmtools. For example, acpidmp DSDT | acpidisasm. /proc/acpi/ac_adapter/AC/state Shows whether the AC adapter is connected. /proc/acpi/battery/BAT*/{alarm,info,state} Detailed information about the battery state. The charge level is read by comparing the last full capacity from info with the remaining capacity from state. A more comfortable way to do this is to use one of the special programs introduced in Section 29.3.3, ACPI Tools (page 530). The charge level at which a battery event (such as warning, low and critical) is triggered can be specified in alarm. /proc/acpi/button This directory contains information about various switches, like the laptop lid and buttons. /proc/acpi/fan/FAN/state Shows if the fan is currently active. Activate or deactivate the fan manually by writing 0 (on) or 3 (off) into this file. However, both the ACPI code in the kernel and the hardware (or the BIOS) overwrite this setting when the system gets too warm. /proc/acpi/processor/* A separate subdirectory is kept for each CPU included in your system. /proc/acpi/processor/*/info Information about the energy saving options of the processor.
526
/proc/acpi/processor/*/power Information about the current processor state. An asterisk next to C2 indicates that the processor is idle. This is the most frequent state, as can be seen from the usage value. /proc/acpi/processor/*/throttling Can be used to set the throttling of the processor clock. Usually, throttling is possible in eight levels. This is independent of the frequency control of the CPU. /proc/acpi/processor/*/limit If the performance (outdated) and the throttling are automatically controlled by a daemon, the maximum limits can be specified here. Some of the limits are determined by the system. Some can be adjusted by the user. /proc/acpi/thermal_zone/ A separate subdirectory exists for every thermal zone. A thermal zone is an area with similar thermal properties whose number and names are designated by the hardware manufacturer. However, many of the possibilities offered by ACPI are rarely implemented. Instead, the temperature control is handled conventionally by the BIOS. The operating system is not given much opportunity to intervene, because the life span of the hardware is at stake. Therefore, some of the files only have a theoretical value. /proc/acpi/thermal_zone/*/temperature Current temperature of the thermal zone. /proc/acpi/thermal_zone/*/state The state indicates if everything is ok or if ACPI applies active or passive cooling. In the case of ACPI-independent fan control, this state is always ok. /proc/acpi/thermal_zone/*/cooling_mode Select the cooling method controlled by ACPI. Choose from passive (less performance, economical) or active cooling mode (full performance, fan noise). /proc/acpi/thermal_zone/*/trip_points Enables the determination of temperature limits for triggering specific actions, like passive or active cooling, suspension (hot), or a shutdown (critical). The possible actions are defined in the DSDT (device-dependent). The trip points determined in the ACPI specification are critical, hot, passive, active1, and active2. Even if not all of them are implemented, they must always be entered
Power Management
527
in this file in this order. For example, the entry echo 90:0:70:0:0 > trip_points sets the temperature for critical to 90 and the temperature for passive to 70 (all temperatures measured in degrees Celsius). /proc/acpi/thermal_zone/*/polling_frequency If the value in temperature is not updated automatically when the temperature changes, toggle the polling mode here. The command echo X > /proc/acpi/thermal_zone/*/polling_frequency causes the temperature to be queried every X seconds. Set X=0 to disable polling. None of these settings, information, and events need to be edited manually. This can be done with the Powersave daemon (powersaved) and its various front-ends, like powersave, kpowersave, and wmpowersave. See Section 29.3.3, ACPI Tools (page 530).
528
hardware or in regard to specific processors or drivers, the userspace implementation is still the only working solution. ondemand governor This is the kernel implementation of a dynamic CPU frequency policy and should work on most systems. As soon as there is a high system load, the CPU frequency is immediately increased. It is lowered on a low system load. conservative governor This governor is similar to the ondemand implementation, except that a more conservative policy is used. The load of the system must be high for a specific amount of time before the CPU frequency is increased. powersave governor The cpu frequency is statically set to the lowest possible. performance governor The cpu frequency is statically set to the highest possible. Throttling the Clock Frequency This technology omits a certain percentage of the clock signal impulses for the CPU. At 25% throttling, every fourth impulse is omitted. At 87.5%, only every eighth impulse reaches the processor. However, the energy savings are a little less than linear. Normally, throttling is only used if frequency scaling is not available or to maximize power savings. This technology, too, must be controlled by a special process. The system interface is /proc/acpi/processor/*/throttling. Putting the Processor to Sleep The operating system puts the processor to sleep whenever there is nothing to do. In this case, the operating system sends the CPU a halt command. There are three states: C1, C2, and C3. In the most economic state, C3, even the synchronization of the processor cache with the main memory is halted. Therefore, this state can only be applied if no other device modifies the contents of the main memory via bus master activity. Some drivers prevent the use of C3. The current state is displayed in /proc/acpi/processor/*/power. Frequency scaling and throttling are only relevant if the processor is busy, because the most economic C state is applied anyway when the processor is idle. If the CPU is busy, frequency scaling is the recommended power saving method. Often the processor only works with a partial load. In this case, it can be run with a lower frequency. Usually, dynamic frequency scaling controlled by the kernel ondemand governor or a daemon, Power Management 529
such as powersaved, is the best approach. A static setting to a low frequency is useful for battery operation or if you want the computer to be cool or quiet. Throttling should be used as the last resort, for example, to extend the battery operation time despite a high system load. However, some systems do not run smoothly when they are throttled too much. Moreover, CPU throttling does not make sense if the CPU has little to do. In SUSE Linux Enterprise these technologies are controlled by the powersave daemon. The configuration is explained in Section 29.5, The powersave Package (page 533).
29.3.4 Troubleshooting
There are two different types of problems. On one hand, the ACPI code of the kernel may contain bugs that were not detected in time. In this case, a solution will be made available for download. More often, however, the problems are caused by the BIOS. Sometimes, deviations from the ACPI specification are purposely integrated in the BIOS to circumvent errors in the ACPI implementation in other widespread operating systems. Hardware components that have serious errors in the ACPI implementation are recorded in a blacklist that prevents the Linux kernel from using ACPI for these components. The first thing to do when problems are encountered is to update the BIOS. If the computer does not boot at all, one of the following boot parameters may be helpful: pci=noacpi Do not use ACPI for configuring the PCI devices. acpi=oldboot Only perform a simple resource configuration. Do not use ACPI for other purposes.
530
acpi=off Disable ACPI. WARNING: Problems Booting without ACPI Some newer machines (especially SMP systems and AMD64 systems) need ACPI for configuring the hardware correctly. On these machines, disabling ACPI can cause problems. Monitor the boot messages of the system with the command dmesg | grep -2i acpi (or all messages, because the problem may not be caused by ACPI) after booting. If an error occurs while parsing an ACPI table, the most important tablethe DSDTcan be replaced with an improved version. In this case, the faulty DSDT of the BIOS is ignored. The procedure is described in Section 29.5.4, Troubleshooting (page 539). In the kernel configuration, there is a switch for activating ACPI debug messages. If a kernel with ACPI debugging is compiled and installed, experts searching for an error can be supported with detailed information. If you experience BIOS or hardware problems, it is always advisable to contact the manufacturers. Especially if they do not always provide assistance for Linux, they should be confronted with the problems. Manufacturers will only take the issue seriously if they realize that an adequate number of their customers use Linux.
Power Management
531
532
Apart from these processes, journaling file systems, like ReiserFS and Ext3, write their metadata independently from bdflush, which also prevents the hard disk from spinning down. To avoid this, a special kernel extension has been developed for mobile devices. See /usr/src/linux/Documentation/laptop-mode.txt for details. Another important factor is the way active programs behave. For example, good editors regularly write hidden backups of the currently modified file to the hard disk, causing the disk to wake up. Features like this can be disabled at the expense of data integrity. In this connection, the mail daemon postfix makes use of the variable POSTFIX_LAPTOP. If this variable is set to yes, postfix accesses the hard disk far less frequently. However, this is irrelevant if the interval for kupdated was increased.
Power Management
533
/etc/sysconfig/powersave/common This file contains general settings for the powersave daemon. For example, the amount of debug messages in /var/log/messages can be increased by increasing the value of the variable DEBUG. /etc/sysconfig/powersave/events The powersave daemon needs this file for processing system events. An event can be assigned external actions or actions performed by the daemon itself. For external actions, the daemon tries to run an executable file (usually a Bash script) in /usr/ lib/powersave/scripts/. Predefined internal actions are: ignore throttle dethrottle suspend_to_disk suspend_to_ram standby do_suspend_to_disk do_suspend_to_ram do_standby notify screen_saver reread_cpu_capabilities throttle slows down the processor by the value defined in MAX_THROTTLING. This value depends on the current scheme. dethrottle sets the processor to full performance. suspend_to_disk, suspend_to_ram, and standby trigger the system event for a sleep mode. These three actions are generally responsible for triggering the sleep mode, but they should always be associated with specific system events.
534
The directory /usr/lib/powersave/scripts contains scripts for processing events: switch_vt Useful if the screen is displaced after a suspend or standby. wm_logout Saves the settings and logs out from GNOME, KDE, or other window managers. wm_shutdown Saves the GNOME or KDE settings and shuts down the system. set_disk_settings Executes the disk settings made in /etc/sysconfig/powersave/disk. If, for example, the variable EVENT_GLOBAL_SUSPEND2DISK="prepare_suspend_to_disk do_suspend_to_disk" is set, the two scripts or actions are processed in the specified order as soon as the user gives powersaved the command for the sleep mode suspend to disk. The daemon runs the external script /usr/lib/ powersave/scripts/prepare_suspend_to_disk. After this script has been processed successfully, the daemon runs the internal action do_suspend_to_disk and sets the computer to the sleep mode after the script has unloaded critical modules and stopped services. The actions for the event of a sleep button could be modified as in EVENT_BUTTON_SLEEP="notify suspend_to_disk". In this case, the user is informed about the suspend by a pop-up window in X or a message on the console. Subsequently, the event EVENT_GLOBAL_SUSPEND2DISK is generated, resulting in the execution of the mentioned actions and a secure system suspend mode. The internal action notify can be customized using the variable NOTIFY_METHOD in /etc/sysconfig/powersave/common. /etc/sysconfig/powersave/cpufreq Contains variables for optimizing the dynamic CPU frequency settings and whether the userspace or the kernel implementation should be used. /etc/sysconfig/powersave/battery Contains battery limits and other battery-specific settings.
Power Management
535
/etc/sysconfig/powersave/sleep In this file, activate the sleep modes and determine which critical modules should be unloaded and which services should be stopped prior to a suspend or standby event. When the system is resumed, these modules are reloaded and the services are restarted. You can even delay a triggered sleep mode, for example, to save files. The default settings mainly concern USB and PCMCIA modules. A failure of suspend or standby is usually caused by certain modules. See Section 29.5.4, Troubleshooting (page 539) for more information about identifying the error. /etc/sysconfig/powersave/thermal Activates cooling and thermal control. Details about this subject are available in the file /usr/share/doc/packages/powersave/README.thermal. /etc/sysconfig/powersave/disk This configuration file controls the actions and settings made regarding the hard disk. /etc/sysconfig/powersave/scheme_* These are the various schemes that adapt the power consumption to certain deployment scenarios. A number of schemes are preconfigured and can be used as they are. Custom schemes can be saved here.
536
Standby (ACPI S1, APM standby) Switches some devices off (manufacturer-dependent). Make sure that the following default options are set in the file /etc/sysconfig/ powersave/events for the correct processing of suspend, standby, and resume (default settings following the installation of SUSE Linux Enterprise):
EVENT_GLOBAL_SUSPEND2DISK= "prepare_suspend_to_disk screen_saver do_suspend_to_disk" EVENT_GLOBAL_SUSPEND2RAM= "prepare_suspend_to_ram screen_saver do_suspend_to_ram" EVENT_GLOBAL_STANDBY= "prepare_standby screen_saver do_standby" EVENT_GLOBAL_RESUME_SUSPEND2DISK= "restore_after_suspend_to_disk" EVENT_GLOBAL_RESUME_SUSPEND2RAM= "restore_after_suspend_to_ram" EVENT_GLOBAL_RESUME_STANDBY= "restore_after_standby"
The actions or scripts to execute when the charge levels drop under the specified limits are defined in the configuration file /etc/sysconfig/powersave/events. The standard actions for buttons can be modified as described in Section 29.5.1, Configuring the powersave Package (page 533).
EVENT_BATTERY_NORMAL="ignore" EVENT_BATTERY_WARNING="notify" EVENT_BATTERY_LOW="notify" EVENT_BATTERY_CRITICAL="wm_shutdown"
Power Management
537
increase as soon as the system is connected to the AC power supply. The CPU frequency, the power saving function of IDE, and a number of other parameters can be modified. The actions to execute when the computer is disconnected from or connected to the AC power supply are defined in /etc/sysconfig/powersave/events. Select the schemes to use in /etc/sysconfig/powersave/common:
AC_SCHEME="performance" BATTERY_SCHEME="powersave"
The schemes are stored in files in /etc/sysconfig/powersave. The filenames are in the format scheme_name-of-the-scheme. The example refers to two schemes: scheme_performance and scheme_powersave. performance, powersave, presentation, and acoustic are preconfigured. Existing schemes can be edited, created, deleted, or associated with different power supply states with the help of the YaST power management module described in Section 29.6, The YaST Power Management Module (page 541).
Further throttling of the CPU performance is possible if the CPU load does not exceed a specified limit for a specified time. Specify the load limit in PROCESSOR_IDLE_LIMIT and the time-out in CPU_IDLE_TIMEOUT. If the CPU load stays below the limit longer than the time-out, the event configured in EVENT_PROCESSOR_IDLE is activated. If the CPU is busy again, EVENT_PROCESSOR_BUSY is executed.
29.5.4 Troubleshooting
All error messages and alerts are logged in the file /var/log/messages. If you cannot find the needed information, increase the verbosity of the messages of powersave using DEBUG in the file /etc/sysconfig/powersave/common. Increase the value of the variable to 7 or even 15 and restart the daemon. The more detailed error messages in /var/log/messages should help you to find the error. The following sections cover the most common problems with powersave.
Power Management
539
3 Copy the file DSDT.aml to any location (/etc/DSDT.aml is recommended). Edit /etc/sysconfig/kernel and adapt the path to the DSDT file accordingly. Start mkinitrd (package mkinitrd). Whenever you install the kernel and use mkinitrd to create an initrd, the modified DSDT is integrated and loaded when the system is booted.
540
If you use suspend or standby in changing network environments or in connection with remotely mounted file systems, such as Samba and NIS, use automounter to mount them or add the respective services, for example, smbfs or nfs, in the above-mentioned variable. If an application accesses the remotely mounted file system prior to a suspend or standby, the service cannot be stopped correctly and the file system cannot be unmounted properly. After resuming the system, the file system may be corrupt and must be remounted.
Power Management
541
In this dialog, select the schemes to use for battery operation and AC operation. To add or modify the schemes, click Edit Schemes, which opens an overview of the existing schemes like that shown in Figure 29.2, Overview of Existing Schemes (page 542). Figure 29.2 Overview of Existing Schemes
542
In the scheme overview, select the scheme to modify then click Edit. To create a new scheme, click Add. The dialog that opens is the same in both cases and is shown in Figure 29.3, Configuring a Scheme (page 543). Figure 29.3 Configuring a Scheme
First, enter a suitable name and description for the new or edited scheme. Determine if and how the CPU performance should be controlled for this scheme. Decide if and to what extent frequency scaling and throttling should be used and whether processes with low priority (niced processes) should be ignored when adjusting the CPU frequency. In the following dialog for the hard disk, define a Standby Policy for maximum performance or for energy saving. The Acoustic Policy controls the noise level of the hard disk (supported by few hard disks). The Cooling Policy determines the cooling method to use. Unfortunately, this type of thermal control is rarely supported by the BIOS. Read /usr/share/doc/packages/powersave/powersave_manual.html #Thermal to learn how you can use the fan and passive cooling methods. Global power management settings can also be made from the initial dialog using Battery Warning, ACPI Settings, or Suspend Permissions. Access these controls by clicking Other Settings and selecting the appropriate item from the menu. Click Battery Warning to access the dialog for the battery charge level, shown in Figure 29.4, Battery Charge Level (page 544).
Power Management
543
The BIOS of your system notifies the operating system whenever the charge level drops under certain configurable limits. In this dialog, define three limits: Warning Capacity, Low Capacity, and Critical Capacity. Specific actions are triggered when the charge level drops under these limits. Usually, the first two states merely trigger a notification to the user. The third critical level triggers a shutdown, because the remaining energy is not sufficient for continued system operation. Select suitable charge levels and the desired actions then click OK to return to the start dialog.
544
Access the dialog for configuring the ACPI buttons using ACPI Settings. It is shown in Figure 29.5, ACPI Settings (page 545). The settings for the ACPI buttons determine how the system should respond to certain switches. Configure the system response to pressing the power button, pressing the sleep button, and closing the laptop lid. Click OK to complete the configuration and return to the start dialog. Click Enable Suspend to enter a dialog in which to determine if and how users of this system may use the suspend or standby functionality. Click OK to return to the main dialog. Click OK again to exit the module and confirm your power management settings.
Power Management
545
Wireless Communication
30
Wireless LAN can be used to establish communication between your SUSE Linux Enterprise machines. This chapter introduces the principles of wireless networking and the basic configuration for wireless networking.
802.11
2.4
802.11b 802.11a
2.4 5
11 54
Wireless Communication
547
Name
Band (GHz)
802.11g
2.4
Additionally, there are proprietary standards, like the 802.11b variation of Texas Instruments with a maximum transmission rate of 22 MBit/s (sometimes referred to as 802.11b+). However, the popularity of cards using this standard is limited.
30.1.1 Hardware
802.11 cards are not supported by SUSE Linux Enterprise. Most cards using 802.11a, 802.11b, and 802.11g are supported. New cards usually comply with the 802.11g standard, but cards using 802.11b are still available. Normally, cards with the following chips are supported: Aironet 4500, 4800 Atheros 5210, 5211, 5212 Atmel at76c502, at76c503, at76c504, at76c506 Intel PRO/Wireless 2100, 2200BG, 2915ABG Intersil Prism2/2.5/3 Intersil PrismGT Lucent/Agere Hermes Ralink RT2400, RT2500 Texas Instruments ACX100, ACX111 ZyDAS zd1201 A number of older cards that are rarely used and no longer available are also supported. An extensive list of WLAN cards and the chips they use is available at the Web site of 548 Installation and Administration
AbsoluteValue Systems at http://www.linux-wlan.org/docs/wlan _adapters.html.gz. http://wiki.uni-konstanz.de/wiki/bin/ view/Wireless/ListeChipsatz provides an overview of the various WLAN chips. Some cards need a firmware image that must be loaded into the card when the driver is initialized. This is the case with Intersil PrismGT, Atmel, and TI ACX100 and ACX111. The firmware can easily be installed with the YaST Online Update. The firmware for Intel PRO/Wireless cards ships with SUSE Linux Enterprise and is automatically installed by YaST as soon as a card of this type is detected. More information about this subject is available in the installed system in /usr/share/doc/ packages/wireless-tools/README.firmware.
30.1.2 Function
In wireless networking, various techniques and configurations are used to ensure fast, high-quality, and secure connections. Different operating types suit different setups. It can be difficult to choose the right authentication method. The available encryption methods have different advantages and pitfalls.
Operating Mode
Basically, wireless networks can be classified as managed networks and ad-hoc networks. Managed networks have a managing element: the access point. In this mode (also referred to as infrastructure mode), all connections of the WLAN stations in the network run over the access point, which may also serve as a connection to an ethernet. Ad-hoc networks do not have an access point. The stations communicate directly with each other. The transmission range and number of participating stations are greatly limited in ad-hoc networks. Therefore, an access point is usually more efficient. It is even possible to use a WLAN card as an access point. Most cards support this functionality. Because a wireless network is much easier to intercept and compromise than a wired network, the various standards include authentication and encryption methods. In the original version of the IEEE 802.11 standard, these are described under the term WEP. However, because WEP has proven to be insecure (see Section Security (page 556)), the WLAN industry (joined under the name Wi-Fi Alliance) has defined a new extension called WPA, which is supposed to eliminate the weaknesses of WEP. The later IEEE
Wireless Communication
549
802.11i standard (also referred to as WPA2, because WPA is based on a draft version 802.11i) includes WPA and some other authentication and encryption methods.
Authentication
To make sure that only authorized stations can connect, various authentication mechanisms are used in managed networks: Open An open system is a system that does not require authentication. Any station can join the network. Nevertheless, WEP encryption (see Section Encryption (page 551)) can be used. Shared Key (according to IEEE 802.11) In this procedure, the WEP key is used for the authentication. However, this procedure is not recommended, because it makes the WEP key more susceptible to attacks. All an attacker needs to do is to listen long enough to the communication between the station and the access point. During the authentication process, both sides exchange the same information, once in encrypted form and once in unencrypted form. This makes it possible for the key to be reconstructed with suitable tools. Because this method makes use of the WEP key for the authentication and for the encryption, it does not enhance the security of the network. A station that has the correct WEP key can authenticate, encrypt, and decrypt. A station that does not have the key cannot decrypt received packets. Accordingly, it cannot communicate, regardless of whether it had to authenticate itself. WPA-PSK (according to IEEE 802.1x) WPA-PSK (PSK stands for preshared key) works similarly to the Shared Key procedure. All participating stations as well as the access point need the same key. The key is 256 bits in length and is usually entered as a passphrase. This system does not need a complex key management like WPA-EAP and is more suitable for private use. Therefore, WPA-PSK is sometimes referred to as WPA Home. WPA-EAP (according to IEEE 802.1x) Actually, WPA-EAP is not an authentication system but a protocol for transporting authentication information. WPA-EAP is used to protect wireless networks in enterprises. In private networks, it is scarcely used. For this reason, WPA-EAP is sometimes referred to as WPA Enterprise.
550
WPA-EAP needs a Radius server to authenticate users. EAP offers three different methods for connecting and authenticating to the server: TLS (Transport Layer Security), TTLS (Tunneled Transport Layer Security), and PEAP (Protected Extensible Authentication Protocol). In a nutshell, these options work as follows: EAP-TLS TLS authentication relies on the mutual exchange of certificates both for server and client. First, the server presents its certificate to the client where it is evaluated. If the certificate is considered valid, the client in turn presents its certificate to the server. While TLS is secure, it requires a working certification management infrastructure in your network. This infrastructure is rarely found in private networks. EAP-TTLS and PEAP Both TTLS and PEAP are two-stage protocols. In the first stage, a secure is established and in the second one the client authentication data is exchanged. They require far less certification management overhead than TLS, if any.
Encryption
There are various encryption methods to ensure that no unauthorized person can read the data packets that are exchanged in a wireless network or gain access to the network: WEP (defined in IEEE 802.11) This standard makes use of the RC4 encryption algorithm, originally with a key length of 40 bits, later also with 104 bits. Often, the length is declared as 64 bits or 128 bits, depending on whether the 24 bits of the initialization vector are included. However, this standard has some weaknesses. Attacks against the keys generated by this system may be successful. Nevertheless, it is better to use WEP than not encrypt the network at all. TKIP (defined in WPA/IEEE 802.11i) This key management protocol defined in the WPA standard uses the same encryption algorithm as WEP, but eliminates its weakness. Because a new key is generated for every data packet, attacks against these keys are in vain. TKIP is used together with WPA-PSK.
Wireless Communication
551
CCMP (defined in IEEE 802.11i) CCMP describes the key management. Usually, it is used in connection with WPAEAP, but it can also be used with WPA-PSK. The encryption takes place according to AES and is stronger than the RC4 encryption of the WEP standard.
Operating Mode A station can be integrated in a WLAN in three different modes. The suitable mode depends on the network in which to communicate: Ad-hoc (peer-to-peer network without access point), Managed (network is managed by an access point), or Master (your network card should be used as the access point). To use any of the WPA-PSK or WPA-EAP modes, the operating mode must be set to managed.
552
Network Name (ESSID) All stations in a wireless network need the same ESSID for communicating with each other. If nothing is specified, the card automatically selects an access point, which may not be the one you intended to use. Authentication Mode Select a suitable authentication method for your network: Open, Shared Key, WPAPSK, or WPA-EAP. If you select WPA authentication, a network name must be set. Expert Settings This button opens a dialog for the detailed configuration of your WLAN connection. A detailed description of this dialog is provided later. After completing the basic settings, your station is ready for deployment in the WLAN. IMPORTANT: Security in Wireless Networks Be sure to use one of the supported authentication and encryption methods to protect your network traffic. Unencrypted WLAN connections allow third parties to intercept all network data. Even a weak encryption (WEP) is better than none at all. Refer to Section Encryption (page 551) and Section Security (page 556) for information. Depending on the selected authentication method, YaST prompts you to fine-tune the settings in another dialog. For Open, there is nothing to configure, because this setting implements unencrypted operation without authentication. Shared Key Set a key input type. Choose from Passphrase, ASCII, or Hexadecimal. You may keep up to four different keys to encrypt the transmitted data. Click WEP Keys to enter the key configuration dialog. Set the length of the key: 128 bit or 64 bit. The default setting is 128 bit. In the list area at the bottom of the dialog, up to four different keys can be specified for your station to use for the encryption. Press Set as Default to define one of them as the default key. Unless you change this, YaST uses the first entered key as the default key. If the standard key is deleted, one of the other keys must be marked manually as the default key. Click Edit to modify existing list entries or create new keys. In this case, a pop-up window prompts you to select an input type (Passphrase, ASCII, or Hexadecimal). If you select Passphrase, enter a word or a character string from which a key is generated ac-
Wireless Communication
553
cording to the length previously specified. ASCII requests an input of 5 characters for a 64-bit key and 13 characters for a 128-bit key. For Hexadecimal, enter 10 characters for a 64-bit key or 26 characters for a 128-bit key in hexadecimal notation. WPA-PSK To enter a key for WPA-PSK, select the input method Passphrase or Hexadecimal. In the Passphrase mode, the input must be 8 to 63 characters. In the Hexadecimal mode, enter 64 characters. WPA-EAP Enter the credentials you have been given by your network administrator. For TLS, provide Identity, Client Certificate, Client Key, and Server Certificate. TTLS and PEAP require Identity and Password. Server Certificate and Anonymous Identity are optional. YaST searches for any certificate under /etc/cert, so save the certificates given to you to this location and restrict access to these files to 0600 (owner read and write). Click Details to enter the advanced authentication dialog for your WPA-EAP setup. Select the authentication method for the second stage of EAP-TTLS or EAP-PEAP communication. If you selected TTLS in the previous dialog, choose any, MD5, GTC, CHAP, PAP, MSCHAPv1, or MSCHAPv2. If you selected PEAP, choose any, MD5, GTC, or MSCHAPv2. PEAP version can be used to force the use of a certain PEAP implementation if the automatically-determined setting does not work for you. Click Expert Settings to leave the dialog for the basic configuration of the WLAN connection and enter the expert configuration. The following options are available in this dialog: Channel The specification of a channel on which the WLAN station should work is only needed in Ad-hoc and Master modes. In Managed mode, the card automatically searches the available channels for access points. In Ad-hoc mode, select one of the 12 offered channels for the communication of your station with the other stations. In Master mode, determine on which channel your card should offer access point functionality. The default setting for this option is Auto. Bit Rate Depending on the performance of your network, you may want to set a certain bit rate for the transmission from one point to another. In the default setting Auto, the
554
system tries to use the highest possible data transmission rate. Some WLAN cards do not support the setting of bit rates. Access Point In an environment with several access points, one of them can be preselected by specifying the MAC address.
30.1.4 Utilities
hostap (package hostap) is used to run a WLAN card as an access point. More information about this package is available at the project home page (http://hostap .epitest.fi/). kismet (package kismet) is a network diagnosis tool with which to listen to the WLAN packet traffic. In this way, you can also detect any intrusion attempts in your network. More information is available at http://www.kismetwireless.net/ and in the manual page.
Wireless Communication
555
Security
If you want to set up a wireless network, remember that anybody within the transmission range can easily access it if no security measures are implemented. Therefore, be sure to activate an encryption method. All WLAN cards and access points support WEP encryption. Although this is not entirely safe, it does present an obstacle for a potential attacker. WEP is usually adequate for private use. WPA-PSK would be even better, but it is not implemented in older access points or routers with WLAN functionality. On some devices, WPA can be implemented by means of a firmware update. Furthermore, Linux does not support WPA on all hardware components. When this documentation was prepared, WPA only worked with cards using Atheros, Intel PRO/Wireless, or Prism2/2.5/3 chips. On Prism2/2.5/3, WPA only works if the hostap driver is used (see Section Problems with Prism2 Cards (page 556)). If WPA is not available, WEP is better than no encryption. In enterprises with advanced security requirements, wireless networks should only be operated with WPA.
30.1.6 Troubleshooting
If your WLAN card fails to respond, check if you have downloaded the needed firmware. Refer to Section 30.1.1, Hardware (page 548). The following paragraphs cover some known problems.
556
WPA
WPA support is quite new in SUSE Linux Enterprise and still under development. Thus, YaST does not support the configuration of all WPA authentication methods. Not all wireless LAN cards and drivers support WPA. Some cards need a firmware update to enable WPA. If you want to use WPA, read /usr/share/doc/packages/ wireless-tools/README.wpa.
Wireless Communication
557
Basic Networking
31
Linux offers the necessary networking tools and features for integration into all types of network structures. The customary Linux protocol, TCP/IP, has various services and special features, which are discussed here. Network access using a network card, modem, or other device can be configured with YaST. Manual configuration is also possible. Only the fundamental mechanisms and the relevant network configuration files are discussed in this chapter. Linux and other Unix operating systems use the TCP/IP protocol. It is not a single network protocol, but a family of network protocols that offer various services. The protocols listed in Table 31.1, Several Protocols in the TCP/IP Protocol Family (page 561) are provided for the purpose of exchanging data between two machines via TCP/IP. Networks combined by TCP/IP, comprising a worldwide network are also referred to, in their entirety, as the Internet. RFC stands for Request for Comments. RFCs are documents that describe various Internet protocols and implementation procedures for the operating system and its applications. The RFC documents describe the setup of Internet protocols. To expand your knowledge about any of the protocols, refer to the appropriate RFC documents. They are available online at http://www.ietf.org/rfc.html. Table 31.1 Protocol TCP Several Protocols in the TCP/IP Protocol Family Description Transmission Control Protocol: A connection-oriented secure protocol. The data to transmit is first sent by the application as a stream of data
Basic Networking
561
Protocol
Description then converted by the operating system to the appropriate format. The data arrives at the respective application on the destination host in the original data stream format in which it was initially sent. TCP determines whether any data has been lost during the transmission and that there is no mix-up. TCP is implemented wherever the data sequence matters.
UDP
User Datagram Protocol: A connectionless, insecure protocol. The data to transmit is sent in the form of packets generated by the application. The order in which the data arrives at the recipient is not guaranteed and data loss is a possibility. UDP is suitable for record-oriented applications. It features a smaller latency period than TCP. Internet Control Message Protocol: Essentially, this is not a protocol for the end user, but a special control protocol that issues error reports and can control the behavior of machines participating in TCP/IP data transfer. In addition, it provides a special echo mode that can be viewed using the program ping. Internet Group Management Protocol: This protocol controls machine behavior when implementing IP multicast.
ICMP
IGMP
As shown in Figure 31.1, Simplified Layer Model for TCP/IP (page 563), data exchange takes place in different layers. The actual network layer is the insecure data transfer via IP (Internet protocol). On top of IP, TCP (transmission control protocol) guarantees, to a certain extent, security of the data transfer. The IP layer is supported by the underlying hardware-dependent protocol, such as ethernet.
562
Application Layer
Applications
Application Layer
Transport Layer
TCP, UDP
Transport Layer
Network Layer
IP
Network Layer
Physical Layer
Cable, Fiberglass
Physical Layer
Data Transfer
The diagram provides one or two examples for each layer. The layers are ordered according to abstraction levels. The lowest layer is very close to the hardware. The uppermost layer, however, is almost a complete abstraction from the hardware. Every layer has its own special function. The special functions of each layer are mostly implicit in their description. The data link and physical layers represent the physical network used, such as ethernet. Almost all hardware protocols work on a packet-oriented basis. The data to transmit is packaged in packets, because it cannot be sent all at once. The maximum size of a TCP/IP packet is approximately 64 KB. Packets are normally quite a bit smaller, because the network hardware can be a limiting factor. The maximum size of a data packet on an ethernet is about fifteen hundred bytes. The size of a TCP/IP packet is limited to this amount when the data is sent over an ethernet. If more data is transferred, more data packets need to be sent by the operating system. For the layers to serve their designated functions, additional information regarding each layer must be saved in the data packet. This takes place in the header of the packet. Every layer attaches a small block of data, called the protocol header, to the front of each emerging packet. A sample TCP/IP data packet traveling over an ethernet cable is illustrated in Figure 31.2, TCP/IP Ethernet Packet (page 564). The proof sum is
Basic Networking
563
located at the end of the packet, not at the beginning. This simplifies things for the network hardware. Figure 31.2 TCP/IP Ethernet Packet
When an application sends data over the network, the data passes through each layer, all implemented in the Linux kernel except the physical layer. Each layer is responsible for preparing the data so it can be passed to the next layer. The lowest layer is ultimately responsible for sending the data. The entire procedure is reversed when data is received. Like the layers of an onion, in each layer the protocol headers are removed from the transported data. Finally, the transport layer is responsible for making the data available for use by the applications at the destination. In this manner, one layer only communicates with the layer directly above or below it. For applications, it is irrelevant whether data is transmitted via a 100 MBit/s FDDI network or via a 56-kbit/s modem line. Likewise, it is irrelevant for the data line which kind of data is transmitted, as long as packets are in the correct format.
564
31.1.1 IP Addresses
Every computer on the Internet has a unique 32-bit address. These 32 bits (or 4 bytes) are normally written as illustrated in the second row in Example 31.1, Writing IP Addresses (page 565). Example 31.1 Writing IP Addresses
IP Address (binary): 11000000 10101000 00000000 00010100 IP Address (decimal): 192. 168. 0. 20
In decimal form, the four bytes are written in the decimal number system, separated by periods. The IP address is assigned to a host or a network interface. It cannot be used anywhere else in the world. There are exceptions to this rule, but these are not relevant in the following passages. The points in IP addresses indicate the hierarchical system. Until the 1990s, IP addresses were strictly categorized in classes. However, this system has proven too inflexible and was discontinued. Now, classless routing (CIDR, classless interdomain routing) is used.
Basic Networking
565
an IP address belongs to the network. All those bits that are 1 mark the corresponding bit in the IP address as belonging to the network. All bits that are 0 mark bits inside the subnetwork. This means that the more bits are 1, the smaller the subnetwork is. Because the netmask always consists of several successive 1 bits, it is also possible to just count the number of bits in the netmask. In Example 31.2, Linking IP Addresses to the Netmask (page 566) the first net with 24 bits could also be written as 192.168.0.0/24. Example 31.2 Linking IP Addresses to the Netmask
IP address (192.168.0.20): 11000000 10101000 00000000 00010100 Netmask (255.255.255.0): 11111111 11111111 11111111 00000000 --------------------------------------------------------------Result of the link: 11000000 10101000 00000000 00000000 In the decimal system: 192. 168. 0. 0 IP address (213.95.15.200): 11010101 10111111 00001111 11001000 Netmask (255.255.255.0): 11111111 11111111 11111111 00000000 --------------------------------------------------------------Result of the link: 11010101 10111111 00001111 00000000 In the decimal system: 213. 95. 15. 0
To give another example: all machines connected with the same ethernet cable are usually located in the same subnetwork and are directly accessible. Even when the subnet is physically divided by switches or bridges, these hosts can still be reached directly. IP addresses outside the local subnet can only be reached if a gateway is configured for the target network. In the most common case, there is only one gateway that handles all traffic that is external. However, it is also possible to configure several gateways for different subnets. If a gateway has been configured, all external IP packets are sent to the appropriate gateway. This gateway then attempts to forward the packets in the same mannerfrom host to hostuntil it reaches the destination host or the packet's TTL (time to live) expires. Table 31.2 Specific Addresses Description This is the netmask AND any address in the network, as shown in Example 31.2, Linking IP Addresses to the Netmask
566
Address Type
Description (page 566) under Result. This address cannot be assigned to any hosts.
Broadcast Address
This basically says, Access all hosts in this subnetwork. To generate this, the netmask is inverted in binary form and linked to the base network address with a logical OR. The above example therefore results in 192.168.0.255. This address cannot be assigned to any hosts. The address 127.0.0.1 is assigned to the loopback device on each host. A connection can be set up to your own machine with this address.
Local Host
Because IP addresses must be unique all over the world, you cannot just select random addresses. There are three address domains to use if you want to set up a private IPbased network. These cannot get any connection from the rest of the Internet, because they cannot be transmitted over the Internet. These address domains are specified in RFC 1597 and listed in Table 31.3, Private IP Address Domains (page 567). Table 31.3 Private IP Address Domains Domain 10.x.x.x 172.16.x.x 172.31.x.x 192.168.x.x
Basic Networking
567
568
31.2.1 Advantages
The most important and most visible improvement brought by the new protocol is the enormous expansion of the available address space. An IPv6 address is made up of 128 bit values instead of the traditional 32 bits. This provides for as many as several quadrillion IP addresses. However, IPv6 addresses are not only different from their predecessors with regard to their length. They also have a different internal structure that may contain more specific information about the systems and the networks to which they belong. More details about this are found in Section 31.2.2, Address Types and Structure (page 570). The following is a list of some other advantages of the new protocol: Autoconfiguration IPv6 makes the network plug and play capable, which means that a newly set up system integrates into the (local) network without any manual configuration. The new host uses its automatic configuration mechanism to derive its own address from the information made available by the neighboring routers, relying on a protocol called the neighbor discovery (ND) protocol. This method does not require any intervention on the administrator's part and there is no need to maintain a central server for address allocationan additional advantage over IPv4, where automatic address allocation requires a DHCP server. Mobility IPv6 makes it possible to assign several addresses to one network interface at the same time. This allows users to access several networks easily, something that could be compared with the international roaming services offered by mobile phone companies: when you take your mobile phone abroad, the phone automatically logs in to a foreign service as soon as it enters the corresponding area, so you can be reached under the same number everywhere and are able to place an outgoing call just like in your home area. Secure Communication With IPv4, network security is an add-on function. IPv6 includes IPSec as one of its core features, allowing systems to communicate over a secure tunnel to avoid eavesdropping by outsiders on the Internet.
Basic Networking
569
Backward Compatibility Realistically, it would be impossible to switch the entire Internet from IPv4 to IPv6 at one time. Therefore, it is crucial that both protocols are able to coexist not only on the Internet, but also on one system. This is ensured by compatible addresses (IPv4 addresses can easily be translated into IPv6 addresses) and through the use of a number of tunnels. See Section 31.2.3, Coexistence of IPv4 and IPv6 (page 574). Also, systems can rely on a dual stack IP technique to support both protocols at the same time, meaning that they have two network stacks that are completely separate, such that there is no interference between the two protocol versions. Custom Tailored Services through Multicasting With IPv4, some services, such as SMB, need to broadcast their packets to all hosts in the local network. IPv6 allows a much more fine-grained approach by enabling servers to address hosts through multicastingby addressing a number of hosts as parts of a group (which is different from addressing all hosts through broadcasting or each host individually through unicasting). Which hosts are addressed as a group may depend on the concrete application. There are some predefined groups to address all name servers (the all name servers multicast group), for example, or all routers (the all routers multicast group).
570
Multicast Addresses of this type relate to a group of network interfaces. Packets with such an address are delivered to all destinations that belong to the group. Multicast addresses are mainly used by certain network services to communicate with certain groups of hosts in a well-directed manner. Anycast Addresses of this type are related to a group of interfaces. Packets with such an address are delivered to the member of the group that is closest to the sender, according to the principles of the underlying routing protocol. Anycast addresses are used to make it easier for hosts to find out about servers offering certain services in the given network area. All servers of the same type have the same anycast address. Whenever a host requests a service, it receives a reply from the server with the closest location, as determined by the routing protocol. If this server should fail for some reason, the protocol automatically selects the second closest server, then the third one, and so forth. An IPv6 address is made up of eight four-digit fields, each representing 16 bits, written in hexadecimal notation. They are also separated by colons (:). Any leading zero bytes within a given field may be dropped, but zeros within the field or at its end may not. Another convention is that more than four consecutive zero bytes may be collapsed into a double colon. However, only one such :: is allowed per address. This kind of shorthand notation is shown in Example 31.3, Sample IPv6 Address (page 571), where all three lines represent the same address. Example 31.3 Sample IPv6 Address
fe80 : 0000 : 0000 : 0000 : 0000 : 10 : 1000 : 1a4 fe80 : 0 : 0 : 0 : 0 : 10 : 1000 : 1a4 fe80 : : 10 : 1000 : 1a4
Each part of an IPv6 address has a defined function. The first bytes form the prefix and specify the type of address. The center part is the network portion of the address, but it may be unused. The end of the address forms the host part. With IPv6, the netmask is defined by indicating the length of the prefix after a slash at the end of the address. An address, as shown in Example 31.4, IPv6 Address Specifying the Prefix Length (page 572), contains the information that the first 64 bits form the network part of the address and the last 64 form its host part. In other words, the 64 means that the netmask is filled with 64 1-bit values from the left. Just like with IPv4, the IP address is combined with AND with the values from the netmask to determine whether the host is located in the same subnetwork or in another one.
Basic Networking
571
IPv6 knows about several predefined types of prefixes. Some of these are shown in Table 31.4, Various IPv6 Prefixes (page 572). Table 31.4 Prefix (hex) 00 Various IPv6 Prefixes Definition IPv4 addresses and IPv4 over IPv6 compatibility addresses. These are used to maintain compatibility with IPv4. Their use still requires a router able to translate IPv6 packets into IPv4 packets. Several special addresses, such as the one for the loopback device, have this prefix as well. Aggregatable global unicast addresses. As is the case with IPv4, an interface can be assigned to form part of a certain subnetwork. Currently, there are the following address spaces: 2001::/16 (production quality address space) and 2002::/16 (6to4 address space). Link-local addresses. Addresses with this prefix should not be routed and should therefore only be reachable from within the same subnetwork. Site-local addresses. These may be routed, but only within the network of the organization to which they belong. In effect, they are the IPv6 equivalent of the current private network address space, such as 10.x.x.x. These are multicast addresses.
fe80::/10
fec0::/10
ff
A unicast address consists of three basic components: Public Topology The first part (which also contains one of the prefixes mentioned above) is used to route packets through the public Internet. It includes information about the company or institution that provides the Internet access.
572
Site Topology The second part contains routing information about the subnetwork to which to deliver the packet. Interface ID The third part identifies the interface to which to deliver the packet. This also allows for the MAC to form part of the address. Given that the MAC is a globally unique, fixed identifier coded into the device by the hardware maker, the configuration procedure is substantially simplified. In fact, the first 64 address bits are consolidated to form the EUI-64 token, with the last 48 bits taken from the MAC, and the remaining 24 bits containing special information about the token type. This also makes it possible to assign an EUI-64 token to interfaces that do not have a MAC, such as those based on PPP or ISDN. On top of this basic structure, IPv6 distinguishes between five different types of unicast addresses: :: (unspecified) This address is used by the host as its source address when the interface is initialized for the first timewhen the address cannot yet be determined by other means. ::1 (loopback) The address of the loopback device. IPv4 Compatible Addresses The IPv6 address is formed by the IPv4 address and a prefix consisting of 96 zero bits. This type of compatibility address is used for tunneling (see Section 31.2.3, Coexistence of IPv4 and IPv6 (page 574)) to allow IPv4 and IPv6 hosts to communicate with others operating in a pure IPv4 environment. IPv4 Addresses Mapped to IPv6 This type of address specifies a pure IPv4 address in IPv6 notation. Local Addresses There are two address types for local use: link-local This type of address can only be used in the local subnetwork. Packets with a source or target address of this type should not be routed to the Internet or other subnetworks. These addresses contain a special prefix (fe80::/10) and the interface ID of the network card, with the middle part consisting of Basic Networking 573
zero bytes. Addresses of this type are used during automatic configuration to communicate with other hosts belonging to the same subnetwork. site-local Packets with this type of address may be routed to other subnetworks, but not to the wider Internetthey must remain inside the organization's own network. Such addresses are used for intranets and are an equivalent of the private address space defined by IPv4. They contain a special prefix (fec0::/10), the interface ID, and a 16 bit field specifying the subnetwork ID. Again, the rest is filled with zero bytes. As a completely new feature introduced with IPv6, each network interface normally gets several IP addresses, with the advantage that several networks can be accessed through the same interface. One of these networks can be configured completely automatically using the MAC and a known prefix with the result that all hosts on the local network can be reached as soon as IPv6 is enabled (using the link-local address). With the MAC forming part of it, any IP address used in the world is unique. The only variable parts of the address are those specifying the site topology and the public topology, depending on the actual network in which the host is currently operating. For a host to go back and forth between different networks, it needs at least two addresses. One of them, the home address, not only contains the interface ID but also an identifier of the home network to which it normally belongs (and the corresponding prefix). The home address is a static address and, as such, it does not normally change. Still, all packets destined to the mobile host can be delivered to it, regardless of whether it operates in the home network or somewhere outside. This is made possible by the completely new features introduced with IPv6, such as stateless autoconfiguration and neighbor discovery. In addition to its home address, a mobile host gets one or more additional addresses that belong to the foreign networks where it is roaming. These are called care-of addresses. The home network has a facility that forwards any packets destined to the host when it is roaming outside. In an IPv6 environment, this task is performed by the home agent, which takes all packets destined to the home address and relays them through a tunnel. On the other hand, those packets destined to the care-of address are directly transferred to the mobile host without any special detours.
574
system is guaranteed where there is a dual stack implementation of both protocols. That still leaves the question of how an IPv6 enabled host should communicate with an IPv4 host and how IPv6 packets should be transported by the current networks, which are predominantly IPv4 based. The best solutions offer tunneling and compatibility addresses (see Section 31.2.2, Address Types and Structure (page 570)). IPv6 hosts that are more or less isolated in the (worldwide) IPv4 network can communicate through tunnels: IPv6 packets are encapsulated as IPv4 packets to move them across an IPv4 network. Such a connection between two IPv4 hosts is called a tunnel. To achieve this, packets must include the IPv6 destination address (or the corresponding prefix) as well as the IPv4 address of the remote host at the receiving end of the tunnel. A basic tunnel can be configured manually according to an agreement between the hosts' administrators. This is also called static tunneling. However, the configuration and maintenance of static tunnels is often too labor-intensive to use them for daily communication needs. Therefore, IPv6 provides for three different methods of dynamic tunneling: 6over4 IPv6 packets are automatically encapsulated as IPv4 packets and sent over an IPv4 network capable of multicasting. IPv6 is tricked into seeing the whole network (Internet) as a huge local area network (LAN). This makes it possible to determine the receiving end of the IPv4 tunnel automatically. However, this method does not scale very well and is also hampered by the fact that IP multicasting is far from widespread on the Internet. Therefore, it only provides a solution for smaller corporate or institutional networks where multicasting can be enabled. The specifications for this method are laid down in RFC 2529. 6to4 With this method, IPv4 addresses are automatically generated from IPv6 addresses, enabling isolated IPv6 hosts to communicate over an IPv4 network. However, a number of problems have been reported regarding the communication between those isolated IPv6 hosts and the Internet. The method is described in RFC 3056. IPv6 Tunnel Broker This method relies on special servers that provide dedicated tunnels for IPv6 hosts. It is described in RFC 3053.
Basic Networking
575
IMPORTANT: The 6bone Initiative In the heart of the old-time Internet, there is already a globally distributed network of IPv6 subnets that are connected through tunnels. This is the 6bone network (http://www.6bone.net), an IPv6 test environment that may be used by programmers and Internet providers who want to develop and offer IPv6-based services to gain the experience necessary to implement the new protocol. More information can be found on the project's Internet site.
576
http://www.6bone.net/ Visit this site if you want to join a tunneled IPv6 network. http://www.ipv6.org/ The starting point for everything about IPv6. RFC 2640 The fundamental RFC about IPv6. IPv6 Essentials A book describing all the important aspects of the topic is IPv6 Essentials by Silvia Hagen (ISBN 0-596-00125-8).
The top of the hierarchy is occupied by root name servers. These root name servers manage the top level domains and are run by the Network Information Center (NIC). Each root name server knows about the name servers responsible for a given top level domain. Information about top level domain NICs is available at http://www .internic.net. DNS can do more than just resolve hostnames. The name server also knows which host is receiving e-mails for an entire domainthe mail exchanger (MX). For your machine to resolve an IP address, it must know about at least one name server and its IP address. Easily specify such a name server with the help of YaST. If you have a modem dial-up connection, you may not need to configure a name server manually at all. The dial-up protocol provides the name server address as the connection is made. The configuration of name server access with SUSE Linux Enterprise is described in Chapter 34, The Domain Name System (page 629). The protocol whois is closely related to DNS. With this program, quickly find out who is responsible for any given domain.
578
Basic Networking
579
Firewall Zone Determine whether your network interface should be protected by a firewall. For details, refer to Section Configuring the Firewall (page 584). Device Activation Depending on which applications or scripts you use to control your network devices, set the appropriate start mode. For details, refer to Section Starting the Device (page 584). MTU Set the maximum transfer rate (MTU) of your interface. Normally, you can safely leave this setting empty and run with the defaults. Only change this value if your setup explicitly requires it.
Configuring IP Addresses
When possible, wired network cards available during installation are automatically configured to use automatic address setup, DHCP. NOTE: IBM System z and DHCP On IBM System z platforms, DHCP-based address configuration is only supported with network cards that have a MAC address. This is only the case with OSA and OSA Express cards. DHCP should also be used if you are using a DSL line but with no static IP assigned by the ISP. If you decide to use DHCP, configure the details in DHCP Client Options. Find this dialog from the Address tab by selecting Advanced DHCP Options. Specify whether the DHCP server should always honor broadcast requests and any identifier to use. If you have a virtual host setup where different hosts communicate through the same interface, an identifier is necessary to distinguish them. DHCP is a good choice for client configuration but it is not ideal for server configuration. To set a static IP address, proceed as follows: 1 Select a card from the list of detected cards in the YaST network card configuration module and click Edit. 2 In the Address tab, choose Static Address Setup.
Basic Networking
581
3 Enter IP Address and Subnet Mask. 4 Click Next. 5 To activate the configuration, click Next again. One network device can have multiple IP addresses, called aliases. To set an alias for your network card, proceed as follows: 1 Select a card from the list of detected cards in the YaST network card configuration module and click Edit. 2 In the Address tab, choose Advanced Additional Addresses. 3 Click Add. 4 Enter Alias Name, IP Address, and Netmask. 5 Click OK. 6 Click OK again. 7 Click Next. 8 To activate the configuration, click Next again.
582
2 In the Address tab, click Hostname and Name Server. 3 To disable DHCP-driven host name configuration, deselect Change Hostname via DHCP. 4 Enter Hostname and, if it is needed, Domain Name. 5 To disable DHCP driven updates of the name server list, deselect Update Name Servers and Search List via DHCP. 6 Enter the name servers and domain search list. 7 Click OK. 8 Click Next. 9 To activate the configuration, click Next again.
Configuring Routing
To make your machine communicate with other machines and other networks, routing information must be given to make network traffic take the correct path. If DHCP is used, this information is automatically provided. If a static setup is used, this data must be added manually. 1 Select a card from the list of detected cards in the YaST network card configuration module and click Edit. 2 In the Address tab, click Routing. 3 Enter the IP of the Default Gateway. 4 Click OK. 5 Click Next. 6 To activate the configuration, click Next again.
Basic Networking
583
584
1 Select a card from the list of detected cards in the YaST network card configuration module and click Edit. 2 Enter the General tab of the network configuration dialog. 3 Determine the firewall zone to which your interface should be assigned. The following options are available: Firewall Disabled The firewall is not run at all. Only use this option if your machine part of a greater network that is protected by an outer firewall. Internal Zone (Unprotected) The firewall is run, but does not enforce any rules to protect this interface. Only use this option, if your machine part is part of a greater network that is protected by an outer firewall. Demilitarized Zone A demilitarized zone is an additional line of defense in front of an internal network and the (hostile) Internet. Hosts assigned to this zone can be reached from the internal network and from the Internet, but cannot access the internal network. External Zone The firewall is run on this interface and fully protects it against other (presumably hostile) network traffic. This is the default option. 4 Click Next. 5 Activate the configuration by clicking Next again.
Basic Networking
585
2 Set the Device Type of the interface from the available options, Configuration Name, and Module Name. If the network card is a PCMCIA or USB device, activate the respective check box and exit this dialog with Next. Otherwise, select your network card model from Select from List. YaST then automatically selects the appropriate kernel module for the card. Hardware Configuration Name specifies the name of the /etc/sysconfig/ hardware/hwcfg-* file containing the hardware settings of your network card. This contains the name of the kernel module as well as the options needed to initialize the hardware. 3 Click Next. 4 In the Address tab, set the device type of the interface, the configuration name, and IP address. To use a static address, choose Static Address Setup then complete IP Address and Subnet Mask. Here, you can also select to configure the hostname, name server, and routing details (see Section Configuring Hostname and DNS (page 582) and Section Configuring Routing (page 583)). If you selected Wireless as the device type of the interface, configure the wireless connection in the next dialog. Detailed information about wireless device configuration is available in Section 30.1, Wireless LAN (page 547). 5 In the General tab, set the Firewall Zone and Device Activation. With User Controlled, grant connection control to ordinary users. 6 Click Next. 7 To activate the new network configuration, click Next again. Information about the conventions for configuration names is available in the getcfg(8) man page.
31.4.2 Modem
TIP: IBM System z: Modem The configuration of this type of hardware is not supported on IBM System z platforms.
586
In the YaST Control Center, access the modem configuration under Network Devices. If your modem was not automatically detected, open the dialog for manual configuration. In the dialog that opens, enter the interface to which the modem is connected under Modem. Figure 31.4 Modem Configuration
If you are behind a private branch exchange (PBX), you may need to enter a dial prefix. This is often a zero. Consult the instructions that came with the PBX to find out. Also select whether to use tone or pulse dialing, whether the speaker should be on, and whether the modem should wait until it detects a dial tone. The last option should not be enabled if the modem is connected to an exchange. Under Details, set the baud rate and the modem initialization strings. Only change these settings if your modem was not detected automatically or if it requires special settings for data transmission to work. This is mainly the case with ISDN terminal adapters. Leave this dialog by clicking OK. To delegate control over the modem to the normal user without root permissions, activate User Controlled. In this way, a user without administrator permissions can activate or deactivate an interface. Under Dial Prefix Regular Expression, specify a regular expression. The Dial Prefix in KInternet, which can be modified by the normal user, must match this regular expression. If this field is left empty, the user cannot set a different Dial Prefix without administrator permissions.
Basic Networking
587
In the next dialog, select the ISP (Internet service provider). To choose from a predefined list of ISPs operating in your country, select Country. Alternatively, click New to open a dialog in which to provide the data for your ISP. This includes a name for the dial-up connection and ISP as well as the login and password provided by your ISP. Enable Always Ask for Password to be prompted for the password each time you connect. In the last dialog, specify additional connection options: Dial on Demand If you enable dial on demand, set at least one name server. Modify DNS when Connected This option is enabled by default, with the effect that the name server address is updated each time you connect to the Internet. Automatically Retrieve DNS If the provider does not transmit its domain name server after connecting, disable this option and enter the DNS data manually. Stupid Mode This option is enabled by default. With it, input prompts sent by the ISP's server are ignored to prevent them from interfering with the connection process. External Firewall Interface and Restart Firewall Selecting these options enables the SUSEfirewall2, which protects you from outside attacks for the duration of your Internet connection. Idle Time-Out (seconds) With this option, specify a period of network inactivity after which the modem disconnects automatically. IP Details This opens the address configuration dialog. If your ISP does not assign a dynamic IP address to your host, disable Dynamic IP Address then enter your host's local IP address and the remote IP address. Ask your ISP for this information. Leave Default Route enabled and close the dialog by selecting OK. Selecting Next returns to the original dialog, which displays a summary of the modem configuration. Close this dialog with Finish.
588
31.4.3 ISDN
TIP: IBM System z: ISDN The configuration of this type of hardware is not supported on IBM System z platforms. Use this module to configure one or several ISDN cards for your system. If YaST did not detect your ISDN card, manually select it. Multiple interfaces are possible, but several ISPs can be configured for one interface. In the subsequent dialogs, set the ISDN options necessary for the proper functioning of the card. Figure 31.5 ISDN Configuration
In the next dialog, shown in Figure 31.5, ISDN Configuration (page 589), select the protocol to use. The default is Euro-ISDN (EDSS1), but for older or larger exchanges, select 1TR6. If you are in the US, select NI1. Select your country in the relevant field. The corresponding country code then appears in the field next to it. Finally, provide your Area Code and the Dial Prefix if necessary. Start Mode defines how the ISDN interface should be started: At Boot Time causes the ISDN driver to be initialized each time the system boots. Manually requires you to load
Basic Networking
589
the ISDN driver as root with the command rcisdn start. On Hotplug, used for PCMCIA or USB devices, loads the driver after the device is plugged in. When finished with these settings, select OK. In the next dialog, specify the interface type for your ISDN card and add ISPs to an existing interface. Interfaces may be either the SyncPPP or the RawIP type, but most ISPs operate in the SyncPPP mode, which is described below. Figure 31.6 ISDN Interface Configuration
The number to enter for My Phone Number depends on your particular setup: ISDN Card Directly Connected to Phone Outlet A standard ISDN line provides three phone numbers (called multiple subscriber numbers, or MSNs). If the subscriber asked for more, there may be up to 10. One of these MSNs must be entered here, but without your area code. If you enter the wrong number, your phone operator automatically falls back to the first MSN assigned to your ISDN line. ISDN Card Connected to a Private Branch Exchange Again, the configuration may vary depending on the equipment installed:
590
1.
Smaller private branch exchanges (PBX) built for home purposes mostly use the Euro-ISDN (EDSS1) protocol for internal calls. These exchanges have an internal S0 bus and use internal numbers for the equipment connected to them. Use one of the internal numbers as your MSN. You should be able to use at least one of the exchange's MSNs that have been enabled for direct outward dialing. If this does not work, try a single zero. For further information, consult the documentation that came with your phone exchange.
2.
Larger phone exchanges designed for businesses normally use the 1TR6 protocol for internal calls. Their MSN is called EAZ and usually corresponds to the direct-dial number. For the configuration under Linux, it should be sufficient to enter the last digit of the EAZ. As a last resort, try each of the digits from 1 to 9.
For the connection to be terminated just before the next charge unit is due, enable ChargeHUP. However, remember that may not work with every ISP. You can also enable channel bundling (multilink PPP) by selecting the corresponding option. Finally, you can enable SuSEfirewall2 for your link by selecting External Firewall Interface and Restart Firewall. To enable the normal user without administrator permissions to activate or deactivate the interface, select the User Controlled. Details opens a dialog in which to implement more complex connection schemes, which are not relevant for normal home users. Leave the Details dialog by selecting OK. In the next dialog, make IP address settings. If you have not been given a static IP by your provider, select Dynamic IP Address. Otherwise, use the fields provided to enter your host's local IP address and the remote IP address according to the specifications of your ISP. If the interface should be the default route to the Internet, select Default Route. Each host can only have one interface configured as the default route. Leave this dialog by selecting Next. The following dialog allows you to set your country and select an ISP. The ISPs included in the list are call-by-call providers only. If your ISP is not in the list, select New. This opens the Provider Parameters dialog in which to enter all the details for your ISP. When entering the phone number, do not include any blanks or commas among the digits. Finally, enter your login and the password as provided by the ISP. When finished, select Next. To use Dial on Demand on a stand-alone workstation, also specify the name server (DNS server). Most ISPs support dynamic DNS, which means the IP address of a name Basic Networking 591
server is sent by the ISP each time you connect. For a single workstation, however, you still need to provide a placeholder address like 192.168.22.99. If your ISP does not support dynamic DNS, specify the name server IP addresses of the ISP. If desired, specify a time-out for the connectionthe period of network inactivity (in seconds) after which the connection should be automatically terminated. Confirm your settings with Next. YaST displays a summary of the configured interfaces. To make all these settings active, select Finish.
31.4.5 DSL
TIP: IBM System z: DSL The configuration of this type of hardware is not supported on IBM System z platforms.
592
To configure your DSL device, select the DSL module from the YaST Network Devices section. This YaST module consists of several dialogs in which to set the parameters of DSL links based on one of the following protocols: PPP over Ethernet (PPPoE) PPP over ATM (PPPoATM) CAPI for ADSL (Fritz Cards) Point-to-Point Tunneling Protocol (PPTP)Austria The configuration of a DSL connection based on PPPoE or PPTP requires that the corresponding network card has already been set up in the correct way. If you have not done so yet, first configure the card by selecting Configure Network Cards (see Section 31.4.1, Configuring the Network Card with YaST (page 579)). In the case of a DSL link, addresses may be assigned automatically but not via DHCP, which is why you should not enable the option Automatic address setup (via DHCP). Instead, enter a static dummy address for the interface, such as 192.168.22.1. In Subnet Mask, enter 255.255.255.0. If you are configuring a stand-alone workstation, leave Default Gateway empty. TIP Values in IP Address and Subnet Mask are only placeholders. They are only needed to initialize the network card and do not represent the DSL link as such.
Basic Networking
593
To begin the DSL configuration (see Figure 31.7, DSL Configuration (page 594)), first select the PPP mode and the ethernet card to which the DSL modem is connected (in most cases, this is eth0). Then use Device Activation to specify whether the DSL link should be established during the boot process. Click User Controlled to authorize the normal user without root permissions to activate or deactivate the interface with KInternet. The dialog also lets you select your country and choose from a number of ISPs operating in it. The details of any subsequent dialogs of the DSL configuration depend on the options set so far, which is why they are only briefly mentioned in the following paragraphs. For details on the available options, read the detailed help available from the dialogs. To use Dial on Demand on a stand-alone workstation, also specify the name server (DNS server). Most ISPs support dynamic DNSthe IP address of a name server is sent by the ISP each time you connect. For a single workstation, however, provide a placeholder address like 192.168.22.99. If your ISP does not support dynamic DNS, enter the name server IP address provided by your ISP. Idle Time-Out (seconds) defines a period of network inactivity after which to terminate the connection automatically. A reasonable time-out value is between 60 and 300 seconds. If Dial on Demand is disabled, it may be useful to set the time-out to zero to prevent automatic hang-up.
594
The configuration of T-DSL is very similar to the DSL setup. Just select T-Online as your provider and YaST opens the T-DSL configuration dialog. In this dialog, provide some additional information required for T-DSLthe line ID, the T-Online number, the user code, and your password. All of these should be included in the information you received after subscribing to T-DSL.
Basic Networking
595
figure. Choose the Device Settings that fit your devices (usually this would be Compatibility mode). Specify both your IP address and the IP address of the remote partner. If needed, adjust the MTU size with Advanced Detailed Settings. Leave the network configuration with Next and Finish. WARNING The use of this interface is deprecated. This interface will not be supported in future versions of SUSE Linux Enterprise Server.
596
Basic Networking
597
additional information, like its name, password or encryption key, NetworkManager prompts for it. Both KDE and GNOME have their own applets for NetworkManager. An appropriate applet should start automatically with the desktop environment. The applet is then shown as an icon in the system tray. Functions of both applets are similar, but their interfaces are different. They can also be used in other graphical environments with standard system tray support.
598
Basic Networking
599
600
To assign a certain network configuration to any card of a certain type (of which only one is inserted at a time) instead of a certain card, select less specific configuration names. For example, bus-pcmcia would be used for all PCMCIA cards. On the other hand, the names can be limited by a preceding interface type. For example, wlan-bus-usb would be assigned to WLAN cards connected to a USB port. The system always uses the configuration that best describes an interface or the device providing the interface. The search for the most suitable configuration is handled by getcfg. The output of getcfg delivers all information that can be used for describing a device. Details regarding the specification of configuration names are available in the manual page of getcfg. With the described method, a network interface is configured with the correct configuration even if the network devices are not always initialized in the same order. However, the name of the interface still depends on the initialization sequence. There are two ways to ensure reliable access to the interface of a certain network card: getcfg-interface configuration name returns the name of the associated network interface. Therefore, the configuration name, such as firewall, dhcpd, routing, or various virtual network interfaces (tunnels), can be entered in some configuration files instead of the interface name, which is not persistent. Persistent interface names are assigned to each interface automatically. You may adjust them to suit your needs. When creating interface names, proceed as outlined in /etc/udev/rules.d/30-net_persistent_names.rules. However, the persistent name pname should not be the same as the name that would automatically be assigned by the kernel. Therefore, eth*, tr*, wlan*, qeth*, iucv*, and so on are not permitted. Instead, use net* or descriptive names like external, internal, or dmz. Make sure that the same interface name is not used twice. Allowed characters in interface names are restricted to [a-zA-Z0-9]. A persistent name can only be assigned to an interface immediately after its registration, which means that the driver of the network card must be reloaded or hwup device description must be executed. The command rcnetwork restart is not sufficient for this purpose. IMPORTANT: Using Persistent Interface Names The use of persistent interface names has not been tested in all areas. Therefore, some applications may not be able to handle freely selected interface names.
Basic Networking
601
ifup requires an existing interface, because it does not initialize the hardware. The initialization of the hardware is handled by the command hwup (executed by hotplug or coldplug). When a device is initialized, ifup is automatically executed for the new interface via hotplug and the interface is set up if the start mode is onboot, hotplug, or auto and the network service was started. Formerly, the command ifup interfacename triggered the hardware initialization. Now the procedure has been reversed. First, a hardware component is initialized then all other actions follow. In this way, a varying number of devices can always be configured in the best way possible with an existing set of configurations. Table 31.5, Manual Network Configuration Scripts (page 602) summarizes the most important scripts involved in the network configuration. Where possible, the scripts are distinguished by hardware and interface. Table 31.5 Configuration Stage Hardware Manual Network Configuration Scripts Command Function
hw{up,down,status} The hw* scripts are executed by the hotplug subsystem to initialize a device, undo the initialization, or query the status of a device. More information is available in the manual page of hwup. getcfg getcfg can be used to query the interface name associated with a configuration name or a hardware description. More information is available in the manual page of getcfg.
Interface
Interface
if{up,down,status} The if* scripts start existing network interfaces or return the status of the specified interface. More information is available in the manual page of ifup.
More information about hotplug and persistent device names is available in Chapter 25, Dynamic Kernel Device Management with udev (page 475).
602
/etc/syconfig/hardware/hwcfg-*
These files contain the hardware configurations of network cards and other devices. They contain the needed parameters, such as the kernel module, start mode, and script associations. Refer to the manual page of hwup for details. Regardless of the existing hardware, the hwcfg-static-* configurations are applied when coldplug is started.
/etc/sysconfig/network/ifcfg-*
These files contain the configurations for network interface. They include information such as the start mode and the IP address. Possible parameters are described in the manual page of ifup. Additionally, all variables from the files dhcp, wireless, and config can be used in the ifcfg-* files if a general setting should be used for only one interface. zseries: IBM System z do not support USB. The names of the interface files and network aliases contain System z-specific elements like qeth.
/etc/sysconfig/network/routes,ifroute-*
The static routing of TCP/IP packets is determined here. All the static routes required by the various system tasks can be entered in the /etc/sysconfig/network/ routes file: routes to a host, routes to a host via a gateway, and routes to a network.
Basic Networking
603
For each interface that needs individual routing, define an additional configuration file: /etc/sysconfig/network/ifroute-*. Replace * with the name of the interface. The entries in the routing configuration files look like this:
# Destination # 127.0.0.0 204.127.235.0 default 207.68.156.51 192.168.0.0 Dummy/Gateway 0.0.0.0 0.0.0.0 204.127.235.41 207.68.145.45 207.68.156.51 Netmask 255.255.255.0 255.255.255.0 0.0.0.0 255.255.255.255 255.255.0.0 Device lo eth0 eth0 eth1 eth1
The route's destination is in the first column. This column may contain the IP address of a network or host or, in the case of reachable name servers, the fully qualified network or hostname. The second column contains the default gateway or a gateway through which a host or network can be accessed. The third column contains the netmask for networks or hosts behind a gateway. For example, the mask is 255.255.255.255 for a host behind a gateway. The fourth column is only relevant for networks connected to the local host such as loopback, Ethernet, ISDN, PPP, and dummy device. The device name must be entered here. An (optional) fifth column can be used to specify the type of a route. Columns that are not needed should contain a minus sign - to ensure that the parser correctly interprets the command. For details, refer to the routes(5) man page.
/etc/resolv.conf
The domain to which the host belongs is specified in this file (keyword search). Also listed is the status of the name server address to access (keyword nameserver). Multiple domain names can be specified. When resolving a name that is not fully qualified, an attempt is made to generate one by attaching the individual search entries. Use multiple name servers by entering several lines, each beginning with nameserver. Precede comments with # signs. YaST enters the specified name server in this file. Example 31.5, /etc/resolv.conf (page 605) shows what /etc/resolv.conf could look like.
604
Some services, like pppd (wvdial), ipppd (isdn), dhcp (dhcpcd and dhclient), pcmcia, and hotplug, modify the file /etc/resolv.conf by means of the script modify_resolvconf. If the file /etc/resolv.conf has been temporarily modified by this script, it contains a predefined comment giving information about the service that modified it, the location where the original file has been backed up, and how to turn off the automatic modification mechanism. If /etc/ resolv.conf is modified several times, the file includes modifications in a nested form. These can be reverted in a clean way even if this reversal takes place in an order different from the order in which modifications were introduced. Services that may need this flexibility include isdn, pcmcia, and hotplug. If a service was not terminated in a normal, clean way, modify_resolvconf can be used to restore the original file. Also, on system boot, a check is performed to see whether there is an uncleaned, modified resolv.conf, for example, after a system crash, in which case the original (unmodified) resolv.conf is restored. YaST uses the command modify_resolvconf check to find out whether resolv .conf has been modified and subsequently warns the user that changes will be lost after restoring the file. Apart from this, YaST does not rely on modify_resolvconf, which means that the impact of changing resolv.conf through YaST is the same as that of any manual change. In both cases, changes have a permanent effect. Modifications requested by the mentioned services are only temporary.
/etc/hosts
In this file, shown in Example 31.6, /etc/hosts (page 606), IP addresses are assigned to hostnames. If no name server is implemented, all hosts to which an IP connection will be set up must be listed here. For each host, enter a line consisting of the IP address, the fully qualified hostname, and the hostname into the file. The IP address must be at the beginning of the line and the entries separated by blanks and tabs. Comments are always preceded by the # sign.
Basic Networking
605
/etc/networks
Here, network names are converted to network addresses. The format is similar to that of the hosts file, except the network names precede the addresses. See Example 31.7, /etc/networks (page 606). Example 31.7 /etc/networks
loopback localnet 127.0.0.0 192.168.0.0
/etc/host.conf
Name resolutionthe translation of host and network names via the resolver libraryis controlled by this file. This file is only used for programs linked to libc4 or libc5. For current glibc programs, refer to the settings in /etc/nsswitch.conf. A parameter must always stand alone in its own line. Comments are preceded by a # sign. Table 31.6, Parameters for /etc/host.conf (page 606) shows the parameters available. A sample /etc/host.conf is shown in Example 31.8, /etc/host.conf (page 607). Table 31.6 Parameters for /etc/host.conf Specifies in which order the services are accessed for the name resolution. Available arguments are (separated by blank spaces or commas): hosts: Searches the /etc/hosts file bind: Accesses a name server nis: Uses NIS multi on/off Defines if a host entered in /etc/hosts can have multiple IP addresses.
606
These parameters influence the name server spoofing, but, apart from that, do not exert any influence on the network configuration. The specified domain name is separated from the hostname after hostname resolution (as long as the hostname includes the domain name). This option is useful if only names from the local domain are in the /etc/hosts file, but should still be recognized with the attached domain names.
trim domainname
/etc/nsswitch.conf
The introduction of the GNU C Library 2.0 was accompanied by the introduction of the Name Service Switch (NSS). Refer to the nsswitch.conf(5) man page and The GNU C Library Reference Manual for details. The order for queries is defined in the file /etc/nsswitch.conf. A sample nsswitch.conf is shown in Example 31.9, /etc/nsswitch.conf (page 607). Comments are introduced by # signs. In this example, the entry under the hosts database means that a request is sent to /etc/hosts (files) via DNS (see Chapter 34, The Domain Name System (page 629)). Example 31.9 /etc/nsswitch.conf
passwd: group: hosts: networks: services: protocols: netgroup: automount: compat compat files dns files dns db files db files files files nis
Basic Networking
607
The databases available over NSS are listed in Table 31.7, Databases Available via /etc/nsswitch.conf (page 608). In addition, automount, bootparams, netmasks, and publickey are expected in the near future. The configuration options for NSS databases are listed in Table 31.8, Configuration Options for NSS Databases (page 609). Table 31.7 aliases Databases Available via /etc/nsswitch.conf Mail aliases implemented by sendmail; see man 5 aliases. Ethernet addresses. For user groups, used by getgrent. See also the man page for group. For hostnames and IP addresses, used by gethostbyname and similar functions. Valid host and user lists in the network for the purpose of controlling access permissions; see the netgroup(5) man page. Network names and addresses, used by getnetent. User passwords, used by getpwent; see the passwd(5) man page. Network protocols, used by getprotoent; see the protocols(5) man page. Remote procedure call names and addresses, used by getrpcbyname and similar functions. Network services, used by getservent. Shadow passwords of users, used by getspnam; see the shadow(5) man page.
ethers group
hosts
netgroup
networks passwd
protocols
rpc
services shadow
608
Configuration Options for NSS Databases directly access files, for example, /etc/aliases access via a database NIS, see also Chapter 36, Using NIS (page 673) can only be used as an extension for hosts and networks can only be used as an extension for passwd, shadow, and group
compat
/etc/nscd.conf
This file is used to configure nscd (name service cache daemon). See the nscd(8) and nscd.conf(5) man pages. By default, the system entries of passwd and groups are cached by nscd. This is important for the performance of directory services, like NIS and LDAP, because otherwise the network connection needs to be used for every access to names or groups. hosts is not cached by default, because the mechanism in nscd to cache hosts makes the local system unable to trust forward and reverse lookup checks. Instead of asking nscd to cache names, set up a caching DNS server. If the caching for passwd is activated, it usually takes about fifteen seconds until a newly added local user is recognized. Reduce this waiting time by restarting nscd with the command rcnscd restart.
/etc/HOSTNAME
This contains the hostname without the domain name attached. This file is read by several scripts while the machine is booting. It may only contain one line in which the hostname is set.
Basic Networking
609
610
tunnel This object represents a tunnel over IP. If no command is given, the default command is used, usually list. Change the state of a device with the command ip link set device_name command. For example, to deactivate device eth0, enter ip link seteth0 down. To activate it again, use ip link seteth0 up. After activating a device, you can configure it. To set the IP address, use ip addr add ip_address + dev device_name. For example, to set the address of the interface eth0 to 192.168.12.154/30 with standard broadcast (option brd), enter ip addr add 192.168.12.154/30 brd + dev eth0. To have a working connection, you must also configure the default gateway. To set gateway for your system, enter ip route get gateway_ip_address. To translate one IP address to another, use nat: ip route add nat ip_address via other_ip_address. To display all devices, use ip link ls. To display only running interfaces, use ip link ls up. To print interface statistics for a device, enter ip -s link ls device_name. To view addresses of your devices, enter ip addr. In the output of the ip addr, also find information about MAC addresses of your devices. To show all routes, use ip route show. For more information about using ip, enter ip help or see the ip(8) man page. The help option is also available for all ip objects. If, for example, you want to read help for ip addr, enter ip addr help. Find the ip manual in /usr/share/doc/ packages/iproute2/ip-cref.pdf.
ping output. The second-to-last line contains information about number of transmitted packets, packet loss, and total time of ping running. As the destination, you can use a hostname or IP address, for example, ping example.com or ping 130.57.5.75. The program sends packets until you press Ctrl + C . If you only need to check the functionality of the connection, you can limit the number of the packets with the -c option. For example to limit ping to three packets, enter ping -c 3 192.168.0. Example 31.10 Output of the Command ping
ping -c 3 example.com PING example.com (130.57.5.75) 56(84) bytes of data. 64 bytes from example.com (130.57.5.75): icmp_seq=1 ttl=49 time=188 ms 64 bytes from example.com (130.57.5.75): icmp_seq=2 ttl=49 time=184 ms 64 bytes from example.com (130.57.5.75): icmp_seq=3 ttl=49 time=183 ms --- example.com ping statistics --3 packets transmitted, 3 received, 0% packet loss, time 2007ms rtt min/avg/max/mdev = 183.417/185.447/188.259/2.052 ms
The default interval between two packets is one second. To change the interval, ping provides option -i. For example to increase ping interval to ten seconds, enter ping -i 10 192.168.0. In a system with multiple network devices, it is sometimes useful to send the ping through a specific interface address. To do so, use the -I option with the name of the selected device, for example, ping -I wlan1 192.168.0. For more options and information about using ping, enter ping -h or see the ping (8) man page.
612
NOTE: ifconfig and ip The program ifconfig is obsolete. Use ip instead. Without arguments, ifconfig displays the status of the currently active interfaces. As you can see in Example 31.11, Output of the ifconfig Command (page 613), ifconfig has very well-arranged and detailed output. The output also contains information about the MAC address of your device, the value of HWaddr, in the first line. Example 31.11 Output of the ifconfig Command
eth0 Link encap:Ethernet HWaddr 00:08:74:98:ED:51 inet6 addr: fe80::208:74ff:fe98:ed51/64 Scope:Link UP BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:634735 errors:0 dropped:0 overruns:4 frame:0 TX packets:154779 errors:0 dropped:0 overruns:0 carrier:1 collisions:0 txqueuelen:1000 RX bytes:162531992 (155.0 Mb) TX bytes:49575995 (47.2 Mb) Interrupt:11 Base address:0xec80 lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:8559 errors:0 dropped:0 overruns:0 frame:0 TX packets:8559 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:533234 (520.7 Kb) TX bytes:533234 (520.7 Kb) wlan1 Link encap:Ethernet HWaddr 00:0E:2E:52:3B:1D inet addr:192.168.2.4 Bcast:192.168.2.255 Mask:255.255.255.0 inet6 addr: fe80::20e:2eff:fe52:3b1d/64 Scope:Link UP BROADCAST NOTRAILERS RUNNING MULTICAST MTU:1500 Metric:1 RX packets:50828 errors:0 dropped:0 overruns:0 frame:0 TX packets:43770 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:45978185 (43.8 Mb) TX bytes:7526693 (7.1 Mb)
For more options and information about using ifconfig, enter ifconfig -h or see the ifconfig (8) man page.
Basic Networking
613
NOTE: route and ip The program route is obsolete. Use ip instead. route is especially useful if you need quick and comprehensible information about your routing configuration to determine problems with routing. To view your current routing configuration, enter route -n as root. Example 31.12 Output of the route -n Command
route -n Kernel IP routing table Destination Gateway Iface 10.20.0.0 * eth0 link-local * eth0 loopback * default eth0 styx.exam.com
Flags U U U UG
MSS Window 0 0 0 0 0 0 0 0
irtt 0 0 0 lo 0
For more options and information about using route, enter route -h or see the route (8) man page.
/etc/init.d/network This script handles the configuration of the network interfaces. The hardware must already have been initialized by /etc/init.d/coldplug (via hotplug). If the network service was not started, no network interfaces are implemented when they are inserted via hotplug.
614
/etc/init.d/inetd
Starts xinetd. xinetd can be used to make server services available on the system. For example, it can start vsftpd whenever an FTP connection is initiated.
/etc/init.d/portmap Starts the portmapper needed for the RPC server, such as an NFS server. /etc/init.d/ nfsserver /etc/init.d/ sendmail /etc/init.d/ypserv /etc/init.d/ypbind Starts the NFS server.
Basic Networking
615
616
Basic Networking
617
32
The service location protocol (SLP) was developed to simplify the configuration of networked clients within a local network. To configure a network client, including all required services, the administrator traditionally needs detailed knowledge of the servers available in the network. SLP makes the availability of selected services known to all clients in the local network. Applications that support SLP can use the information distributed and be configured automatically. IMPORTANT: SLP Support in SUSE Linux Enterprise Server Services that offer SLP support include cupsd, rsyncd, ypserv, openldap2, openwbem (CIM), ksysguardd, saned, kdm vnc login, smpppd, rpasswd, postfix, and sshd (via fish.) SUSE Linux Enterprise supports installation using installation sources provided with SLP and contains many system services with integrated support for SLP. YaST and Konqueror both have appropriate front-ends for SLP. You can use SLP to provide networked clients with central functions, such as an installation server, file server, or print server on your SUSE Linux Enterprise.
619
linuxrc starts an SLP inquiry after the system has booted from the selected boot medium and displays the sources found.
## Register a saned service on this system ## en means english language ## 65535 disables the timeout, so the service registration does ## not need refreshes service:scanner.sane://$HOSTNAME:6566,en,65535 watch-port-tcp=6566 description=SANE scanner daemon
The most important line in this file is the service URL, which begins with service:. This contains the service type (scanner.sane) and the address under which the service is available on the server. $HOSTNAME is automatically replaced with the full hostname. The name of the TCP port on which the relevant service can be found follows, separated by a colon. Then enter the language in which the service should appear and the duration of registration in seconds. These should be separated from the service URL by commas. Set the value for the duration of registration between 0 and 65535. 0 prevents registration. 65535 removes all restrictions. The registration file also contains the two variables watch-tcp-port and description. watch-tcp-port links the SLP service announcement to whether the relevant service is active by having slpd check the status of the service. The second variable contains a more precise description of the service that is displayed in suitable browsers.
620
TIP: YaST and SLP Some services brokered by YaST, such as an installation server or YOU server, perform this registration for you automatically when you activate SLP in the module dialogs. YaST then creates registration files for these services. Static Registration with /etc/slp.reg The only difference from the procedure with /etc/slp.reg.d is the grouping of all services within a central file. Dynamic Registration with slptool If a service should be registered for SLP from proprietary scripts, use the slptool command line front-end.
621
622
33
The NTP (network time protocol) mechanism is a protocol for synchronizing the system time over the network. First, a machine can obtain the time from a server that is a reliable time source. Second, a machine can itself act as a time source for other computers in the network. The goal is twofoldmaintaining the absolute time and synchronizing the system time of all machines within a network. Maintaining an exact system time is important in many situations. The built-in hardware (BIOS) clock does often not meet the requirements of applications like databases. Manual correction of the system time would lead to severe problems because, for example, a backward leap can cause malfunction of critical applications. Within a network, it is usually necessary to synchronize the system time of all machines, but manual time adjustment is a bad approach. xntp provides an mechanism to solve these problems. It continuously adjusts the system time with the help of reliable time servers in the network. It further enables the management of local reference clocks, such as radio-controlled clocks.
623
SuSEfirewall because they are part of a protected intranet. Both are described in the following.
In the detailed server selection dialog, determine whether to implement time synchronization using a time server from your local network (Local NTP Server) or an Internetbased time server that takes care of your time zone (Public NTP Server). For a local time server, click Lookup to start an SLP query for available time servers in your network. Select the most suitable time server from the list of search results and exit the dialog with OK. For a public time server, select your country (time zone) and a suitable server from the list under Public NTP Server then exit the dialog with OK. In the main
624
dialog, test the availability of the selected server with Test and quit the dialog with Finish.
In Complex NTP Client Configuration, determine whether xntpd should be started in a chroot jail. By default, Run NTP Daemon in Chroot Jail is activated. This increases the security in the event of an attack over xntpd, because it prevents the attacker from compromising the entire system. Configure NTP Daemon via DHCP sets up the NTP client to get a list of the NTP servers available in your network via DHCP. The servers and other time sources for the client to query are listed in the lower part. Modify this list as needed with Add, Edit, and Delete. Display Log provides the possibility to view the log files of your client.
625
Click Add to add a new source of time information. In the following dialog, select the type of source with which the time synchronization should be made. The following options are available: Server Another dialog enables you to select an NTP server (as described in Section 33.1.1, Quick NTP Client Configuration (page 624)). Activate Use for Initial Synchronization to trigger the synchronization of the time information between the server and the client when the system is booted. An input field allows you to specify additional options for xntpd. Refer to /usr/share/doc/packages/xntp-doc (part of the xntp-doc package) for detailed information. Peer A peer is a machine to which a symmetric relationship is established: it acts both as a time server and as a client. To use a peer in the same network instead of a server, enter the address of the system. The rest of the dialog is identical to the Server dialog. Radio Clock To use a radio clock in your system for the time synchronization, enter the clock type, unit number, device name, and other options in this dialog. Click Driver Calibration to fine-tune the driver. Detailed information about the operation of a local radio clock is available in /usr/share/doc/packages/xntp-doc/ html/refclock.htm. Outgoing Broadcast Time information and queries can also be transmitted by broadcast in the network. In this dialog, enter the address to which such broadcasts should be sent. Do not activate broadcasting unless you have a reliable time source like a radio controlled clock. Incoming Broadcast If you want your client to receive its information via broadcast, enter the address from which the respective packets should be accepted in this fields.
its name to the file /etc/ntp.conf by adding the line server ntp.example.com. To add more time servers, insert additional lines with the keyword server. After initializing xntpd with the command rcntpd start, it takes about one hour until the time is stabilized and the drift file for correcting the local computer clock is created. With the drift file, the systematic error of the hardware clock can be computed as soon as the computer is powered on. The correction is used immediately, resulting in a higher stability of the system time. There are two possible ways to use the NTP mechanism as a client: First, the client can query the time from a known server in regular intervals. With many clients, this approach can cause a high load on the server. Second, the client can wait for NTP broadcasts sent out by broadcast time servers in the network. This approach has the disadvantage that the quality of the server is unknown and a server sending out wrong information can cause severe problems. If the time is obtained via broadcast, you do not need the server name. In this case, enter the line broadcastclient in the configuration file /etc/ntp.conf. To use one or more known time servers exclusively, enter their names in the line starting with servers.
627
module, for example, has mode 5. To use this clock as a preferred reference, specify the keyword prefer. The complete server line for a Conrad DCF77 receiver module would be:
server 127.127.8.0 mode 5 prefer
Other clocks follow the same pattern. Following the installation of the xntp-doc package, the documentation for xntp is available in the directory /usr/share/doc/ packages/xntp-doc/html. The file /usr/share/doc/packages/ xntp-doc/html/refclock.htm provides links to the driver pages describing the driver parameters.
628
34
DNS (domain name system) is needed to resolve the domain names and hostnames into IP addresses. In this way, the IP address 192.168.0.0 is assigned to the hostname earth, for example. Before setting up your own name server, read the general information about DNS in Section 31.3, Name Resolution (page 577). The following configuration examples refer to BIND.
629
(not expired) zone data. If the slave cannot obtain a new copy of the zone data, it stops responding for the zone. Forwarder Forwarders are DNS servers to which your DNS server should send queries it cannot answer. Record The record is information about name and IP address. Supported records and their syntax are described in BIND documentation. Some special records are: NS record An NS record tells name servers which machines are in charge of a given domain zone. MX record The MX (mail exchange) records describe the machines to contact for directing mail across the Internet. SOA record SOA (Start of Authority) record is the first record in a zone file. The SOA record is used when using DNS to synchronize data between multiple computers.
630
1 When starting the module for the first time, the Forwarder Settings dialog, shown in Figure 34.1, DNS Server Installation: Forwarder Settings (page 631), opens. In it, decide whether the PPP daemon should provide a list of forwarders on dialup via DSL or ISDN (PPP Daemon Sets Forwarders) or whether you want to supply your own list (Set Forwarders Manually). Figure 34.1 DNS Server Installation: Forwarder Settings
2 The DNS Zones dialog consists of several parts and is responsible for the management of zone files, described in Section 34.5, Zone Files (page 646). For a new zone, provide a name for it in Zone Name. To add a reverse zone, the name must end in .in-addr.arpa. Finally, select the Zone Type (master or slave). See Figure 34.2, DNS Server Installation: DNS Zones (page 632). Click Edit Zone to configure other settings of an existing zone. To remove a zone, click Delete Zone.
631
3 In the final dialog, you can open the DNS port in the firewall by clicking Open Port in Firewall. Then decide whether or not the DNS server should be started (On or Off). You can also activate LDAP support. See Figure 34.3, DNS Server Installation: Finish Wizard (page 633).
632
633
Logging
To set what the DNS server should log and how, select Logging. Under Log Type, specify where the DNS server should write the log data. Use the systemwide log file /var/log/messages by selecting Log to System Log or specify a different file by selecting Log to File. In the latter case, additionally specify the maximum file size in megabytes and the number of log files to store. Further options are available under Additional Logging. Enabling Log All DNS Queries causes every query to be logged, in which case the log file could grow extremely large. For this reason, it is not a good idea to enable this option for other than debugging purposes. To log the data traffic during zone updates between DHCP and DNS server, enable Log Zone Updates. To log the data traffic during a zone transfer from master to slave, enable Log Zone Transfer. See Figure 34.4, DNS Server: Logging (page 634). Figure 34.4 DNS Server: Logging
634
Using ACLs
Use this window to define ACLs (access control lists) to enforce access restrictions. After providing a distinct name under Name, specify an IP address (with or without netmask) under Value in the following fashion:
{ 10.10/16; }
The syntax of the configuration file requires that the address ends with a semicolon and is put into curly braces.
TSIG Keys
The main purpose of TSIGs (transaction signatures) is to secure communications between DHCP and DNS servers. They are described in Section 34.7, Secure Transactions (page 651). To generate a TSIG key, enter a distinctive name in the field labeled Key ID and specify the file where the key should be stored (Filename). Confirm your choices with Add. To use a previously created key, leave the Key ID field blank and select the file where it is stored under File Name. After that, confirm with Add.
635
636
Zone Editor (NS Records) This dialog allows you to define alternative name servers for the zones specified. Make sure that your own name server is included in the list. To add a record, enter its name under Name Server to Add then confirm with Add. See Figure 34.7, DNS Server: Zone Editor (NS Records) (page 638).
637
Zone Editor (MX Records) To add a mail server for the current zone to the existing list, enter the corresponding address and priority value. After doing so, confirm by selecting Add. See Figure 34.8, DNS Server: Zone Editor (MX Records) (page 639).
638
Zone Editor (SOA) This page allows you to create SOA (start of authority) records. For an explanation of the individual options, refer to Example 34.6, File /var/lib/named/world.zone (page 647). Changing SOA records is not supported for dynamic zones managed via LDAP.
639
Zone Editor (Records) This dialog manages name resolution. In Record Key, enter the hostname then select its type. A-Record represents the main entry. The value for this should be an IP address. CNAME is an alias. Use the types NS and MX for detailed or partial records that expand on the information provided in the NS Records and MX Records tabs. These three types resolve to an existing A record. PTR is for reverse zones. It is the opposite of an A record.
640
a proper DNS. A simple example of this is included in the documentation in /usr/ share/doc/packages/bind/sample-config. TIP: Automatic Adaptation of the Name Server Information Depending on the type of Internet connection or the network connection, the name server information can automatically be adapted to the current conditions. To do this, set the variable MODIFY_NAMED_CONF_DYNAMICALLY in the file /etc/sysconfig/network/config to yes. However, do not set up any official domains until assigned one by the responsible institution. Even if you have your own domain and it is managed by the provider, you are better off not using it, because BIND would otherwise not forward requests for this domain. The Web server at the provider, for example, would not be accessible for this domain. To start the name server, enter the command rcnamed start as root. If done appears to the right in green, named, as the name server process is called, has been started successfully. Test the name server immediately on the local system with the host or dig programs, which should return localhost as the default server with the address 127.0.0.1. If this is not the case, /etc/resolv.conf probably contains an incorrect name server entry or the file does not exist at all. For the first test, enter host 127.0.0.1, which should always work. If you get an error message, use rcnamed status to see whether the server is actually running. If the name server does not start or behaves unexpectedly, you can usually find the cause in the log file /var/log/messages. To use the name server of the provider or one already running on your network as the forwarder, enter the corresponding IP address or addresses in the options section under forwarders. The addresses included in Example 34.1, Forwarding Options in named.conf (page 641) are just examples. Adjust these entries to your own setup. Example 34.1 Forwarding Options in named.conf
options { directory "/var/lib/named"; forwarders { 10.11.12.13; 10.11.12.14; }; listen-on { 127.0.0.1; 192.168.0.99; }; allow-query { 127/8; 192.168.0/24; }; notify no; };
641
The options entry is followed by entries for the zone, localhost, and 0.0.127.in-addr.arpa. The type hint entry under . should always be present. The corresponding files do not need to be modified and should work as they are. Also make sure that each entry is closed with a ; and that the curly braces are in the correct places. After changing the configuration file /etc/named.conf or the zone files, tell BIND to reread them with rcnamed reload. Achieve the same by stopping and restarting the name server with rcnamed restart. Stop the server at any time by entering rcnamed stop.
642
643
127.0.0.1 to permit requests from the local host. If you omit this entry entirely, all interfaces are used by default. listen-on-v6 port 53 {any; }; Tells BIND on which port it should listen for IPv6 client requests. The only alternative to any is none. As far as IPv6 is concerned, the server only accepts a wild card address. query-source address * port 53; This entry is necessary if a firewall is blocking outgoing DNS requests. This tells BIND to post requests externally from port 53 and not from any of the high ports above 1024. query-source-v6 address * port 53; Tells BIND which port to use for IPv6 queries. allow-query { 127.0.0.1; net; }; Defines the networks from which clients can post DNS requests. Replace net with address information like 192.168.1/24. The /24 at the end is an abbreviated expression for the netmask, in this case, 255.255.255.0. allow-transfer ! *;; Controls which hosts can request zone transfers. In the example, such requests are completely denied with ! *. Without this entry, zone transfers can be requested from anywhere without restrictions. statistics-interval 0; In the absence of this entry, BIND generates several lines of statistical information per hour in /var/log/messages. Set it to 0 to suppress these statistics completely or set an interval in minutes. cleaning-interval 720; This option defines at which time intervals BIND clears its cache. This triggers an entry in /var/log/messages each time it occurs. The time specification is in minutes. The default is 60 minutes. interface-interval 0; BIND regularly searches the network interfaces for new or nonexistent interfaces. If this value is set to 0, this is not done and BIND only listens at the interfaces detected at start-up. Otherwise, the interval can be defined in minutes. The default is sixty minutes. 644 Installation and Administration
notify no; no prevents other name servers from being informed when changes are made to the zone data or when the name server is restarted.
34.4.2 Logging
What, how, and where logging takes place can be extensively configured in BIND. Normally, the default settings should be sufficient. Example 34.3, Entry to Disable Logging (page 645) shows the simplest form of such an entry and completely suppresses any logging. Example 34.3 Entry to Disable Logging
logging { category default { null; }; };
After zone, specify the name of the domain to administer (my-domain.de) followed by in and a block of relevant options enclosed in curly braces, as shown in Example 34.4, Zone Entry for my-domain.de (page 645). To define a slave zone, switch the type to slave and specify a name server that administers this zone as master (which, in turn, may be a slave of another master), as shown in Example 34.5, Zone Entry for other-domain.de (page 645). Example 34.5 Zone Entry for other-domain.de
zone "other-domain.de" in { type slave; file "slave/other-domain.zone"; masters { 10.0.0.1; }; };
645
type master; By specifying master, tell BIND that the zone is handled by the local name server. This assumes that a zone file has been created in the correct format. type slave; This zone is transferred from another name server. It must be used together with masters. type hint; The zone . of the hint type is used to set the root name servers. This zone definition can be left as is. file my-domain.zone or file slave/other-domain.zone; This entry specifies the file where zone data for the domain is located. This file is not required for a slave, because this data is fetched from another name server. To differentiate master and slave files, use the directory slave for the slave files. masters { server-ip-address; }; This entry is only needed for slave zones. It specifies from which name server the zone file should be transferred. allow-update {! *; }; This option controls external write access, which would allow clients to make a DNS entrysomething not normally desirable for security reasons. Without this entry, zone updates are not allowed at all. The above entry achieves the same because ! * effectively bans any such activity.
646
again. A missing or wrongly placed dot is probably the most frequent cause of name server configuration errors. The first case to consider is the zone file world.zone, responsible for the domain world.cosmos, shown in Example 34.6, File /var/lib/named/world.zone (page 647). Example 34.6 File /var/lib/named/world.zone
$TTL 2D world.cosmos. IN SOA 2003072441 1D 2H 1W 2D ) IN NS IN MX gateway sun moon earth mars www IN IN IN IN IN IN IN A A A A A A CNAME gateway serial refresh retry expiry minimum root.world.cosmos. (
; ; ; ; ;
Line 1: $TTL defines the default time to live that should apply to all the entries in this file. In this example, entries are valid for a period of two days (2 D). Line 2: This is where the SOA (start of authority) control record begins: The name of the domain to administer is world.cosmos in the first position. This ends with a ., because otherwise the zone would be appended a second time. Alternatively, @ can be entered here, in which case the zone would be extracted from the corresponding entry in /etc/named.conf. After IN SOA is the name of the name server in charge as master for this zone. The name is expanded from gateway to gateway.world.cosmos, because it does not end with a .. An e-mail address of the person in charge of this name server follows. Because the @ sign already has a special meaning, . is entered here instead. For
647
root@world.cosmos the entry must read root.world.cosmos.. The . must be included at the end to prevent the zone from being added. The ( includes all lines up to ) into the SOA record. Line 3: The serial number is an arbitrary number that is increased each time this file is changed. It is needed to inform the secondary name servers (slave servers) of changes. For this, a 10 digit number of the date and run number, written as YYYYMMDDNN, has become the customary format. Line 4: The refresh rate specifies the time interval at which the secondary name servers verify the zone serial number. In this case, one day. Line 5: The retry rate specifies the time interval at which a secondary name server, in case of error, attempts to contact the primary server again. Here, two hours. Line 6: The expiration time specifies the time frame after which a secondary name server discards the cached data if it has not regained contact to the primary server. Here, it is a week. Line 7: The last entry in the SOA record specifies the negative caching TTLthe time for which results of unresolved DNS queries from other servers may be cached. Line 9: The IN NS specifies the name server responsible for this domain. gateway is extended to gateway.world.cosmos because it does not end with a .. There can be several lines like thisone for the primary and one for each secondary name server. If notify is not set to no in /etc/named.conf, all the name servers listed here are informed of the changes made to the zone data. Line 10: The MX record specifies the mail server that accepts, processes, and forwards emails for the domain world.cosmos. In this example, this is the host sun.world.cosmos. The number in front of the hostname is the preference value. If there are multiple MX entries, the mail server with the smallest value is
648
taken first and, if mail delivery to this server fails, an attempt is made with the next higher value. Lines 1217: These are the actual address records where one or more IP addresses are assigned to hostnames. The names are listed here without a . because they do not include their domain, so world.cosmos is added to all of them. Two IP addresses are assigned to the host gateway, because it has two network cards. Wherever the host address is a traditional one (IPv4), the record is marked with A. If the address is an IPv6 address, the entry is marked with A6. The previous token for IPv6 addresses was AAAA, which is now obsolete. NOTE: A6 Syntax The A6 record has a slightly different syntax than AAAA. Because of the fragmentation possibility, it is necessary to provide information about missed bits before the address. You must provide this information even if you want to use a completely unfragmented address. For the old AAAA record with the syntax
pluto IN pluto IN AAAA 2345:00C1:CA11:0001:1234:5678:9ABC:DEF0 AAAA 2345:00D2:DA11:0001:1234:5678:9ABC:DEF0
You need to add information about missing bits in A6 format. Because the example above is complete (does not miss any bits), the A6 format of this record is:
pluto IN pluto IN AAAA 0 2345:00C1:CA11:0001:1234:5678:9ABC:DEF0 AAAA 0 2345:00D2:DA11:0001:1234:5678:9ABC:DEF0
Do not use IPv4 addresses with IPv6 mapping. If a host has an IPv4 address, it uses an A record, not an A6. Line 18: The alias www can be used to address mond (CNAME means canonical name). The pseudodomain in-addr.arpa is used for the reverse lookup of IP addresses into hostnames. It is appended to the network part of the address in reverse notation. So 192.168.1 is resolved into 1.168.192.in-addr.arpa. See Example 34.7, Reverse Lookup (page 650).
649
$TTL 2D 1.168.192.in-addr.arpa. IN SOA gateway.world.cosmos. root.world.cosmos. ( 2003072441 ; serial 1D ; refresh 2H ; retry 1W ; expiry 2D ) ; minimum IN NS 1 2 3 IN PTR IN PTR IN PTR gateway.world.cosmos. gateway.world.cosmos. earth.world.cosmos. mars.world.cosmos.
Line 1: $TTL defines the standard TTL that applies to all entries here. Line 2: The configuration file should activate reverse lookup for the network 192.168.1.0. Given that the zone is called 1.168.192.in-addr.arpa, should not be added to the hostnames. Therefore, all hostnames are entered in their complete formwith their domain and with a . at the end. The remaining entries correspond to those described for the previous world.cosmos example. Lines 37: See the previous example for world.cosmos. Line 9: Again this line specifies the name server responsible for this zone. This time, however, the name is entered in its complete form with the domain and a . at the end. Lines 1113: These are the pointer records hinting at the IP addresses on the respective hosts. Only the last part of the IP address is entered at the beginning of the line, without the . at the end. Appending the zone to this (without the .in-addr.arpa) results in the complete IP address in reverse order. Normally, zone transfers between different versions of BIND should be possible without any problem.
650
The key itself (a string like ejIkuCyyGJwwuN3xAteKgg==) is found in both files. To use it for transactions, the second file (Khost1-host2.+157+34265.key) must be transferred to the remote host, preferably in a secure way (using scp, for example). On the remote server, the key must be included in the file /etc/named.conf to enable a secure communication between host1 and host2:
key host1-host2. { algorithm hmac-md5;
651
secret ";ejIkuCyyGJwwuN3xAteKgg==; };
WARNING: File Permissions of /etc/named.conf Make sure that the permissions of /etc/named.conf are properly restricted. The default for this file is 0640, with the owner being root and the group named. As an alternative, move the keys to an extra file with specially limited permissions, which is then included from /etc/named.conf. To include an external file, use:
include "filename"
Replace filename with an absolute path to your file with keys. To enable the server host1 to use the key for host2 (which has the address 192.168.2.3 in this example), the server's /etc/named.conf must include the following rule:
server 192.168.2.3 { keys { host1-host2. ;}; };
Analogous entries must be included in the configuration files of host2. Add TSIG keys for any ACLs (access control lists, not to be confused with file system ACLs) that are defined for IP addresses and address ranges to enable transaction security. The corresponding entry could look like this:
allow-update { key host1-host2. ;};
This topic is discussed in more detail in the BIND Administrator Reference Manual under update-policy.
652
algorithm is currently used to generate these keys. The public keys generated should be included in the corresponding zone file with an $INCLUDE rule. With the command dnssec-makekeyset, all keys generated are packaged into one set, which must then be transferred to the parent zone in a secure manner. On the parent, the set is signed with dnssec-signkey. The files generated by this command are then used to sign the zones with dnssec-signzone, which in turn generates the files to include for each zone in /etc/named.conf.
653
DHCP
35
The purpose of the dynamic host configuration protocol (DHCP) is to assign network settings centrally from a server rather than configuring them locally on each and every workstation. A host configured to use DHCP does not have control over its own static address. It is enabled to configure itself completely and automatically according to directions from the server. If you use the NetworkManager on the client side, you do not need to configure the client at all. This is useful if you have changing environments and only one interface active at a time. Never use NetworkManager on a machine that runs a DHCP server. TIP: IBM System z: DHCP Support On IBM System z platforms, DHCP only works on interfaces using the OSA and OSA Express network cards. These cards are the only ones with a MAC, which is required for DHCP's autoconfiguration features. One way to configure a DHCP server is to identify each client using the hardware address of its network card (which is fixed in most cases), then supply that client with identical settings each time it connects to the server. DHCP can also be configured to assign addresses to each interested client dynamically from an address pool set up for that purpose. In the latter case, the DHCP server tries to assign the same address to the client each time it receives a request, even over longer periods. This works only if the network does not have more clients than addresses. DHCP makes life easier for system administrators. Any changes, even bigger ones, related to addresses and the network configuration in general can be implemented centrally by editing the server's configuration file. This is much more convenient than reconfig-
DHCP
655
uring numerous workstations. Also it is much easier to integrate machines, particularly new machines, into the network, because they can be given an IP address from the pool. Retrieving the appropriate network settings from a DHCP server is especially useful in the case of laptops regularly used in different networks. A DHCP server supplies not only the IP address and the netmask, but also the hostname, domain name, gateway, and name server addresses for the client to use. In addition to that, DHCP allows a number of other parameters to be configured in a centralized way, for example, a time server from which clients may poll the current time or even a print server.
656
Global Settings Use the check box to determine whether your DHCP settings should be automatically stored by an LDAP server. In the entry fields, provide the network specifics for all clients the DHCP server should manage. These specifics are the domain name, address of a time server, addresses of the primary and secondary name server, addresses of a print and a WINS server (for a mixed network with both Windows and Linux clients), gateway address, and lease time. See Figure 35.2, DHCP Server: Global Settings (page 658).
DHCP
657
Dynamic DHCP In this step, configure how dynamic IP addresses should be assigned to clients. To do so, specify an IP range from which the server can assign addresses to DHCP clients. All these addresses must be covered by the same netmask. Also specify the lease time during which a client may keep its IP address without needing to request an extension of the lease. Optionally, specify the maximum lease timethe period during which the server reserves an IP address for a particular client. See Figure 35.3, DHCP Server: Dynamic DHCP (page 659).
658
Finishing the Configuration and Setting the Start Mode After the third part of the configuration wizard, a last dialog is shown in which you can define how the DHCP server should be started. Here, specify whether to start the DHCP server automatically when the system is booted or manually when needed (for example, for test purposes). Click Finish to complete the configuration of the server. See Figure 35.4, DHCP Server: Start-Up (page 660). Alternatively, you can select Host Management from the tree structure to the left to configure special host management features in addition to the basic configuration (see Figure 35.5, DHCP Server: Host Management (page 661)).
DHCP
659
Host Management Instead of using dynamic DHCP in the way described in the preceding sections, you can also configure the server to assign addresses in quasi-static fashion. To do so, use the entry fields provided in the lower part to specify a list of the clients to manage in this way. Specifically, provide the Name and the IP Address to give to such a client, the Hardware Address, and the Network Type (token ring or ethernet). Modify the list of clients, which is shown in the upper part, with Add, Edit, and Delete from List. See Figure 35.5, DHCP Server: Host Management (page 661).
660
DHCP
661
Selecting the Declaration Type The Global Options of the DHCP server are made up of a number of declarations. This dialog lets you set the declaration types Subnet, Host, Shared Network, Group, Pool of Addresses, and Class. This example shows the selection of a new subnetwork (see Figure 35.7, DHCP Server: Selecting a Declaration Type (page 663)).
662
Subnet Configuration This dialog allows you specify a new subnet with its IP address and netmask. In the middle part of the dialog, modify the DHCP server start options for the selected subnet using Add, Edit, and Delete. To set up dynamic DNS for the subnet, select Dynamic DNS.
DHCP
663
TSIG Key Management If you chose to configure dynamic DNS in the previous dialog, you can now configure the key management for a secure zone transfer. Selecting OK takes you to another dialog in which to configure the interface for dynamic DNS (see Figure 35.10, DHCP Server: Interface Configuration for Dynamic DNS (page 666)).
664
Dynamic DNS: Interface Configuration You can now activate dynamic DNS for the subnet by selecting Enable Dynamic DNS for This Subnet. After doing so, use the drop-down list to choose the TSIG keys for forward and reverse zones, making sure that keys are the same for the DNS and the DHCP server. With Update Global Dynamic DNS Settings, enable the automatic update and adjustment of the global DHCP server settings according to the dynamic DNS environment. Finally, define which forward and reverse zones should be updated per dynamic DNS, specifying the name of the primary name server for each of the two zones. If the name server runs on the same host as the DHCP server, you can leave these fields blank. Selecting Ok returns to the subnet configuration dialog (see Figure 35.8, DHCP Server: Configuring Subnets (page 664)). Selecting Ok again returns to the original expert configuration dialog.
DHCP
665
Network Interface Configuration To define the interfaces where the DHCP server should listen and adjust the firewall configuration, select Advanced Interface Configuration from the expert configuration dialog. From the list of interfaces displayed, select one or more that should be attended by the the DHCP server. If clients in all of the subnets should be able to communicate with the server and the server host also runs a firewall, adjust the firewall accordingly. To do so, select Adapt Firewall Settings. YaST then adjusts the rules of SuSEfirewall2 to the new conditions (see Figure 35.11, DHCP Server: Network Interface and Firewall (page 667)), after which you can return to the original dialog by selecting Ok.
666
After completing all the configuration steps, close the dialog with Ok. The server is now started with its new configuration.
DHCP
667
domain-name "cosmos.all"; domain-name-servers 192.168.1.1, 192.168.1.2; broadcast-address 192.168.1.255; routers 192.168.1.254; subnet-mask 255.255.255.0;
subnet 192.168.1.0 netmask 255.255.255.0 { range 192.168.1.10 192.168.1.20; range 192.168.1.100 192.168.1.200; }
This simple configuration file should be sufficient to get the DHCP server to assign IP addresses in the network. Make sure that a semicolon is inserted at the end of each line, because otherwise dhcpd is not started. The sample file can be divided into three sections. The first one defines how many seconds an IP address is leased to a requesting client by default (default-lease-time) before it should apply for renewal. The section also includes a statement of the maximum period for which a machine may keep an IP address assigned by the DHCP server without applying for renewal (max-lease-time). In the second part, some basic network parameters are defined on a global level: The line option domain-name defines the default domain of your network. With the entry option domain-name-servers, specify up to three values for the DNS servers used to resolve IP addresses into hostnames and vice versa. Ideally, configure a name server on your machine or somewhere else in your network before setting up DHCP. That name server should also define a hostname for each 668 Installation and Administration
dynamic address and vice versa. To learn how to configure your own name server, read Chapter 34, The Domain Name System (page 629). The line option broadcast-address defines the broadcast address the requesting client should use. With option routers, set where the server should send data packets that cannot be delivered to a host on the local network (according to the source and target host address and the subnet mask provided). In most cases, especially in smaller networks, this router is identical to the Internet gateway. With option subnet-mask, specify the netmask assigned to clients. The last section of the file defines a network, including a subnet mask. To finish, specify the address range that the DHCP daemon should use to assign IP addresses to interested clients. In Example 35.1, The Configuration File /etc/dhcpd.conf (page 668), clients may be given any address between 192.168.1.10 and 192.168.1.20 as well as 192.168.1.100 and 192.168.1.200. After editing these few lines, you should be able to activate the DHCP daemon with the command rcdhcpd start. It will be ready for use immediately. Use the command rcdhcpd check-syntax to perform a brief syntax check. If you encounter any unexpected problems with your configurationthe server aborts with an error or does not return done on startyou should be able to find out what has gone wrong by looking for information either in the main system log /var/log/messages or on console 10 ( Ctrl + Alt + F10 ). On a default SUSE Linux Enterprise system, the DHCP daemon is started in a chroot environment for security reasons. The configuration files must be copied to the chroot environment so the daemon can find them. Normally, there is no need to worry about this because the command rcdhcpd start automatically copies the files.
DHCP
669
To identify a client configured with a static address, dhcpd uses the hardware address, which is a globally unique, fixed numerical code consisting of six octet pairs for the identification of all network devices (for example, 00:00:45:12:EE:F4). If the respective lines, like the ones in Example 35.2, Additions to the Configuration File (page 670), are added to the configuration file of Example 35.1, The Configuration File /etc/dhcpd.conf (page 668), the DHCP daemon always assigns the same set of data to the corresponding client. Example 35.2 Additions to the Configuration File
host earth { hardware ethernet 00:00:45:12:EE:F4; fixed-address 192.168.1.21; }
The name of the respective client (host hostname, here earth) is entered in the first line and the MAC address in the second line. On Linux hosts, find the MAC address with the command ip link show followed by the network device (for example, eth0). The output should contain something like
link/ether 00:00:45:12:EE:F4
In the preceding example, a client with a network card having the MAC address 00:00:45:12:EE:F4 is assigned the IP address 192.168.1.21 and the hostname earth automatically. The type of hardware to enter is ethernet in nearly all cases, although token-ring, which is often found on IBM systems, is also supported.
670
/etc/localtime /etc/host.conf /etc/hosts /etc/resolv.conf These files are copied to /var/lib/dhcp/etc/ when starting the init script. Take these copies into account for any changes that they require if they are dynamically modified by scripts like /etc/ppp/ip-up. However, there should be no need to worry about this if the configuration file only specifies IP addresses (instead of hostnames). If your configuration includes additional files that should be copied into the chroot environment, set these under the variable DHCPD_CONF_INCLUDE_FILES in the file /etc/sysconfig/dhcpd. To ensure that the DHCP logging facility keeps working even after a restart of the syslog-ng daemon, there is an additional entry SYSLOGD_ADDITIONAL_SOCKET_DHCP in the file /etc/sysconfig/syslog.
DHCP
671
Using NIS
36
As soon as multiple UNIX systems in a network want to access common resources, it becomes important that all user and group identities are the same for all machines in that network. The network should be transparent to users: whatever machines they use, they always find themselves in exactly the same environment. This is made possible by means of NIS and NFS services. NFS distributes file systems over a network and is discussed in Chapter 39, Sharing File Systems with NFS (page 725). NIS (Network Information Service) can be described as a database-like service that provides access to the contents of /etc/passwd, /etc/shadow, and /etc/group across networks. NIS can also be used for other purposes (making the contents of files like /etc/hosts or /etc/services available, for example), but this is beyond the scope of this introduction. People often refer to NIS as YP, because it works like the network's yellow pages.
Using NIS
673
and set up slave servers in the subnets as described in Section 36.1.2, Configuring a NIS Slave Server (page 678).
674
a Enter the NIS domain name. b Define whether the host should also be a NIS client, enabling users to log in and access data from the NIS server, by selecting This host is also a NIS client. Select Changing of passwords to allow users in your network (both local users and those managed through the NIS server) to change their passwords on the NIS server (with the command yppasswd). This makes the options Allow Changes to GECOS Field and Allow Changes to Login Shell available. GECOS means that the users can also change their names and address settings with the command ypchfn. SHELL allows users to change their default shell with the command ypchsh, for example, to switch from bash to sh. The new shell must be one of the predefined entries in /etc/shells. c If your NIS server should act as a master server to NIS slave servers in other subnets, select Active Slave NIS Server exists. d Select Open Ports in Firewall to have YaST adapt the firewall settings for the NIS server. Figure 36.2 Master Server Setup
Using NIS
675
e Leave this dialog with Next or click Other global settings to make additional settings. Other global settings include changing the source directory of the NIS server (/etc by default). In addition, passwords can be merged here. The setting should be Yes so the files (/etc/passwd, /etc/shadow, and /etc/group) are used to build the user database. Also determine the smallest user and group ID that should be offered by NIS. Click OK to confirm your settings and return to the previous screen. Figure 36.3 Changing the Directory and Synchronizing Files for a NIS Server
4 If you previously enabled Active Slave NIS Server Exists, enter the hostnames used as slaves and click Next. 5 If you do not use slave servers, the slave configuration is skipped and you continue directly to the dialog for the database configuration. Here, specify the maps, the partial databases to transfer from the NIS server to the client. The default settings are usually adequate. Leave this dialog with Next. 6 Check which maps should be available and click Next to continue.
676
7 Enter the hosts that are allowed to query the NIS server. You can add, edit, or delete hosts by clicking the appropriate button. Specify from which networks requests can be sent to the NIS server. Normally, this is your internal network. In this case, there should be the following two entries:
255.0.0.0 0.0.0.0 127.0.0.0 0.0.0.0
The first entry enables connections from your own host, which is the NIS server. The second one allows all hosts to send requests to the server.
Using NIS
677
678
c Set This host is also a NIS client if you want to enable user logins on this server. d Adapt the firewall settings with Open Ports in Firewall. e Click Next. 4 Enter the hosts that are allowed to query the NIS server. You can add, edit, or delete hosts by clicking the appropriate button. Specify from which networks requests can be sent to the NIS server. Normally, this is all hosts. In this case, there should be the following two entries:
255.0.0.0 0.0.0.0 127.0.0.0 0.0.0.0
The first entry enables connections from your own host, which is the NIS server. The second one allows all hosts with access to the same network to send requests to the server. 5 Click Finish to save changes and exit the setup.
Using NIS
679
In the expert settings, disable Answer Remote Hosts if you do not want other hosts to be able to query which server your client is using. By checking Broken Server, the client is enabled to receive replies from a server communicating through an unprivileged port. For further information, see man ypbind. After you have made your settings, click Finish to save them and return to the YaST control center. Figure 36.6 Setting Domain and Address of a NIS Server
680
37
The Lightweight Directory Access Protocol (LDAP) is a set of protocols designed to access and maintain information directories. LDAP can be used for numerous purposes, such as user and group management, system configuration management, or address management. This chapter provides a basic understanding of how OpenLDAP works and how to manage LDAP data with YaST. While there are several implementations of the LDAP protocol, this chapter focuses entirely on the OpenLDAP implementation. It is crucial within a networked environment to keep important information structured and quickly available. This can be done with a directory service that, like the common yellow pages, keeps information available in a well-structured, quickly searchable form. In the ideal case, a central server keeps the data in a directory and distributes it to all clients using a certain protocol. The data is structured in a way that allows a wide range of applications to access it. That way, it is not necessary for every single calendar tool and e-mail client to keep its own databasea central repository can be accessed instead. This notably reduces the administration effort for the information. The use of an open and standardized protocol like LDAP ensures that as many different client applications as possible can access such information. A directory in this context is a type of database optimized for quick and effective reading and searching: To make numerous concurrent reading accesses possible, write access is limited to a small number of updates by the administrator. Conventional databases are optimized for accepting the largest possible data volume in a short time.
681
Because write accesses can only be executed in a restricted fashion, a directory service is used to administer mostly unchanging, static information. Data in a conventional database typically changes very often (dynamic data). Phone numbers in a company directory do not change nearly as often as, for example, the figures administered in accounting. When static data is administered, updates of the existing data sets are very rare. When working with dynamic data, especially when data sets like bank accounts or accounting are concerned, the consistency of the data is of primary importance. If an amount should be subtracted from one place to be added to another, both operations must happen concurrently, within a transaction, to ensure balance over the data stock. Databases support such transactions. Directories do not. Short-term inconsistencies of the data are quite acceptable in directories. The design of a directory service like LDAP is not laid out to support complex update or query mechanisms. All applications accessing this service should gain access quickly and easily.
682
Mail routing (postfix, sendmail) Address books for mail clients, like Mozilla, Evolution, and Outlook Administration of zone descriptions for a BIND9 name server User authentication with Samba in heterogeneous networks This list can be extended because LDAP is extensible, unlike NIS. The clearly-defined hierarchical structure of the data eases the administration of large amounts of data, because it can be searched more easily.
683
The complete diagram is a fictional directory information tree. The entries on three levels are depicted. Each entry corresponds to one box in the picture. The complete, valid distinguished name for the fictional SUSE employee Geeko Linux, in this case, is cn=Geeko Linux,ou=doc,dc=suse,dc=de. It is composed by adding the RDN cn=Geeko Linux to the DN of the preceding entry ou=doc,dc=suse,dc=de. The types of objects that should be stored in the DIT are globally determined following a scheme. The type of an object is determined by the object class. The object class determines what attributes the concerned object must or can be assigned. A scheme, therefore, must contain definitions of all object classes and attributes used in the desired application scenario. There are a few common schemes (see RFC 2252 and 2256). It is, however, possible to create custom schemes or to use multiple schemes complementing each other if this is required by the environment in which the LDAP server should operate. Table 37.1, Commonly Used Object Classes and Attributes (page 685) offers a small overview of the object classes from core.schema and inetorgperson.schema used in the example, including required attributes and valid attribute values.
684
Table 37.1
Commonly Used Object Classes and Attributes Meaning Example Entry Required Attributes dc
Object Class
dcObject
domainComponent (name com- suse ponents of the domain) organizationalUnit (organizational unit) doc
organizationalUnit inetOrgPerson
ou
sn and cn
Example 37.1, Excerpt from schema.core (page 685) shows an excerpt from a scheme directive with explanations (line numbering for explanatory reasons). Example 37.1 Excerpt from schema.core
#1 attributetype (2.5.4.11 NAME ( 'ou' 'organizationalUnitName') #2 DESC 'RFC2256: organizational unit this object belongs to' #3 SUP name ) ... #4 objectclass ( 2.5.6.5 NAME 'organizationalUnit' #5 DESC 'RFC2256: an organizational unit' #6 SUP top STRUCTURAL #7 MUST ou #8 MAY (userPassword $ searchGuide $ seeAlso $ businessCategory $ x121Address $ registeredAddress $ destinationIndicator $ preferredDeliveryMethod $ telexNumber $ teletexTerminalIdentifier $ telephoneNumber $ internationaliSDNNumber $ facsimileTelephoneNumber $ street $ postOfficeBox $ postalCode $ postalAddress $ physicalDeliveryOfficeName $ st $ l $ description) ) ...
The attribute type organizationalUnitName and the corresponding object class organizationalUnit serve as an example here. Line 1 features the name of the attribute, its unique OID (object identifier) (numerical), and the abbreviation of the attribute.
685
Line 2 gives a brief description of the attribute with DESC. The corresponding RFC on which the definition is based is also mentioned here. SUP in line 3 indicates a superordinate attribute type to which this attribute belongs. The definition of the object class organizationalUnit begins in line 4, like in the definition of the attribute, with an OID and the name of the object class. Line 5 features a brief description of the object class. Line 6, with its entry SUP top, indicates that this object class is not subordinate to another object class. Line 7, starting with MUST, lists all attribute types that must be used in conjunction with an object of the type organizationalUnit. Line 8, starting with MAY, lists all attribute types that are permitted in conjunction with this object class. A very good introduction to the use of schemes can be found in the documentation of OpenLDAP. When installed, find it in /usr/share/doc/packages/openldap2/ admin-guide/index.html.
This first directive in slapd.conf, shown in Example 37.2, slapd.conf: Include Directive for Schemes (page 686), specifies the scheme by which the LDAP directory is organized. The entry core.schema is required. Additionally required schemes are appended to this directive. Find information in the included OpenLDAP documentation.
686
These two files contain the PID (process ID) and some of the arguments with which the slapd process is started. There is no need for modifications here. Example 37.4 slapd.conf: Access Control
# Sample Access Control # Allow read access of root DSE # Allow self write access # Allow authenticated users read access # Allow anonymous users to authenticate # access to dn="" by * read access to * by self write by users read by anonymous auth # # if no access controls are present, the default is: # Allow read by all # # rootdn can always write!
Example 37.4, slapd.conf: Access Control (page 687) is the excerpt from slapd .conf that regulates the access permissions for the LDAP directory on the server. The settings made here in the global section of slapd.conf are valid as long as no custom access rules are declared in the database-specific section. These would overwrite the global declarations. As presented here, all users have read access to the directory, but only the administrator (rootdn) can write to this directory. Access control regulation in LDAP is a highly complex process. The following tips can help: Every access rule has the following structure:
access to <what> by <who> <access>
what is a placeholder for the object or attribute to which access is granted. Individual directory branches can be protected explicitly with separate rules. It is also possible to process regions of the directory tree with one rule by using regular expressions. slapd evaluates all rules in the order in which they are listed in the configuration file. More general rules should be listed after more specific onesthe first rule slapd regards as valid is evaluated and all following entries are ignored. who determines who should be granted access to the areas determined with what. Regular expressions may be used. slapd again aborts the evaluation of who after LDAPA Directory Service 687
the first match, so more specific rules should be listed before the more general ones. The entries shown in Table 37.2, User Groups and Their Access Grants (page 688) are possible. Table 37.2 Tag * anonymous users self dn.regex=<regex> User Groups and Their Access Grants Scope All users without exception Not authenticated (anonymous) users Authenticated users Users connected with the target object All users matching the regular expression
access specifies the type of access. Use the options listed in Table 37.3, Types of Access (page 688). Table 37.3 Tag none auth compare search read write Types of Access Scope of Access No access For contacting the server To objects for comparison access For the employment of search filters Read access Write access
688
slapd compares the access right requested by the client with those granted in slapd.conf. The client is granted access if the rules allow a higher or equal right than the requested one. If the client requests higher rights than those declared in the rules, it is denied access. Example 37.5, slapd.conf: Example for Access Control (page 689) shows an example of a simple access control that can be arbitrarily developed using regular expressions. Example 37.5 slapd.conf: Example for Access Control
access to dn.regex="ou=([^,]+),dc=suse,dc=de" by dn.regex="cn=administrator,ou=$1,dc=suse,dc=de" write by user read by * none
This rule declares that only its respective administrator has write access to an individual ou entry. All other authenticated users have read access and the rest of the world has no access. TIP: Establishing Access Rules If there is no access to rule or no matching by directive, access is denied. Only explicitly declared access rights are granted. If no rules are declared at all, the default principle is write access for the administrator and read access for the rest of the world. Find detailed information and an example configuration for LDAP access rights in the online documentation of the installed openldap2 package. Apart from the possibility to administer access permissions with the central server configuration file (slapd.conf), there is access control information (ACI). ACI allows storage of the access information for individual objects within the LDAP tree. This type of access control is not yet common and is still considered experimental by the developers. Refer to http://www.openldap.org/faq/data/cache/758.html for information.
689
The type of database, a Berkeley database in this case, is set in the first line of this section (see Example 37.6, slapd.conf: Database-Specific Directives (page 690)). checkpoint determines the amount of data (in kb) that is kept in the transaction log before it is written to the actual database and the time (in minutes) between two write actions. cachesize sets the number of objects kept in the database's cache. suffix determines for which portion of the LDAP tree this server should be responsible. The following rootdn determines who owns administrator rights to this server. The user declared here does not need to have an LDAP entry or exist as regular user. The administrator password is set with rootpw. Instead of using secret here, it is possible to enter the hash of the administrator password created by slappasswd. The directory directive indicates the directory in the file system where the database directories are stored on the server. The last directive, index objectClass eq, results in the maintenance of an index of all object classes. Attributes for which users search most often can be added here according to experience. Custom Access rules defined here for the database are used instead of the global Access rules.
690
server manually, enter the command rcldap stop. Request the status of the running LDAP server with rcldap status. The YaST runlevel editor, described in Section 20.2.3, Configuring System Services (Runlevel) with YaST (page 396), can be used to have the server started and stopped automatically on boot and halt of the system. It is also possible to create the corresponding links to the start and stop scripts with the insserv command from a command prompt as described in Section 20.2.2, Init Scripts (page 392).
691
IMPORTANT: Encoding of LDIF Files LDAP works with UTF-8 (Unicode). Umlauts must be encoded correctly. Use an editor that supports UTF-8, such as Kate or recent versions of Emacs. Otherwise, avoid umlauts and other special characters or use recode to recode the input to UTF-8. Save the file with the .ldif suffix then pass it to the server with the following command:
ldapadd -x -D <dn of the administrator> -W -f <file>.ldif
-x switches off the authentication with SASL in this case. -D declares the user that calls the operation. The valid DN of the administrator is entered here just like it has been configured in slapd.conf. In the current example, this is cn=admin,dc=suse,dc=de. -W circumvents entering the password on the command line (in clear text) and activates a separate password prompt. This password was previously determined in slapd.conf with rootpw. -f passes the filename. See the details of running ldapadd in Example 37.8, ldapadd with example.ldif (page 693).
692
The user data of individuals can be prepared in separate LDIF files. Example 37.9, LDIF Data for Tux (page 693) adds Tux to the new LDAP directory. Example 37.9 LDIF Data for Tux
# coworker Tux dn: cn=Tux Linux,ou=devel,dc=suse,dc=de objectClass: inetOrgPerson cn: Tux Linux givenName: Tux sn: Linux mail: tux@suse.de uid: tux telephoneNumber: +49 1234 567-8
An LDIF file can contain an arbitrary number of objects. It is possible to pass entire directory branches to the server at once or only parts of it as shown in the example of individual objects. If it is necessary to modify some data relatively often, a fine subdivision of single objects is recommended.
693
Import the modified file into the LDAP directory with the following command:
ldapmodify -x -D cn=admin,dc=suse,dc=de -W -f tux.ldif
Alternatively, pass the attributes to change directly to ldapmodify. The procedure for this is described below: 1 Start ldapmodify and enter your password:
ldapmodify -x -D cn=admin,dc=suse,dc=de -W Enter LDAP password:
2 Enter the changes while carefully complying with the syntax in the order presented below:
dn: cn=Tux Linux,ou=devel,dc=suse,dc=de changetype: modify replace: telephoneNumber telephoneNumber: +49 1234 567-10
Find detailed information about ldapmodify and its syntax in the ldapmodify man page.
The -b option determines the search basethe section of the tree within which the search should be performed. In the current case, this is dc=suse,dc=de. To perform a more finely-grained search in specific subsections of the LDAP directory (for example, only within the devel department), pass this section to ldapsearch with -b. -x requests activation of simple authentication. (objectClass=*) declares that all objects contained in the directory should be read. This command option can be used after the creation of a new directory tree to verify that all entries have been recorded correctly and the server responds as desired. Find more information about the use of ldapsearch in the corresponding man page (ldapsearch(1)).
694
695
1 Log in as root. 2 Start YaST and select Network Services LDAP Server. 3 Set LDAP to be started at system boot. 4 If the LDAP server should announce its services via SLP, check Register at an SLP Daemon. 5 Select Configure to configure General Settings and Databases. To configure the Global Settings of your LDAP server, proceed as follows: 1 Accept or modify the schema files included in the server's configuration by selecting Schema Files in the left part of the dialog. The default selection of schema files applies to the server providing a source of YaST user account data. 2 With Log Level Settings, configure the degree of logging activity (verbosity) of the LDAP server. From the predefined list, select or deselect the logging options according to your needs. The more options are enabled, the larger your log files grow. 3 Determine the connection types the LDAP server should allow. Choose from: bind_v2 This option enables connection requests (bind requests) from clients using the previous version of the protocol (LDAPv2). bind_anon_cred Normally the LDAP server denies any authentication attempts with empty credentials (DN or password). Enabling this option, however, makes it possible to connect with a password and no DN to establish an anonymous connection. bind_anon_dn Enabling this option makes it possible to connect without authentication (anonymously) using a DN but no password.
696
update_anon Enabling this option allows nonauthenticated (anonymous) update operations. Access is restricted according to ACLs and other rules (see Section 37.3.1, Global Directives in slapd.conf (page 686)). 4 To configure secure communication between client and server, proceed with TLS Settings: a Set TLS Active to Yes to enable TLS and SSL encryption of the client/server communication. b Click Select Certificate and determine how to obtain a valid certificate. Choose Import Certificate (import certificate from external source) or Use Common Server Certificate (use the certificate created upon installation of SUSE Linux Enterprise Server). If you opted for importing a certificate, YaST prompts you to specify the exact path to its location. If you opted for using the common server certificate and it has not been created during installation, it is subsequently created.
To configure the databases managed by your LDAP server, proceed as follows: 1 Select the Databases item in the left part of the dialog. 2 Click Add Database to add the new database. 3 Enter the requested data: Base DN Enter the base DN of your LDAP server. Root DN Enter the DN of the administrator in charge of the server. If you check Append Base DN, only provide the cn of the administrator and the system fills in the rest automatically.
697
LDAP Password Enter the password for the database administrator. Encryption Determine the encryption algorithm to use to secure the password of Root DN. Choose crypt, smd5, ssha, or sha. The dialog also includes a plain option to enable the use of plain text passwords, but enabling this is not recommended for security reasons. To confirm your settings and return to the previous dialog, select OK. To edit a previously created database, select its base DN in the tree to the left. In the right part of the window, YaST displays a dialog similar to the one used for the creation of a new databasewith the main difference that the base DN entry is grayed out and cannot be changed. After leaving the LDAP server configuration by selecting Finish, you are ready to go with a basic working configuration for your LDAP server. To fine-tune this setup, edit the file /etc/openldap/slapd.conf accordingly then restart the server.
698
pam_ldap.so is installed and the PAM configuration is adapted (see Example 37.11, pam_unix2.conf Adapted to LDAP (page 699)). Example 37.11 pam_unix2.conf Adapted to LDAP
auth: account: password: session: use_ldap use_ldap use_ldap none
When manually configuring additional services to use LDAP, include the PAM LDAP module in the PAM configuration file corresponding to the service in /etc/pam.d. Configuration files already adapted to individual services can be found in /usr/ share/doc/packages/pam_ldap/pam.d/. Copy appropriate files to /etc/ pam.d. glibc name resolution through the nsswitch mechanism is adapted to the employment of LDAP with nss_ldap. A new, adapted file nsswitch.conf is created in /etc with the installation of this package. Find more about the workings of nsswitch .conf in Section 31.6.1, Configuration Files (page 603). The following lines must be present in nsswitch.conf for user administration and authentication with LDAP. See Example 37.12, Adaptations in nsswitch.conf (page 699). Example 37.12 Adaptations in nsswitch.conf
passwd: compat group: compat passwd_compat: ldap group_compat: ldap
These lines order the resolver library of glibc first to evaluate the corresponding files in /etc and additionally access the LDAP server as sources for authentication and user data. Test this mechanism, for example, by reading the content of the user database with the command getent passwd. The returned set should contain a survey of the local users of your system as well as all users stored on the LDAP server. To prevent regular users managed through LDAP from logging in to the server with ssh or login, the files /etc/passwd and /etc/group each need to include an additional line. This is the line +::::::/sbin/nologin in /etc/passwd and +::: in /etc/group.
699
Basic Configuration
The basic LDAP client configuration dialog (Figure 37.3, YaST: Configuration of the LDAP Client (page 700)) opens during installation if you choose LDAP user management or when you select Network Services LDAP Client in the YaST Control Center in the installed system. Figure 37.3 YaST: Configuration of the LDAP Client
700
To authenticate users of your machine against an OpenLDAP server and enable user management via OpenLDAP, proceed as follows: 1 Click Use LDAP to enable the use of LDAP. Select Use LDAP but Disable Logins instead if you want to use LDAP for authentication, but do not want other users to log in to this client. 2 Enter the IP address of the LDAP server to use. 3 Enter the LDAP base DN to select the search base on the LDAP server. To retrieve the base DN automatically, click Fetch DN. YaST then checks for any LDAP database on the server address specified above. Choose the appropriate base DN from the search results given by YaST. 4 If TLS or SSL protected communication with the server is required, select LDAP TLS/SSL. 5 If the LDAP server still uses LDAPv2, explicitly enable the use of this protocol version by selecting LDAP Version 2. 6 Select Start Automounter to mount remote directories on your client, such as a remotely managed /home. 7 Click Finish to apply your settings.
701
To modify data on the server as administrator, click Advanced Configuration. The following dialog is split in two tabs. See Figure 37.4, YaST: Advanced Configuration (page 702). 1 In the Client Settings tab, adjust the following settings to your needs: a If the search base for users, passwords, and groups differs from the global search base specified the LDAP base DN, enter these different naming contexts in User Map, Password Map, and Group Map. b Specify the password change protocol. The standard method to use whenever a password is changed is crypt, meaning that password hashes generated by crypt are used. For details on this and other options, refer to the pam_ldap man page. c Specify the LDAP group to use with Group Member Attribute. The default value for this is member. 2 In Administration Settings, adjust the following settings:
702
a Set the base for storing your user management data via Configuration Base DN. b Enter the appropriate value for Administrator DN. This DN must be identical with the rootdn value specified in /etc/openldap/slapd.conf to enable this particular user to manipulate data stored on the LDAP server. Enter the full DN (such as cn=admin,dc=suse,dc=de) or activate Append Base DN to have the base DN added automatically when you enter cn=admin. c Check Create Default Configuration Objects to create the basic configuration objects on the server to enable user management via LDAP. d If your client machine should act as a file server for home directories across your network, check Home Directories on This Machine. e Click Accept to leave the Advanced Configuration then Finish to apply your settings. Use Configure User Management Settings to edit entries on the LDAP server. Access to the configuration modules on the server is then granted according to the ACLs and ACIs stored on the server. Follow the procedures outlined in Section Configuring the YaST Group and User Administration Modules (page 703).
703
The dialog for module configuration (Figure 37.5, YaST: Module Configuration (page 704)) allows the creation of new modules, selection and modification of existing configuration modules, and design and modification of templates for such modules. To create a new configuration module, proceed as follows: 1 Click New and select the type of module to create. For a user configuration module, select suseuserconfiguration and for a group configuration choose susegroupconfiguration. 2 Choose a name for the new template. The content view then features a table listing all attributes allowed in this module with their assigned values. Apart from all set attributes, the list also contains all other attributes allowed by the current schema but currently not used. 3 Accept the preset values or adjust the defaults to use in group and user configuration by selecting the respective attribute, pressing Edit, and entering the new value. Rename a module by simply changing the cn attribute of the module. Clicking Delete deletes the currently selected module. 4 After you click Accept, the new module is added to the selection menu.
704
The YaST modules for group and user administration embed templates with sensible standard values. To edit a template associated with a configuration module, proceed as follows: 1 In the Module Configuration dialog, click Configure Template. 2 Determine the values of the general attributes assigned to this template according to your needs or leave some of them empty. Empty attributes are deleted on the LDAP server. 3 Modify, delete, or add new default values for new objects (user or group configuration objects in the LDAP tree). Figure 37.6 YaST: Configuration of an Object Template
Connect the template to its module by setting the susedefaulttemplate attribute value of the module to the DN of the adapted template. TIP The default values for an attribute can be created from other attributes by using a variable instead of an absolute value. For example, when creating a
705
new user, cn=%sn %givenName is created automatically from the attribute values for sn and givenName. Once all modules and templates are configured correctly and ready to run, new groups and users can be registered in the usual way with YaST.
706
The initial input form of user administration offers LDAP Options. This gives the possibility to apply LDAP search filters to the set of available users or go to the module for the configuration of LDAP users and groups by selecting LDAP User and Group Configuration.
707
Quick Start Guide Brief step-by-step instructions for installing your first LDAP server. Find it at http://www.openldap.org/doc/admin22/quickstart.html or on an installed system in /usr/share/doc/packages/openldap2/ admin-guide/quickstart.html. OpenLDAP 2.2 Administrator's Guide A detailed introduction to all important aspects of LDAP configuration, including access controls and encryption. See http://www.openldap.org/doc/ admin22/ or, on an installed system, /usr/share/doc/packages/ openldap2/admin-guide/index.html. Understanding LDAP A detailed general introduction to the basic principles of LDAP: http://www .redbooks.ibm.com/redbooks/pdfs/sg244986.pdf. Printed literature about LDAP: LDAP System Administration by Gerald Carter (ISBN 1-56592-491-6) Understanding and Deploying LDAP Directory Services by Howes, Smith, and Good (ISBN 0-672-32316-8) The ultimate reference material for the subject of LDAP is the corresponding RFCs (request for comments), 2251 to 2256.
708
Samba
Using Samba, a Unix machine can be configured as a file and print server for DOS, Windows, and OS/2 machines. Samba has developed into a fully-fledged and rather complex product. Configure Samba with YaST, SWAT (a Web interface), or the configuration file.
38
38.1 Terminology
The following are some terms used in Samba documentation and in the YaST module. SMB protocol Samba uses the SMB (server message block) protocol that is based on the NetBIOS services. Due to pressure from IBM, Microsoft released the protocol so other software manufacturers could establish connections to a Microsoft domain network. With Samba, the SMB protocol works on top of the TCP/IP protocol, so the TCP/IP protocol must be installed on all clients. TIP: IBM System z: NetBIOS Support IBM System z merely support SMB over TCP/IP. NetBIOS support is not available on these systems. CIFS protocol CIFS (common Internet file system) protocol is another protocol supported by Samba. CIFS defines a standard remote file system access protocol for use over
Samba
709
the network, enabling groups of users to work together and share documents across the network. NetBIOS NetBIOS is a software interface (API) designed for communication between machines. Here, a name service is provided. It enables machines connected to the network to reserve names for themselves. After reservation, these machines can be addressed by name. There is no central process that checks names. Any machine on the network can reserve as many names as it wants as long as the names are not already in use. The NetBIOS interface can now be implemented for different network architectures. An implementation that works relatively closely with network hardware is called NetBEUI, but this is often referred to as NetBIOS. Network protocols implemented with NetBIOS are IPX from Novell (NetBIOS via TCP/IP) and TCP/IP. The NetBIOS names sent via TCP/IP have nothing in common with the names used in /etc/hosts or those defined by DNS. NetBIOS uses its own, completely independent naming convention. However, it is recommended to use names that correspond to DNS hostnames to make administration easier. This is the default used by Samba. Samba server Samba server is a server that provides SMB/CIFS services and NetBIOS over IP naming services to clients. For Linux, there are two daemons for Samba server: smnd for SMB/CIFS services and nmbd for naming services. Samba client Samba client is a system that uses Samba services from a Samba server over the SMB protocol. All common operating systems, such as Mac OS X, Windows, and OS/2, support the SMB protocol. The TCP/IP protocol must be installed on all computers. Samba provides a client for the different UNIX flavors. For Linux, there is a kernel module for SMB that allows the integration of SMB resources on the Linux system level. You do not need run any daemon for Samba client. Shares SMB servers provide hardware space to their clients by means of shares. Shares are printers and directories with their subdirectories on the server. It is exported by means of a name and can be accessed by its name. The share name can be set to any nameit does not have to be the name of the export directory. A printer is also assigned a name. Clients can access the printer by its name.
710
Samba
711
Shares
In the Shares tab, determine the Samba shares to activate. There are some predefined shares, like homes and printers. Use Toggle Status to switch between Active and Inactive. Click Add to add new shares and Delete to delete the selected share.
Identity
In the Identity tab, you can determine the domain with which the host is associated (Base Settings) and whether to use an alternative hostname in the network (NetBIOS Host Name). To set expert global settings or set user authentication, for example LDAP, click Advanced Settings.
712
Using LDAP
In the tab LDAP Settings, you can determine the LDAP server to use for authentication. To test the connection to your LDAP server, click Test Connection. To set expert LDAP settings or use default values, click Advanced Settings. Find more information about LDAP configuration in Chapter 37, LDAPA Directory Service (page 681).
Samba
713
workgroup = TUX-NET This line assigns the Samba server to a workgroup. Replace TUX-NET with an appropriate workgroup of your networking environment. Your Samba server appears under its DNS name unless this name has been assigned to any other machine in the network. If the DNS name is not available, set the server name using netbiosname=MYNAME. See mansmb.conf for more details about this parameter. os level = 2 This parameter triggers whether your Samba server tries to become LMB (local master browser) for its workgroup. Choose a very low value to spare the existing Windows network from any disturbances caused by a misconfigured Samba server. More information about this important topic can be found in the files BROWSING.txt and BROWSING-Config.txt under the textdocs subdirectory of the package documentation. If no other SMB server is present in your network (such as a Windows NT or 2000 server) and you want the Samba server to keep a list of all systems present in the local environment, set the os level to a higher value (for example, 65). Your Samba server is then chosen as LMB for your local network. When changing this setting, consider carefully how this could affect an existing Windows network environment. First test the changes in an isolated network or at a noncritical time of day. wins support and wins server To integrate your Samba server into an existing Windows network with an active WINS server, enable the wins server option and set its value to the IP address of that WINS server. If your Windows machines are connected to separate subnets and should still be aware of each other, you need to set up a WINS server. To turn a Samba server into such a WINS server, set the option wins support = Yes. Make sure that only one Samba server of the network has this setting enabled. The options wins server and wins support must never be enabled at the same time in your smb.conf file.
714
Shares
The following examples illustrate how a CD-ROM drive and the user directories (homes) are made available to the SMB clients. [cdrom] To avoid having the CD-ROM drive accidentally made available, these lines are deactivated with comment marks (semicolons in this case). Remove the semicolons in the first column to share the CD-ROM drive with Samba. Example 38.1 A CD-ROM Share
;[cdrom] ; comment = Linux CD-ROM ; path = /media/cdrom ; locking = No
[cdrom] and comment The entry [cdrom] is the name of the share that can be seen by all SMB clients on the network. An additional comment can be added to further describe the share. path = /media/cdrom path exports the directory /media/cdrom. By means of a very restrictive default configuration, this kind of share is only made available to the users present on this system. If this share should be made available to everybody, add a line guest ok = yes to the configuration. This setting gives read permissions to anyone on the network. It is recommended to handle this parameter with great care. This applies even more to the use of this parameter in the [global] section. [homes] The [home] share is of special importance here. If the user has a valid account and password for the Linux file server and his own home directory, he can be connected to it.
Samba
715
[homes] As long as there is no other share using the share name of the user connecting to the SMB server, a share is dynamically generated using the [homes] share directives. The resulting name of the share is the username. valid users = %S %S is replaced with the concrete name of the share as soon as a connection has been successfully established. For a [homes] share, this is always the username. As a consequence, access rights to a user's share are restricted exclusively to the user. browseable = No This setting makes the share invisible in the network environment. read only = No By default, Samba prohibits write access to any exported share by means of the read only = Yes parameter. To make a share writable, set the value read only = No, which is synonymous with writable = Yes. create mask = 0640 Systems that are not based on MS Windows NT do not understand the concept of UNIX permissions, so they cannot assign permissions when creating a file. The parameter create mask defines the access permissions assigned to newly created files. This only applies to writable shares. In effect, this setting means the owner has read and write permissions and the members of the owner's primary group have read permissions. valid users = %S prevents read access even if the group has read permissions. For the group to have read or write access, deactivate the line valid users = %S.
716
Security Levels
To improve security, each share access can be protected with a password. SMB has three possible ways of checking the permissions: Share Level Security (security = share) A password is firmly assigned to a share. Everyone who knows this password has access to that share. User Level Security (security = user) This variation introduces the concept of the user to SMB. Each user must register with the server with his own password. After registration, the server can grant access to individual exported shares dependent on usernames. Server Level Security (security = server): To its clients, Samba pretends to be working in user level mode. However, it passes all password queries to another user level mode server, which takes care of authentication. This setting expects an additional parameter (password server). The selection of share, user, or server level security applies to the entire server. It is not possible to offer individual shares of a server configuration with share level security and others with user level security. However, you can run a separate Samba server for each configured IP address on a system. More information about this subject can be found in the Samba HOWTO Collection. For multiple servers on one system, pay attention to the options interfaces and bind interfaces only.
mouse. If you activate Also Use SMB Information for Linux Authentication, the user authentication runs over the Samba server. After completing all settings, click Finish to finish the configuration.
If encrypted passwords are used for verification purposesthis is the default setting with well-maintained MS Windows 9x installations, MS Windows NT 4.0 from service pack 3, and all later productsthe Samba server must be able to handle these. The entry encrypt passwords = yes in the [global] section enables this (with Samba version 3, this is now the default). In addition, it is necessary to prepare user accounts 718 Installation and Administration
and passwords in an encryption format that conforms with Windows. Do this with the command smbpasswd -a name. Create the domain account for the computers, required by the Windows NT domain concept, with the following commands: Example 38.4 Setting Up a Machine Account
useradd hostname\$ smbpasswd -a -m hostname
With the useradd command, a dollar sign is added. The command smbpasswd inserts this automatically when the parameter -m is used. The commented configuration example (/usr/share/doc/packages/Samba/examples/smb.conf.SuSE) contains settings that automate this task. Example 38.5 Automated Setup of a Machine Account
add machine script = /usr/sbin/useradd -g nogroup -c "NT Machine Account" \ -s /bin/false %m\$
To make sure that Samba can execute this script correctly, choose a Samba user with the required administrator permissions. To do so, select one user and add it to the ntadmin group. After that, all users belonging to this Linux group can be assigned Domain Admin status with the command:
net groupmap add ntgroup="Domain Admins" unixgroup=ntadmin
More information about this topic is provided in Chapter 12 of the Samba HOWTO Collection, found in /usr/share/doc/packages/samba/ Samba-HOWTO-Collection.pdf.
To join an AD domain in a running system, proceed as follows: 1 Log in as root and start YaST. 2 Start Network Services Windows Domain Membership. 3 Enter the domain to join at Domain or Workgroup in the Windows Domain Membership screen. Alternately, use Browse to get a list of all available domains and select one. Figure 38.1 Determining Windows Domain Membership
4 Check Also Use SMB Information for Linux Authentication to use the SMB source for Linux authentication on your SUSE Linux Enterprise Server. 5 Click Finish and confirm the domain join when prompted for it. 6 Provide the password for the Windows Administrator on the AD server and click OK.
720
Your server is now set up to pull in all authentication data from the Active Directory domain controller.
Samba
721
722
2 Assign each of the UNIX groups to NT groups: Example 38.6 Example Script initGroups.sh
#!/bin/bash #### Keep this as a shell script for future re-use # Known domain global groups net groupmap modify ntgroup="Domain Admins" unixgroup=root net groupmap modify ntgroup="Domain Users" unixgroup=users net groupmap modify ntgroup="Domain Guests" unixgroup=nobody # Our domain global groups net groupmap add ntgroup="Operation" unixgroup=operation type=d net groupmap add ntgroup="Shipping" unixgroup=shipping type=d
Samba
723
Find detailed information about LDAP and migration from Windows NT or 2000 in /usr/share/doc/packages/samba/examples/LDAP/ smbldap-tools-*/doc, where * is your smbldap-tools version.
724
39
725
If user directories from the machine sun, for example, should be imported, use the following command:
mount sun:/home /home
726
cations to all members of a group without installing them locally on each and every host. To install such a server, start YaST and select Network Services NFS Server. A dialog like that in Figure 39.2, NFS Server Configuration Tool (page 727) opens. Figure 39.2 NFS Server Configuration Tool
Next, activate Start NFS Server and click Next. In the upper text field, enter the directories to export. Below, enter the hosts that should have access to them. This dialog is shown in Figure 39.3, Configuring an NFS Server with YaST (page 728). There are four options that can be set for each host: single host, netgroups, wildcards, and IP networks. A more thorough explanation of these options is provided by man exports. Exit completes the configuration.
727
IMPORTANT: Automatic Firewall Configuration If a firewall is active on your system (SuSEfirewall2), YaST adapts its configuration for the NFS server by enabling the nfs service when Open Ports in Firewall is selected.
728
File Synchronization
Today, many people use several computersone computer at home, one or several computers at the workplace, and possibly a laptop or PDA on the road. Many files are needed on all these computers. You may want to be able to work with all computers and modify the files and subsequently have the latest version of the data available on all computers.
40
File Synchronization
729
WARNING: Risk of Data Loss Before you start managing your data with a synchronization system, you should be well acquainted with the program used and test its functionality. A backup is indispensable for important files. The time-consuming and error-prone task of manually synchronizing data can be avoided by using one of the programs that use various methods to automate this job. The following summaries are merely intended to convey a general understanding of how these programs work and how they can be used. If you plan to use them, read the program documentation.
40.1.1 Unison
Unison is not a network file system. Instead, the files are simply saved and edited locally. The program Unison can be executed manually to synchronize files. When the synchronization is performed for the first time, a database is created on the two hosts, containing checksums, time stamps, and permissions of the selected files. The next time it is executed, Unison can recognize which files were changed and propose transmission from or to the other host. Usually all suggestions can be accepted.
40.1.2 CVS
CVS, which is mostly used for managing program source versions, offers the possibility to keep copies of the files on multiple computers. Accordingly, it is also suitable for data synchronization. CVS maintains a central repository on the server in which the files and changes to files are saved. Changes that are performed locally are committed to the repository and can be retrieved from other computers by means of an update. Both procedures must be initiated by the user. CVS is very resilient to errors when changes occur on several computers. The changes are merged and, if changes took place in the same lines, a conflict is reported. When a conflict occurs, the database remains in a consistent state. The conflict is only visible for resolution on the client host.
730
40.1.3 Subversion
In contrast to CVS, which evolved, Subversion (SVN) is a consistently designed project. Subversion was developed as a technically improved successor to CVS. Subversion has been improved in many respects to its predecessor. Due to its history, CVS only maintains files and is oblivious of directories. Directories also have a version history in Subversion and can be copied and renamed just like files. It is also possible to add metadata to every file and to every directory. This metadata can be fully maintained with versioning. As opposed to CVS, Subversion supports transparent network access over dedicated protocols, like WebDAV (Web-based Distributed Authoring and Versioning). WebDAV extends the functionality of the HTTP protocol to allow collaborative write access to files on remote Web servers. Subversion was largely assembled on the basis of existing software packages. Therefore, the Apache Web server and the WebDAV extension always run in conjunction with Subversion.
40.1.4 mailsync
Unlike the synchronization tools covered in the previous sections, mailsync only synchronizes e-mails between mailboxes. The procedure can be applied to local mailbox files as well as to mailboxes on an IMAP server. Based on the message ID contained in the e-mail header, the individual messages are either synchronized or deleted. Synchronization is possible between individual mailboxes and between mailbox hierarchies.
40.1.5 rsync
When no version control is needed but large directory structures need to be synchronized over slow network connections, the tool rsync offers well-developed mechanisms for transmitting only changes within files. This not only concerns text files, but also binary files. To detect the differences between files, rsync subdivides the files into blocks and computes checksums over them.
File Synchronization
731
The effort put into the detection of the changes comes at a price. The systems to synchronize should be scaled generously for the usage of rsync. RAM is especially important.
40.2.2 Portability
Subversion, CVS, and unison are also available for many other operating systems, including various Unix and Windows systems.
732
40.2.6 History
An additional feature of Subversion or CVS is that old file versions can be reconstructed. A brief editing remark can be inserted for each change and the development of the files can easily be traced later based on the content and the remarks. This is a valuable aid for theses and program texts.
File Synchronization
733
40.2.8 GUI
Unison offers a graphical user interface that displays the synchronization procedures Unison wants to perform. Accept the proposal or exclude individual files from the synchronization. In text mode, interactively confirm the individual procedures. Experienced users normally run Subversion or CVS from the command line. However, graphical user interfaces are available for Linux, such as cervisia, and for other operating systems, like wincvs. Many development tools, such as kdevelop, and text editors, such as emacs, provide support for CVS or Subversion. The resolution of conflicts is often much easier to perform with these front-ends.
734
File Synchronization
735
unison History -
rsync o + +(ssh) +
mailsync + o +(SSL) +
40.3.1 Requirements
Unison must be installed on the client as well as on the server. In this context, the term server refers to a second, remote host (unlike CVS, explained in Section 40.1.2, CVS (page 730)). In the following section, Unison is used together with ssh. In this case, an SSH client must be installed on the client and an SSH server must be installed on the server.
736
You want to synchronize these two directories. The user is known as tux on the client and as geeko on the server. The first thing to do is to test if the client-server communication works:
unison -testserver /home/tux/dir1 ssh://geeko@server//homes/geeko/dir2
The most frequently encountered problems are: The Unison versions used on the client and server are not compatible. The server does not allow SSH connections. Neither of the two specified paths exists. If everything works, omit the option -testserver. During the first synchronization, Unison does not yet know the relationship between the two directories and submits suggestions for the transfer direction of the individual files and directories. The arrows in the Action column indicate the transfer direction. A question mark means that Unison is not able to make a suggestion regarding the transfer direction because both versions were changed or are new. The arrow keys can be used to set the transfer direction for the individual entries. If the transfer directions are correct for all displayed entries, simply click Go. The characteristics of Unison (for example, whether to perform the synchronization automatically in clear cases) can be controlled by means of command-line parameters specified when the program is started. View the complete list of all parameters with unison --help.
File Synchronization
737
For each pair, a synchronization log is maintained in the user directory ~/.unison. Configuration sets, such as ~/.unison/example.prefs, can also be stored in this directory. To start the synchronization, specify this file as the command-line parameter as in unison example.prefs.
738
CVS_RSH=ssh CVSROOT=tux@server:/serverdir
The command cvs init can be used to initialize the CVS server from the client side. This needs to be done only once. Finally, the synchronization must be assigned a name. Select or create a directory on the client exclusively to contain files to manage with CVS (the directory can also be empty). The name of the directory is also the name of the synchronization. In this example, the directory is called synchome. Change to this directory and enter the following command to set the synchronization name to synchome:
cvs import synchome tux wilber
Many CVS commands require a comment. For this purpose, CVS starts an editor (the editor defined in the environment variable $EDITOR or vi if no editor was defined). The editor call can be circumvented by entering the comment in advance on the command line, such as in the following example:
cvs import -m 'this is a test' synchome tux wilber
File Synchronization
739
cvs diff file1 directory1. Use cvs -nq update to see which files would be affected by an update. Here are some of the status symbols displayed during an update: U The local version was updated. This affects all files that are provided by the server and missing on the local system. M The local version was modified. If there were changes on the server, it was possible to merge the differences in the local copy. P The local version was patched with the version on the server. C The local file conflicts with current version in the repository. ? This file does not exist in CVS. The status M indicates a locally modified file. Either commit the local copy to the server or remove the local file and run the update again. In this case, the missing file is retrieved from the server. If you commit a locally modified file and the file was changed in the same line and committed, you might get a conflict, indicated with C. In this case, look at the conflict marks (> and <) in the file and decide between the two versions. As this can be a rather unpleasant job, you might decide to abandon your changes, delete the local file, and enter cvs up to retrieve the current version from the server.
740
Other options can be listed with svnadmin help. As opposed to CVS, Subversion is not based on RCS, but rather on different types of repository. The Berkeley Database or FSFS (a repository that uses the file system directly) is commonly used. Do not install a repository on remote file systems, like NFS, AFS, or Windows SMB. The database requires POSIX locking mechanisms, which these file systems do not support. The command svnlook provides information about an existing repository.
svnlook info /path/to/repository
A server must be configured to allow different users to access the repository. Either use the Apache Web server with WebDAV to do this or use svnserve, the server packaged with Subversion. Once svnserve is up and running, the repository can be accessed with a URL with svn:// or svn+ssh://. Users that should authenticate themselves when calling svn can be set in /etc/svnserve.conf. A decision for Apache or for svnserve depends on many factors. It is recommended to browse the Subversion book. More information about it can be found in Section 40.5.3, For More Information (page 744).
File Synchronization
741
The content provided by a correctly configured server fitted with a corresponding repository can be accessed by any client with one of the following commands:
svn list http://svn.example.com/path/to/project
or
svn list svn://svn.example.com/path/to/project
Save an existing project in the current directory (check it out) with the command svn checkout:
svn checkout http://svn.example.com/path/to/project nameofproject
Checking out creates a new subdirectory nameofproject on the client. Operations (adding, copying, renaming, deleting) can then be performed on it:
svn svn svn svn add file copy oldfile newfile move oldfile newfile delete file
These commands can also be used on directories. Subversion can additionally record properties of a file or directory:
svn propset license GPL foo.txt
The preceding example sets the value GPL for the property license. Display properties with svn proplist:
742
Save the changes to the server with svn commit Another user can incorporate your changes in his working directory by synchronizing with the server using svn update. Unlike CVS, the status of a working directory in Subversion can be displayed without accessing the repository with svn status. Local changes are displayed in five columns, with the first one being the most important one: '' No changes. 'A' Object is marked for addition. 'D' Object is marked for deletion. 'M' Object was modified. 'C' Object is in conflict. 'I' Object was ignored. '?' Object is not being maintained by versioning control. '!' Object is reported missing. This flag appears when the object was deleted or moved without the svn command. '~' Object was being maintained as a file but has since been replaced by a directory or the opposite has occurred. The second column shows the status of properties. The meaning of all other columns can be read in the Subversion book.
File Synchronization
743
Up to this point, the handling does not differ much from that of a regular copying tool, like scp. rsync should be operated in rsync mode to make all its features fully available. This is done by starting the rsyncd daemon on one of the systems. Configure it in the file /etc/rsyncd.conf. For example, to make the directory /srv/ftp available with rsync, use the following configuration: 744 Installation and Administration
gid = nobody uid = nobody read only = true use chroot = no transfer logging = true log format = %h %o %f %l %b log file = /var/log/rsyncd.log [FTP] path = /srv/ftp comment = An Example
Then start rsyncd with rcrsyncd start. rsyncd can also be started automatically during the boot process. Set this up by activating this service in the runlevel editor provided by YaST or by manually entering the command insserv rsyncd. rsyncd can alternatively be started by xinetd. This is, however, only recommended for servers that rarely use rsyncd. The example also creates a log file listing all connections. This file is stored in /var/ log/rsyncd.log. It is then possible to test the transfer from a client system. Do this with the following command:
rsync -avz sun::FTP
This command lists all files present in the directory /srv/ftp of the server. This request is also logged in the log file /var/log/rsyncd.log. To start an actual transfer, provide a target directory. Use . for the current directory. For example:
rsync -avz sun::FTP .
By default, no files are deleted while synchronizing with rsync. If this should be forced, the additional option --delete must be stated. To ensure that no newer files are deleted, the option --update can be used instead. Any conflicts that arise must be resolved manually.
File Synchronization
745
Mail/ is a subdirectory of the user's home directory that contains e-mail folders, including the folder saved-messages. If mailsync is started with mailsync -m saved-messages, it lists an index of all messages in saved-messages. If the following definition is made
store localdir { pat Mail/* prefix Mail/ }
the command mailsync -m localdir lists all messages stored under Mail/. In contrast, the command mailsync localdir lists the folder names. The specifications of a store on an IMAP server appear as follows:
store imapinbox { server {mail.edu.harvard.com/user=gulliver} ref {mail.edu.harvard.com} pat INBOX }
746
The above example merely addresses the main folder on the IMAP server. A store for the subfolders would appear as follows:
store imapdir { server {mail.edu.harvard.com/user=gulliver} ref {mail.edu.harvard.com} pat INBOX.* prefix INBOX. }
If the IMAP server supports encrypted connections, the server specification should be changed to
server {mail.edu.harvard.com/ssl/user=gulliver}
The prefix is explained later. Now the folders under Mail/ should be connected to the subdirectories on the IMAP server:
channel folder localdir imapdir { msinfo .mailsync.info }
mailsync uses the msinfo file to keep track of the messages that have already been synchronized. The command mailsync folder does the following: Expands the mailbox pattern on both sides. Removes the prefix from the resulting folder names. Synchronizes the folders in pairs (or creates them if they do not exist). Accordingly, the folder INBOX.sent-mail on the IMAP server is synchronized with the local folder Mail/sent-mail (provided the definitions explained above exist). The synchronization between the individual folder is performed as follows: If a message already exists on both sides, nothing happens.
File Synchronization
747
If the message is missing on one side and is new (not listed in the msinfo file), it is transmitted there. If the message merely exists on one side and is old (already listed in the msinfo file), it is deleted there (because the message that had obviously existed on the other side was deleted). To know in advance which messages will be transmitted and which will be deleted during a synchronization, start mailsync with a channel and a store with mailsync folder localdir. This command produces a list of all messages that are new on the local host as well as a list of all messages that would be deleted on the IMAP side during a synchronization. Similarly, the command mailsync folder imapdir produces a list of all messages that are new on the IMAP side and a list of all messages that would be deleted on the local host during a synchronization.
748
File Synchronization
749
41
With a share of more than 70%, the Apache HTTP Server (Apache) is the world's most widely-used Web server according to the November 2005 Survey from http://www .netcraft.com/. Apache, developed by the Apache Software Foundation (http://www.apache.org/), is available for most operating systems. SUSE Linux Enterprise Server includes Apache version 2.2. In this chapter, learn how to install, configure and set up a Web server; how to use SSL, CGI, and additional modules; and how to troubleshoot Apache.
41.1.1 Requirements
Make sure that the following requirements are met before trying to set up the Apache Web server: 1. 2. The machine's network is configured properly. For more information about this topic, refer to Chapter 31, Basic Networking (page 561). The machine's exact system time is maintained by synchronizing with a time server. This is necessary because parts of the HTTP protocol depend on the
751
correct time. See Chapter 33, Time Synchronization with NTP (page 623) to learn more about this topic. 3. 4. The latest security updates are installed. If in doubt, run a YaST Online Update. The default Web server port (port 80) is opened in the firewall. For this, configure the SUSEFirewall2 to allow the service HTTP Server in the external zone. This can be done using YaST. Section 44.4.1, Configuring the Firewall with YaST (page 834) gives details.
41.1.2 Installation
Apache on SUSE Linux Enterprise Server is not installed by default. To install it, start YaST and select Software Software Management. Now choose Filter Patterns and select Web and LAMP Server. Confirm the installation of the dependent packages to finish the installation process. Apache is installed with a standard, predefined configuration that runs out of the box. The installation includes the multiprocessing module apache2-prefork as well the PHP5 module. Refer to Section 41.4, Installing, Activating, and Configuring Modules (page 769) for more information about modules.
41.1.3 Start
To start Apache and make sure that it is automatically started during boot, start YaST and select System System Services (Runlevel). Search for apache2 and Enable the service. The Web server starts immediately. By saving your changes with Finish, the system is configured to automatically start Apache in runlevels 3 and 5 during boot. For more information about the runlevels in SUSE Linux Enterprise Server and a description of the YaST runlevel editor, refer to Section 20.2.3, Configuring System Services (Runlevel) with YaST (page 396). To start Apache using the shell, run rcapache2 start. To make sure that Apache is automatically started during boot in runlevels 3 and 5, use chkconfig -a apache2. If you have not received error messages when starting Apache, the Web server should be running now. Start a browser and open http://localhost/. You should see
752
an Apache test page starting with If you can see this, it means that the installation of the Apache Web server software on this system was successful. If you do not see this page, refer to Section 41.8, Troubleshooting (page 786). Now that the Web server is running, you can add your own documents, adjust the configuration according to your needs, or add functionality by installing modules.
Configuration Files
Apache configuration files can be found in two different locations: /etc/sysconfig/apache2 /etc/apache2/
753
/etc/sysconfig/apache2
/etc/sysconfig/apache2 controls some global settings of Apache, like modules to load, additional configuration files to include, flags with which the server should be started, and flags that should be added to the command line. Every configuration option in this file is extensively documented and therefore not mentioned here. For a generalpurpose Web server, the settings in /etc/sysconfig/apache2 should be sufficient for any configuration needs. IMPORTANT: No SuSEconfig Module for Apache The SuSEconfig module for Apache has been removed from SUSE Linux Enterprise Server. It is no longer necessary to run SuSEconfig after changing /etc/sysconfig/apache2.
/etc/apache2/
/etc/apache2/ hosts all configuration files for Apache. In the following, the purpose of each file is explained. Each file includes several configuration options (also referred to as directives). Every configuration option in these files is extensively documented and therefore not mentioned here. The Apache configuration files are organized as follows:
/etc/apache2/ | |- charset.conv |- conf.d/ | | | |- *.conf | |- default-server.conf |- errors.conf |- httpd.conf |- listen.conf |- magic |- mime.types |- mod_*.conf |- server-tuning.conf |- ssl-global.conf |- ssl.* |- sysconfig.d | | | |- global.conf | |- include.conf
754
Apache Configuration Files in /etc/apache2/ charset.conv Specifies which character sets to use for different languages. Do not edit. conf.d/*.conf Configuration files added by other modules. These configuration files can be included into your virtual host configuration where needed. See vhosts.d/vhost .template for examples. By doing so, you can provide different module sets for different virtual hosts. default-server.conf Global configuration for all virtual hosts with reasonable defaults. Instead of changing the values, overwrite them with a virtual host configuration. errors.conf Defines how Apache responds to errors. To customize these messages for all virtual hosts, edit this file. Otherwise overwrite these directives in your virtual host configurations. httpd.conf The main Apache server configuration file. Avoid changing this file. It mainly contains include statements and global settings. Overwrite global settings in the respective configuration files listed here. Change host-specific settings (such as document root) in your virtual host configuration. listen.conf Binds Apache to specific IP addresses and ports. Name-based virtual hosting (see Section Name-Based Virtual Hosts (page 757) is also configured here. magic Data for the mime_magic module that helps Apache automatically determine the MIME type of an unknown file. Do not change.
755
mime.types MIME types known by the system (this actually is a link to /etc/mime.types). Do not edit. If you need to add MIME types not listed here, add them to mod _mime-defaults.conf. mod_*.conf Configuration files for the modules that are installed by default. Refer to Section 41.4, Installing, Activating, and Configuring Modules (page 769) for details. Note that configuration files for optional modules reside in the directory conf.d. server-tuning.conf Contains configuration directives for the different MPMs (see Section 41.4.4, Multiprocessing Modules (page 773)) as well as general configuration options that control Apache's performance. Properly test your Web server when making changes here. ssl-global.conf and ssl.* Global SSL configuration and SSL certificate data. Refer to Section 41.6, Setting Up a Secure Web Server with SSL (page 779) for details. sysconfig.d/*.conf Configuration files automatically generated from /etc/sysconfig/apache2. Do not change any of these filesedit /etc/sysconfig/apache2 instead. Put no other configuration files in this directory. uid.conf Specifies under which user and group ID Apache runs. Do not change. vhosts.d/*.conf Your virtual host configuration should go here.The directory contains template files for virtual hosts with and without SSL. Every file in this directory ending in .conf is automatically included in the Apache configuration. Refer to Section Virtual Host Configuration (page 756) for details.
It is common practice to use virtual hosts to save administrative effort (only a single Web server needs to be maintained) and hardware expenses (each domain does not require a dedicated server). Virtual hosts can be name based, IP based, or port based. Virtual hosts can be configured via YaST (see Section Virtual Hosts (page 764)) or by manually editing a configuration file. By default, Apache in SUSE Linux Enterprise Server is prepared for one configuration file per virtual host in /etc/apache2/ vhosts.d/. All files in this directory with the extension .conf are automatically included to the configuration. A basic template for a virtual host is provided in this directory (vhost.template or vhost-ssl.template for a virtual host with SSL support). TIP: Always Create a Virtual Host Configuration It is recommended to always create a virtual host configuration file, even if your Web server only hosts one domain. In doing so, you not only have the domain-specific configuration in one file, but you can always fall back to a working basic configuration by simply moving, deleting, or renaming the configuration file for the virtual host. For the same reason, you should also create separate configuration files for each virtual host. The <VirtualHost></VirtualHost> block holds the information that applies to a particular domain. When Apache receives a client request for a defined virtual host, it uses the directives enclosed in this section. Almost all directives can be used in a virtual host context. See http://httpd.apache.org/docs/2.0/mod/ quickreference.html for further information about Apache's configuration directives.
757
The first argument can be a fully qualified domain name, but it is recommended to use the IP address. The second argument is the port and is optional. By default, port 80 is used and is configured via the Listen directive. The wild card * can be used for both the IP address and the port number to receive requests on all interfaces. IPv6 addresses must be enclosed in square brackets. Example 41.1 Variations of Name-Based VirtualHost Entries
# NameVirtualHost IP-address[:Port] NameVirtualHost 192.168.1.100:80 NameVirtualHost 192.168.1.100 NameVirtualHost *:80 NameVirtualHost * NameVirtualHost [2002:c0a8:164::]:80
The opening VirtualHost tag takes the IP address (or fully qualified domain name) previously declared with the NameVirtualHost as an argument in a name-based virtual host configuration. A port number previously declared with the NameVirtualHost directive is optional. The wild card * is also allowed as a substitute for the IP address. This syntax is only valid in combination with the wild card usage in NameVirtualHost * . When using IPv6 addresses, the address must be included in square brackets. Example 41.2 Name-Based VirtualHost Directives
<VirtualHost 192.168.1.100:80> ... </VirtualHost> <VirtualHost 192.168.1.100> ... </VirtualHost> <VirtualHost *:80> ... </VirtualHost> <VirtualHost *> ... </VirtualHost> <VirtualHost [2002:c0a8:164::]> ... </VirtualHost>
758
Here, VirtualHost directives are only specified for interfaces other than 192.168.0.10. When a Listen directive is also configured for 192.168.0.10, a separate IP-based virtual host must be created to answer HTTP requests to that interfaceotherwise the directives found in the default server configuration (/etc/ apache2/default-server.conf) are applied.
759
DocumentRoot Path to the directory from which Apache should serve files for this host. For security reasons, access to the entire file system is forbidden by default, so you must explicitly unlock this directory within a Directory container. ServerAdmin E-mail address of the server administrator. This address is, for example, shown on error pages Apache creates. ErrorLog The error log file for this virtual host. Although it is not necessary to create separate error log files for each virtual host, it is common practice to do so, because it makes debugging of errors much easier. /var/log/apache2/ is the default directory where Apache's log files should be kept. CustomLog The access log file for this virtual host. Although it is not necessary to create separate access log files for each virtual host, it is common practice to do so, because it allows separate analysis of access statistics for each host. /var/log/apache2/ is the default directory where Apache's log files should be kept. As mentioned above, access to the whole file system is forbidden by default for security reasons. Therefore, explicitly unlock the DocumentRoot directory in which you have placed the files Apache should serve:
<Directory "/srv/www/example.com_htdocs"> Order allow,deny Allow from all </Directory>
The complete configuration file looks like this: Example 41.4 Basic VirtualHost Configuration
<VirtualHost 192.168.0.10> ServerName www.example.com DocumentRoot /srv/www/example.com_htdocs ServerAdmin webmaster@example.com ErrorLog /var/log/apache2/www.example.com_log CustomLog /var/log/apache2/www.example.com-access_log common <Directory "/srv/www/example.com"> Order allow,deny Allow from all </Directory> </VirtualHost>
760
Modules
The Modules configuration option allows for the activation or deactivation of the script languages, the web server should support. For the activation or deactivation of other modules, refer to Section Server Modules (page 766). Click Next to advance to the next dialog.
761
Default Host
This option pertains to the default Web server. As explained in Section Virtual Host Configuration (page 756), Apache can serve multiple virtual hosts from a single physical machine. The first declared virtual host in the configuration file is commonly referred to as the default host. Each virtual host inherits the default host's configuration. To edit the host settings (also called directives), choose the appropriate entry in the table then click Edit. To add new directives, click Add. To delete a directive, select it and click Delete. Figure 41.1 HTTP Server Wizard: Default Host
Here is list of the default settings of the server: Document Root Path to the directory from which Apache serves files for this host. /srv/www/ htdocs is the default location. Alias With the help of Alias directives, URLs can be mapped to physical file system locations. This means that a certain path even outside the Document Root in the file system can be accessed via a URL aliasing that path.
762
The default SUSE Linux Enterprise Server Alias /icons points to /usr/ share/apache2/icons for the Apache icons displayed in the directory index view. ScriptAlias Similar to the Alias directive, the ScriptAlias directive maps a URL to a file system location. The difference is that ScriptAlias designates the target directory as a CGI location, meaning that CGI scripts should be executed in that location. Directory With the Directory setting, you can enclose a group of configuration options that will only apply to the specified directory. Access and display options for the directories /usr/share/apache2/icons and /srv/www/cgi-bin are configured here. It should not be necessary to change the defaults. Include With include, additional configuration files can be specified. /etc/apache2/ conf.d/ is the directory containing the configuration files that come with external modules. By default, all files in this directory (*.conf) are included. /etc/ apache2/conf.d/apache2-manual?conf is the directory containing all apache2-manual configuration files. Server Name This specifies the default URL used by clients to contact the Web server. Use a fully qualified domain name (FQDN) to reach the Web server at http://FQDN/ or its IP address. You cannot choose an arbitrary name herethe server must be known under this name. Server Administrator E-Mail E-mail address of the server administrator. This address is, for example, shown on error pages Apache creates. Server Resolution This option refers to Section Virtual Host Configuration (page 756). Determine Request Server by HTTP Headers lets a VirtualHost answer on a request to its server name (see Section Name-Based Virtual Hosts (page 757)). Determine Request Server by Server IP Address makes Apache select the requested host by
763
the HTTP header information the client sends. See Section IP-Based Virtual Hosts (page 759) for more details on IP-based virtual hosts. After finishing with the Default Host step, click Next to continue with the configuration.
Virtual Hosts
In this step, the wizard displays a list of already configured virtual hosts (see Section Virtual Host Configuration (page 756)). If you have not made manual changes prior to starting the YaST HTTP wizard, only one virtual host is presentone identical to the default host configured in the previous step. It is marked as default with an asterisk next to the server name. To add a host, click Add to open a dialog in which to enter basic information about the host. Server Identification includes the server name, server contents root (DocumentRoot), and administrator e-mail. Server Resolution is used to determine how a host is identified (name based or IP based). These options are explained in Section Default Host (page 762). Clicking Next advances to the second part of the virtual host configuration dialog. In part two of the virtual host configuration you can specify whether to enable CGI scripts and which directory to use for these scripts. It is also possible to enable SSL. If you do so, you must specify the path to the certificate as well. See Section 41.6.2, Configuring Apache with SSL (page 783) for details on SSL and certificates. With the Directory Index option, you can specify which file to display when the client requests a directory (by default, index.html). Add one or more filenames (space-separated) if you want to change this. With Enable Public HTML, the content of the users public directories (~user/public_html/) is made available on the server under http://www.example.com/~user. IMPORTANT: Creating Virtual Hosts It is not possible to add virtual hosts at will. If using name-based virtual hosts, each hostname must be resolved on the network. If using IP-based virtual hosts, you can assign only one host to each IP address available.
764
Summary
This is the final step of the wizard. Here, determine how and when the Apache server is started: when booting or manually. Also see a short summary of the configuration made so far. If you are satisfied with your settings, click Finish to complete configuration. If you want to change something, click Back until you have reached the desired dialog. Clicking HTTP Server Expert Configuration opens the dialog described in Section HTTP Server Configuration (page 765). Figure 41.2 HTTP Server Wizard: Summary
765
Server Modules
You can change the status (enabled or disabled) of Apache2 modules by clicking Toggle Status. Click Add Module to add a new module that is already installed but not yet listed. Learn more about modules in Section 41.4, Installing, Activating, and Configuring Modules (page 769).
766
767
startssl Starts Apache with SSL support if it is not already running. For more information about SSL support, refer to Section 41.6, Setting Up a Secure Web Server with SSL (page 779). restart Stops then restarts Apache. Starts the Web server if it was not running before. try-restart Stops then restarts Apache only if it has been running before. reload or graceful Stops the Web server by advising all forked Apache processes to first finish their requests before shutting down. As each process dies, it is replaced by a newly started one, resulting in complete restart of Apache. TIP rcapache2 reload is the preferred method of restarting Apache in production environments, for example, to activate a change in the configuration, because it allows all clients to be served without causing connection break-offs. configtest Checks the syntax of the configuration files without affecting a running Web server. Because this check is forced every time the server is started, reloaded, or restarted, it is usually not necessary to run the test explicitly (if a configuration error is found, the Web server is not started, reloaded, or restarted). probe Probes for the necessity of a reload (checks whether the configuration has changed) and suggests the required arguments for the rcapache2 command. server-status and full-server-status Dumps a short or full status screen, respectively. Requires either lynx or w3m installed as well as the module mod_status enabled. In addition to that, status must be added to APACHE_SERVER_FLAGS in the file /etc/sysconfig/apache2.
768
TIP: Additional Flags If you specify additional flags to the rcapache2, these are passed through to the Web server.
769
770
mod_alias Provides Alias and Redirect directives with which you can map a URl to a specific directory (Alias) or redirect a requested URL to another location. This module is enabled by default. mod_auth* The authentication modules provide different authentication methods: basic authentication with mod_auth_basic or digest authentication with mod_auth_digest. Digest authentication in Apache 2.2 is considered experimental. mod_auth_basic and mod_auth_digest must be combined with an authentication provider module, mod_authn_* (for example, mod_authn_file for text filebased authentication) and with an authorization module mod_authz_* (for example, mod_authz_user for user authorization). More information about this topic is available in the Authentication howto at http://httpd.apache.org/docs/2.2/howto/auth.html mod_autoindex Autoindex generates directory listings when no index file (for example, index .html) is present. The look and feel of these indexes is configurable. This module is enabled by default. However, directory listings are disabled by default via the Options directiveoverwrite this setting in your virtual host configuration. The default configuration file for this module is located at /etc/apache2/mod _autoindex-defaults.conf. mod_cgi mod_cgi is needed to execute CGI scripts. This module is enabled by default. mod_deflate Using this module, Apache can be configured to compress given file types on the fly before delivering them. mod_dir mod_dir provides the DirectoryIndex directive with which you can configure which files are automatically delivered when a directory is requested (index .html by default). It also provides an automatic redirect to the correct URl when a directory request does not contain a trailing slash. This module is enabled by default.
771
mod_expires With mod_expires, you can control how often proxy and browser caches refresh your documents by sending an Expires header. This module is enabled by default. mod_include mod_include lets you use Server Side Includes (SSI), which provide a basic functionality to generate HTML pages dynamically. This module is enabled by default. mod_info Provides a comprehensive overview of the server configuration under http://localhost/server-info/. For security reasons, you should always limit access to this URL. By default only localhost is allowed to access this URL. mod_info is configured at /etc/apache2/mod_info.conf mod_log_config With this module, you can configure the looks of the Apache log files. This module is enabled by default. mod_mime The mime module takes care that a file is delivered with the correct MIME header based on the filename's extension (for example text/html for HTML documents). This module is enabled by default. mod_negotiation Necessary for content negotiation. See http://httpd.apache.org/docs/ 2.2/content-negotiation.html for more information. This module is enabled by default. mod_rewrite Provides the functionality of mod_alias, but offers more features and flexibility. With mod_rewrite, you can redirect URLs based on multiple rules, request headers, and more. mod_speling mod_speling attempts to automatically correct typographical errors in URLs, such as capitalization errors. mod_ssl Enables encrypted connections between Web server and clients. See Section 41.6, Setting Up a Secure Web Server with SSL (page 779) for details. This module is enabled by default. 772 Installation and Administration
mod_status Provides information on server activity and performance under http://localhost/server-status/. For security reasons, you should always limit access to this URL. By default, only localhost is allowed to access this URl. mod_status is configured at /etc/apache2/mod_status.conf mod_suexec mod_suexec lets you run CGI scripts under a different user and group. This module is enabled by default. mod_userdir Enables user-specific directories available under ~user/. The UserDir directive must be specified in the configuration. This module is enabled by default.
Prefork MPM
The prefork MPM implements a nonthreaded, preforking Web server. It makes the Web server behave similarly to Apache version 1.x in that it isolates each request and handles it by forking a separate child process. Thus problematic requests cannot affect others, avoiding a lockup of the Web server. While providing stability with this process-based approach, the prefork MPM consumes more system resources than its counterpart, the worker MPM. The prefork MPM is considered the default MPM for Unix-based operating systems. IMPORTANT: MPMs in This Document This document assumes Apache is used with the prefork MPM.
Worker MPM
The worker MPM provides a multithreaded Web server. A thread is a lighter form of a process. The advantage of a thread over a process is its lower resource consumption.
773
Instead of only forking child processes, the worker MPM serves requests by using threads with server processes. The preforked child processes are multithreaded. This approach makes Apache perform better by consuming fewer system resources than the prefork MPM. One major disadvantage is the stability of the worker MPM: if a thread becomes corrupt, all threads of a process can be affected. In the worst case, this may result in a server crash. Especially when using the Common Gateway Interface (CGI) with Apache under heavy load, internal server errors might occur due to threads unable to communicate with system resources. Another argument against using the worker MPM with Apache is that not all available Apache modules are thread-safe and thus cannot be used in conjunction with the worker MPM. WARNING: Using PHP Modules with MPMs Not all available PHP modules are thread-safe. Using the worker MPM with mod_php is strongly discouraged.
774
Configuration File: /etc/apache2/conf.d/mod_perl.conf More Information: /usr/share/doc/packages/apache2-mod_perl mod_php5 PHP is a server-side, cross-platform HTML embedded scripting language. Package Name: apache2-mod_php5 Configuration File: /etc/apache2/conf.d/php5.conf More Information: /usr/share/doc/packages/apache2-mod_php5 mod_python mod_python allows embedding Python within the Apache HTTP server for a considerable boost in performance and added flexibility in designing Web-based applications. Package Name: apache2-mod_python More Information: /usr/share/doc/packages/apache2-mod_python mod_ruby mod_ruby embeds the Ruby interpreter into the Apache Web server, allowing Ruby CGI scripts to be executed natively. These scripts start much faster than without mod_ruby. Package Name: apache2-mod_ruby More Information: /usr/share/doc/packages/apache2-mod_ruby mod_jk-ap20 This module provides connectors between Apache and a Tomcat Servlet Container. Package Name: mod_jk-ap20 More Information: /usr/share/doc/packages/mod_jk-ap20
41.4.6 Compilation
Apache can be extended by advanced users by writing custom modules. To develop modules for Apache or compile third-party modules, the package apache2-devel is required along with the corresponding development tools. apache2-devel also contains the apxs2 tools, which are necessary for compiling additional modules for Apache.
775
apxs2 enables the compilation and installation of modules from source code (including the required changes to the configuration files), which creates dynamic shared objects (DSOs) that can be loaded into Apache at runtime. The apxs2 binaries are located under /usr/sbin: /usr/sbin/apxs2suitable for building an extension module that works with any MPM. The installation location is /usr/lib/apache2. /usr/sbin/apxs2-preforksuitable for prefork MPM modules. The installation location is /usr/lib/apache2-prefork. /usr/sbin/apxs2-workersuitable for worker MPM modules. apxs2 installs modules so they can be used for all MPMs. The other two programs install modules so they can only be used for the respective MPMs. apxs2 installs modules in /usr/lib/apache2, apxs2-prefork and apxs2-worker installs modules in /usr/lib/apache2-prefork or /usr/lib/apache2-worker. Install and activate a module from source code with the commands cd /path/to/module/source; apxs2 -cia mod_foo.c (-c compiles the module, -i installs it, and -a activates it). Other options of apxs2 are described in the apxs2(1) man page.
776
Tells Apache to handle all files within this directory as CGI scripts. Enables CGI script execution Tells the server to treat files with the extensions .pl and .cgi as CGI scripts. Adjust according to your needs. The Order and Allow directives control the default access state and the order in which Allow and Deny directives are evaluated. In this case deny statements are evaluated before allow statements and access from everywhere is enabled.
777
directory of your virtual host (/srv/www/example.com_cgi-bin/) and name it test .cgi. Files accessible by the Web server should be owned by to the user root (see Section 41.7, Avoiding Security Problems (page 784) for additional information). Because the Web server runs with a different user, the CGI scripts must be world-executable and world-readable. Change into the CGI directory and use the command chmod 755 test.cgi to apply the proper permissions. Now call http://localhost/cgi-bin/test.cgi or http://example.com/cgi-bin/test.cgi. You should see the CGI/1.0 test script report.
41.5.3 Troubleshooting
If you do not see the output of the test program but an error message instead, check the following: CGI Troubleshooting Have you reloaded the server after having changed the configuration? Check with rcapache2 probe. If you have configured your custom CGI directory, is it configured properly? If in doubt, try the script within the default CGI directory /srv/www/cgi-bin/ and call it with http://localhost/cgi-bin/test.cgi. Are the file permissions correct? Change into the CGI directory and execute the ls -l test.cgi. Its output should start with
-rwxr-xr-x 1 root root
Make sure that the script does not contain programming errors. If you have not changed test.cgi, this should not be the case, but if you are using your own programs, always make sure that they do not contain programming errors.
778
779
TIP: For More Information To learn more about concepts and definitions of SSL/TSL, refer to http:// httpd.apache.org/docs/2.2/ssl/ssl_intro.html.
780
Choose RSA ( R , the default), because some older browsers have problems with DSA. 2 Generating RSA private key for CA (1024 bit) No interaction needed. 3 Generating X.509 certificate signing request for CA Create the CA's distinguished name here. This requires you to answer a few questions, such as country name or organization name. Enter valid data, because everything you enter here later shows up in the certificate. You do not need to answer every question. If one does not apply to you or you want to leave it blank, use .. Common name is the name of the CA itselfchoose a significant name, such as My company CA. 4 Generating X.509 certificate for CA signed by itself Choose certificate version
3
(the default).
5 Generating RSA private key for SERVER (1024 bit) No interaction needed. 6 Generating X.509 certificate signing request for SERVER Create the distinguished name for the server key here. Questions are almost identical to the ones already answered for the CA's distinguished name. The data entered here applies to the Web server and does not necessarily need to be identical to the CA's data (for example, if the server is located elsewhere). IMPORTANT: Selecting a Common Name The common name you enter here must be the fully qualified hostname of your secure server (for example, www.example.com). Otherwise the browser issues a warning that the certificate does not match the server when accessing the Web server. 7 Generating X.509 certificate signed by own CA Choose certificate version
3
(the default).
781
8 Encrypting RSA private key of CA with a pass phrase for security It is strongly recommended to encrypt the private key of the CA with a password, so choose Y and enter a password. 9 Encrypting RSA private key of SERVER with a pass phrase for security Encrypting the server key with a password requires you to enter this password every time you start the Web server. This makes it difficult to automatically start the server on boot or to restart the Web server. Therefore, it is common sense to say N to this question. Keep in mind that your key is unprotected when not encrypted with a password and make sure that only authorized persons have access to the key. IMPORTANT: Encrypting the Server Key If you choose to encrypt the server key with a password, increase the value for APACHE_TIMEOUT in /etc/sysconfig/apache2. Otherwise you do not have enough time to enter the passphrase before the attempt to start the server is stopped unsuccessfully. The script's result page presents a list of certificates and keys it has generated. Contrary to what the script outputs, the files have not been generated in the local directory conf, but to the correct locations under /etc/apache2/. The last step is to copy the CA certificate file from /etc/apache2/ssl.crt/ca .crt to a location where your users can access it in order to incorporate it into the list of known and trusted CAs in their Web browsers. Otherwise a browser complains that the certificate was issued by an unknown authority. The certificate is valid for one year. IMPORTANT: Self-Signed Certificates Only use a self-signed certificate on a Web server that is accessed by people who know and trust you as a certificate authority. It is not recommended to use such a certificate on a public shop, for example.
782
783
To use SSL, it must be activated in the global server configuration. Open /etc/ sysconfig/apache2 in an editor and search for APACHE_MODULES. Add ssl to the list of modules if it is not already present (mod_ssl is activated by default). Next, search for APACHE_SERVER_FLAGS and add SSL. If you have chosen to encrypt your server certificate with a password, you should also increase the value for APACHE_TIMEOUT, so you have enough time to enter the passphrase when Apache starts. Restart the server to make these changes active. A reload is not sufficient. The virtual host configuration directory contains a template /etc/apache2/vhosts .d/vhost-ssl.template with SSL-specific directives that are extensively documented. Refer to Section Virtual Host Configuration (page 756) for the general virtual host configuration. To get started, it should be sufficient to adjust the values for the following directives: DocumentRoot ServerName ServerAdmin ErrorLog TransferLog IMPORTANT: Name-Based Virtual Hosts and SSL It is not possible to run multiple SSL-enabled virtual hosts on a server with only one IP address. Users connecting to such a setup receive a warning message stating that the certificate does not match the server name every time they visit the URL. A separate IP address or port is necessary for every SSL-enabled domain to achieve communication based on a valid SSL certificate.
784
785
41.8 Troubleshooting
If Apache does not start, the Web page is not accessible, or users cannot connect to the Web server, it is important to find the cause of the problem. Here are some typical places to look for error explanations and important things to check. First, rcapache2 (described in Section 41.3, Starting and Stopping Apache (page 767)) is verbose about errors, so can be quite helpful if it is actually used for operating Apache. Sometimes it is tempting to use the binary /usr/sbin/httpd2 for
786
starting or stopping the Web server. Avoid doing this and use the rcapache2 script instead. rcapache2 even provides tips and hints for solving configuration errors. Second, the importance of log files cannot be overemphasized. In case of both fatal and nonfatal errors, the Apache log files, mainly the error log file, are the places to look for causes. Additionally, you can control the verbosity of the logged messages with the LogLevel directive if more detail is needed in the log files. By default, the error log file is located at /var/log/apache2/error_log. TIP: A Simple Test Watch the Apache log messages with the command tail -F /var/log/apache2/my_error_log. Then run rcapache2 restart. Now, try to connect with a browser and check the output. A common mistake is not to open the ports for Apache in the firewall configuration of the server. If you configure Apache with YaST, there is a separate option available to take care of this specific issue (see Section 41.2.2, Configuring Apache with YaST (page 761)). If you are configuring Apache manually, open firewall ports for HTTP and HTTPS via YaST's firewall module. If the error cannot be tracked down with the help of any these, check the online Apache bug database at http://httpd.apache.org/bug_report.html. Additionally, the Apache user community can be reached via a mailing list available at http:// httpd.apache.org/userslist.html. A recommended newsgroup is comp .infosystems.www.servers.unix.
787
41.9.3 Development
More information about developing Apache modules or about getting involved in the Apache Web server project are available at the following locations: Apache Developer Information http://httpd.apache.org/dev/ Apache Developer Documentation http://httpd.apache.org/docs/2.2/developer/
788
789
42
Squid is a widely-used proxy cache for Linux and UNIX platforms. This means that it stores requested Internet objects, such as data on a Web or FTP server, on a machine that is closer to the requesting workstation than the server. It may be set up in multiple hierarchies to assure optimal response times and low bandwidth usage, even in modes that are transparent for the end user. Additional software like squidGuard may be used to filter Web contents. Squid acts as a proxy cache. It redirects object requests from clients (in this case, from Web browsers) to the server. When the requested objects arrive from the server, it delivers the objects to the client and keeps a copy of them in the hard disk cache. One of the advantages of caching is that several clients requesting the same object can be served from the hard disk cache. This enables clients to receive the data much faster than from the Internet. This procedure also reduces the network traffic. Along with the actual caching, Squid offers a wide range of features such as distributing the load over intercommunicating hierarchies of proxy servers, defining strict access control lists for all clients accessing the proxy, allowing or denying access to specific Web pages with the help of other applications, and generating statistics about frequentlyvisited Web pages for the assessment of the users' surfing habits. Squid is not a generic proxy. It normally proxies only HTTP connections. It does also support the protocols FTP, Gopher, SSL, and WAIS, but it does not support other Internet protocols, such as Real Audio, news, or video conferencing. Because Squid only supports the UDP protocol to provide communication between different caches, many other multimedia programs are not supported.
791
792
HIT code if the object was detected or a MISS if it was not. If multiple HIT responses were found, the proxy server decides from which server to download, depending on factors such as which cache sent the fastest answer or which one is closer. If no satisfactory responses are received, the request is sent to the parent cache. TIP To avoid duplication of objects in different caches in the network, other ICP protocols are used, such as CARP (cache array routing protocol) or HTCP (hypertext cache protocol). The more objects maintained in the network, the greater the possibility of finding the desired one.
793
42.2.3 RAM
The amount of memory (RAM) required by Squid directly correlates to the number of objects in the cache. Squid also stores cache object references and frequently requested objects in the main memory to speed up retrieval of this data. Random access memory is much faster than a hard disk. In addition to that, there is other data that Squid needs to keep in memory, such as a table with all the IP addresses handled, an exact domain name cache, the most frequently requested objects, access control lists, buffers, and more.
794
It is very important to have sufficient memory for the Squid process, because system performance is dramatically reduced if it must be swapped to disk. The cachemgr.cgi tool can be used for the cache memory management. This tool is introduced in Section 42.6, cachemgr.cgi (page 805). Sites with huge network traffic should consider using an AMD64 or Intel EM64T system with more than 4 GB of memory.
42.2.4 CPU
Squid is not a program that requires intensive CPU usage. The load of the processor is only increased while the contents of the cache are loaded or checked. Using a multiprocessor machine does not increase the performance of the system. To increase efficiency, it is better to buy faster disks or add more memory.
795
so, consider that Squid is made completely accessible to anyone by this action. Therefore, define ACLs that control access to the proxy. More information about this is available in Section 42.4.2, Options for Access Controls (page 800). After modifying the configuration file /etc/squid/squid.conf, Squid must reload the configuration file. Do this with rcsquid reload. Alternatively, completely restart Squid with rcsquid restart. The command rcsquid status can be used to check if the proxy is running. The command rcsquid stop causes Squid to shut down. This can take a while, because Squid waits up to half a minute (shutdown_lifetime option in /etc/squid/ squid.conf) before dropping the connections to the clients and writing its data to the disk. WARNING: Terminating Squid Terminating Squid with kill or killall can damage the cache. To be able to restart Squid, the damaged cache must be deleted. If Squid dies after a short period of time even though it was started successfully, check whether there is a faulty name server entry or whether the /etc/resolv.conf file is missing. Squid logs the cause of a start-up failure in the file /var/log/squid/ cache.log. If Squid should be loaded automatically when the system boots, use the YaST runlevel editor to activate Squid for the desired runlevels. See Section 7.5.13, System Services (Runlevel) (page 167). An uninstall of Squid does not remove the cache hierarchy or the log files. To remove these, delete the /var/cache/squid directory manually.
796
Dynamic DNS Normally, with dynamic DNS, the DNS server is set by the provider during the establishment of the Internet connection and the local file /etc/resolv.conf is adjusted automatically. This behavior is controlled in the file /etc/ sysconfig/network/config with the sysconfig variable MODIFY_RESOLV_CONF_DYNAMICALLY, which is set to "yes". Set this variable to "no" with the YaST sysconfig editor (see Section 20.3.1, Changing the System Configuration Using the YaST sysconfig Editor (page 398)). Then enter the local DNS server in the file /etc/resolv.conf with the IP address 127.0.0.1 for localhost. This way Squid can always find the local name server when it starts. To make the provider's name server accessible, enter it in the configuration file /etc/named.conf under forwarders along with its IP address. With dynamic DNS, this can be achieved automatically during connection establishment by setting the sysconfig variable MODIFY_NAMED_CONF_DYNAMICALLY to YES. Static DNS With static DNS, no automatic DNS adjustments take place while establishing a connection, so there is no need to change any sysconfig variables. You must, however, enter the local DNS server in the file /etc/resolv.conf as described above. Additionally, the providers static name server must be entered manually in the file /etc/named.conf under forwarders along with its IP address. TIP: DNS and Firewall If you have a firewall running, make sure DNS requests can pass it.
end of the line. The given values almost always correlate with the default values, so removing the comment signs without changing any of the parameters actually has little effect in most cases. If possible, leave the sample as it is and insert the options along with the modified parameters in the line below. This way, the default values may easily be recovered and compared with the changes. TIP: Adapting the Configuration File after an Update If you have updated from an earlier Squid version, it is recommended to edit the new /etc/squid/squid.conf and only apply the changes made in the previous file. If you try to use the old squid.conf, risk that the configuration no longer works, because options are sometimes modified and new changes added.
798
cache_dir ufs /var/cache/squid/ 100 16 256 The entry cache_dir defines the directory where all the objects are stored on disk. The numbers at the end indicate the maximum disk space in MB to use and the number of directories in the first and second level. The ufs parameter should be left alone. The default is 100 MB occupied disk space in the /var/cache/squid directory and creation of 16 subdirectories inside it, each containing 256 more subdirectories. When specifying the disk space to use, leave sufficient reserve disk space. Values from a minimum of 50% to a maximum of 80% of the available disk space make the most sense here. The last two numbers for the directories should only be increased with caution, because too many directories can also lead to performance problems. If you have several disks that share the cache, enter several cache_dir lines. cache_access_log /var/log/squid/access.log, cache_log /var/log/squid/cache.log, cache_store_log /var/log/squid/store.log These three entries specify the paths where Squid logs all its actions. Normally, nothing is changed here. If Squid is experiencing a heavy usage burden, it might make sense to distribute the cache and the log files over several disks. emulate_httpd_log off If the entry is set to on, obtain readable log files. Some evaluation programs cannot interpret this, however. client_netmask 255.255.255.255 With this entry, mask IP addresses of clients in the log files. The last digit of the IP address is set to zero if you enter 255.255.255.0 here. You may protect the privacy of your clients that way. ftp_user Squid@ With this, set the password Squid should use for the anonymous FTP login. It can make sense to specify a valid e-mail address here, because some FTP servers check these for validity. cache_mgr webmaster An e-mail address to which Squid sends a message if it unexpectedly crashes. The default is webmaster. logfile_rotate 0 If you run squid -k rotate, Squid can rotate secured log files. The files are numbered in this process and, after reaching the specified value, the oldest file is
799
overwritten. The default value is 0 because archiving and deleting log files in SUSE Linux Enterprise Server is carried out by a cron job set in the configuration file /etc/logrotate/squid. append_domain <domain> With append_domain, specify which domain to append automatically when none is given. Usually, your own domain is entered here, so entering www in the browser accesses your own Web server. forwarded_for on If you set the entry to off, Squid removes the IP address and the system name of the client from HTTP requests. Otherwise it adds a line to the header like
X-Forwarded-For: 192.168.0.0
negative_ttl 5 minutes; negative_dns_ttl 5 minutes Normally, you do not need to change these values. If you have a dial-up connection, however, the Internet may, at times, not be accessible. Squid makes a note of the failed requests then refuses to issue new ones, although the Internet connection has been reestablished. In a case such as this, change the minutes to seconds then, after clicking Reload in the browser, the dial-up process should be reengaged after a few seconds. never_direct allow acl_name To prevent Squid from taking requests directly from the Internet, use the above command to force connection to another proxy. This must have previously been entered in cache_peer. If all is specified as the acl_name, force all requests to be forwarded directly to the parent. This might be necessary, for example, if you are using a provider that strictly stipulates the use of its proxies or denies its firewall direct Internet access.
800
acl <acl_name> <type> <data> An ACL requires at least three specifications to define it. The name <acl_name> can be chosen arbitrarily. For <type>, select from a variety of different options, which can be found in the ACCESS CONTROLS section in the /etc/squid/ squid.conf file. The specification for <data> depends on the individual ACL type and can also be read from a file, for example, via hostnames, IP addresses, or URLs. The following are some simple examples:
acl acl acl acl mysurfers srcdomain .my-domain.com teachers src 192.168.1.0/255.255.255.0 students src 192.168.7.0-192.168.9.0/255.255.255.0 lunch time MTWHF 12:00-15:00
http_access allow <acl_name> http_access defines who is allowed to use the proxy and who can access what on the Internet. For this, ACLs must be given. localhost and all have already been defined above, which can deny or allow access via deny or allow. A list containing any number of http_access entries can be created, processed from top to bottom, and, depending on which occurs first, access is allowed or denied to the respective URL. The last entry should always be http_access deny all. In the following example, the localhost has free access to everything while all other hosts are denied access completely.
http_access allow localhost http_access deny all
In another example using these rules, the group teachers always has access to the Internet. The group students only gets access Monday to Friday during lunch time.
http_access http_access http_access http_access deny localhost allow teachers allow students lunch time deny all
The list with the http_access entries should only be entered, for the sake of readability, at the designated position in the /etc/squid/squid.conf file. That is, between the text
# INSERT YOUR OWN RULE(S) HERE TO ALLOW ACCESS FROM YOUR # CLIENTS
801
redirect_program /usr/bin/squidGuard With this option, specify a redirector such as squidGuard, which allows blocking unwanted URLs. Internet access can be individually controlled for various user groups with the help of proxy authentication and the appropriate ACLs. squidGuard is a separate package that can be installed and configured. auth_param basic program /usr/sbin/pam_auth If users must be authenticated on the proxy, set a corresponding program, such as pam_auth. When accessing pam_auth for the first time, the user sees a login window in which to enter the username and password. In addition, an ACL is still required, so only clients with a valid login can use the Internet:
acl password proxy_auth REQUIRED http_access allow password http_access deny all
The REQUIRED after proxy_auth can be replaced with a list of permitted usernames or with the path to such a list. ident_lookup_access allow <acl_name> With this, have an ident request run for all ACL-defined clients to find each user's identity. If you apply all to the <acl_name>, this is valid for all clients. Also, an ident daemon must be running on all clients. For Linux, install the pidentd package for this purpose. For Microsoft Windows, free software is available for download from the Internet. To ensure that only clients with a successful ident lookup are permitted, define a corresponding ACL here:
acl identhosts ident REQUIRED http_access allow identhosts http_access deny all
Here, too, replace REQUIRED with a list of permitted usernames. Using ident can slow down the access time quite a bit, because ident lookups are repeated for each request.
802
jects, whether they are in its cache or not. When working in a network, several situations may arise: For security reasons, it is recommended that all clients use a proxy to surf the Internet. All clients must use a proxy, regardless of whether they are aware of it. The proxy in a network is moved, but the existing clients should retain their old configuration. In all these cases, a transparent proxy may be used. The principle is very easy: the proxy intercepts and answers the requests of the Web browser, so the Web browser receives the requested pages without knowing from where they are coming. As the name indicates, the entire process is done transparently.
803
tion 44.4.1, Configuring the Firewall with YaST (page 834). Its configuration file can be found in /etc/sysconfig/SuSEfirewall2. The configuration file consists of well-documented entries. To set a transparent proxy, you must configure several firewall options: Device pointing to the Internet: FW_DEV_EXT="eth1" Device pointing to the network: FW_DEV_INT="eth0" Define ports and services (see /etc/services) on the firewall that are accessed from untrusted (external) networks such as the Internet. In this example, only Web services are offered to the outside:
FW_SERVICES_EXT_TCP="www"
Define ports or services (see /etc/services) on the firewall that are accessed from the secure (internal) network, both via TCP and UDP:
FW_SERVICES_INT_TCP="domain www 3128" FW_SERVICES_INT_UDP="domain"
This allows accessing Web services and Squid (whose default port is 3128). The service domain stands for DNS (domain name service). This service is commonly used. Otherwise, simply take it out of the above entries and set the following option to no:
FW_SERVICE_DNS="yes"
The most important option is option number 15: Example 42.1 Firewall Configuration: Option 15
# # # # # # # # # # # # # # 15.) Which accesses to services should be redirected to a local port on the firewall machine? This can be used to force all internal users to surf via your Squid proxy, or transparently redirect incoming Web traffic to a secure Web server. Choice: leave empty or use the following explained syntax of redirecting rules, separated with spaces. A redirecting rule consists of 1) source IP/net, 2) destination IP/net, 3) original destination port and 4) local port to redirect the traffic to, separated by a colon, e.g. "10.0.0.0/8,0/0,80,3128 0/0,172.20.1.1,80,8080"
804
The comments above show the syntax to follow. First, enter the IP address and the netmask of the internal networks accessing the proxy firewall. Second, enter the IP address and the netmask to which these clients send their requests. In the case of Web browsers, specify the networks 0/0, a wild card that means to everywhere. After that, enter the original port to which these requests are sent and, finally, the port to which all these requests are redirected. Because Squid supports protocols other than HTTP, redirect requests from other ports to the proxy, such as FTP (port 21), HTTPS, or SSL (port 443). In this example, Web services (port 80) are redirected to the proxy port (port 3128). If there are more networks or services to add, they must be separated by a blank space in the respective entry.
FW_REDIRECT_TCP="192.168.0.0/16,0/0,80,3128 192.168.0.0/16,0/0,21,3128" FW_REDIRECT_UDP="192.168.0.0/16,0/0,80,3128 192.168.0.0/16,0/0,21,3128"
To start the firewall and the new configuration with it, change an entry in the /etc/ sysconfig/SuSEfirewall2 file. The entry START_FW must be set to "yes". Start Squid as shown in Section 42.3, Starting Squid (page 795). To check if everything is working properly, check the Squid logs in /var/log/squid/access.log. To verify that all ports are correctly configured, perform a port scan on the machine from any computer outside your network. Only the Web services (port 80) should be open. To scan the ports with nmap, the command syntax is nmap -O IP_address.
42.6 cachemgr.cgi
The cache manager (cachemgr.cgi) is a CGI utility for displaying statistics about the memory usage of a running Squid process. It is also a more convenient way to manage the cache and view statistics without logging the server.
42.6.1 Setup
First, a running Web server on your system is required. Configure Apache as described in Chapter 41, The Apache HTTP Server (page 751). To check if Apache is already running, as root enter the command rcapache status. If a message like this appears:
Checking for service httpd: OK Server uptime: 1 day 18 hours 29 minutes 39 seconds
805
Apache is running on the machine. Otherwise, enter rcapache start to start Apache with the SUSE Linux Enterprise Server default settings. The last step to set it up is to copy the file cachemgr.cgi to the Apache directory cgi-bin:
cp /usr/share/doc/packages/squid/scripts/cachemgr.cgi /srv/www/cgi-bin/
These rules assume that the Web server and Squid are running on the same machine. If the communication between the cache manager and Squid originates at the Web server on another computer, include an extra ACL as in Example 42.2, Access Rules (page 806). Example 42.2 Access Rules
acl manager proto cache_object acl localhost src 127.0.0.1/255.255.255.255 acl webserver src 192.168.1.7/255.255.255.255 # webserver IP
Then add the rules in Example 42.3, Access Rules (page 806) to permit access from the Web server. Example 42.3 Access Rules
http_access allow manager localhost http_access allow manager webserver http_access deny manager
Configure a password for the manager for access to more options, like closing the cache remotely or viewing more information about the cache. For this, configure the entry
806
cachemgr_passwd with a password for the manager and the list of options to view. This list appears as a part of the entry comments in /etc/squid/squid.conf. Restart Squid every time the configuration file is changed. Do this easily with rcsquid reload.
42.7 squidGuard
This section is not intended to explain an extensive configuration of squidGuard, only to introduce it and give some advice for using it. For more in-depth configuration issues, refer to the squidGuard Web site at http://www.squidguard.org. squidGuard is a free (GPL), flexible, and fast filter, redirector, and access controller plug-in for Squid. It lets you define multiple access rules with different restrictions for different user groups on a Squid cache. squidGuard uses Squid's standard redirector interface. squidGuard can do the following: Limit the Web access for some users to a list of accepted or well-known Web servers or URLs. Block access to some listed or blacklisted Web servers or URLs for some users. Block access to URLs matching a list of regular expressions or words for some users. Redirect blocked URLs to an intelligent CGI-based information page. Redirect unregistered users to a registration form. Redirect banners to an empty GIF.
807
Use different access rules based on time of day, day of the week, date, etc. Use different rules for different user groups. squidGuard and Squid cannot be used to: Edit, filter, or censor text inside documents. Edit, filter, or censor HTML-embedded script languages, such as JavaScript or VBscript. Before it can be used, install squidGuard. Provide a minimal configuration file as /etc/squidguard.conf. Find configuration examples in http://www .squidguard.org/config/. Experiment later with more complicated configuration settings. Next, create a dummy access denied page or a more or less complex CGI page to redirect Squid if the client requests a blacklisted Web site. Using Apache is strongly recommended. Now, configure Squid to use squidGuard. Use the following entry in the /etc/squid/ squid.conf file:
redirect_program /usr/bin/squidGuard
Another option called redirect_children configures the number of redirect (in this case squidGuard) processes running on the machine. squidGuard is fast enough to handle many requests: on a 500 MHz Pentium with 5,900 domains and 7,880 URLs (totaling 13,780), 100,000 requests can be processed within 10 seconds. Therefore, it is not recommended to set more than four processes, because the allocation of these processes would consume an excessive amount of memory
redirect_children 4
Last, have Squid load the new configuration by running rcsquid reload. Now, test your settings with a browser.
808
This puts the report in the directory of the Web server. Apache is required to view the reports. Another powerful cache report generator tool is SARG (Squid Analysis Report Generator). More information about this is available at: http://sarg.sourceforge .net/.
809
810
Part V. Security
43
An increasing number of authentication mechanisms are based on cryptographic procedures. Digital certificates that assign cryptographic keys to their owners play an important role in this context. These certificates are used for communication and can also be found, for example, on company ID cards. The generation and administration of certificates is mostly handled by official institutions that offer this as a commercial service. In some cases, however, it may make sense to carry out these tasks yourself, for example, if a company does not wish to pass personal data to third parties. SUSE Linux Enterprise Server offers two YaST modules for certification, which offer basic management functions for digital X.509 certificates. The following sections explain the basics of digital certification and how to use YaST to create and administer certificates of this type. For more detailed information, refer to http://www.ietf.org/ html.charters/pkix-charter.html.
813
Private Key The private key must be kept safely by the key owner. Accidental publication of the private key compromises the key pair and renders it useless. Public Key The key owner circulates the public key for use by third parties.
814
815
Field Extensions
816
Content Every entry contains the serial number of the certificate, the time of revocation, and optional extensions (CRL entry extensions) Optional CRL extensions
Extensions
817
818
CA Name Enter the technical name of the CA. Directory names, among other things, are derived from this name, which is why only the characters listed in the help can be used. The technical name is also displayed in the overview when the module is started. Common Name Enter the name to use to refer to the CA. E-Mail Addresses Several e-mail addresses can be entered that can be seen by the CA user. This can be helpful for inquiries. Country Select the country where the CA is operated. Organisation, Organisational Unit, Locality, State Optional values 4 Click Next. 5 Enter a password in the second dialog. This password is always required when using the CAwhen creating a sub-CA or generating certificates. The text fields have the following meaning: Key Length Key Length contains a meaningful default and does not generally need to be changed unless an application cannot deal with this key length. Valid Period (days) The Valid Period in the case of a CA defaults to 3650 days (roughly ten years). This long period makes sense because the replacement of a deleted CA involves an enormous administrative effort. Clicking Advanced Options opens a dialog for setting different attributes from the X.509 extensions (Figure 43.4, YaST CA ModuleExtended Settings (page 824)). These values have rational default settings and should only be changed if you are really sure of what you are doing. 6 YaST displays the current settings for confirmation. Click Create. The root CA is created then appears in the overview.
819
TIP In general, it is best not to allow user certificates to be issued by the root CA. It is better to create at least one sub-CA and create the user certificates from there. This has the advantage that the root CA can be kept isolated and secure, for example, on an isolated computer on secure premises. This makes it very difficult to attack the root CA.
820
4 Click Advanced and select Create SubCA. This opens the same dialog as for creating a root CA. 5 Proceed as described in Section 43.2.1, Creating a Root CA (page 818). 6 Select the tab Certificates. Reset compromised or otherwise unwanted sub-CAs here using Revoke. Revocation is not enough to deactivate a sub-CA on its own. Also publish revoked sub-CAs in a CRL. The creation of CRLs is described in Section 43.2.5, Creating CRLs (page 825). 7 Finish with Ok
the e-mail address of the recipient (the public key owner) to be included in the certificate. In the case of server and client certificates, the hostname of the server must be entered in the Common Name field. The default validity period for certificates is 365 days. To create client and server certificates, do the following: 1 Start YaST and open the CA module. 2 Select the required CA and click Enter CA. 3 Enter the password if entering a CA for the first time. YaST displays the CA key information in the Description tab. 4 Click Certificates (see Figure 43.3, Certificates of a CA (page 822)). Figure 43.3 Certificates of a CA
5 Click Add Add Server Certificate and create a server certificate. 6 Click Add Add Client Certificate and create a client certificate. Do not forget to enter an e-mail address. 7 Finish with Ok
822
To revoke compromised or otherwise unwanted certificates, do the following: 1 Start YaST and open the CA module. 2 Select the required CA and click Enter CA. 3 Enter the password if entering a CA the first time. YaST displays the CA key information in the Description tab. 4 Click Certificates (see Section 43.2.2, Creating or Revoking a Sub-CA (page 820).) 5 Select the certificate to revoke and click Revoke. 6 Choose a reason to revoke this certificate 7 Finish with Ok. NOTE Revocation alone is not enough to deactivate a certificate. Also publish revoked certificates in a CRL. Section 43.2.5, Creating CRLs (page 825) explains how to create CRLs. Revoked certificates can be completely removed after publication in a CRL with Delete.
823
3 Click Advanced Edit Defaults. 4 Choose the type the settings to change. The dialog for changing the defaults, shown in Figure 43.4, YaST CA ModuleExtended Settings (page 824), then opens. Figure 43.4 YaST CA ModuleExtended Settings
5 Change the associated value on the right side and set or delete the critical setting with critical. 6 Click Next to see a short summary. 7 Finish your changes with Save. TIP All changes to the defaults only affect objects created after this point. Already existing CAs and certificates remain unchanged.
824
825
must be entered manually. You must always enter several passwords (see Table 43.3, Passwords during LDAP Export (page 826)). Table 43.3 Password LDAP Password Certificate Password New Certificate Password Passwords during LDAP Export Meaning Authorizes the user to make entries in the LDAP tree. Authorizes the user to export the certificate. The PKCS12 format is used during LDAP export. This format forces the assignment of a new password for the exported certificate.
Certificates, CAs, and CRLs can be exported to LDAP. Exporting a CA to LDAP To export a CA, enter the CA as described in Section 43.2.2, Creating or Revoking a Sub-CA (page 820). Select Extended Export to LDAP in the subsequent dialog, which opens the dialog for entering LDAP data. If your system has been configured with the YaST LDAP client, the fields are already partly completed. Otherwise, enter all the data manually. Entries are made in LDAP in a separate tree with the attribute caCertificate. Exporting a Certificate to LDAP Enter the CA containing the certificate to export then select Certificates. Select the required certificate from the certificate list in the upper part of the dialog and select Export Export to LDAP. The LDAP data is entered here in the same way as for CAs. The certificate is saved with the corresponding user object in the LDAP tree with the attributes userCertificate (PEM format) and userPKCS12 (PKCS12 format). Exporting a CRL to LDAP Enter the CA containing the CRL to export and select CRL. If desired, then create a new CRL and export this with Export To LDAP. The LDAP data is also entered here in the same way as with CAs. Entries are then made in the LDAP at the same point as the associated CA, but using the certificateRevocationList attribute.
826
827
TIP If you select Import here, you can select the source in the file system. This option can also be used to import certificates from a transport medium, such as a USB stick. To import a common server certificate, do the following: 1 Start YaST and open Common Server Certificate under Security and Users 2 View the data for the current certificate in the description field after YaST has been started. 3 Select Import and the certificate file. 4 Enter the password and click Next. The certificate is imported then displayed in the description field. 5 Close YaST with Finish.
828
44
Whenever Linux is used in a networked environment, you can use the kernel functions that allow the manipulation of network packets to maintain a separation between internal and external network areas. The Linux netfilter framework provides the means to establish an effective firewall that keeps different networks apart. With the help of iptablesa generic table structure for the definition of rule setsprecisely control the packets allowed to pass a network interface. Such a packet filter can be set up quite easily with the help of SuSEfirewall2 and the corresponding YaST module.
829
nat This table defines any changes to the source and target addresses of packets. Using these functions also allows you to implement masquerading, which is a special case of NAT used to link a private network with the Internet. mangle The rules held in this table make it possible to manipulate values stored in IP headers (such as the type of service). Figure 44.1 iptables: A Packet's Possible Paths
PREROUTING
incoming packet
mangle nat
INPUT
mangle filter
Routing
FORWARD
OUTPUT
filter
POSTROUTING
mangle nat
outgoing packet
These tables contain several predefined chains to match packets: PREROUTING This chain is applied to incoming packets. INPUT This chain is applied to packets destined for the system's internal processes. FORWARD This chain is applied to packets that are only routed through the system. OUTPUT This chain is applied to packets originating from the system itself.
830
POSTROUTING This chain is applied to all outgoing packets. Figure 44.1, iptables: A Packet's Possible Paths (page 830) illustrates the paths along which a network packet may travel on a given system. For the sake of simplicity, the figure lists tables as parts of chains, but in reality these chains are held within the tables themselves. In the simplest of all possible cases, an incoming packet destined for the system itself arrives at the eth0 interface. The packet is first referred to the PREROUTING chain of the mangle table then to the PREROUTING chain of the nat table. The following step, concerning the routing of the packet, determines that the actual target of the packet is a process of the system itself. After passing the INPUT chains of the mangle and the filter table, the packet finally reaches its target, provided that the rules of the filter table are actually matched.
831
As mentioned, whenever one of the LAN hosts sends a packet destined for an Internet address, it goes to the default router. However, the router must be configured before it can forward such packets. For security reasons, SUSE Linux Enterprise does not enable this in a default installation. To enable it, set the variable IP_FORWARD in the file /etc/sysconfig/sysctl to IP_FORWARD=yes. The target host of the connection can see your router, but knows nothing about the host in your internal network where the packets originated. This is why the technique is called masquerading. Because of the address translation, the router is the first destination of any reply packets. The router must identify these incoming packets and translate their target addresses, so packets can be forwarded to the correct host in the local network. With the routing of inbound traffic depending on the masquerading table, there is no way to open a connection to an internal host from the outside. For such a connection, there would be no entry in the table. In addition, any connection already established has a status entry assigned to it in the table, so the entry cannot be used by another connection. As a consequence of all this, you might experience some problems with a number of application protocols, such as ICQ, cucme, IRC (DCC, CTCP), and FTP (in PORT mode). Netscape, the standard FTP program, and many others use the PASV mode. This passive mode is much less problematic as far as packet filtering and masquerading are concerned.
832
A more effective but more complex mechanism is the combination of several types of systems, such as a packet filter interacting with an application gateway or proxy. In this case, the packet filter rejects any packets destined for disabled ports. Only packets directed to the application gateway are accepted. This gateway or proxy pretends to be the actual client of the server. In a sense, such a proxy could be considered a masquerading host on the protocol level used by the application. One example for such a proxy is Squid, an HTTP proxy server. To use Squid, the browser must be configured to communicate via the proxy. Any HTTP pages requested are served from the proxy cache and pages not found in the cache are fetched from the Internet by the proxy. As another example, the SUSE proxy-suite (proxy-suite) provides a proxy for the FTP protocol. The following section focuses on the packet filter that comes with SUSE Linux Enterprise. For further information about packet filtering and firewalling, read the Firewall HOWTO included in the howto package. If this package is installed, read the HOWTO with less /usr/share/doc/howto/en/txt/Firewall-HOWTO.gz.
44.4 SuSEfirewall2
SuSEfirewall2 is a script that reads the variables set in /etc/sysconfig/ SuSEfirewall2 to generate a set of iptables rules. It defines three security zones, although only the first and the second one are considered in the following sample configuration: External Zone Given that there is no way to control what is happening on the external network, the host needs to be protected from it. In most cases, the external network is the Internet, but it could be another insecure network, such as a WLAN. Internal Zone This refers to the private network, in most cases the LAN. If the hosts on this network use IP addresses from the private range (see Section 31.1.2, Netmasks and Routing (page 565)), enable network address translation (NAT), so hosts on the internal network can access the external one. Demilitarized Zone (DMZ) While hosts located in this zone can be reached both from the external and the internal network, they cannot access the internal network themselves. This setup can
833
be used to put an additional line of defense in front of the internal network, because the DMZ systems are isolated from the internal network. Any kind of network traffic not explicitly allowed by the filtering rule set is suppressed by iptables. Therefore, each of the interfaces with incoming traffic must be placed into one of the three zones. For each of the zones, define the services or protocols allowed. The rule set is only applied to packets originating from remote hosts. Locally generated packets are not captured by the firewall. The configuration can be performed with YaST (see Section 44.4.1, Configuring the Firewall with YaST (page 834)). It can also be made manually in the file /etc/ sysconfig/SuSEfirewall2, which is well commented. Additionally, a number of example scenarios are available in /usr/share/doc/packages/ SuSEfirewall2/EXAMPLES.
834
Interfaces All known network interfaces are listed here. To remove an interface from a zone, select the interface, press Change, and choose No Zone Assigned. To add an interface to a zone, select the interface, press Change and choose any of the available zones. You may also create a special interface with your own settings by using Custom. Allowed Services You need this option to offer services from your system to a zone from which it is protected. By default, the system is only protected from external zones. Explicitly allow the services that should be available to external hosts. Activate the services after selecting the desired zone in Allowed Services for Selected Zone. Masquerading Masquerading hides your internal network from external networks, such as the Internet, while enabling hosts in the internal network to access the external network transparently. Requests from the external network to the internal one are blocked and requests from the internal network seem to be issued by the masquerading server when seen externally. If special services of an internal machine need to be available to the external network, add special redirect rules for the service. Broadcast In this dialog, configure the UDP ports that allow broadcasts. Add the required port numbers or services to the appropriate zone, separated by spaces. See also the file /etc/services. The logging of broadcasts that are not accepted can be enabled here. This may be problematic, because Windows hosts use broadcasts to know about each other and so generate many packets that are not accepted. IPsec Support Configure whether the IPsec service should be available to the external network in this dialog. Configure which packets are trusted under Details. Logging Level There are two rules for the logging: accepted and not accepted packets. Packets that are not accepted are DROPPED or REJECTED. Select from Log All, Log Critical, or Do Not Log Any for both of them. When completed with the firewall configuration, exit this dialog with Next. A zoneoriented summary of your firewall configuration then opens. In it, check all settings.
835
All services, ports, and protocols that have been allowed are listed in this summary. To modify the configuration, use Back. Press Accept to save your configuration.
836
proxy server between the hosts of the internal network and the Internet. Masquerading is not needed for services a proxy server provides. FW_MASQ_NETS (masquerading) Specify the hosts or networks to masquerade, leaving a space between the individual entries. For example:
FW_MASQ_NETS="192.168.0.0/24 192.168.10.1"
FW_PROTECT_FROM_INT (firewall) Set this to yes to protect your firewall host from attacks originating in your internal network. Services are only available to the internal network if explicitly enabled. Also see FW_SERVICES_INT_TCP and FW_SERVICES_INT_UDP. FW_SERVICES_EXT_TCP (firewall) Enter the TCP ports that should be made available. Leave this blank for a normal workstation at home that should not offer any services. FW_SERVICES_EXT_UDP (firewall) Leave this blank unless you run a UDP service and want to make it available to the outside. The services that use UDP include include DNS servers, IPSec, TFTP, DHCP and others. In that case, enter the UDP ports to use. FW_SERVICES_INT_TCP (firewall) With this variable, define the services available for the internal network. The notation is the same as for FW_SERVICES_EXT_TCP, but the settings are applied to the internal network. The variable only needs to be set if FW_PROTECT_FROM_INT is set to yes. FW_SERVICES_INT_UDP (firewall) See FW_SERVICES_INT_TCP. After configuring the firewall, test your setup. The firewall rule sets are created by entering SuSEfirewall2 start as root. Then use telnet, for example, from an external host to see whether the connection is actually denied. After that, review /var/ log/messages, where you should see something like this:
Mar 15 13:21:38 linux kernel: SFW2-INext-DROP-DEFLT IN=eth0 OUT= MAC=00:80:c8:94:c3:e7:00:a0:c9:4d:27:56:08:00 SRC=192.168.10.0 DST=192.168.10.1 LEN=60 TOS=0x10 PREC=0x00 TTL=64 ID=15330 DF PROTO=TCP SPT=48091 DPT=23 WINDOW=5840 RES=0x00 SYN URGP=0 OPT (020405B40402080A061AFEBC0000000001030300)
837
Other packages to test your firewall setup are nmap or nessus. The documentation of nmap is found at /usr/share/doc/packages/nmap and the documentation of nessus resides in the directory /usr/share/doc/packages/nessus-core after installing the respective package.
838
45
With more and more computers installed in networked environments, it often becomes necessary to access hosts from a remote location. This normally means that a user sends login and password strings for authentication purposes. As long as these strings are transmitted as plain text, they could be intercepted and misused to gain access to that user account without the authorized user even knowing about it. Apart from the fact that this would open all the user's files to an attacker, the illegal account could be used to obtain administrator or root access or to penetrate other systems. In the past, remote connections were established with telnet, which offers no guards against eavesdropping in the form of encryption or other security mechanisms. There are other unprotected communication channels, like the traditional FTP protocol and some remote copying programs. The SSH suite provides the necessary protection by encrypting the authentication strings (usually a login name and a password) and all the other data exchanged between the hosts. With SSH, the data flow could still be recorded by a third party, but the contents are encrypted and cannot be reverted to plain text unless the encryption key is known. So SSH enables secure communication over insecure networks, such as the Internet. The SSH flavor that comes with SUSE Linux Enterprise is OpenSSH.
839
Quotation marks are necessary here to send both instructions with one command. It is only by doing this that the second command is executed on sun.
840
ing all subdirectories to the backup directory on the host sun. If this subdirectory does not exist yet, it is created automatically. The option -p tells scp to leave the time stamp of files unchanged. -C compresses the data transfer. This minimizes the data volume to transfer, but creates a heavier burden on the processor.
841
Override this to use version 1 of the protocol with the -1 switch. To continue using version 1 after a system update, follow the instructions in /usr/share/doc/ packages/openssh/README.SuSE. This document also describes how an SSH 1 environment can be transformed into a working SSH 2 environment with just a few steps. When using version 1 of SSH, the server sends its public host key and a server key, which is regenerated by the SSH daemon every hour. Both allow the SSH client to encrypt a freely chosen session key, which is sent to the SSH server. The SSH client also tells the server which encryption method (cipher) to use. Version 2 of the SSH protocol does not require a server key. Both sides use an algorithm according to Diffie-Helman to exchange their keys. The private host and server keys are absolutely required to decrypt the session key and cannot be derived from the public parts. Only the SSH daemon contacted can decrypt the session key using its private keys (see man /usr/share/doc/packages/openssh/RFC.nroff). This initial connection phase can be watched closely by turning on the verbose debugging option -v of the SSH client. The client stores all public host keys in ~/.ssh/known_hosts after its first contact with a remote host. This prevents any man-in-the-middle attacksattempts by foreign SSH servers to use spoofed names and IP addresses. Such attacks are detected either by a host key that is not included in ~/.ssh/known_hosts or by the server's inability to decrypt the session key in the absence of an appropriate private counterpart. It is recommended to back up the private and public keys stored in /etc/ssh/ in a secure, external location. In this way, key modifications can be detected and the old ones can be used again after a reinstallation. This spares users any unsettling warnings. If it is verified that, despite the warning, it is indeed the correct SSH server, the existing entry for the system must be removed from ~/.ssh/known_hosts.
this by way of another key pair, which is generated by the user. The SSH package provides a helper program for this: ssh-keygen. After entering ssh-keygen -t rsa or ssh-keygen -t dsa, the key pair is generated and you are prompted for the base filename in which to store the keys. Confirm the default setting and answer the request for a passphrase. Even if the software suggests an empty passphrase, a text from 10 to 30 characters is recommended for the procedure described here. Do not use short and simple words or phrases. Confirm by repeating the passphrase. Subsequently, you will see where the private and public keys are stored, in this example, the files id_rsa and id_rsa.pub. Use ssh-keygen -p -t rsa or ssh-keygen -p -t dsa to change your old passphrase. Copy the public key component (id_rsa.pub in the example) to the remote machine and save it to ~/.ssh/authorized_keys. You will be asked to authenticate yourself with your passphrase the next time you establish a connection. If this does not occur, verify the location and contents of these files. In the long run, this procedure is more troublesome than giving your password each time. Therefore, the SSH package provides another tool, ssh-agent, which retains the private keys for the duration of an X session. The entire X session is started as a child process of ssh-agent. The easiest way to do this is to set the variable usessh at the beginning of the .xsession file to yes and log in via a display manager, such as KDM or XDM. Alternatively, enter ssh-agent startx. Now you can use ssh or scp as usual. If you have distributed your public key as described above, you are no longer prompted for your password. Take care of terminating your X session or locking it with a password protection application, such as xlock. All the relevant changes that resulted from the introduction of version 2 of the SSH protocol are also documented in the file /usr/share/doc/packages/openssh/ README.SuSE.
remote machine over the existing SSH connection. At the same time, X applications started remotely and locally viewed with this method cannot be intercepted by unauthorized individuals. By adding the option -A, the ssh-agent authentication mechanism is carried over to the next machine. This way, you can work from different machines without having to enter a password, but only if you have distributed your public key to the destination hosts and properly saved it there. Both mechanisms are deactivated in the default settings, but can be permanently activated at any time in the systemwide configuration file /etc/ssh/sshd_config or the user's ~/.ssh/config. ssh can also be used to redirect TCP/IP connections. In the examples below, SSH is told to redirect the SMTP and the POP3 port, respectively:
ssh -L 25:sun:25 earth
With this command, any connection directed to earth port 25 (SMTP) is redirected to the SMTP port on sun via an encrypted channel. This is especially useful for those using SMTP servers without SMTP-AUTH or POP-before-SMTP features. From any arbitrary location connected to a network, e-mail can be transferred to the home mail server for delivery. Similarly, all POP3 requests (port 110) on earth can be forwarded to the POP3 port of sun with this command:
ssh -L 110:sun:110 earth
Both commands must be executed as root, because the connection is made to privileged local ports. E-mail is sent and retrieved by normal users in an existing SSH connection. The SMTP and POP3 host must be set to localhost for this to work. Additional information can be found in the manual pages for each of the programs described above and also in the files under /usr/share/doc/packages/openssh.
844
Network AuthenticationKerberos
46
An open network provides no means to ensure that a workstation can identify its users properly except the usual password mechanisms. In common installations, the user must enter the password each time a service inside the network is accessed. Kerberos provides an authentication method with which a user registers once then is trusted in the complete network for the rest of the session. To have a secure network, the following requirements must be met: Have all users prove their identity for each desired service and make sure that no one can take the identity of someone else. Make sure that each network server also proves its identity. Otherwise an attacker might be able to impersonate the server and obtain sensitive information transmitted to the server. This concept is called mutual authentication, because the client authenticates to the server and vice versa. Kerberos helps you meet these requirements by providing strongly encrypted authentication. The following shows how this is achieved. Only the basic principles of Kerberos are discussed here. For detailed technical instruction, refer to the documentation provided with your implementation of Kerberos.
Network AuthenticationKerberos
845
credential Users or clients need to present some kind of credentials that authorize them to request services. Kerberos knows two kinds of credentialstickets and authenticators. ticket A ticket is a per-server credential used by a client to authenticate at a server from which it is requesting a service. It contains the name of the server, the client's name, the client's Internet address, a time stamp, a lifetime, and a random session key. All this data is encrypted using the server's key. authenticator Combined with the ticket, an authenticator is used to prove that the client presenting a ticket is really the one it claims to be. An authenticator is built of the client's name, the workstation's IP address, and the current workstation's time all encrypted with the session key only known to the client and the server from which it is requesting a service. An authenticator can only be used once, unlike a ticket. A client can build an authenticator itself. principal A Kerberos principal is a unique entity (a user or service) to which it can assign a ticket. A principal consists of the following components: Primarythe first part of the principal, which can be the same as your username in the case of a user. Instancesome optional information characterizing the primary. This string is separated from the primary by a /. Realmthis specifies your Kerberos realm. Normally, your realm is your domain name in uppercase letters. mutual authentication Kerberos ensures that both client and server can be sure of each others identity. They share a session key, which they can use to communicate securely. session key Session keys are temporary private keys generated by Kerberos. They are known to the client and used to encrypt the communication between the client and the server for which it requested and received a ticket.
846
replay Almost all messages sent in a network can be eavesdropped, stolen, and resent. In the Kerberos context, this would be most dangerous if an attacker manages to obtain your request for a service containing your ticket and authenticator. He could then try to resend it (replay) to impersonate you. However, Kerberos implements several mechanisms to deal with that problem. server or service Service is used to refer to a specific action to perform. The process behind this action is referred to as a server.
Network AuthenticationKerberos
847
The client's IP address The newly-generated session key This ticket is then sent back to the client together with the session key, again in encrypted form, but this time the private key of the client is used. This private key is only known to Kerberos and the client, because it is derived from your user password. Now that the client has received this response, you are prompted for your password. This password is converted into the key that can decrypt the package sent by the authentication server. The package is unwrapped and password and key are erased from the workstation's memory. As long as the lifetime given to the ticket used to obtain other tickets does not expire, your workstation can prove your identity.
848
Network AuthenticationKerberos
849
The newly-generated session key The new ticket is assigned a lifetime, which is the lesser of the remaining lifetime of the ticket-granting ticket and the default for the service. The client receives this ticket and the session key, which are sent by the ticket-granting service, but this time the answer is encrypted with the session key that came with the original ticket-granting ticket. The client can decrypt the response without requiring the user's password when a new service is contacted. Kerberos can thus acquire ticket after ticket for the client without bothering the user more than once at login time.
850
rsh, rcp, rshd ftp, ftpd ksu You no longer have to enter your password for using these applications because Kerberos has already proven your identity. ssh, if compiled with Kerberos support, can even forward all the tickets acquired for one workstation to another one. If you use ssh to log in to another workstation, ssh makes sure that the encrypted contents of the tickets are adjusted to the new situation. Simply copying tickets between workstations is not sufficient because the ticket contains workstation-specific information (the IP address). XDM, GDM, and KDM offer Kerberos support, too. Read more about the Kerberos network applications in Kerberos V5 UNIX User's Guide at http://web.mit.edu/ kerberos
Network AuthenticationKerberos
851
47
853
For the sake of simplicity, assume you are setting up just one realm for your entire organization. For the remainder of this section, the realm name EXAMPLE.COM is used in all examples.
Edit the passwd, group, shadow, and gshadow files in /etc and remove the lines that start with a + character (these are for NIS lookups).
854
6 Disable all user accounts except root's account by editing /etc/shadow and replacing the hashed passwords with * or ! characters.
855
1 Install the RPMs On a machine designated as the KDC, install special software packages. See Section 47.4.1, Installing the RPMs (page 856) for details. 2 Adjust the Configuration Files The configuration files /etc/krb5.conf and /var/lib/kerberos/krb5kdc/kdc.conf must be adjusted for your scenario. These files contain all information on the KDC. 3 Create the Kerberos Database Kerberos keeps a database of all principal identifiers and the secret keys of all principals that need to be authenticated. 4 Adjust the ACL Files: Add Administrators The Kerberos database on the KDC can be managed remotely. To prevent unauthorized principals from tampering with the database, Kerberos uses access control lists. You must explicitly enable remote access for the administrator principal to enable him to manage the database. 5 Adjust the Kerberos Database: Add Administrators You need at least one administrative principal to run and administer Kerberos. This principal must be added before starting the KDC. 6 Start the Kerberos Daemon Once the KDC software is installed and properly configured, start the Kerberos daemon to provide Kerberos service for your realm. 7 Create a Principal for Yourself
856
When you make tape backups of the Kerberos database (/var/lib/kerberos/ krb5kdc/principal), do not back up the stash file (which is in /var/lib/ kerberos/krb5kdc/.k5.EXAMPLE.COM). Otherwise, everyone able to read the tape could also decrypt the database. Therefore, it is also a good idea to keep a copy of the pass phrase in a safe or some other secure location, because you need it to restore your database from backup tape after a crash. To create the stash file and the database, run:
$> kdb5_util create -r EXAMPLE.COM -s Initializing database '/var/lib/kerberos/krb5kdc/principal' for realm 'EXAMPLE.COM', master key name 'K/M@EXAMPLE.COM' You will be prompted for the database Master Password. It is important that you NOT FORGET this password. Enter KDC database master key: <= Type the master password. Re-enter KDC database master key to verify: <= Type it again. $>
This shows that there are now a number of principals in the database. All of these are for internal use by Kerberos.
Next, create another principal named newbie/admin by typing ank newbie/admin at the kadmin prompt. The admin suffixed to your username is a role. Later, use this
857
role when administering the Kerberos database. A user can have several roles for different purposes. Roles are basically completely different accounts with similar names.
858
To configure your Kerberos clients, add the following stanza to krb5.conf (where kdc.example.com is the hostname of the KDC):
[libdefaults] default_realm = EXAMPLE.COM [realms] EXAMPLE.COM = { kdc = kdc.example.com admin_server = kdc.example.com }
The default_realm line sets the default realm for Kerberos applications. If you have several realms, just add additional statements to the [realms] section. Also add a statement to this file that tells applications how to map hostnames to a realm. For example, when connecting to a remote host, the Kerberos library needs to know in which realm this host is located. This must be configured in the [domain_realms] section:
[domain_realm] .example.com = EXAMPLE.COM www.foobar.com = EXAMPLE.COM
This tells the library that all hosts in the example.com DNS domains are in the EXAMPLE.COM Kerberos realm. In addition, one external host named www.foobar .com should also be considered a member of the EXAMPLE.COM realm.
859
The data portion of SRV resource records consists of a priority value, a weight, a port number, and a hostname. The priority defines the order in which hosts should be tried (lower values indicate a higher priority). The weight is there to support some sort of load balancing among servers of equal priority. You probably do not need any of this, so it is okay to set these to zero. MIT Kerberos currently looks up the following names when looking for services: _kerberos This defines the location of the KDC daemon (the authentication and ticket granting server). Typical records look like this:
_kerberos._udp.EXAMPLE.COM. _kerberos._tcp.EXAMPLE.COM. IN IN SRV SRV 0 0 88 kdc.example.com. 0 0 88 kdc.example.com.
_kerberos-adm This describes the location of the remote administration service. Typical records look like this:
_kerberos-adm._tcp.EXAMPLE.COM. IN SRV 0 0 749 kdc.example.com.
Because kadmind does not support UDP, there should be no _udp record. As with the static configuration file, there is a mechanism to inform clients that a specific host is in the EXAMPLE.COM realm, even if it is not part of the example.com DNS domain. This can be done by attaching a TXT record to _keberos.hostname, as shown here:
_keberos.www.foobar.com. IN TXT "EXAMPLE.COM"
860
861
To configure ticket-related options in the Advanced Settings dialog, choose from the following options: Specify the Default Ticket Lifetime and the Default Renewable Lifetime in days, hours, or minutes (using the units of measurement d, h, and m, with no blank space between the value and the unit). To forward your complete identity to use your tickets on other hosts, select Forwardable. Enable the transfer of certain tickets by selecting Proxiable. Keep tickets available with a PAM module even after a session has ended by enabling Retained. Enable Kerberos authentication support for your OpenSSH client by selecting the corresponding check box. The client then uses Kerberos tickets to authenticate with the SSH server. Exclude a range of user accounts from using Kerberos authentication by providing a value for the Minimum UID that a user of this feature must have. For instance, you may want to exclude the system administrator (root). 862 Installation and Administration
Use Clock Skew to set a value for the allowable difference between the time stamps and your host's system time. To keep the system time in sync with an NTP server, you can also set up the host as an NTP client by selecting NTP Configuration, which opens the YaST NTP client dialog that is described in Section 33.1, Configuring an NTP Client with YaST (page 623). After finishing the configuration, YaST performs all the necessary changes and the Kerberos client is ready for use. Figure 47.2 YaST: Advanced Configuration of a Kerberos Client
863
newbie/admin
Replace the username newbie with your own. Restart kadmind for the change to take effect.
Using the getprivs command, verify which privileges you have. The list shown above is the full set of privileges. As an example, modify the principal newbie:
kadmin -p newbie/admin Authenticating as principal newbie/admin@EXAMPLE.COM with password. Password for newbie/admin@EXAMPLE.COM: kadmin: getprinc newbie Principal: newbie@EXAMPLE.COM Expiration date: [never] Last password change: Wed Jan 12 17:28:46 CET 2005 Password expiration date: [none] Maximum ticket life: 0 days 10:00:00 Maximum renewable life: 7 days 00:00:00 Last modified: Wed Jan 12 17:47:17 CET 2005 (admin/admin@EXAMPLE.COM) Last successful authentication: [never] Last failed authentication: [never] Failed password attempts: 0 Number of keys: 2 Key: vno 1, Triple DES cbc mode with HMAC/sha1, no salt Key: vno 1, DES cbc mode with CRC-32, no salt Attributes: Policy: [none] kadmin: modify_principal -maxlife "8 hours" newbie Principal "newbie@EXAMPLE.COM" modified.
864
kadmin: getprinc joe Principal: newbie@EXAMPLE.COM Expiration date: [never] Last password change: Wed Jan 12 17:28:46 CET 2005 Password expiration date: [none] Maximum ticket life: 0 days 08:00:00 Maximum renewable life: 7 days 00:00:00 Last modified: Wed Jan 12 17:59:49 CET 2005 (newbie/admin@EXAMPLE.COM) Last successful authentication: [never] Last failed authentication: [never] Failed password attempts: 0 Number of keys: 2 Key: vno 1, Triple DES cbc mode with HMAC/sha1, no salt Key: vno 1, DES cbc mode with CRC-32, no salt Attributes: Policy: [none] kadmin:
This changes the maximum ticket life time to eight hours. For more information about the kadmin command and the options available, refer to http://web.mit.edu/ kerberos/www/krb5-1.4/krb5-1.4/doc/krb5-admin.html#Kadmin %20Options or look at man 8 kadmin.
Services such the SSH daemon read this key and use it to obtain new tickets automatically when needed. The default keytab file resides in /etc/krb5.keytab. To create a host principal for test.example.com, enter the following commands during your kadmin session:
kadmin -p newbie/admin Authenticating as principal newbie/admin@EXAMPLE.COM with password. Password for newbie/admin@EXAMPLE.COM: kadmin: addprinc -randkey host/test.example.com WARNING: no policy specified for host/test.example.com@EXAMPLE.COM; defaulting to no policy Principal "host/test.example.com@EXAMPLE.COM" created.
Instead of setting a password for the new principal, the -randkey flag tells kadmin to generate a random key. This is used here because no user interaction is wanted for this principal. It is a server account for the machine. Finally, extract the key and store it in the local keytab file /etc/krb5.keytab. This file is owned by the superuser, so you must be root to execute the next command in the kadmin shell:
kadmin: ktadd host/test.example.com Entry for principal host/test.example.com with kvno 3, encryption type Triple DES cbc mode with HMAC/sha1 added to keytab WRFILE:/etc/krb5.keytab. Entry for principal host/test.example.com with kvno 3, encryption type DES cbc mode with CRC-32 added to keytab WRFILE:/etc/krb5.keytab. kadmin:
When completed, make sure that you destroy the admin ticket obtained with kinit above with kdestroy.
866
The pam_unix2 module also supports Kerberos authentication and password update. To enable Kerberos support in pam_unix2, edit the file /etc/security/pam _unix2.conf so it contains the following lines:
auth: account: password: session: use_krb5 nullok use_krb5 use_krb5 nullok none
After that, all programs evaluating the entries in this file use Kerberos for user authentication. For a user that does not have a Kerberos principal, pam_unix2 falls back on the normal password authentication mechanism. For those users who have a principal, it should now be possible to change their Kerberos passwords transparently using the passwd command. To make fine adjustments to the way in which pam_krb5 is used, edit the file /etc/ krb5.conf and add default applications to pam. For details, refer to the manual page with man 5 pam_krb5. The pam_krb5 module was specifically not designed for network services that accept Kerberos tickets as part of user authentication. This is an entirely different matter, which is discussed below.
867
# KerberosTicketCleanup yes # These are for version 2 - better to use this GSSAPIAuthentication yes GSSAPICleanupCredentials yes
Then restart your SSH daemon using rcsshd restart. To use Kerberos authentication with protocol version 2, enable it on the client side as well. Do this either in the systemwide configuration file /etc/ssh/ssh_config or on a per-user level by editing ~/.ssh/config. In both cases, add the option GSSAPIAuthentication yes. You should now be able to connect using Kerberos authentication. Use klist to verify that you have a valid ticket then connect to the SSH server. To force SSH protocol version 1, specify the -1 option on the command line. TIP: Additional Information The file /usr/share/doc/packages/openssh/README.kerberos discusses the interaction of OpenSSH and Kerberos in more detail.
868
By default, the LDAP server slapd runs as user and group ldap, while the keytab file is readable by root only. Therefore, either change the LDAP configuration so the server runs as root or make the keytab file readable by the group ldap. The latter is done automatically by the OpenLDAP start script (/etc/init.d/ldap) if the keytab file has been specified in the OPENLDAP_KRB5_KEYTAB variable in /etc/ sysconfig/openldap and the OPENLDAP_CHOWN_DIRS variable is set to yes, which is the default setting. If OPENLDAP_KRB5_KEYTAB is left empty, the default keytab under /etc/krb5.keytab is used and you must adjust the privileges yourself as described below. To run slapd as root, edit /etc/sysconfig/openldap. Disable the OPENLDAP_USER and OPENLDAP_GROUP variables by putting a comment character in front of them. To make the keytab file readable by group LDAP, execute
chgrp ldap /etc/krb5.keytab chmod 640 /etc/krb5.keytab
A third, and maybe the best solution, is to tell OpenLDAP to use a special keytab file. To do this, start kadmin, and enter the following command after you have added the principal ldap/earth.example.com:
ktadd -k /etc/openldap/ldap.keytab ldap/earth.example.com@EXAMPLE.COM
To tell OpenLDAP to use a different keytab file, change the following variable in /etc/sysconfig/openldap:
OPENLDAP_KRB5_KEYTAB="/etc/openldap/ldap.keytab"
869
As you can see, ldapsearch prints a message that it started GSSAPI authentication. The next message is very cryptic, but it shows that the security strength factor (SSF for short) is 56 (The value 56 is somewhat arbitrary. Most likely it was chosen because this is the number of bits in a DES encryption key). What this tells you is that GSSAPI authentication was successful and that encryption is being used to provide integrity protection and confidentiality for the LDAP connection. In Kerberos, authentication is always mutual. This means that not only have you authenticated yourself to the LDAP server, but also the LDAP server authenticated itself to you. In particular, this means communication is with the desired LDAP server, rather than some bogus service set up by an attacker.
870
access to dn="*,ou=people,dc=example,dc=com" attrs=loginShell by self write # Every user can read everything access to * by users read
The second statement gives authenticated users write access to the loginShell attribute of their own LDAP entry. The third statement gives all authenticated users read access to the entire LDAP directory. There is one minor piece of the puzzle missinghow the LDAP server can find out that the Kerberos user joe@EXAMPLE.COM corresponds to the LDAP distinguished name uid=joe,ou=people,dc=example,dc=com. This sort of mapping must be configured manually using the saslExpr directive. In this example, add the following to slapd.conf:
authz-regexp uid=(.*),cn=GSSAPI,cn=auth uid=$1,ou=people,dc=example,dc=com
To understand how this works, you need to know that when SASL authenticates a user, OpenLDAP forms a distinguished name from the name given to it by SASL (such as joe) and the name of the SASL flavor (GSSAPI). The result would be uid=joe,cn=GSSAPI,cn=auth. If a authz-regexp has been configured, it checks the DN formed from the SASL information using the first argument as a regular expression. If this regular expression matches, the name is replaced with the second argument of the authz-regexp statement. The placeholder $1 is replaced with the substring matched by the (.*) expression. More complicated match expressions are possible. If you have a more complicated directory structure or a schema in which the username is not part of the DN, you can even use search expressions to map the SASL DN to the user DN.
871
48
Encrypting a Hard Disk Partition You can create an encrypted partition with YaST during installation or in an already installed system. See Section 48.1.1, Creating an Encrypted Partition during Installation (page 874) and Section 48.1.2, Creating an Encrypted Partition on a Running System (page 875) for the details. This option can also be used for removable media, such as external hard disks, as described in Section 48.1.4, Encrypting the Content of Removable Media (page 876). Creating an Encrypted File as Container You can at any time create an encrypted file on your hard disk or on on a removable medium with YaST. The encrypted file can then be used to store other files or folders. For more information, refer to Section 48.1.3, Creating an Encrypted File as a Container (page 876). Encrypting Single Files If you only have a small number of files that hold sensitive or confidential data, you can encrypt them individually and protect them with a password using the vi
873
editor. Refer to Section 48.2, Using vi to Encrypt Single Files (page 876) for more information. WARNING: Encrypted Media Is Limited Protection Be aware that with the methods described in this chapter, you cannot protect your running system from being compromised. After the encrypted media is successfully mounted, everybody with appropriate permissions has access to it. However, encrypted media is useful for cases such as loss or theft of your computer or to prevent unauthorized individuals from reading your confidential data.
874
new encrypted partition, click Create. In the dialog that opens, enter the partitioning parameters for the new partition, such as the desired formatting and the mount point. Complete the process by clicking Encrypt File System. In the following dialog, enter the password twice. The new encrypted partition is created after the partitioning dialog is closed by clicking OK. While booting, the operating system requests the password before mounting the partition. If you do not want to mount the encrypted partition during start-up, click Enter when prompted for the password. Then decline the offer to enter the password again. In this case, the encrypted file system is not mounted and the operating system continues booting, blocking access to your data. The partition is available to all users once it has been mounted. If the encrypted file system should only be mounted when necessary, enable Do Not Mount During Booting in the fstab Options dialog. The respective partition will not be mounted when the system is booted. To make it available afterwards, mount it manually with mount name_of_partition mount_point . Enter the password when prompted to do so. After finishing your work with the partition, unmount it with umount name_of_partition to protect it from access by other users. When you are installing your system on a machine where several partitions already exist, you can also decide to encrypt an existing partition during installation. In this case follow the description in Section 48.1.2, Creating an Encrypted Partition on a Running System (page 875) and be aware that this action destroys all data on the existing partition to encrypt.
875
the procedure is the same as in Section 48.1.1, Creating an Encrypted Partition during Installation (page 874).
876
For even more security, you can place the encrypted text file in an encrypted partition. This is recommended because the encryption used in vi is not very strong.
877
49
Many security vulnerabilities result from bugs in trusted programs. A trusted program runs with privilege that some attacker would like to have. The program fails to keep that trust if there is a bug in the program that allows the attacker to acquire that privilege. Novell AppArmor is an application security solution designed specifically to provide least privilege confinement to suspect programs. AppArmor allows the administrator to specify the domain of activities the program can perform by developing a security profile for that applicationa listing of files that the program may access and the operations the program may perform. Effective hardening of a computer system requires minimizing the number of programs that mediate privilege then securing the programs as much as possible. With Novell AppArmor, you only need to profile the programs that are exposed to attack in your environment, which drastically reduces the amount of work required to harden your computer. AppArmor profiles enforce policies to make sure that programs do what they are supposed to do, but nothing else. Administrators only need to care about the applications that are vulnerable to attacks and generate profiles for these. Hardening a system thus comes down to building and maintaining the AppArmor profile set and monitoring any policy violations or exceptions logged by AppArmor's reporting facility. Building AppArmor profiles to confine an application is very straightforward and intuitive. AppArmor ships with several tools that assist in profile creation. It does not require you to do any programming or script handling. The only task that is required from the administrator is to determine a policy of strictest access and execute permissions for each application that needs to be hardened.
879
Updates or modifications to the application profiles are only required if the software configuration or the desired range of activities changes. AppArmor offers intuitive tools to handle profile updates or modifications. Users should not notice AppArmor at all. It runs behind the scenes and does not require any user interaction. Performance is not affected noticeably by AppArmor. If some activity of the application is not covered by an AppArmor profile or if some activity of the application is prevented by AppArmor, the administrator needs to adjust the profile of this application to cover this kind of behavior. This guide outlines the basic tasks that need to be performed with AppArmor to effectively harden a system. For more in-depth information, refer to Novell AppArmor 2.0 Administration Guide.
880
Using YaST System Services (Runlevel) Disable or enable AppArmor by removing or adding its boot script to the sequence of scripts executed on system boot. Status changes are applied at the next system boot. Using Novell AppArmor Control Panel Toggle the status of Novell AppArmor in a running system by switching it off or on using the YaST Novell AppArmor Control Panel. Changes made here are applied instantaneously. The Control Panel triggers a stop or start event for AppArmor and removes or adds its boot script in the system's boot sequence. To disable AppArmor permanently by removing it from the sequence of scripts executed on system boot, proceed as follows: 1 Log in as root and start YaST. 2 Select System System Services (Runlevel). 3 Select Expert Mode. 4 Select boot.apparmor and click Set/Reset Disable the service. 5 Exit the YaST Runlevel tool with Finish. AppArmor will not be initialized on the next system boot and stays inactive until you explicitly reenable it. Reenabling a service using the YaST Runlevel tool is similar to disabling it. Toggle the status of AppArmor in a running system by using the AppArmor Control Panel. These changes take effect as soon as you apply them and survive a reboot of the system. To toggle AppArmor's status, proceed as follows: 1 Log in as root and start YaST. 2 Select Novell AppArmor AppArmor Control Panel. 3 Select Enable AppArmor Configure. 4 Click Enable and OK to enable AppArmor or Disable and OK to disable AppArmor.
881
882
Web Applications CGI Perl scripts, PHP pages, and more complex Web applications can be started through a Web browser. Cron Jobs Programs that the cron daemon periodically run read input from a variety of sources. To find out which processes are currently running with open network ports and might need a profile to confine them, run aa-unconfined as root. Example 49.1 Output of aa-unconfined
19848 19887 19947 29205 /usr/sbin/cupsd not confined /usr/sbin/sshd not confined /usr/lib/postfix/master not confined /usr/sbin/sshd confined by '/usr/sbin/sshd (enforce)'
Each of the processes in the above example labeled not confined might need a custom profile to confine it. Those labeled confined by are already protected by AppArmor. TIP: For More Information For more information about choosing the the right applications to profile, refer to Chapter 2, Selecting Programs to Immunize (Novell AppArmor 2.0 Administration Guide).
883
For each application, perform the following steps to create a profile: 1 As root, let AppArmor create a rough outline of the application's profile by running aa-genprof programname or Outline the basic profile by running YaST Novell AppArmor Add Profile Wizard and specifying the complete path of the application to profile. A basic profile is outlined and AppArmor is put into learning mode, which means that it logs any activity of the program you are executing but does not yet restrict it. 2 Run the full range of the application's actions to let AppArmor get a very specific picture of its activities. 3 Let AppArmor analyze the log files generated in Step 2 (page 884) by running typing S in aa-genprof. or Analyze the logs by clicking Scan system log for AppArmor events in the Add Profile Wizard and following the instructions given in the wizard until the profile is completed. AppArmor scans the logs it recorded during the application's run and asks you to set the access rights for each event that was logged. Either set them for each file or use globbing. 4 Once all access permissions are set, your profile is set to enforce mode. The profile is applied and AppArmor restricts the application according to the profile just created. If you started aa-genprof on an application that had an existing profile that was in complain mode, this profile remains in learning mode upon exit of this learning cycle. For more information about changing the mode of a profile, refer to Section aa-complainEntering Complain or Learning Mode (Chapter 3, Building Novell AppArmor Profiles, Novell AppArmor 2.0 Administration Guide) and Section aa-enforceEntering Enforce Mode (Chapter 3, Building Novell AppArmor Profiles, Novell AppArmor 2.0 Administration Guide).
884
Test your profile settings by performing every task you need with the application you just confined. Normally, the confined program runs smoothly and you do not notice AppArmor activities at all. However, if you notice certain misbehavior with your application, check the system logs and see if AppArmor is too closely constricting your application. Depending on the log mechanism used on your system, there are several places to look for AppArmor log entries: /var/log/audit.log If the audit package is installed and auditd is running, AppArmor events are logged as follows:
type=APPARMOR msg=audit(1140325305.502:1407): REJECTING w access to /usr/lib/firefox/update.test (firefox-bin(9469) profile /usr/lib/firefox/firefox-bin active /usr/lib/firefox/firefox-bin)
/var/log/messages If auditd is not used, AppArmor events are logged in the standard system log under /var/log/messages. An example entry would look like the following:
Feb 22 18:29:14 dhcp-81 klogd: audit(1140661749.146:3): REJECTING w access to /dev/console (mdnsd(3239) profile /usr/sbin/mdnsd active /usr/sbin/mdnsd)
dmesg If auditd is not running, AppArmor events can also be checked using the dmesg command:
audit(1140661749.146:3): REJECTING w access to /dev/console (mdnsd(3239) profile /usr/sbin/mdnsd active /usr/sbin/mdnsd)
To adjust the profile, analyze the log messages relating this application again as described in Step 3 (page 884). Determine the access rights or restrictions when prompted. TIP: For More Information For more information about profile building and modification, refer to Chapter 3, Building Novell AppArmor Profiles (Novell AppArmor 2.0 Administration Guide).
885
886
2 Select the type of report to examine or configure from Executive Security Summary, Applications Audit, and Security Incident Report. 3 Edit the report generation frequency, e-mail address, export format, and location of the reports by selecting Edit and providing the requested data. 4 To run a report of the selected type, click Run Now. 5 Browse through the archived reports of a given type by selecting View Archive and specifying the report type. or Delete unneeded reports or add new ones. TIP: For More Information For more information about configuring event notification in Novell AppArmor, refer to Section 4.2, Setting Up Event Notification (Chapter 4, Managing Profiled Applications, Novell AppArmor 2.0 Administration Guide). Find more information about report configuration in Section 4.3, Reports (Chapter 4, Managing Profiled Applications, Novell AppArmor 2.0 Administration Guide).
887
4 Leave YaST after you answer all questions. Your changes are applied to the respective profiles. TIP: For More Information For more information about updating your profiles from the system logs, refer to Section 3.3.5, Updating Profiles from Log Entries (Chapter 3, Building Novell AppArmor Profiles, Novell AppArmor 2.0 Administration Guide).
888
50
One of the main characteristics of a Linux or UNIX system is its ability to handle several users at the same time (multiuser) and to allow these users to perform several tasks (multitasking) on the same computer simultaneously. Moreover, the operating system is network transparent. The users often do not know whether the data and applications they are using are provided locally from their machine or made available over the network. With the multiuser capability, the data of different users must be stored separately. Security and privacy need to be guaranteed. Data security was already an important issue, even before computers could be linked through networks. Just like today, the most important concern was the ability to keep data available in spite of a lost or otherwise damaged data medium, a hard disk in most cases. This section is primarily focused on confidentiality issues and on ways to protect the privacy of users, but it cannot be stressed enough that a comprehensive security concept should always include procedures to have a regularly updated, workable, and tested backup in place. Without this, you could have a very hard time getting your data backnot only in the case of some hardware defect, but also if the suspicion arises that someone has gained unauthorized access and tampered with files.
889
personal communication with people who have the desired information or access to the data on a computer directly from the console of a computer (physical access) over a serial line using a network link In all these cases, a user should be authenticated before accessing the resources or data in question. A Web server might be less restrictive in this respect, but you still would not want it to disclose all your personal data to any surfer. In the list above, the first case is the one where the highest amount of human interaction is involved, such as when you are contacting a bank employee and are required to prove that you are the person owning that bank account. Then you are asked to provide a signature, a PIN, or a password to prove that you are the person you claim to be. In some cases, it might be possible to elicit some intelligence from an informed person just by mentioning known bits and pieces to win the confidence of that person by using clever rhetoric. The victim could be led to reveal gradually more information, maybe without even becoming aware of it. Among hackers, this is called social engineering. You can only guard against this by educating people and by dealing with language and information in a conscious way. Before breaking into computer systems, attackers often try to target receptionists, service people working with the company, or even family members. In many cases, such an attack based on social engineering is only discovered at a much later time. A person wanting to obtain unauthorized access to your data could also use the traditional way and try to get at your hardware directly. Therefore, the machine should be protected against any tampering so that no one can remove, replace, or cripple its components. This also applies to backups and even any network cable or the power cord. Also secure the boot procedure, because there are some well-known key combinations that might provoke unusual behavior. Protect yourself against this by setting passwords for the BIOS and the boot loader. Serial terminals connected to serial ports are still used in many places. Unlike network interfaces, they do not rely on a network protocol to communicate with the host. A simple cable or an infrared port is used to send plain characters back and forth between the devices. The cable itself is the weakest point of such a system: with an older printer connected to it, it is easy to record anything that runs over the wires. What can be
890
achieved with a printer can also be accomplished in other ways, depending on the effort that goes into the attack. Reading a file locally on a host requires other access rules than opening a network connection with a server on a different host. There is a distinction between local security and network security. The line is drawn where data must be put into packets to be sent somewhere else.
50.1.2 Passwords
On a Linux system, passwords are not stored as plain text and the text string entered is not simply matched with the saved pattern. If this were the case, all accounts on your system would be compromised as soon as someone got access to the corresponding file. Instead, the stored password is encrypted and, each time it is entered, is encrypted again and the two encrypted strings are compared. This only provides more security if the encrypted password cannot be reverse-computed into the original text string. This is actually achieved by a special kind of algorithm, also called trapdoor algorithm, because it only works in one direction. An attacker who has obtained the encrypted string is not able to get your password by simply applying the same algorithm again. Instead, it would be necessary to test all the possible character combinations until a combination is found that looks like your password when encrypted. With passwords eight characters long, there are quite a number of possible combinations to calculate. In the seventies, it was argued that this method would be more secure than others due to the relative slowness of the algorithm used, which took a few seconds to encrypt just one password. In the meantime, however, PCs have become powerful enough to do several hundred thousand or even millions of encryptions per second. Because of this,
891
encrypted passwords should not be visible to regular users (/etc/shadow cannot be read by normal users). It is even more important that passwords are not easy to guess, in case the password file becomes visible due to some error. Consequently, it is not really useful to translate a password like tantalize into t@nt@1lz3. Replacing some letters of a word with similar looking numbers is not safe enough. Password cracking programs that use dictionaries to guess words also play with substitutions like that. A better way is to make up a word with no common meaning, something that only makes sense to you personally, like the first letters of the words of a sentence or the title of a book, such as The Name of the Rose by Umberto Eco. This would give the following safe password: TNotRbUE9. In contrast, passwords like beerbuddy or jasmine76 are easily guessed even by someone who has only some casual knowledge about you.
file permissions immediately. An incorrect file attribute does not only mean that files could be changed or deleted. These modified files could be executed by root or, in the case of configuration files, programs could use such files with the permissions of root. This significantly increases the possibilities of an attacker. Attacks like this are called cuckoo eggs, because the program (the egg) is executed (hatched) by a different user (bird), just like a cuckoo tricks other birds into hatching its eggs. A SUSE Linux Enterprise system includes the files permissions, permissions .easy, permissions.secure, and permissions.paranoid, all in the directory /etc. The purpose of these files is to define special permissions, such as worldwritable directories or, for files, the setuser ID bit (programs with the setuser ID bit set do not run with the permissions of the user that has launched it, but with the permissions of the file owner, in most cases root). An administrator can use the file /etc/ permissions.local to add his own settings. To define which of the above files is used by SUSE's configuration programs to set permissions accordingly, select Security in YaST. To learn more about the topic, read the comments in /etc/permissions or consult the manual page of chmod (man chmod).
893
Format string bugs work in a slightly different way, but again it is the user input that could lead the program astray. In most cases, these programming errors are exploited with programs executed with special permissionssetuid and setgid programswhich also means that you can protect your data and your system from such bugs by removing the corresponding execution privileges from programs. Again, the best way is to apply a policy of using the lowest possible privileges (see Section 50.1.4, File Permissions (page 892)). Given that buffer overflows and format string bugs are bugs related to the handling of user data, they are not only exploitable if access has been given to a local account. Many of the bugs that have been reported can also be exploited over a network link. Accordingly, buffer overflows and format string bugs should be classified as being relevant for both local and network security.
50.1.6 Viruses
Contrary to what some people say, there are viruses that run on Linux. However, the viruses that are known were released by their authors as a proof of concept to prove that the technique works as intended. None of these viruses have been spotted in the wild so far. Viruses cannot survive and spread without a host on which to live. In this case, the host would be a program or an important storage area of the system, such as the master boot record, which needs to be writable for the program code of the virus. Owing to its multiuser capability, Linux can restrict write access to certain files, especially important with system files. Therefore, if you did your normal work with root permissions, you would increase the chance of the system being infected by a virus. In contrast, if you follow the principle of using the lowest possible privileges as mentioned above, chances of getting a virus are slim. Apart from that, you should never rush into executing a program from some Internet site that you do not really know. SUSE's RPM packages carry a cryptographic signature as a digital label that the necessary care was taken to build them. Viruses are a typical sign that the administrator or the user lacks the required security awareness, putting at risk even a system that should be highly secure by its very design. Viruses should not be confused with worms, which belong to the world of networks entirely. Worms do not need a host to spread.
894
more about X Window System security mechanisms in the man page of Xsecurity (man Xsecurity). SSH (secure shell) can be used to encrypt a network connection completely and forward it to an X server transparently without the encryption mechanism being perceived by the user. This is also called X forwarding. X forwarding is achieved by simulating an X server on the server side and setting a DISPLAY variable for the shell on the remote host. Further details about SSH can be found in Chapter 45, SSH: Secure Network Operations (page 839). WARNING If you do not consider the host where you log in to be a secure host, do not use X forwarding. With X forwarding enabled, an attacker could authenticate via your SSH connection to intrude on your X server and sniff your keyboard input, for instance.
896
it makes it easier for him to push the active attack, because the host will not be able to interfere with the attack for some time.
50.1.13 Worms
Worms are often confused with viruses, but there is a clear difference between the two. Unlike viruses, worms do not need to infect a host program to live. Instead, they are specialized to spread as quickly as possible on network structures. The worms that appeared in the past, such as Ramen, Lion, or Adore, make use of well-known security holes in server programs like bind8 or lprNG. Protection against worms is relatively easy. Given that some time elapses between the discovery of a security hole and the moment the worm hits your server, there is a good chance that an updated version of the affected program is available on time. That is only useful if the administrator actually installs the security updates on the systems in question.
898
www.novell.com/linux/security/securitysupport.html. The list suse-security-announce@suse.de is a first-hand source of information regarding updated packages and includes members of SUSE's security team among its active contributors. The mailing list suse-security@suse.de is a good place to discuss any security issues of interest. Subscribe to it on the same Web page. bugtraq@securityfocus.com is one of the best-known security mailing lists worldwide. Reading this list, which receives between 15 and 20 postings per day, is recommended. More information can be found at http://www.securityfocus .com. The following is a list of rules you may find useful in dealing with basic security concerns: According to the rule of using the most restrictive set of permissions possible for every job, avoid doing your regular jobs as root. This reduces the risk of getting a cuckoo egg or a virus and protects you from your own mistakes. If possible, always try to use encrypted connections to work on a remote machine. Using ssh (secure shell) to replace telnet, ftp, rsh, and rlogin should be standard practice. Avoid using authentication methods based on IP addresses alone. Try to keep the most important network-related packages up-to-date and subscribe to the corresponding mailing lists to receive announcements on new versions of such programs (bind, sendmail, ssh, etc.). The same should apply to software relevant to local security. Change the /etc/permissions file to optimize the permissions of files crucial to your system's security. If you remove the setuid bit from a program, it might well be that it cannot do its job anymore in the intended way. On the other hand, consider that, in most cases, the program will also have ceased to be a potential security risk. You might take a similar approach with world-writable directories and files. Disable any network services you do not absolutely require for your server to work properly. This makes your system safer. Open ports, with the socket state LISTEN, can be found with the program netstat. As for the options, it is recommended to Security and Confidentiality 899
use netstat -ap or netstat -anp. The -p option allows you to see which process is occupying a port under which name. Compare the netstat results with those of a thorough port scan done from outside your host. An excellent program for this job is nmap, which not only checks out the ports of your machine, but also draws some conclusions as to which services are waiting behind them. However, port scanning may be interpreted as an aggressive act, so do not do this on a host without the explicit approval of the administrator. Finally, remember that it is important not only to scan TCP ports, but also UDP ports (options -sS and -sU). To monitor the integrity of the files of your system in a reliable way, use the program AIDE (Advanced Intrusion Detection Environment), available on SUSE Linux Enterprise. Encrypt the database created by AIDE to prevent someone from tampering with it. Furthermore, keep a backup of this database available outside your machine, stored on an external data medium not connected to it by a network link. Take proper care when installing any third-party software. There have been cases where a hacker had built a trojan horse into the tar archive of a security software package, which was fortunately discovered very quickly. If you install a binary package, have no doubts about the site from which you downloaded it. SUSE's RPM packages are gpg-signed. The key used by SUSE for signing is: ID:9C800ACA 2000-10-19 SUSE Package Signing Key <build@suse.de> Key fingerprint = 79C1 79B2 E1C8 20C1 890F 9994 A84E DAE8 9C80 0ACA The command rpm --checksig package.rpm shows whether the checksum and the signature of an uninstalled package are correct. Find the key on the first CD of the distribution and on most key servers worldwide. Check your backups of user and system files regularly. Consider that if you do not test whether the backup works, it might actually be worthless. Check your log files. Whenever possible, write a small script to search for suspicious entries. Admittedly, this is not exactly a trivial task. In the end, only you can know which entries are unusual and which are not. Use tcp_wrapper to restrict access to the individual services running on your machine, so you have explicit control over which IP addresses can connect to a
900
service. For further information regarding tcp_wrapper, consult the manual pages of tcpd and hosts_access (man 8 tcpd, man hosts_access). Use SuSEfirewall to enhance the security provided by tcpd (tcp_wrapper). Design your security measures to be redundant: a message seen twice is much better than no message at all.
901
51
SUSE Linux Enterprise comes with various sources of information and documentation. The SUSE Help Center provides central access to the most important documentation resources on your system in searchable form. These resources include online help for installed applications, manual pages, info pages, databases on hardware and software topics, and all manuals delivered with your product.
905
configuration of the search function in the Search tab are presented in Section 51.1.2, The Search Function (page 907). The Contents tab presents a tree view of all available and currently installed information sources. Click the book icons to open and browse the individual categories. View Window The view window always displays the currently selected contents, such as online manuals, search results, or Web pages. Figure 51.1 The Main Window of the SUSE Help Center
NOTE: Language Selects View The documentation available in the SUSE Help Center depends on the current language. Changing your language changes the tree view.
51.1.1 Contents
The SUSE Help Center provides access to useful information from various sources. It contains special documentation for SUSE Linux Enterprise (Start-Up and Reference), all available information sources for your workstation environment, online help for the
906
installed programs, and help texts for other applications. Furthermore, the SUSE Help Center provides access to SUSE's online databases that cover special hardware and software issues for SUSE Linux Enterprise. All these sources can be searched comfortably once a search index has been generated.
If no search index has been generated, the system automatically prompts you to do so when you click the Search tab or enter a search string then click Search. In the window for generating the search index, shown in Figure 51.3, Generating a Search Index (page 908), use the check boxes to determine the information sources to index. The index is generated when you exit the dialog with Build Index.
907
To limit the search base and the hit list as precisely as possible, use the three drop-down menus to determine the number of displayed hits and the selection area of sources to search. The following options are available for determining the selection area: Default A predefined selection of sources is searched. All All sources are searched. None No sources selected for the search. Custom Determine the sources to search by activating the respective check boxes in the overview. When you have completed the search configuration, click Search. The relevant items are then displayed in the view window and can easily be navigated with mouse clicks.
908
8 9
Generally, man pages are delivered with the associated command. They can be browsed in the help center or directly in a shell. To display a man page in a shell, use the man command. For example, to display the man page for ls enter man ls. Each man page consists of several parts labeled NAME, SYNOPSIS, DESCRIPTION, SEE ALSO, LICENSING, and AUTHOR. There may be additional sections available depending on the type of command. With Q , exit the man page viewer.
909
Another possibility to display a man page is to use Konqueror. Start Konqueror and type, for example, man:/ls. If there are different categories for a command, Konqueror displays them as links.
51.4.1 HOWTOs
HOWTOs are usually a short, informal, step-by-step guide to accomplishing a specific task. It is written by experts for nonexperts in a procedural manner. For example, how to configure a DHCP server. HOWTOs can be found in the package howto and are installed under /usr/share/doc/howto
910
911
912
51.8 Usenet
Created in 1979 before the rise of the Internet, Usenet is one of the oldest computer networks and still in active use. The format and transmission of Usenet articles is very similar to e-mail, but is developed for a many-to-many communication. Usenet is organized into seven topical categories: comp.* for computer-related discussions, misc.* for miscellaneous topics, news.* for newsgroup-related matters, rec.* for recreation and entertainment, sci.* for science-related discussions, soc.* for social discussions, and talk.* for various controversial topics. The top levels are split in subgroups. For instance, comp.os.linux.hardware is a newsgroup for Linux-specific hardware issues. Before you can post an article, have your client connect to a news server and subscribe to a specific newsgroup. News clients include Knode or Evolution. Each news server communicates to other news servers and exchanges articles with them. Not all newsgroups may be available on your news server. Interesting newsgroups for Linux users are comp.os.linux.apps, comp.os.linux.questions, and comp.os.linux.hardware. If you cannot find a specific newsgroup, go to http://www.linux.org/docs/usenetlinux .html. Follow the general Usenet rules available online at http://www.faqs .org/faqs/usenet/posting-rules/part1/.
concentrates on standardizing Web technologies. W3C promotes the dissemination of open, license-free, and manufacturer-independent specifications, such as HTML, XHTML, and XML. These Web standards are developed in a four-stage process in working groups and are presented to the public as W3C recommendations (REC). http://www.oasis-open.org OASIS (Organization for the Advancement of Structured Information Standards) is an international consortium specializing in the development of standards for Web security, e-business, business transactions, logistics, and interoperability between various markets. http://www.ietf.org The Internet Engineering Task Force (IETF) is an internationally active cooperative of researchers, network designers, suppliers, and users. It concentrates on the development of Internet architecture and the smooth operation of the Internet by means of protocols. Every IETF standard is published as an RFC (Request for Comments) and is available free-of-charge. There are six types of RFC: proposed standards, draft standards, Internet standards, experimental protocols, information documents, and historic standards. Only the first three (proposed, draft, and full) are IETF standards in the narrower sense (see http://www.ietf.org/rfc/rfc1796.txt). http://www.ieee.org The Institute of Electrical and Electronics Engineers (IEEE) is an organization that draws up standards in the areas of information technology, telecommunication, medicine and health care, transport, and others. IEEE standards are subject to a fee. http://www.iso.org The ISO Committee (International Organization for Standards) is the world's largest developer of standards and maintains a network of national standardization institutes in over 140 countries. ISO standards are subject to a fee. http://www.din.de, http://www.din.com The Deutsches Institut fr Normung (DIN) is a registered technical and scientific association. It was founded in 1917. According to DIN, the organization is the institution responsible for standards in Germany and represents German interests in worldwide and European standards organizations.
914
The association brings together manufacturers, consumers, trade professionals, service companies, scientists and others who have an interest in the establishment of standards. The standards are subject to a fee and can be ordered using the DIN home page.
915
52
This chapter offers a range of common problems that can arise with an intention of covering as many of the various types of potential problems as possible. That way, even if your precise situation is not listed here, there might be one similar enough to offer hints as to the solution.
/var/log/mail.* /var/log/messages
917
Description Hardware messages from the SaX display and KVM system. Messages from the desktop applications currently running. Replace user with the actual username. All messages from the kernel and system log daemon assigned WARNING level or higher. Binary file containing user login records for the current machine session. View it with last. Various start-up and runtime logs from the X Window system. It is useful for debugging failed X start-ups. Directory containing YaST's actions and their results. Directory containing Samba server and client log messages.
/home/user/ .xsession-errors
/var/log/warn
/var/log/wtmp
/var/log/Xorg.*.log
/var/log/YaST2/
/var/log/samba/
Linux comes with a number of tools for system analysis and monitoring. See Chapter 17, System Monitoring Utilities (page 323) for a selection of the most important ones used in system diagnostics. Each scenario included in the following begins with a header describing the problem followed by a paragraph or two offering suggested solutions, available references for more detailed solutions, and cross-references to other scenarios that might be related.
typical problems you might run into and offers possible solutions or workarounds for this kind of situations.
919
1. 2. 3.
The program checks if the BIOS provides VESA 2.0compliant framebuffer support and boots the kernel accordingly. The monitor data (DDC info) is read. The first block of the first hard disk (MBR) is read to map BIOS IDs to Linux device names during the boot loader configuration. The program attempts to read the block by means of the the lba32 functions of the BIOS to determine if the BIOS supports these functions.
If you keep Shift pressed when SYSLINUX starts, all these steps are skipped. For troubleshooting purposes, insert the line
verbose 1
in syslinux.cfg for the boot loader to display which action is currently being performed. If the machine does not boot from the floppy disk, you may need to change the boot sequence in the BIOS to A,C,CDROM.
Incorrect Boot Sequence in BIOS The BIOS boot sequence must have CD-ROM set as the first entry for booting. Otherwise the machine would try to boot from another medium, typically the hard disk. Guidance for changing the BIOS boot sequence can be found the documentation provided with your motherboard or in the following paragraphs. The BIOS is the software that enables the very basic functions of a computer. Motherboard vendors provide a BIOS specifically made for their hardware. Normally, the BIOS setup can only be accessed at a specific timewhen the machine is booting. During this initialization phase, the machine performs a number of diagnostic hardware tests. One of them is a memory check, indicated by a memory counter. When the counter appears, look for a line, usually below the counter or somewhere at the bottom, mentioning the key to press to access the BIOS setup. Usually the key to press is Del , F1 , or Esc . Press this key until the BIOS setup screen appears. Procedure 52.1 Changing the BIOS Boot Sequence 1 Enter the BIOS using the proper key as announced by the boot routines and wait for the BIOS screen to appear. 2 To change the boot sequence in an AWARD BIOS, look for the BIOS FEATURES SETUP entry. Other manufacturers may have a different name for this, such as ADVANCED CMOS SETUP. When you have found the entry, select it and confirm with Enter . 3 In the screen that opens, look for a subentry called BOOT SEQUENCE. The boot sequence is often set to something like C,A or A,C. In the former case, the machine first searches the hard disk (C) then the floppy drive (A) to find a bootable medium. Change the settings by pressing PgUp or PgDown until the sequence is A,CDROM,C. 4 Leave the BIOS setup screen by pressing Esc . To save the changes, select SAVE & EXIT SETUP or press F10 . To confirm that your settings should be saved, press Y . Procedure 52.2 Changing the Boot Sequence in a SCSI BIOS (Adaptec Host Adapter) 1 Open the setup by pressing
Ctrl
2 Select Disk Utilities, which displays the connected hardware components. Common Problems and Their Solutions 921
Make note of the SCSI ID of your CD-ROM drive. 3 Exit the menu with
Esc
4 Open Configure Adapter Settings. Under Additional Options, select Boot Device Options and press Enter . 5 Enter the ID of the CD-ROM drive and press 6 Press
Esc Enter
again.
7 Exit this screen and confirm with Yes to boot the computer. Regardless of what language and keyboard layout your final installation will be using, most BIOS configurations use the US keyboard layout as depicted in the following figure: Figure 52.1 US Keyboard Layout
Esc F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12
~ `
Tab
! 1 Q
@ 2 W A Z
Alt
# 3 E S X
$ 4 R D C
% 5 T F V
^ 6 Y G B
& 7 U H N
* 8 I J M
( 9 O K < ,
) 0 P L > .
Alt
_ { [ : ; ? / " '
+ = } ]
| \
<--
Enter Shift
Ctrl
Ctrl
922
1 With the first CD or DVD still in the CD-ROM drive, reboot the machine with Ctrl + Alt + Del or using the hardware reset button. 2 When the boot screen appears, use the arrow keys of your keyboard to navigate to Installation--ACPI Disabled and press Enter to launch the boot and installation process. This option disables the support for ACPI power management techniques. 3 Proceed with the installation as described in Chapter 3, Installation with YaST (page 35). If this fails, proceed as above, but choose Installation--Safe Settings instead. This option disables ACPI and DMA support. Most hardware should boot with this option. If both of these options fail, use the boot options prompt to pass any additional parameters needed to support this type of hardware to the installation kernel. For more information about the parameters available as boot options, refer to the kernel documentation located in /usr/src/linux/Documentation/kernel-parameters.txt. TIP: Obtaining Kernel Documentation Install the kernel-source package to view the kernel documentation. There are various other ACPI-related kernel parameters that can be entered at the boot prompt prior to booting for installation: acpi=off This parameter disables the complete ACPI subsystem on your computer. This may be useful if your computer cannot handle ACPI at all or if you think ACPI in your computer causes trouble. acpi=force Always enable ACPI even if your computer has an old BIOS dated before the year 2000. This parameter also enables ACPI if it is set in addition to acpi=off. acpi=noirq Do not use ACPI for IRQ routing. acpi=ht Run only enough ACPI to enable hyper-threading.
923
acpi=strict Be less tolerant of platforms that are not strictly ACPI specification compliant. pci=noacpi Disable PCI IRQ routing of the new ACPI system. Once you have determined the right parameter combination, YaST automatically writes them to the boot loader configuration to make sure that the system boots properly next time. If unexplainable errors occur when the kernel is loaded or during the installation, select Memory Test in the boot menu to check the memory. If Memory Test returns an error, it is usually a hardware error.
924
3 Select Installation and proceed with the installation as described in Chapter 3, Installation with YaST (page 35). To perform a VNC installation, proceed as follows: 1 Boot for installation. 2 Enter the following text at the boot options prompt:
vnc=1 vncpassword=some_password
Replace some_password with the password to use for installation. 3 Select Installation then press
Enter
Instead of starting right into the graphical installation routine, the system continues to run in text mode then halts, displaying a message containing the IP address and port number at which the installer can be reached via a browser interface or a VNC viewer application. 4 If using a browser to access the installer, launch the browser and enter the address information provided by the installation routines on the future SUSE Linux Enterprise machine and hit Enter :
http://ip_address_of_machine:5801
A dialog opens in the browser window prompting you for the VNC password. Enter it and proceed with the installation as described in Chapter 3, Installation with YaST (page 35). IMPORTANT Installation via VNC works with any browser under any operating system, provided Java support is enabled. If you use any kind of VNC viewer on your preferred operating system, enter the IP address and password when prompted to do so. A window opens, displaying the installation dialogs. Proceed with the installation as usual.
925
926
927
The returned line indicates that the machine's default runlevel (initdefault) is set to 5 and that it should boot to the graphical desktop. If the runlevel is set to any other number, use the YaST Runlevel Editor module to set it to 5. IMPORTANT Do not edit the runlevel configuration manually. Otherwise SuSEconfig (run by YaST) will overwrite these changes on its next run. If you need to make manual changes here, disable future SuSEconfig changes by setting CHECK_INITTAB in /etc/sysconfig/suseconfig to no. If the runlevel is set to 5, you might have corruption problems with your desktop or X Windows software. Examine the log files at /var/log/Xorg.*.log for detailed messages from the X server as it attempted to start. If the desktop fails during start, it might log error messages to /var/log/messages. If these error messages hint at a configuration problem in the X server, try to fix these issues. If the graphical system still does not come up, consider reinstalling the graphical desktop. One quick test: the startx command should force the X Window System to start with the configured defaults if the user is currently logged in on the console. If that does not work, it should log errors to the console. For more information about the X Window system configuration, refer to Chapter 27, The X Window System (page 495).
them but then does not behave properly (fails to start the graphic desktop, produces errors, drops to a command line, etc.).
3 Enter the username and password for root. 4 Make all the necessary changes. 5 Boot into the full multiuser and network mode by entering telinit 5 at the command line.
930
Login Successful but GNOME Desktop Fails (page 933) and Section 52.4.4, Login Successful but KDE Desktop Fails (page 934). 4 If the user's home directory has been used with another Linux distribution, remove the Xauthority file in the user's home. Use a console login via Ctrl + Alt + F1 and run rm .Xauthority as this user. This should eliminate X authentication problems for this user. Try a graphical login again. 5 If graphical login still fails, do a console login with Ctrl + Alt + F1 . Try to start an X session on another displaythe first one (:0) is already in use:
startx -- :1
This should bring up a graphical screen and your desktop. If it does not, check the log files of the X Window System (/var/log/Xorg.displaynumber .log) or the log file for your desktop applications (.xsession-errors in the user's home directory) for any irregularities. 6 If the desktop could not start because of corrupt configuration files, proceed with Section 52.4.3, Login Successful but GNOME Desktop Fails (page 933) or Section 52.4.4, Login Successful but KDE Desktop Fails (page 934). The following are some common reasons why network authentication for a particular user might fail on a specific machine: The user might have entered the wrong password. The username exists in the machine's local authentication files and is also provided by a network authentication system, causing conflicts. The home directory exists but is corrupt or unavailable. Perhaps it is write protected or is on a server that is inaccessible at the moment. The user does not have permission to log in to that particular host in the authentication system. The machine has changed hostnames, for whatever reason, and the user does not have permission to log in to that host. The machine cannot reach the authentication server or directory server that contains that user's information.
931
There might be problems with the X Window System authenticating this particular user, especially if the user's home has been used with another Linux distribution prior to installing the current one. To locate the cause of the login failures with network authentication, proceed as follows: 1 Check whether the user remembered his password correctly before you start debugging the whole authentication mechanism. 2 Determine the directory server the machine relies on for authentication and make sure that it is up and running and properly communicating with the other machines. 3 Determine that the user's username and password work on other machines to make sure that his authentication data exists and is properly distributed. 4 See if another user can log in to the misbehaving machine. If another user can log in without difficulty or if root can log in, log in and examine the /var/ log/messages file. Locate the time stamps that correspond to the login attempts and determine if PAM has produced any error messages. 5 Try to log in from a console (using Ctrl + Alt + F1 ). If this is successful, the blame cannot be put on PAM or the directory server on which the user's home is hosted, because it is possible to authenticate this user on this machine. Try to locate any problems with the X Window System or the desktop (GNOME or KDE). For more information, refer to Section 52.4.3, Login Successful but GNOME Desktop Fails (page 933) and Section 52.4.4, Login Successful but KDE Desktop Fails (page 934). 6 If the user's home directory has been used with another Linux distribution, remove the Xauthority file in the user's home. Use a console login via Ctrl + Alt + F1 and run rm .Xauthority as this user. This should eliminate X authentication problems for this user. Try a graphical login again. 7 If graphical login still fails, do a console login with Ctrl + Alt + F1 . Try to start an X session on another displaythe first one (:0) is already in use:
startx -- :1
This should bring up a graphical screen and your desktop. If it does not, check the log files of the X Window System (/var/log/Xorg.displaynumber .log) or the log file for your desktop applications (.xsession-errors in the user's home directory) for any irregularities. 932 Installation and Administration
8 If the desktop could not start because of corrupt configuration files, proceed with Section 52.4.3, Login Successful but GNOME Desktop Fails (page 933) or Section 52.4.4, Login Successful but KDE Desktop Fails (page 934).
4 Log out. 5 Have the user log in, but do not allow him to run any applications. 6 Recover the user's individual application configuration data (including the Evolution e-mail client data) by copying the ~/.gconf-ORIG-RECOVER/apps/ directory back into the new ~/.gconf directory as follows:
cp -a ./.gconf-ORIG-RECOVER/apps ./.gconf/
If this causes the login problems, attempt to recover only the critical application data and force the user to reconfigure the remainder of the applications.
933
Replace user with the actual username. Removing these two directories just removes the corrupted cache files. No real data is harmed using this procedure. Corrupted desktop configuration files can always be replaced with the initial configuration files. If you want to recover the user's adjustments, carefully copy them back from their temporary location after the configuration has been restored using the default configuration values. To replace a corrupted desktop configuration with the initial configuration values, proceed as follows: 1 Log in as root. 2 Enter the user's home directory:
cd /home/user
3 Move the KDE configuration directory and the .skel files to a temporary location:
mv .kde .kde-ORIG-RECOVER mv .skel .skel-ORIG-RECOVER
4 Log out.
934
5 Let the user log in to this machine. 6 After the desktop has started successfully, copy the user's own configurations back into place:
cp -a .kde-ORIG-RECOVER/share .kde/share
IMPORTANT If the user's own adjustments caused the login to fail and continue to do so, repeat the procedure as described above, but do not copy the .kde/ share directory.
935
DNS (Name Service) A broken or malfunctioning name service affects the network's functioning in many ways. If the local machine relies on any network servers for authentication and these servers cannot be found due to name resolution issues, users would not even be able to log in. Machines in the network managed by a broken name server would not be able to see each other and communicate. NTP (Time Service) A malfunctioning or completely broken NTP service could affect Kerberos authentication and X server functionality. NFS (File Service) If any application needed data stored in an NFS mounted directory, it would not be able to start or function properly if this service was down or misconfigured. In a worst case scenario, a user's personal desktop configuration would not come up if his home directory containing the .gconf or .kde subdirectories could not be found due to an outage of the NFS server. Samba (File Service) If any application needed data stored in a directory on a Samba server, it would not be able to start or function properly if this service was down. NIS (User Management) If your SUSE Linux Enterprise system relied on a NIS server to provide the user data, users would not be able to log in to this machine if the NIS service was down. LDAP (User Management) If your SUSE Linux Enterprise system relied on an LDAP server to provide the user data, users would not be able to log in to this machine if the LDAP service was down. Kerberos (Authentication) Authentication would not work and login to any machine would fail. CUPS (Network Printing) Users would not be able to print. 4 Check whether the network servers are running and whether your network setup allows you to establish a connection:
936
IMPORTANT The debugging procedure described below only applies to a simple network server/client setup that does not involve any internal routing. It assumes both server and client are members of the same subnet without the need for additional routing. a Use ping hostname (replace hostname with the hostname of the server) to check whether each one of them is up and responding to the network. If this command is successful, it tells you that the host you were looking for is up and running and that the name service for your network is configured correctly. If ping fails with destination host unreachable, either your system or the desired server is not properly configured or down. Check whether your system is reachable by running ping your_hostname from another machine. If you can reach your machine from another machine, it is the server that is not running at all or not configured correctly. If ping fails with unknown host, the name service is not configured correctly or the hostname used was incorrect. Use ping -n ipaddress to try to connect to this host without name service. If this is successful, check the spelling of the hostname and for a misconfigured name service in your network. For further checks on this matter, refer to Step 4.b (page 937). If ping still fails, either your network card is not configured correctly or your network hardware is faulty. Refer to Step 4.c (page 938) for information about this. b Use host hostname to check whether the hostname of the server you are trying to connect to is properly translated into an IP address and vice versa. If this command returns the IP address of this host, the name service is up and running. If the host command fails, check all network configuration files relating to name and address resolution on your host: /etc/resolv.conf This file is used to keep track of the name server and domain you are currently using. It can be modified manually or automatically adjusted by YaST or DHCP. Automatic adjustment is preferable. However, make sure that this file has the following structure and all network addresses and domain names are correct: Common Problems and Their Solutions 937
This file can contain more than one name server address, but at least one of them must be correct to provide name resolution to your host. If needed, adjust this file using the YaST DNS and Hostname module. If your network connection is handled via DHCP, enable DHCP to change hostname and name service information by selecting Change Hostname via DHCP and Update Name Servers and Search List via DHCP in the YaST DNS and Hostname module. /etc/nsswitch.conf This file tells Linux where to look for name service information. It should look like this:
... hosts: files dns networks: files dns ...
The dns entry is vital. It tells Linux to use an external name server. Normally, these entries are automatically made by YaST, but it never hurts to check. If all the relevant entries on the host are correct, let your system administrator check the DNS server configuration for the correct zone information. For detailed information about DNS, refer to Chapter 34, The Domain Name System (page 629). If you have made sure that the DNS configuration of your host and the DNS server are correct, proceed with checking the configuration of your network and network device. c If your system cannot establish a connection to a network server and you have excluded name service problems from the list of possible culprits, check the configuration of your network card. Use the command ifconfig network_device (executed as root) to check whether this device was properly configured. Make sure that both inet address and Mask are configured correctly. An error in the IP address or a missing bit in your network mask would render your network configuration unusable. If necessary, perform this check on the server as well.
938
d If the name service and network hardware are properly configured and running, but some external network connections still get long time-outs or fail entirely, use traceroute fully_qualified_domain_name (executed as root) to track the network route these requests are taking. This command lists any gateway (hop) a request from your machine passes on its way to its destination. It lists the response time of each hop and whether this hop is reachable at all. Use a combination of traceroute and ping to track down the culprit and let the administrators know. Once you have identified the cause of your network trouble, you can resolve it yourself (if the problem is located on your machine) or let the system administrators of your network know about your findings so they can reconfigure the services or repair the necessary systems.
939
c Enter the path to the location of the backup if you want to keep a local backup. For your backup to be archived on a network server (via NFS), enter the IP address or name of the server and the directory that should hold your archive. d Determine the archive type and click Next. e Determine the backup options to use, such as whether files not belonging to any package should be backed up and whether a list of files should be displayed prior to creating the archive. Also determine whether changed files should be identified using the time-consuming MD5 mechanism. Use Expert to enter a dialog for the backup of entire hard disk areas. Currently, this option only applies to the Ext2 file system. f Finally, set the search constraints to exclude certain system areas from the backup area that do not need to be backed up, such as lock files or cache files. Add, edit, or delete items until your needs are met and leave with OK. 3 Once you have finished the profile settings, you can start the backup right away with Create Backup or configure automatic backup. It is also possible to create other profiles tailored for various other purposes. To configure automatic backup for a given profile, proceed as follows: 1 Select Automatic Backup from the Profile Management menu. 2 Select Start Backup Automatically. 3 Determine the backup frequency. Choose daily, weekly, or monthly. 4 Determine the backup start time. These settings depend on the backup frequency selected. 5 Decide whether to keep old backups and how many should be kept. To receive an automatically generated status message of the backup process, check Send Summary Mail to User root. 6 Click OK to apply your settings and have the first backup start at the time specified.
940
941
Automatic Repair
To start the automatic repair mode of YaST System Repair, proceed as follows: 1 Boot the system with the original installation medium used for the initial installation (as outlined in Chapter 3, Installation with YaST (page 35)). 2 In System Analysis, select Other Repair Installed System.
942
3 Select Automatic Repair. YaST now launches an extensive analysis of the installed system. The progress of the procedure is displayed at the bottom of the screen with two progress bars. The upper bar shows the progress of the currently running test. The lower bar shows the overall progress of the analysis. The log window in the top section tracks the currently running test and its result. See Figure 52.2, Automatic Repair Mode (page 943). The following main test runs are performed with every run. They contain, in turn, a number of individual subtests. Figure 52.2 Automatic Repair Mode
Partition Tables of All Hard Disks Checks the validity and coherence of the partition tables of all detected hard disks. Swap Partitions The swap partitions of the installed system are detected, tested, and offered for activation where applicable. The offer should be accepted for the sake of a higher system repair speed. File Systems All detected file systems are subjected to a file systemspecific check.
943
Entries in the File /etc/fstab The entries in the file are checked for completeness and consistency. All valid partitions are mounted. Boot Loader Configuration The boot loader configuration of the installed system (GRUB or LILO) is checked for completeness and coherence. Boot and root devices are examined and the availability of the initrd modules is checked. Package Database This checks whether all packages necessary for the operation of a minimal installation are present. While it is optionally possible also to analyze the base packages, this takes a long time because of their vast number. 4 Whenever an error is encountered, the procedure stops and a dialog opens outlining the details and possible solutions. Read the screen messages carefully before accepting the proposed fix. If you decide to decline a proposed solution, your system remains unchanged. 5 After the repair process has been terminated successfully, click OK and Finish and remove the installation media. The system automatically reboots.
Customized Repair
To launch the Customized Repair mode and selectively check certain components of your installed system, proceed as follows: 1 Boot the system with the original installation medium used for the initial installation (as outlined in Chapter 3, Installation with YaST (page 35)). 2 In System Analysis, select Other Repair Installed System. 3 Select Customized Repair. Choosing Customized Repair shows a list of test runs that are all marked for execution at first. The total range of tests matches that of automatic repair. If you already know where no damage is present, unmark the corresponding tests. Clicking Next starts a narrower test procedure that probably has a significantly shorter running time.
944
Not all test groups can be applied individually. The analysis of the fstab entries is always bound to an examination of the file systems, including existing swap partitions. YaST automatically resolves such dependencies by selecting the smallest number of necessary test runs. 4 Whenever an error is encountered, the procedure stops and a dialog opens outlining the details and possible solutions. Read the screen messages carefully before accepting the proposed fix. If you decide to decline a proposed solution, your system remains unchanged. 5 After the repair process has been terminated successfully, click OK and Finish and remove the installation media. The system automatically reboots.
Expert Tools
If you are knowledgeable with SUSE Linux Enterprise and already have a very clear idea of what needs to be repaired in your system, directly apply the tools skipping the system analysis. To make use of the Expert Tools feature of the YaST System Repair module, proceed as follows: 1 Boot the system with the original installation medium used for the initial installation (as outlined in Chapter 3, Installation with YaST (page 35)). 2 In System Analysis, select Other Repair Installed System. 3 Select Expert Tools and choose one or more repair options. 4 After the repair process has been terminated successfully, click OK and Finish and remove the installation media. The system automatically reboots. Expert tools provides the following options to repair your faulty system: Install New Boot Loader This starts the YaST boot loader configuration module. Find details in Section 21.3, Configuring the Boot Loader with YaST (page 411).
945
Start Partitioning Tool This starts the expert partitioning tool in YaST. Find details in Section 7.5.8, Partitioner (page 161). Repair File System This checks the file systems of your installed system. You are first offered a selection of all detected partitions and can then choose the ones to check. Recover Lost Partitions It is possible to attempt to reconstruct damaged partition tables. A list of detected hard disks is presented first for selection. Clicking OK starts the examination. This can take a while depending on the processing power and size of the hard disk. IMPORTANT: Reconstructing a Partition Table The reconstruction of a partition table is tricky. YaST attempts to recognize lost partitions by analyzing the data sectors of the hard disk. The lost partitions are added to the rebuilt partition table when recognized. This is, however, not successful in all imaginable cases. Save System Settings to Floppy This option saves important system files to a floppy disk. If one of these files become damaged, it can be restored from disk. Verify Installed Software This checks the consistency of the package database and the availability of the most important packages. Any damaged installed packages can be reinstalled with this tool.
946
Access the installed system in a change root environment Check, modify, and reinstall the boot loader configuration Resize partitions using the parted command. Find more information about this tool at the Web site of GNU Parted (http://www.gnu.org/software/parted/ parted.html). The rescue system can be loaded from various sources and locations. The simplest option is to boot the rescue system from the original installation CD or DVD: 1 Insert the installation medium into your CD or DVD drive. 2 Reboot the system. 3 At the boot screen, choose the Rescue System option. 4 Enter root at the Rescue: prompt. A password is not required. If your hardware setup does not include a CD or DVD drive, you can boot the rescue system from a network source (including the SUSE FTP server). The following example applies to a remote boot scenarioif using another boot medium, such as a floppy disk, modify the info file accordingly and boot as you would for a normal installation. 1 Enter the configuration of your PXE boot setup and replace install=protocol://instsource with rescue=protocol://instsource. As with a normal installation, protocol stands for any of the supported network protocols (NFS, HTTP, FTP, etc.) and instsource for the path to your network installation source. 2 Boot the system using Wake on LAN. 3 Enter root at the Rescue: prompt. A password is not required. Once you have entered the rescue system, you can make use of the virtual consoles that can be reached with Alt + F1 to Alt + F6 . A shell and many other useful utilities, such as the mount program, are available in the /bin directory. The sbin directory contains important file and network utilities for reviewing and repairing the file system. This directory also contains the most important binaries for system maintenance, such as fdisk, mkfs, mkswap, mount, mount, init, and Common Problems and Their Solutions 947
shutdown, and ifconfig, ip, route, and netstat for maintaining the network. The directory /usr/bin contains the vi editor, find, less, and ssh. To see the system messages, either use the command dmesg or view the file /var/ log/messages.
All directories of the system are now located under /mnt 3 Change the directory to the mounted root file system:
cd /mnt
4 Open the problematic configuration file in the vi editor. Adjust and save the configuration. 5 Unmount the root file system from the rescue system:
umount /mnt
948
task (see Section Using YaST System Repair (page 942) for details). However, if you need to do a manual file system check or repair, boot the rescue system. It contains the utilities to check and repair the ext2, ext3, reiserfs, xfs, jfs, dosfs, and vfat file systems.
5 Now you have access to the installed system. Before rebooting the system, unmount the partitions with umount -a and leave the change root environment with exit. WARNING: Limitations Although you have full access to the files and applications of the installed system, there are some limitations. The kernel that is running is the one that was booted with the rescue system. It only supports essential hardware and it is not possible to add kernel modules from the installed system unless the kernel
949
versions are exactly the same (which is unlikely). So you cannot access a sound card, for example. It is also not possible to start a graphical user interface. Also note that you leave the change root environment when you switch the console with Alt + F1 to Alt + F6 .
4 Unmount the partitions, log out from the change root environment, and reboot the system:
umount -a exit reboot
950
951
0.0.0150 is the channel to which the DASD is connected. The 1 means activate the disk (a 0 at this place would deactivate the disk). The 0 stands for no DIAG mode for the disk (a 1 here would enable DAIG access to the disk). 2 Now the DASD is online (check with cat /proc/partitions) and can used for subsequent commands. Procedure 52.4 Configuring a zFCP Disk 1 To configure a zFCP disk, it is necessary to first configure the zFCP adapter. Do this with the following command:
zfcp_host_configure 0.0.4000 1
0.0.4000 is the channel to which the adapter is attached and 1 stands for activate (a 0 here would deactivate the adapter). 2 After the adapter is activated, a disk can be configured. Do this with the following command:
zfcp_disk_configure 0.0.4000 1234567887654321 8765432100000000 1
0.0.4000 is the previously-used channel ID, 1234567887654321 is the WWPN (World wide Port Number), and 8765432100000000 is the LUN (logical unit number). The 1 stands for activating the disk (a 0 here would deactivate the disk). 3 Now the zFCP disk is online (check with cat /proc/partitions) and can used for subsequent commands.
952
953
Finally, halt the rescue system with the halt command. The SUSE Linux Enterprise Server system can now be IPLed as described in Section 3.9.10, IBM System z: IPLing the Installed System (page 55).
954
Index
Symbols
64-bit Linux, 379 kernel specifications, 383 runtime support, 380 software development, 380
A
access permissions (see permissions) ACLs, 299310 access, 301, 304 check algorithm, 309 default, 302, 307 definitions, 301 effects, 307 handling, 302 masks, 306 permission bits, 303 structure, 302 support, 310 ACPI disabling, 39 add-on products, 146 Apache, 173, 751789 CGI scripts, 776 configuring, 753 files, 753 manually, 753760 virtual host, 756 YaST, 761767 installing, 752 modules, 769776 available, 770 building, 775 external, 774 installing, 770 multiprocessing, 773
quick start, 751 security, 784 Squid, 805 SSL, 779784 configure Apache with SSL, 783 creating an SSL certificate, 779 starting, 767 stopping, 767 troubleshooting, 786 authentication Kerberos, 210 PAM, 513520 AutoYaST, 181 cloning system, 67
B
backups, 150 creating with YaST, 158 restoring, 159 Bash, 346358 .bashrc, 422 .profile, 422 commands, 346 features, 353 pipes, 355 profile, 421 wild cards, 354 BIND, 640650 BIOS boot sequence, 921 booting, 385 boot sectors, 401402 CD, from, 920 configuring, 54 YaST, 411416 floppy disks, from, 919 graphic, 417 GRUB, 401420 initramfs, 387
C
cards graphics, 501 network, 578579 sound, 156 cat, 367 cd, 363 CDs booting from, 920 checking, 152 chgrp, 361, 364 chmod, 360, 364 chown, 361, 363 CJK, 429 clear, 372 commands, 361372 bzip2, 357 cat, 367 cd, 363 chgrp, 361, 364 chmod, 360, 364 chown, 361, 363 clear, 372 cp, 362 date, 370 df, 369 diff, 368 du, 369 file, 367 find, 366 fonts-config, 503 free, 369, 426 getfacl, 305 grep, 367 grub, 402
gzip, 357, 365 halt, 372 help, 348 ifconfig, 612 ip, 610 kadmin, 857 kill, 370 killall, 370 kinit, 864 ktadd, 866 ldapadd, 692 ldapdelete, 695 ldapmodify, 694 ldapsearch, 694, 870 less, 367 ln, 363 locate, 366 lp, 461 ls, 362 man, 361 mkdir, 363 mount, 368 mv, 363 nslookup, 371 passwd, 372 ping, 371, 611 ps, 370 reboot, 372 rm, 363 rmdir, 363 route, 613 rpm, 311 rpmbuild, 311 scp, 840 setfacl, 305 sftp, 841 slptool, 621 smbpasswd, 719 ssh, 840 ssh-agent, 843
ssh-keygen, 842 su, 372 tar, 356, 365 telnet, 371 top, 370 umount, 368 updatedb, 366 configuration files, 603 .bashrc, 422, 425 .emacs, 427 .mailsync, 746 .profile, 422 .xsession, 843 acpi, 525 asound.conf, 156 crontab, 422 csh.cshrc, 431 dhclient.conf, 667 dhcp, 603 dhcpd.conf, 668 fstab, 164, 368 group, 200 grub.conf, 409 host.conf, 606 HOSTNAME, 609 hosts, 173, 577, 605 ifcfg-*, 603 inittab, 389, 391392, 428 inputrc, 429 kernel, 387 krb5.conf, 858, 860, 867 krb5.keytab, 866 language, 429, 431 logrotate.conf, 423 menu.lst, 404 modprobe.d/sound, 156 named.conf, 641650, 796 network, 603 networks, 606 nscd.conf, 609
nsswitch.conf, 607, 699 openldap, 869 pam_unix2.conf, 699, 867 passwd, 200 permissions, 899 powersave, 525 powersave.conf, 218 profile, 421, 425, 431 resolv.conf, 426, 604, 641, 795 routes, 603 samba, 713 services, 713, 804 slapd.conf, 686, 870871 smb.conf, 713, 723 smppd.conf, 616 smpppd-c.conf, 617 squid.conf, 795, 797, 801, 803, 806, 808 squidguard.conf, 808 sshd_config, 844, 867 ssh_config, 868 suseconfig, 400 sysconfig, 168, 398400 termcap, 429 wireless, 603 XF86Config, 213 xorg.conf, 213, 497 Device, 501 Monitor, 502 Screen, 499 configuring, 398 cable modem, 592 DASD, 157 DNS, 172, 629 DSL, 169, 592 e-mail, 170 firewalls, 180 graphics cards, 153, 190 groups, 178 GRUB, 402, 409
hard disk controllers, 153 hard disks DMA, 154 hardware, 152158 IPv6, 576 ISDN, 169, 589 languages, 168 mail servers, 171 modems, 169, 586 monitor, 153, 190 network cards, 169 networks, 169176, 579 manually, 600615 NFS, 173174 NTP, 174 PAM, 216 power management, 167 powertweak, 167 printing, 455457 routing, 175, 603 Samba, 711717 clients, 176, 717 servers, 176 security, 176180 software, 139150 sound cards, 156 Squid, 797 SSH, 839 system, 137184 system services, 174 T-DSL, 595 time zone, 168 users, 177 wireless cards, 169 ZFCP, 158 consoles assigning, 428 graphical, 417 switching, 428 core files, 425
D
date, 370 deltarpm, 315 df, 369 DHCP, 172, 655671 configuring with YaST, 656 dhcpd, 668669 packages, 667 server, 668669 static address assignment, 669 diff, 368 directories changing, 363 creating, 363 deleting, 363 paths, 351 structure, 349 disks boot, 159, 416 required space, 45 rescue, 159 Distributed Replicated Block Device (see DRBD) DNS, 577 BIND, 640650 configuring, 172, 629 domains, 604 forwarding, 641 logging, 645 mail exchanger, 578 name servers, 604 NIC, 578 options, 643 reverse lookup, 649
security and, 898 Squid and, 796 starting, 641 terminology, 629 top level domain, 577 troubleshooting, 641 zones files, 646 documentation (see help) domain name system (see DNS) DOS sharing files, 709 DRBD, 274 drivers, 147 drives mounting, 368 unmounting, 368 du, 369
F
file, 367 file servers, 174 file systems, 483493 ACLs, 299310 cryptofs, 873 encrypting, 873 Ext2, 485486 Ext3, 486487 FAT, 48 LFS, 491 limitations, 491 NTFS, 4950 OCFS2, 285297 Reiser4, 488 ReiserFS, 484485 repairing, 948 selecting, 484 supported, 490491 terms, 483 XFS, 488489 files archiving, 356, 365 comparing, 368 compressing, 356, 365 copying, 362 deleting, 363 encrypting, 876 finding, 424 moving, 363 paths, 351 searching contents, 367 searching for, 366 synchronizing, 729749 CVS, 730, 738740
E
e-mail configuring, 170 synchronizing, 731 mailsync, 746749 editors Emacs, 427428 vi, 372 Emacs, 427428 .emacs, 427 default.el, 427 encoding ISO-8859-1, 431 encrypting, 873876 creating partitions, 874 files, 876877 files with vi, 876 partitions, 874876 removable media, 876 YaST, with, 874
mailsync, 731, 746749 rsync, 731 Subversion, 731 Unison, 730, 736738 uncompressing, 357 viewing, 355, 367 find, 366 Firefox URL open command, 220 firewalls, 180, 829 packet filters, 829, 832 Squid and, 803 SuSEfirewall2, 829, 833 fonts, 503 CID-keyed, 508 TrueType, 503 X11 core, 503 Xft, 504 free, 369
G
GNOME shell, 346 graphics 3D, 508511 3Ddiag, 510 diagnosis, 509 drivers, 508 installation support for, 510 SaX, 509 support for, 508 testing, 510 troubleshooting, 510 cards 3D, 508511 drivers, 501 GLIDE, 508511 OpenGL, 508511 drivers, 508
testing, 510 grep, 367 groups managing, 178 GRUB, 401420 boot menu, 404 boot password, 410 boot sectors, 402 booting, 402 commands, 402411 device names, 405 device.map, 403, 408 GRUB Geom Error, 418 grub.conf, 403, 409 JFS and GRUB, 418 limitations, 402 Master Boot Record (MBR), 401 menu editor, 407 menu.lst, 403404 partition names, 405 troubleshooting, 418 uninstalling, 416 gunzip, 357 gzip, 357, 365
H
HA, 269277 clusters, 275 cold standby, 270 DRBD, 274 failover, 270 Heartbeat, 273, 279283 hot standby, 270 Linux Virtual Server, 275 load balancing, 270 RAID, 274 rsync, 274 SPOF, 270 STONITH, 270
warm standby, 270 halt, 372 hard disks DMA, 154 hardware DASD, 157 graphics cards, 153, 190 hard disk controllers, 153 information, 154 infrared, 153 ISDN, 589 monitor, 153, 190 ZFCP, 158 Heartbeat, 273, 279283 help, 905908 books, 911 FAQs, 910 guides, 911 HOWTOs, 910 info pages, 427, 910 Linux documentation (TLDP), 910 man pages, 361, 427, 909 manuals, 911 package documentation, 912 specifications, 913 standards, 913 SUSE books, 911 SUSE Help Center, 905 Usenet, 913 Wikipedia, 911 X, 502 high availability (see HA) hostnames, 172
adding scripts, 394 inittab, 389 scripts, 392396 installation support 3D graphics cards and, 510 installing directory, into, 151 GRUB, 402 manually, 215 packages, 312 Xen, 151 YaST, with, 3567 internationalization, 429 Internet cinternet, 617 dial-up, 615617 DSL, 592 ISDN, 589 KInternet, 617 qinternet, 617 smpppd, 615617 TDSL, 595 IP addresses, 565 classes, 565 dynamic assignment, 655 IPv6, 568 configuring, 576 masquerading, 831 private, 567 iSCSI, 259
J
joystick configuring, 155
I
I18N, 429 inetd, 174 info pages, 427 init, 389
K
KDE shell, 346 Kerberos, 845851
administering, 853871 authenticators, 846 clients configuring, 858860 clock skew, 860 clock synchronization, 855 configuring clients, 858860 credentials, 846 installing, 853871 KDC, 854858 administering, 863 nsswitch.conf, 854 starting, 858 keytab, 866 LDAP and, 868871 master key, 856 PAM support, 866867 principals, 846 creating, 857 host, 865 realms, 853 creating, 857 session key, 846 SSH configuration, 867 stash file, 856 ticket-granting service, 849 tickets, 846, 849 kernels caches, 426 limits, 492 keyboard Asian characters, 429 configuring, 155 layout, 428 mapping, 428 compose, 429 multikey, 429 X Keyboard Extension, 429 XKB, 429
L
L10N, 429 languages, 150, 168 laptops power management, 521533 LDAP, 681708 access control, 689 ACLs, 687 adding data, 691 administering groups, 706 administering users, 706 configuring YaST, 695 deleting data, 695 directory tree, 683 Kerberos and, 868871 ldapadd, 691 ldapdelete, 695 ldapmodify, 693 ldapsearch, 694 modifying data, 693 searching data, 694 server configuration manual, 686 YaST, 695 YaST client, 698 modules, 700 templates, 700 less, 355, 367 LFS, 491 license agreement, 42 Lightweight Directory Access Protocol (see LDAP) Linux networks and, 561
sharing files with another OS, 709 uninstalling, 416 Linux virtual server, 275 linuxrc manual installation, 215 ln, 363 localization, 429 locate, 366, 424 log files, 179, 423 boot.msg, 182, 525 messages, 182, 641, 837 Squid, 796, 799, 805 Unison, 738 XFree86, 510 logging login attempts, 179 Logical Volume Manager (see LVM) logrotate, 423 LPAR installation IPL, 55 ls, 347, 362 LSB installing packages, 311 LVM YaST, 123
YaST, 586 more, 355 mount, 368 mouse configuring, 155 multipath IO, 251257 LVM2, 257 mdadm, 257 software configuration, 253 supported hardware, 252 system configuration, 253 mv, 363
N
name servers (see DNS) NAT (see masquerading) NetBIOS, 710 Network File System (see NFS) Network Information Service (see NIS) networks, 561 authentication Kerberos, 845851 base network address, 566 broadcast address, 567 configuration files, 603609 configuring, 169176, 578595, 600 615 IPv6, 576 DHCP, 172, 655 DNS, 577 localhost, 567 netmasks, 565 routing, 175, 565 SLP, 619 TCP/IP, 561 YaST, 579 alias, 582 gateway, 583 hostname, 582
M
mail servers configuring, 171 man pages, 361, 427 masquerading, 831 configuring with SuSEfirewall2, 833 Master Boot Record (see MBR) MBR, 401402 memory RAM, 426 mkdir, 363 modems cable, 592
IP address, 581 starting, 584 NFS, 725 clients, 173, 725 importing, 726 mounting, 726 servers, 174, 726 NIS, 673680 clients, 174, 679 masters, 673679 servers, 174 slaves, 673679 nslookup, 371 NSS, 607 databases, 608 NTP client, 174
O
OpenLDAP (see LDAP) OpenSSH (see SSH) OpenWBEM, 223250 OS/2 sharing files, 709
P
packages compiling, 319 compiling with build, 321 installing, 312 LSB, 311 package manager, 311 RPMs, 311 uninstalling, 312 verifying, 312 packet filters (see firewalls) PAM, 513520 configuring, 216 partitions
creating, 44, 161, 163 encrypting, 874 EVMS, 163 fstab, 164 LVM, 163 parameters, 163 partition table, 401 RAID, 163 resizing Windows, 47 swap, 163 types, 44 passwd, 372 passwords changing, 372 paths, 351 absolute, 351 relative, 351 PCI device drivers, 166 permissions, 358 ACLs, 299310 changing, 360, 364 directories, 359 file permissions, 424 file systems, 358 files, 358 viewing, 360 ping, 371, 611 Pluggable Authentication Modules (see PAM) ports 53, 643 scanning, 805 PostgreSQL updating, 200 power management, 521541 ACPI, 521, 524531, 536 APM, 521, 523524, 536 battery monitor, 522 charge level, 537
cpufrequency, 533 cpuspeed, 533 hibernation, 522 powersave, 533 standby, 522 suspend, 522 YaST, 541 powersave, 533 configuring, 533 printing, 451, 455457 applications, from, 461 command line, 461 configuring with YaST, 455 connection, 456 CUPS, 461 drivers, 456 GDI printers, 467 Ghostscript driver, 456 kprinter, 461 network, 468 port, 456 PPD file, 456 queues, 456 Samba, 710 test page, 456 troubleshooting network, 468 xpp, 461 private branch exchange, 590 processes, 370 killing, 370 overview, 370 protocols CIFS, 709 IPv6, 568 LDAP, 681 SLP, 619 SMB, 709 proxies, 175, 791 (see Squid) advantages, 791
R
RAID, 274 YaST, 131 reboot, 372 registering command line, 152 Internet, without, 152 YaST, 152 release notes, 182 repairing systems, 942 rescue system, 946, 951 starting from CD, 947 starting from network source, 947 RFCs, 561 rm, 363 rmdir, 363 routing, 175, 565, 603604 masquerading, 831 netmasks, 565 routes, 603 static, 604 RPM, 311322 database rebuilding, 313, 319 deltarpm, 315 dependencies, 312 patches, 313 queries, 316 rpmnew, 312 rpmorig, 312 rpmsave, 312 security, 900 SRPMS, 319 tools, 322 uninstalling, 313
updating, 312 verify, 318 verifying, 312 rpmbuild, 311 rsync, 274, 731, 744 runlevels, 167, 389392 changing, 391392 editing in YaST, 396
S
Samba, 709724 CIFS, 709 clients, 176, 710, 717718 configuring, 711717 installing, 711 login, 718 names, 710 permissions, 717 printers, 710 printing, 718 security, 717 server, 710 servers, 176, 711717 shares, 710, 715 SMB, 709 starting, 711 stopping, 711 swat, 713 TCP/IP and, 709 SaX2 display device, 192 display settings, 190 dual head, 192 graphics card, 191 graphics tablet, 195 keyboard settings, 195 mouse settings, 194 multihead, 193 remote access (VNC), 196
resolution and color depth, 192 touchscreen, 196 SCPM, 167 screen resolution, 501 scripts init.d, 389, 392396, 614 boot, 393 boot.local, 394 boot.setup, 394 halt, 394 network, 614 nfsserver, 615 portmap, 615 rc, 392, 394 sendmail, 615 squid, 795 xinetd, 615 ypbind, 615 ypserv, 615 mkinitrd, 387 modify_resolvconf, 426, 605 SuSEconfig, 398400 disabling, 400 security, 889901 attacks, 897898 booting, 890, 892 bugs and, 893, 896 configuring, 177180 DNS, 898 engineering, 890 firewalls, 180, 829 intrusion detection, 216 local, 891894 network, 895898 passwords, 891892 permissions, 892893 reporting problems, 901 RPM signatures, 900 Samba, 717
serial terminals, 890 Squid, 792 SSH, 839844 tcpd, 901 telnet, 839 tips and tricks, 898 viruses, 894 worms, 898 X and, 895 Service Location Protocol (see SLP) shells, 345376 Bash, 346 commands, 361372 pipes, 355 wild cards, 354 SLP, 619 browser, 621 Konqueror, 621 registering services, 620 slptool, 621 SMB (see Samba) smpd, 709 soft RAID (see RAID) software compiling, 319 development SUSE SDK, 147 drivers, 147 installing, 139146 removing, 139146 sound configuring in YaST, 156 fonts, 157 MIDI, 157 mixers, 215 source compiling, 319 spm, 319 Squid, 791 access controls, 806
ACLs, 800 Apache, 805 cachemgr.cgi, 805, 807 caches, 791792 damaged, 796 size, 794 Calamaris, 809 configuring, 797 CPU and, 795 directories, 795 DNS, 796 features, 791 firewalls and, 803 log files, 796, 799, 805 object status, 793 permissions, 795, 800 RAM and, 794 reports, 809 security, 792 squidGuard, 807 starting, 795 statistics, 805, 807 stopping, 796 system requirements, 793 transparent proxies, 802, 805 troubleshooting, 796 uninstalling, 796 SSH, 839844 authentication mechanisms, 842 daemon, 841 key pairs, 841, 843 scp, 840 sftp, 841 ssh, 840 ssh-agent, 843844 ssh-keygen, 843 sshd, 841 X and, 843 su, 372 Subversion, 731, 741
SUSE books, 911 SUSE SDK, 147 SVN (Subversion), 731 system configuring, 137184 languages, 168 limiting resource use, 425 localizing, 429 rebooting, 372 rescuing, 946 security, 178 services, 174 shutdown, 372 updating, 149
updating online, 148149 command line, 187 passwd and group, 200 patch CD, 149 problems, 200 sound mixers, 215 YaST, 200 users /etc/passwd, 516, 699 managing, 177
V
variables environment, 430 virtual machine server, 435449 virtual memory, 163 VNC administration, 175
T
tar, 356, 365 TCP/IP, 561 ICMP, 562 IGMP, 562 layer model, 562 packets, 563564 TCP, 561 UDP, 562 telnet, 371 time zones, 168 TLDP, 910 top, 370 Tripwire replaced by AIDE, 216
W
whois, 578 wild cards, 366 Windows sharing files, 709
X
X character sets, 503 CID-keyed fonts, 508 display device, 192 display settings, 190 drivers, 501 dual head, 192 font systems, 503 fonts, 503 graphics card, 191 graphics tablet, 195 help, 502
U
ulimit, 425 options, 425 umount, 368 uninstalling GRUB, 416 Linux, 416 updatedb, 366
keyboard settings, 195 mouse settings, 194 multihead, 193 optimizing, 497503 remote access (VNC), 196 resolution and color depth, 192 SaX2, 497 security, 895 SSH and, 843 touchscreen, 196 TrueType fonts, 503 virtual screen, 501 X11 core fonts, 503 xf86config, 497 xft, 503 Xft, 504 X Keyboard Extension (see keyboard, XKB) X Window System (see X) X.509 certification certificates, 815 principles, 813 repository, 817 revocation list, 816 YaST, 813 X.Org, 497 Xen, 435449 installation into directory, 151 Xft, 504 xinetd, 174 XKB (see keyboard, XKB) xorg.conf color depth, 500 Depth, 500 Device, 500 Display, 500 Files, 498 InputDevice, 498 Modeline, 500 modelines, 498
Y
YaST 3D, 509 add-on, 146 autoinstallation, 181 profiles, 181 AutoYaST, 181 backups, 150, 158 boot configuration, 411 default system, 414 security, 415 time-out, 414 boot loader disk order, 415 location, 413 password, 415 type, 412 boot mode, 54 CA management, 180, 818 cable modem, 592 clustering, 160 configuring, 137184 Control Center, 138 DASD, 157 DHCP, 656 disk creation, 159 disk space, 45 DMA, 154 DNS, 172 driver CDs, 184 DSL, 592 e-mail, 170 EVMS, 161 firewall, 180 graphics cards, 153, 190
group management, 178 GRUB, 412 hard disk controllers, 153 hardware, 152158 detection, 53 information, 154 Heartbeat, 160 high availability, 160 hostname, 57, 172 infrared, 153 installation into directory, 151 installation mode, 43 installation scope, 51 installation settings, 43 installation sources, 147 installation summary, 43 installing with, 3567 ISDN, 589 joystick, 155 Kerberos client, 173 keyboard, 53, 155 languages, 40, 138, 150, 168 LDAP, 173 clients, 64, 698 servers, 695 LILO, 412 LVM, 123, 160 mail server, 171 media check, 152 modems, 586 monitor, 153, 190 ncurses, 184 network card, 579 network configuration, 58, 169176 NFS clients, 173 NFS server, 174 NIS clients, 65, 679 Novell AppArmor, 176 NTP client, 174 online update, 148149
package dependencies, 52 partitioning, 44, 161 PCI device drivers, 166 power management, 167, 541 powertweak, 167 printing, 455457 profile manager, 167 RAID, 131 registering, 152 release notes, 182 repairing systems, 942 root password, 58 routing, 175 runlevels, 396 safe settings, 39 Samba clients, 65, 176, 717 servers, 176 SCPM, 167 security, 177180 sendmail, 170 server certificate, 180 SLP, 176 SLP browser, 621 software, 139150 software updates, 60 sound cards, 156 starting, 36, 137 support query, 182 sysconfig editor, 168, 398 system analysis, 43 system security, 178 system start-up, 36 T-DSL, 595 text mode, 184190 modules, 187 time zone, 43, 168 updating, 149, 200 user management, 177 X.509 certification, 813
certificates, 821 changing default values, 823 creating CRLs, 825 exporting CA objects as a file, 827 exporting CA objects to LDAP, 825 importing general server certificates, 827 root CA, 818 sub-CA, 820 Xen, 151 ZFCP, 158 YP (see NIS)
Z
z/VM Installation IPL, 55