Product SiteDocumentation Site

Red Hat Enterprise Linux 6

Deployment Guide

Deployment, Configuration and Administration of Red Hat Enterprise Linux 6

Edition 2

Jaromír Hradílek

Red Hat, Inc. Engineering Content Services

Douglas Silas

Red Hat, Inc. Engineering Content Services

Martin Prpič

Red Hat, Inc. Engineering Content Services

Eva Kopalová

Red Hat, Inc. Engineering Content Services

Ella Deon Lackey

Red Hat, Inc. Engineering Content Services

Tomáš Čapek

Red Hat, Inc. Engineering Content Services

Petr Kovář

Red Hat, Inc. Engineering Content Services

Miroslav Svoboda

Red Hat, Inc. Engineering Content Services

John Ha

Red Hat, Inc. Engineering Content Services

David O'Brien

Red Hat, Inc. Engineering Content Services

Michael Hideo

Red Hat, Inc. Engineering Content Services

Don Domingo

Red Hat, Inc. Engineering Content Services

Legal Notice

Copyright © 2010, 2011 Red Hat, Inc.
The text of and illustrations in this document are licensed by Red Hat under a Creative Commons Attribution–Share Alike 3.0 Unported license ("CC-BY-SA"). An explanation of CC-BY-SA is available at http://creativecommons.org/licenses/by-sa/3.0/. In accordance with CC-BY-SA, if you distribute this document or an adaptation of it, you must provide the URL for the original version.
Red Hat, as the licensor of this document, waives the right to enforce, and agrees not to assert, Section 4d of CC-BY-SA to the fullest extent permitted by applicable law.
Red Hat, Red Hat Enterprise Linux, the Shadowman logo, JBoss, MetaMatrix, Fedora, the Infinity Logo, and RHCE are trademarks of Red Hat, Inc., registered in the United States and other countries.
Linux® is the registered trademark of Linus Torvalds in the United States and other countries.
Java® is a registered trademark of Oracle and/or its affiliates.
XFS® is a trademark of Silicon Graphics International Corp. or its subsidiaries in the United States and/or other countries.
MySQL® is a registered trademark of MySQL AB in the United States, the European Union and other countries.
All other trademarks are the property of their respective owners.


1801 Varsity Drive
RaleighNC 27606-2072 USA
Phone: +1 919 754 3700
Phone: 888 733 4281
Fax: +1 919 754 3701

Abstract
The Deployment Guide documents relevant information regarding the deployment, configuration and administration of Red Hat Enterprise Linux 6. It is oriented towards system administrators with a basic understanding of the system.

Preface
1. Target Audience
2. How to Read this Book
3. Document Conventions
3.1. Typographic Conventions
3.2. Pull-quote Conventions
3.3. Notes and Warnings
4. Feedback
5. Acknowledgments
I. Basic System Configuration
1. Keyboard Configuration
1.1. Changing the Keyboard Layout
1.2. Adding the Keyboard Layout Indicator
1.3. Setting Up a Typing Break
2. Date and Time Configuration
2.1. Date/Time Properties Tool
2.1.1. Date and Time Properties
2.1.2. Network Time Protocol Properties
2.1.3. Time Zone Properties
2.2. Command Line Configuration
2.2.1. Date and Time Setup
2.2.2. Network Time Protocol Setup
3. Managing Users and Groups
3.1. Introduction to Users and Groups
3.1.1. User Private Groups
3.1.2. Shadow Passwords
3.2. Using the User Manager Tool
3.2.1. Viewing Users and Groups
3.2.2. Adding a New User
3.2.3. Adding a New Group
3.2.4. Modifying User Properties
3.2.5. Modifying Group Properties
3.3. Using Command Line Tools
3.3.1. Adding a New User
3.3.2. Adding a New Group
3.3.3. Enabling Password Aging
3.3.4. Enabling Automatic Logouts
3.3.5. Creating Group Directories
3.4. Additional Resources
3.4.1. Installed Documentation
II. Package Management
4. Product Subscriptions and Entitlements
4.1. An Overview of Managing Subscriptions and Content
4.1.1. The Purpose of Subscription Management
4.1.2. Defining Subscriptions, Entitlements, and Products
4.1.3. Subscription Management Tools
4.1.4. Subscription and Content Architecture
4.1.5. Advanced Content Management: Extended Update Support
4.1.6. Certificate-based Red Hat Network versus RHN Classic
4.2. Using Red Hat Subscription Manager Tools
4.2.1. Launching Red Hat Subscription Manager
4.2.2. About subscription-manager
4.2.3. Looking at RHN Subscription Management
4.3. Managing Special Deployment Scenarios
4.3.1. Local Subscription Services, Local Content Providers, and Multi-Tenant Organizations
4.3.2. Virtual Guests and Hosts
4.3.3. Domains
4.4. Registering, Unregistering, and Reregistering a System
4.4.1. Registering Consumers in Hosted Environment
4.4.2. Registering Consumers to a Local Organization
4.4.3. Registering an Offline Consumer
4.4.4. Registering Consumers from the Command Line
4.4.5. Unregistering
4.4.6. Restoring a Registration
4.5. Handling Subscriptions
4.5.1. Subscribing and Unsubscribing through the GUI
4.5.2. Handling Subscriptions through the Command Line
4.5.3. Stacking Subscriptions
4.5.4. Manually Adding a New Subscription
4.6. Redeeming Subscriptions on a Machine
4.6.1. Redeeming Subscriptions through the GUI
4.6.2. Redeeming Subscriptions on a Machine through the Command Line
4.7. Viewing Available and Used Subscriptions
4.7.1. Viewing Subscriptions in the GUI
4.7.2. Listing Subscriptions with the Command Line
4.7.3. Viewing Subscriptions Used in Both RHN Classic and Certificate-based Red Hat Network
4.8. Working with Subscription yum Repos
4.9. Responding to Subscription Notifications
4.10. Healing Subscriptions
4.10.1. Enabling Healing
4.10.2. Changing the Healing Check Frequency
4.11. Viewing Organization Information
4.12. Updating Entitlements Certificates
4.12.1. Updating Entitlement Certificates
4.12.2. Updating Subscription Information
4.13. Configuring the Subscription Service
4.13.1. Red Hat Subscription Manager Configuration Files
4.13.2. Using the config Command
4.13.3. Using an HTTP Proxy
4.13.4. Changing the Subscription Server
4.13.5. Configuring Red Hat Subscription Manager to Use a Local Content Provider
4.13.6. Managing Secure Connections to the Subscription Server
4.13.7. Starting and Stopping the Subscription Service
4.13.8. Checking Logs
4.13.9. Showing and Hiding Incompatible Subscriptions
4.13.10. Checking and Adding System Facts
4.13.11. Regenerating Identity Certificates
4.13.12. Getting the System UUID
4.13.13. Viewing Package Profiles
4.13.14. Retrieving the Consumer ID, Registration Tokens, and Other Information
4.14. About Certificates and Managing Entitlements
4.14.1. The Structure of Identity Certificates
4.14.2. The Structure of Entitlement Certificates
4.14.3. The Structure of Product Certificates
4.14.4. Anatomy of Satellite Certificates
5. Yum
5.1. Checking For and Updating Packages
5.1.1. Checking For Updates
5.1.2. Updating Packages
5.1.3. Preserving Configuration File Changes
5.2. Packages and Package Groups
5.2.1. Searching Packages
5.2.2. Listing Packages
5.2.3. Displaying Package Information
5.2.4. Installing Packages
5.2.5. Removing Packages
5.2.6. Working with Transaction History
5.3. Configuring Yum and Yum Repositories
5.3.1. Setting [main] Options
5.3.2. Setting [repository] Options
5.3.3. Using Yum Variables
5.3.4. Viewing the Current Configuration
5.3.5. Adding, Enabling, and Disabling a Yum Repository
5.3.6. Creating a Yum Repository
5.4. Yum Plug-ins
5.4.1. Enabling, Configuring, and Disabling Yum Plug-ins
5.4.2. Installing Additional Yum Plug-ins
5.4.3. Plug-in Descriptions
5.5. Additional Resources
6. PackageKit
6.1. Updating Packages with Software Update
6.2. Using Add/Remove Software
6.2.1. Refreshing Software Sources (Yum Repositories)
6.2.2. Finding Packages with Filters
6.2.3. Installing and Removing Packages (and Dependencies)
6.2.4. Installing and Removing Package Groups
6.2.5. Viewing the Transaction Log
6.3. PackageKit Architecture
6.4. Additional Resources
III. Networking
7. NetworkManager
7.1. The NetworkManager Daemon
7.2. Interacting with NetworkManager
7.2.1. Connecting to a Network
7.2.2. Configuring New and Editing Existing Connections
7.2.3. Connecting to a Network Automatically
7.2.4. User and System Connections
8. Network Interfaces
8.1. Network Configuration Files
8.2. Interface Configuration Files
8.2.1. Ethernet Interfaces
8.2.2. Channel Bonding Interfaces
8.2.3. Alias and Clone Files
8.2.4. Dialup Interfaces
8.2.5. Other Interfaces
8.3. Interface Control Scripts
8.4. Configuring Static Routes
8.5. Network Function Files
8.6. Additional Resources
8.6.1. Installed Documentation
IV. Infrastructure Services
9. Services and Daemons
9.1. Configuring the Default Runlevel
9.2. Configuring the Services
9.2.1. Using the Service Configuration Utility
9.2.2. Using the ntsysv Utility
9.2.3. Using the chkconfig Utility
9.3. Running the Services
9.3.1. Checking the Service Status
9.3.2. Running the Service
9.3.3. Stopping the Service
9.3.4. Restarting the Service
9.4. Additional Resources
9.4.1. Installed Documentation
9.4.2. Related Books
10. Configuring Authentication
10.1. Configuring System Authentication
10.1.1. Launching the Authentication Configuration Tool UI
10.1.2. Selecting the Identity Store for Authentication
10.1.3. Configuring Alternative Authentication Features
10.1.4. Configuring Authentication from the Command Line
10.1.5. Using Custom Home Directories
10.2. Using and Caching Credentials with SSSD
10.2.1. About the sssd.conf File
10.2.2. Starting and Stopping SSSD
10.2.3. Configuring Services
10.2.4. Creating Domains
10.2.5. Configuring Access Control for SSSD Domains
10.2.6. Configuring Domain Failover
10.2.7. Deleting Domain Cache Files
10.2.8. Using NSCD with SSSD
10.2.9. Troubleshooting SSSD
11. OpenSSH
11.1. The SSH Protocol
11.1.1. Why Use SSH?
11.1.2. Main Features
11.1.3. Protocol Versions
11.1.4. Event Sequence of an SSH Connection
11.2. Configuring OpenSSH
11.2.1. Configuration Files
11.2.2. Starting an OpenSSH Server
11.2.3. Requiring SSH for Remote Connections
11.2.4. Using a Key-Based Authentication
11.3. OpenSSH Clients
11.3.1. Using the ssh Utility
11.3.2. Using the scp Utility
11.3.3. Using the sftp Utility
11.4. More Than a Secure Shell
11.4.1. X11 Forwarding
11.4.2. Port Forwarding
11.5. Additional Resources
11.5.1. Installed Documentation
11.5.2. Useful Websites
V. Servers
12. DHCP Servers
12.1. Why Use DHCP?
12.2. Configuring a DHCP Server
12.2.1. Configuration File
12.2.2. Lease Database
12.2.3. Starting and Stopping the Server
12.2.4. DHCP Relay Agent
12.3. Configuring a DHCP Client
12.4. Configuring a Multihomed DHCP Server
12.4.1. Host Configuration
12.5. DHCP for IPv6 (DHCPv6)
12.6. Additional Resources
12.6.1. Installed Documentation
13. DNS Servers
13.1. Introduction to DNS
13.1.1. Nameserver Zones
13.1.2. Nameserver Types
13.1.3. BIND as a Nameserver
13.2. BIND
13.2.1. Configuring the named Service
13.2.2. Editing Zone Files
13.2.3. Using the rndc Utility
13.2.4. Using the dig Utility
13.2.5. Advanced Features of BIND
13.2.6. Common Mistakes to Avoid
13.2.7. Additional Resources
14. Web Servers
14.1. The Apache HTTP Server
14.1.1. New Features
14.1.2. Notable Changes
14.1.3. Updating the Configuration
14.1.4. Running the httpd Service
14.1.5. Editing the Configuration Files
14.1.6. Working with Modules
14.1.7. Setting Up Virtual Hosts
14.1.8. Setting Up an SSL Server
14.1.9. Additional Resources
15. Mail Servers
15.1. Email Protocols
15.1.1. Mail Transport Protocols
15.1.2. Mail Access Protocols
15.2. Email Program Classifications
15.2.1. Mail Transport Agent
15.2.2. Mail Delivery Agent
15.2.3. Mail User Agent
15.3. Mail Transport Agents
15.3.1. Postfix
15.3.2. Sendmail
15.3.3. Fetchmail
15.3.4. Mail Transport Agent (MTA) Configuration
15.4. Mail Delivery Agents
15.4.1. Procmail Configuration
15.4.2. Procmail Recipes
15.5. Mail User Agents
15.5.1. Securing Communication
15.6. Additional Resources
15.6.1. Installed Documentation
15.6.2. Useful Websites
15.6.3. Related Books
16. Directory Servers
16.1. OpenLDAP
16.1.1. Introduction to LDAP
16.1.2. Installing the OpenLDAP Suite
16.1.3. Configuring an OpenLDAP Server
16.1.4. Running an OpenLDAP Server
16.1.5. Configuring a System to Authenticate Using OpenLDAP
16.1.6. Additional Resources
17. File and Print Servers
17.1. Samba
17.1.1. Introduction to Samba
17.1.2. Samba Daemons and Related Services
17.1.3. Connecting to a Samba Share
17.1.4. Configuring a Samba Server
17.1.5. Starting and Stopping Samba
17.1.6. Samba Server Types and the smb.conf File
17.1.7. Samba Security Modes
17.1.8. Samba Account Information Databases
17.1.9. Samba Network Browsing
17.1.10. Samba with CUPS Printing Support
17.1.11. Samba Distribution Programs
17.1.12. Additional Resources
17.2. FTP
17.2.1. The File Transfer Protocol
17.2.2. FTP Servers
17.2.3. Files Installed with vsftpd
17.2.4. Starting and Stopping vsftpd
17.2.5. vsftpd Configuration Options
17.2.6. Additional Resources
17.3. Printer Configuration
17.3.1. Starting the Printer Configuration Tool
17.3.2. Starting Printer Setup
17.3.3. Adding a Local Printer
17.3.4. Adding an AppSocket/HP JetDirect printer
17.3.5. Adding an IPP Printer
17.3.6. Adding an LPD/LPR Host or Printer
17.3.7. Adding a Samba (SMB) printer
17.3.8. Selecting the Printer Model and Finishing
17.3.9. Printing a test page
17.3.10. Modifying Existing Printers
17.3.11. Additional Resources
VI. Monitoring and Automation
18. System Monitoring Tools
18.1. Viewing System Processes
18.2. Viewing Memory Usage
18.3. Viewing File Systems
18.4. Viewing Hardware Information
18.5. Monitoring Performance with Net-SNMP
18.5.1. Installing Net-SNMP
18.5.2. Running the Net-SNMP Daemon
18.5.3. Configuring Net-SNMP
18.5.4. Retrieving Performance Data over SNMP
18.5.5. Extending Net-SNMP
18.6. Additional Resources
18.6.1. Installed Documentation
19. Viewing and Managing Log Files
19.1. Configuring rsyslog
19.1.1. Global Directives
19.1.2. Modules
19.1.3. Rules
19.1.4. rsyslog Command Line Configuration
19.2. Locating Log Files
19.2.1. Configuring logrotate
19.3. Viewing Log Files
19.4. Adding a Log File
19.5. Monitoring Log Files
19.6. Additional Resources
19.6.1. Installed Documentation
19.6.2. Useful Websites
20. Automating System Tasks
20.1. Cron and Anacron
20.1.1. Starting and Stopping the Service
20.1.2. Configuring Anacron Jobs
20.1.3. Configuring Cron Jobs
20.1.4. Controlling Access to Cron
20.1.5. Black/White Listing of Cron Jobs
20.2. At and Batch
20.2.1. Configuring At Jobs
20.2.2. Configuring Batch Jobs
20.2.3. Viewing Pending Jobs
20.2.4. Additional Command Line Options
20.2.5. Controlling Access to At and Batch
20.2.6. Starting and Stopping the Service
20.3. Additional Resources
20.3.1. Installed Documentation
21. Automatic Bug Reporting Tool (ABRT)
21.1. Overview
21.2. Installing ABRT and Starting its Services
21.3. Running ABRT
21.3.1. Using the Graphical User Interface
21.3.2. Using the Command Line Interface
21.4. Configuring ABRT
21.4.1. ABRT Events
21.4.2. Standard ABRT Installation Supported Events
21.4.3. Event Configuration in ABRT GUI
21.4.4. ABRT Specific Configuration
21.4.5. Configuring Automatic Reporting
21.4.6. Uploading and reporting using a proxy server
21.5. Configuring Centralized Crash Collection
21.5.1. Configuration Steps Required on a Dedicated System
21.5.2. Configuration Steps Required on a Client System
21.5.3. Saving Package Information
21.5.4. Testing ABRT's Crash Detection
22. OProfile
22.1. Overview of Tools
22.2. Configuring OProfile
22.2.1. Specifying the Kernel
22.2.2. Setting Events to Monitor
22.2.3. Separating Kernel and User-space Profiles
22.3. Starting and Stopping OProfile
22.4. Saving Data
22.5. Analyzing the Data
22.5.1. Using opreport
22.5.2. Using opreport on a Single Executable
22.5.3. Getting more detailed output on the modules
22.5.4. Using opannotate
22.6. Understanding /dev/oprofile/
22.7. Example Usage
22.8. OProfile Support for Java
22.8.1. Profiling Java Code
22.9. Graphical Interface
22.10. OProfile and SystemTap
22.11. Additional Resources
22.11.1. Installed Docs
22.11.2. Useful Websites
VII. Kernel, Module and Driver Configuration
23. Manually Upgrading the Kernel
23.1. Overview of Kernel Packages
23.2. Preparing to Upgrade
23.3. Downloading the Upgraded Kernel
23.4. Performing the Upgrade
23.5. Verifying the Initial RAM Disk Image
23.6. Verifying the Boot Loader
23.6.1. Configuring the GRUB Boot Loader
23.6.2. Configuring the OS/400 Boot Loader
23.6.3. Configuring the YABOOT Boot Loader
24. Working with Kernel Modules
24.1. Listing Currently-Loaded Modules
24.2. Displaying Information About a Module
24.3. Loading a Module
24.4. Unloading a Module
24.5. Setting Module Parameters
24.6. Persistent Module Loading
24.7. Specific Kernel Module Capabilities
24.7.1. Using Multiple Ethernet Cards
24.7.2. Using Channel Bonding
24.8. Additional Resources
25. The kdump Crash Recovery Service
25.1. Configuring the kdump Service
25.1.1. Configuring the kdump at first boot
25.1.2. Using the Kernel Dump Configuration Utility
25.1.3. Configuring kdump on the Command Line
25.1.4. Testing the Configuration
25.2. Analyzing the Core Dump
25.2.1. Running the crash Utility
25.2.2. Displaying the Message Buffer
25.2.3. Displaying a Backtrace
25.2.4. Displaying a Process Status
25.2.5. Displaying Virtual Memory Information
25.2.6. Displaying Open Files
25.2.7. Exiting the Utility
25.3. Additional Resources
25.3.1. Installed Documentation
25.3.2. Useful Websites
A. Consistent Network Device Naming
A.1. Affected Systems
A.2. System Requirements
A.3. Enabling and Disabling the Feature
A.4. Notes for Administrators
B. RPM
B.1. RPM Design Goals
B.2. Using RPM
B.2.1. Finding RPM Packages
B.2.2. Installing and Upgrading
B.2.3. Configuration File Changes
B.2.4. Uninstalling
B.2.5. Freshening
B.2.6. Querying
B.2.7. Verifying
B.3. Checking a Package's Signature
B.3.1. Importing Keys
B.3.2. Verifying Signature of Packages
B.4. Practical and Common Examples of RPM Usage
B.5. Additional Resources
B.5.1. Installed Documentation
B.5.2. Useful Websites
B.5.3. Related Books
C. The X Window System
C.1. The X Server
C.2. Desktop Environments and Window Managers
C.2.1. Desktop Environments
C.2.2. Window Managers
C.3. X Server Configuration Files
C.3.1. The Structure of the Configuration
C.3.2. The xorg.conf.d Directory
C.3.3. The xorg.conf File
C.4. Fonts
C.4.1. Adding Fonts to Fontconfig
C.5. Runlevels and X
C.5.1. Runlevel 3
C.5.2. Runlevel 5
C.6. Additional Resources
C.6.1. Installed Documentation
C.6.2. Useful Websites
D. The sysconfig Directory
D.1. Files in the /etc/sysconfig/ Directory
D.1.1. /etc/sysconfig/arpwatch
D.1.2. /etc/sysconfig/authconfig
D.1.3. /etc/sysconfig/autofs
D.1.4. /etc/sysconfig/clock
D.1.5. /etc/sysconfig/dhcpd
D.1.6. /etc/sysconfig/firstboot
D.1.7. /etc/sysconfig/i18n
D.1.8. /etc/sysconfig/init
D.1.9. /etc/sysconfig/ip6tables-config
D.1.10. /etc/sysconfig/keyboard
D.1.11. /etc/sysconfig/ldap
D.1.12. /etc/sysconfig/named
D.1.13. /etc/sysconfig/network
D.1.14. /etc/sysconfig/ntpd
D.1.15. /etc/sysconfig/quagga
D.1.16. /etc/sysconfig/radvd
D.1.17. /etc/sysconfig/samba
D.1.18. /etc/sysconfig/selinux
D.1.19. /etc/sysconfig/sendmail
D.1.20. /etc/sysconfig/spamassassin
D.1.21. /etc/sysconfig/squid
D.1.22. /etc/sysconfig/system-config-users
D.1.23. /etc/sysconfig/vncservers
D.1.24. /etc/sysconfig/xinetd
D.2. Directories in the /etc/sysconfig/ Directory
D.3. Additional Resources
D.3.1. Installed Documentation
E. The proc File System
E.1. A Virtual File System
E.1.1. Viewing Virtual Files
E.1.2. Changing Virtual Files
E.2. Top-level Files within the proc File System
E.2.1. /proc/buddyinfo
E.2.2. /proc/cmdline
E.2.3. /proc/cpuinfo
E.2.4. /proc/crypto
E.2.5. /proc/devices
E.2.6. /proc/dma
E.2.7. /proc/execdomains
E.2.8. /proc/fb
E.2.9. /proc/filesystems
E.2.10. /proc/interrupts
E.2.11. /proc/iomem
E.2.12. /proc/ioports
E.2.13. /proc/kcore
E.2.14. /proc/kmsg
E.2.15. /proc/loadavg
E.2.16. /proc/locks
E.2.17. /proc/mdstat
E.2.18. /proc/meminfo
E.2.19. /proc/misc
E.2.20. /proc/modules
E.2.21. /proc/mounts
E.2.22. /proc/mtrr
E.2.23. /proc/partitions
E.2.24. /proc/slabinfo
E.2.25. /proc/stat
E.2.26. /proc/swaps
E.2.27. /proc/sysrq-trigger
E.2.28. /proc/uptime
E.2.29. /proc/version
E.3. Directories within /proc/
E.3.1. Process Directories
E.3.2. /proc/bus/
E.3.3. /proc/bus/pci
E.3.4. /proc/driver/
E.3.5. /proc/fs
E.3.6. /proc/irq/
E.3.7. /proc/net/
E.3.8. /proc/scsi/
E.3.9. /proc/sys/
E.3.10. /proc/sysvipc/
E.3.11. /proc/tty/
E.3.12. /proc/PID/
E.4. Using the sysctl Command
E.5. Additional Resources
E.5.1. Installed Documentation
E.5.2. Useful Websites
F. Revision History
Index

Preface

The Deployment Guide contains information on how to customize the Red Hat Enterprise Linux 6 system to fit your needs. If you are looking for a comprehensive, task-oriented guide for configuring and customizing your system, this is the manual for you.
This manual discusses many intermediate topics such as the following:
  • Installing and managing packages using the graphical PackageKit and command line Yum package managers
  • Setting up a network—from establishing an Ethernet connection using NetworkManager to configuring channel bonding interfaces to increase server bandwidth
  • Configuring DHCP, BIND, Apache HTTP Server, Postfix, Sendmail and other enterprise-class servers and software
  • Gathering information about your system, including obtaining user-space crash data with the Automatic Bug Reporting Tool, and kernel-space crash data with kdump
  • Easily working with kernel modules and upgrading the kernel

1. Target Audience

The Deployment Guide assumes you have a basic understanding of the Red Hat Enterprise Linux operating system. If you need help with the installation of this system, refer to the Red Hat Enterprise Linux 6 Installation Guide.

2. How to Read this Book

This manual is divided into the following main categories:
Part I, “Basic System Configuration”
This part covers basic system administration tasks such as keyboard configuration, date and time configuration, and managing users and groups.
Chapter 1, Keyboard Configuration covers basic keyboard setup. Read this chapter if you need to change the keyboard layout, add the Keyboard Indicator applet to the panel, or enforce a periodic typing brake.
Chapter 2, Date and Time Configuration covers the configuration of the system date and time. Read this chapter if you need to change the date and time setup, or configure the system to synchronize the clock with a remote Network Time Protocol (NTP) server.
Chapter 3, Managing Users and Groups covers the management of users and groups in a graphical user interface and on the command line. Read this chapter if you need to manage users and groups on your system, or enable password aging.
Part II, “Package Management”
This part focuses on product subscriptions and entitlements, and describes how to manage software packages on Red Hat Enterprise Linux using both Yum and the PackageKit suite of graphical package management tools.
Chapter 4, Product Subscriptions and Entitlements provides an overview of subscription management in Red Hat Enterprise Linux and the Red Hat Subscription Manager tools which are available. Read this chapter to learn how to register or unregister a system, activate a machine, and handle product subscriptions and entitlements.
Chapter 5, Yum describes the Yum package manager. Read this chapter for information how to search, install, update, and uninstall packages on the command line.
Chapter 6, PackageKit describes the PackageKit suite of graphical package management tools. Read this chapter for information how to search, install, update, and uninstall packages using a graphical user interface.
Part III, “Networking”
This part describes how to configure the network on Red Hat Enterprise Linux.
Chapter 7, NetworkManager focuses on NetworkManager, a dynamic network control and configuration system that attempts to keep network devices and connections up and active when they are available. Read this chapter for information how to run the NetworkManager daemon, and how to interact with it using the corresponding applet for the notification area.
Chapter 8, Network Interfaces explores various interface configuration files, interface control scripts, and network function files located in the /etc/sysconfig/network-scripts/ directory. Read this chapter for information how to use these files to configure network interfaces.
Part IV, “Infrastructure Services”
This part provides information how to configure services and daemons, configure authentication, and enable remote logins.
Chapter 9, Services and Daemons explains the concept of runlevels, and describes how to set the default one. It also covers the configuration of the services to be run in each of these runlevels, and provides information on how to start, stop, and restart a service. Read this chapter to learn how to manage services on your system.
Chapter 10, Configuring Authentication describes how to configure user information retrieval from Lightweight Directory Access Protocol (LDAP), Network Information Service (NIS), and Winbind user account databases, and provides an introduction to the System Security Services Daemon (SSSD). Read this chapter if you need to configure authentication on your system.
Chapter 11, OpenSSH describes how to enable a remote login via the SSH protocol. It covers the configuration of the sshd service, as well as a basic usage of the ssh, scp, sftp client utilities. Read this chapter if you need a remote access to a machine.
Part V, “Servers”
This part discusses various topics related to servers such as how to set up a web server or share files and directories over the network.
Chapter 12, DHCP Servers guides you through the installation of a Dynamic Host Configuration Protocol (DHCP) server and client. Read this chapter if you need to configure DHCP on your system.
Chapter 13, DNS Servers introduces you to Domain Name System (DNS), explains how to install, configure, run, and administer the BIND DNS server. Read this chapter if you need to configure a DNS server on your system.
Chapter 14, Web Servers focuses on the Apache HTTP Server 2.2, a robust, full-featured open source web server developed by the Apache Software Foundation. Read this chapter if you need to configure a web server on your system.
Chapter 15, Mail Servers reviews modern email protocols in use today, and some of the programs designed to send and receive email, including Postfix, Sendmail, Fetchmail, and Procmail. Read this chapter if you need to configure a mail server on your system.
Chapter 16, Directory Servers covers the installation and configuration of OpenLDAP 2.4, an open source implementation of the LDAPv2 and LDAPv3 protocols. Read this chapter if you need to configure a directory server on your system.
Chapter 17, File and Print Servers guides you through the installation and configuration of Samba, an open source implementation of the Server Message Block (SMB) protocol, and vsftpd, the primary FTP server shipped with Red Hat Enterprise Linux. Additionally, it explains how to use the Printer Configuration tool to configure printers. Read this chapter if you need to configure a file or print server on your system.
Part VI, “Monitoring and Automation”
This part describes various tools that allow system administrators to monitor system performance, automate system tasks, and report bugs.
Chapter 18, System Monitoring Tools discusses applications and commands that can be used to retrieve important information about the system. Read this chapter to learn how to gather essential system information.
Chapter 19, Viewing and Managing Log Files describes the configuration of the rsyslog daemon, and explains how to locate, view, and monitor log files. Read this chapter to learn how to work with log files.
Chapter 20, Automating System Tasks provides an overview of the cron, at, and batch utilities. Read this chapter to learn how to use these utilities to perform automated tasks.
Chapter 21, Automatic Bug Reporting Tool (ABRT) concentrates on ABRT, a system service and a set of tools to collect crash data and send a report to the relevant issue tracker. Read this chapter to learn how to use ABRT on your system.
Chapter 22, OProfile covers OProfile, a low overhead, system-wide performance monitoring tool. Read this chapter for information how to use OProfile on your system.
Part VII, “Kernel, Module and Driver Configuration”
This part covers various tools that assist administrators with kernel customization.
Chapter 23, Manually Upgrading the Kernel provides important information how to manually update a kernel package using the rpm command instead of yum. Read this chapter if you cannot update a kernel package with the Yum package manager.
Chapter 24, Working with Kernel Modules explains how to display, query, load, and unload kernel modules and their dependencies, and how to set module parameters. Additionally, it covers specific kernel module capabilities such as using multiple Ethernet cards and using channel bonding. Read this chapter if you need to work with kernel modules.
Chapter 25, The kdump Crash Recovery Service explains how to configure, test, and use the kdump service in Red Hat Enterprise Linux, and provides a brief overview of how to analyze the resulting core dump using the crash debugging utility. Read this chapter to learn how to enable kdump on your system.
Appendix A, Consistent Network Device Naming
This appendix covers consistent network device naming for network interfaces, a feature that changes the name of network interfaces on a system in order to make locating and differentiating the interfaces easier. Read this appendix to learn more about this feature and how to enable or disable it.
Appendix B, RPM
This appendix concentrates on the RPM Package Manager (RPM), an open packaging system used by Red Hat Enterprise Linux, and the use of the rpm utility. Read this appendix if you need to use rpm instead of yum.
Appendix C, The X Window System
This appendix covers the configuration of the X Window System, the graphical environment used by Red Hat Enterprise Linux. Read this appendix if you need to adjust the configuration of your X Window System.
Appendix D, The sysconfig Directory
This appendix outlines some of the files and directories located in the /etc/sysconfig/ directory. Read this appendix if you want to learn more about these files and directories, their function, and their contents.
Appendix E, The proc File System
This appendix explains the concept of a virtual file system, and describes some of the top-level files and directories within the proc file system (that is, the /proc/ directory). Read this appendix if you want to learn more about this file system.

3. Document Conventions

This manual uses several conventions to highlight certain words and phrases and draw attention to specific pieces of information.
In PDF and paper editions, this manual uses typefaces drawn from the Liberation Fonts set. The Liberation Fonts set is also used in HTML editions if the set is installed on your system. If not, alternative but equivalent typefaces are displayed. Note: Red Hat Enterprise Linux 5 and later includes the Liberation Fonts set by default.

3.1. Typographic Conventions

Four typographic conventions are used to call attention to specific words and phrases. These conventions, and the circumstances they apply to, are as follows.
Mono-spaced Bold
Used to highlight system input, including shell commands, file names and paths. Also used to highlight keycaps and key combinations. For example:
To see the contents of the file my_next_bestselling_novel in your current working directory, enter the cat my_next_bestselling_novel command at the shell prompt and press Enter to execute the command.
The above includes a file name, a shell command and a keycap, all presented in mono-spaced bold and all distinguishable thanks to context.
Key combinations can be distinguished from keycaps by the hyphen connecting each part of a key combination. For example:
Press Enter to execute the command.
Press Ctrl+Alt+F2 to switch to the first virtual terminal. Press Ctrl+Alt+F1 to return to your X-Windows session.
The first paragraph highlights the particular keycap to press. The second highlights two key combinations (each a set of three keycaps with each set pressed simultaneously).
If source code is discussed, class names, methods, functions, variable names and returned values mentioned within a paragraph will be presented as above, in mono-spaced bold. For example:
File-related classes include filesystem for file systems, file for files, and dir for directories. Each class has its own associated set of permissions.
Proportional Bold
This denotes words or phrases encountered on a system, including application names; dialog box text; labeled buttons; check-box and radio button labels; menu titles and sub-menu titles. For example:
Choose SystemPreferencesMouse from the main menu bar to launch Mouse Preferences. In the Buttons tab, click the Left-handed mouse check box and click Close to switch the primary mouse button from the left to the right (making the mouse suitable for use in the left hand).
To insert a special character into a gedit file, choose ApplicationsAccessoriesCharacter Map from the main menu bar. Next, choose SearchFind… from the Character Map menu bar, type the name of the character in the Search field and click Next. The character you sought will be highlighted in the Character Table. Double-click this highlighted character to place it in the Text to copy field and then click the Copy button. Now switch back to your document and choose EditPaste from the gedit menu bar.
The above text includes application names; system-wide menu names and items; application-specific menu names; and buttons and text found within a GUI interface, all presented in proportional bold and all distinguishable by context.
Mono-spaced Bold Italic or Proportional Bold Italic
Whether mono-spaced bold or proportional bold, the addition of italics indicates replaceable or variable text. Italics denotes text you do not input literally or displayed text that changes depending on circumstance. For example:
To connect to a remote machine using ssh, type ssh username@domain.name at a shell prompt. If the remote machine is example.com and your username on that machine is john, type ssh john@example.com.
The mount -o remount file-system command remounts the named file system. For example, to remount the /home file system, the command is mount -o remount /home.
To see the version of a currently installed package, use the rpm -q package command. It will return a result as follows: package-version-release.
Note the words in bold italics above — username, domain.name, file-system, package, version and release. Each word is a placeholder, either for text you enter when issuing a command or for text displayed by the system.
Aside from standard usage for presenting the title of a work, italics denotes the first use of a new and important term. For example:
Publican is a DocBook publishing system.

3.2. Pull-quote Conventions

Terminal output and source code listings are set off visually from the surrounding text.
Output sent to a terminal is set in mono-spaced roman and presented thus:
books        Desktop   documentation  drafts  mss    photos   stuff  svn
books_tests  Desktop1  downloads      images  notes  scripts  svgs
Source-code listings are also set in mono-spaced roman but add syntax highlighting as follows:
package org.jboss.book.jca.ex1;

import javax.naming.InitialContext;

public class ExClient
{
   public static void main(String args[]) 
       throws Exception
   {
      InitialContext iniCtx = new InitialContext();
      Object         ref    = iniCtx.lookup("EchoBean");
      EchoHome       home   = (EchoHome) ref;
      Echo           echo   = home.create();

      System.out.println("Created Echo");

      System.out.println("Echo.echo('Hello') = " + echo.echo("Hello"));
   }
}

3.3. Notes and Warnings

Finally, we use three visual styles to draw attention to information that might otherwise be overlooked.

Note

Notes are tips, shortcuts or alternative approaches to the task at hand. Ignoring a note should have no negative consequences, but you might miss out on a trick that makes your life easier.

Important

Important boxes detail things that are easily missed: configuration changes that only apply to the current session, or services that need restarting before an update will apply. Ignoring a box labeled 'Important' will not cause data loss but may cause irritation and frustration.

Warning

Warnings should not be ignored. Ignoring warnings will most likely cause data loss.

4. Feedback

If you find a typographical error in this manual, or if you have thought of a way to make this manual better, we would love to hear from you! Please submit a report in Bugzilla against the product Red Hat Enterprise Linux 6.
When submitting a bug report, be sure to provide the following information:
  • Manual's identifier: doc-Deployment_Guide
  • Version number: 6
If you have a suggestion for improving the documentation, try to be as specific as possible when describing it. If you have found an error, please include the section number and some of the surrounding text so we can find it easily.

5. Acknowledgments

Certain portions of this text first appeared in the Deployment Guide, copyright © 2007 Red Hat, Inc., available at http://docs.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/5/html/Deployment_Guide/index.html.
Section 18.5, “Monitoring Performance with Net-SNMP” is based on an article written by Michael Solberg.
The authors of this book would like to thank the following people for their valuable contributions: Adam Tkáč, Andrew Fitzsimon, Andrius Benokraitis, Brian Cleary Edward Bailey, Garrett LeSage, Jeffrey Fearn, Joe Orton, Joshua Wulf, Karsten Wade, Lucy Ringland, Marcela Mašláňová, Mark Johnson, Michael Behm, Miroslav Lichvár, Radek Vokál, Rahul Kavalapara, Rahul Sundaram, Sandra Moore, Zbyšek Mráz, Jan Včelák, Peter Hutterer and James Antill, among many others.

Part I. Basic System Configuration

Chapter 1. Keyboard Configuration

This chapter describes how to change the keyboard layout, as well as how to add the Keyboard Indicator applet to the panel. It also covers the option to enforce a typing break, and explains both advantages and disadvantages of doing so.

1.1. Changing the Keyboard Layout

The installation program allowed you to configure a keyboard layout for your system. However, the default settings may not always suit your current needs. To configure a different keyboard layout after the installation, use the Keyboard Preferences tool.
To open Keyboard Layout Preferences, select SystemPreferencesKeyboard from the panel, and click the Layouts tab.
Keyboard Layout Preferences
Keyboard Layout Preferences
Figure 1.1. Keyboard Layout Preferences

You will be presented with a list of available layouts. To add a new one, click the Add... button below the list, and you will be prompted to chose which layout you want to add.
Choosing a layout
Choosing a layout
Figure 1.2. Choosing a layout

Currently, there are two ways how to chose the keyboard layout: you can either find it by the country it is associated with (the By country tab), or you can select it by the language (the By language tab). In either case, first select the desired country or language from the Country or Language pulldown menu, then specify the variant from the Variants menu. The preview of the layout changes immediately. To confirm the selection, click Add.
Selecting the default layout
Selecting the default layout
Figure 1.3. Selecting the default layout

The layout should appear in the list. To make it the default, select the radio button next to its name. The changes take effect immediately. Note that there is a text-entry field at the bottom of the window where you can safely test your settings. Once you are satisfied, click Close to close the window.
Testing the layout
Testing the layout
Figure 1.4. Testing the layout

Disable separate layout for each window

By default, changing the keyboard layout affects the active window only. This means that if you change the layout and switch to another window, this window will use the old one, which might be confusing. To turn this behavior off, unselect the Separate layout for each window check box.
Disabling separate layout for each window
Doing this has its drawbacks though, as you will no longer be able to chose the default layout by selecting the radio button as shown in Figure 1.3, “Selecting the default layout”. To make the layout the default, simply drag it at the beginning of the list.
Changing the order of layouts

1.2. Adding the Keyboard Layout Indicator

If you want to see what keyboard layout you are currently using, or you would like to switch between different layouts with a single mouse click, add the Keyboard Indicator applet to the panel. To do so, right-click the empty space on the main panel, and select the Add to Panel... option from the pulldown menu.
Adding a new applet
Adding a New Applet
Figure 1.5. Adding a new applet

You will be presented with a list of available applets. Scroll through the list (or start typing keyboard to the search field at the top of the window), select Keyboard Indicator, and click the Add button.
Selecting the Keyboard Indicator
Selecting the Keyboard Indicator
Figure 1.6. Selecting the Keyboard Indicator

The applet appears immediately, displaying the shortened name of the country the current layout is associated with. To display the actual variant, hover the pointer over the applet icon.
The Keyboard Indicator applet
The Keyboard Indicator applet
Figure 1.7. The Keyboard Indicator applet

1.3. Setting Up a Typing Break

Typing for a long period of time can be not only tiring, but it can also increase the risk of serious health problems, such as carpal tunnel syndrome. One way of preventing this is to configure the system to enforce the typing break. Simply select SystemPreferencesKeyboard from the panel, click the Typing Break tab, and select the Lock screen to enforce typing break check box.
Typing Break Properties
Typing Break Properties
Figure 1.8. Typing Break Properties

To increase or decrease the amount of time you want to be allowed to type before the break is enforced, click the up or down button next to the Work interval lasts label respectively. You can do the same with the Break interval lasts setting to alter the length of the break itself. Finally, select the Allow postponing of breaks check box if you want to be able to delay the break in case you need to finish the work. The changes take effect immediately.
Taking a break
Taking a break
Figure 1.9. Taking a break

Next time you reach the time limit, you will be presented with a screen advising you to take a break, and a clock displaying the remaining time. If you enabled it, the Postpone Break button will be located at the bottom right corner of the screen.

Chapter 2. Date and Time Configuration

This chapter covers setting the system date and time in Red Hat Enterprise Linux, both manually and using the Network Time Protocol (NTP), as well as setting the adequate time zone. Two methods are covered: setting the date and time using the Date/Time Properties tool, and doing so on the command line.

2.1. Date/Time Properties Tool

The Date/Time Properties tool allows the user to change the system date and time, to configure the time zone used by the system, and to set up the Network Time Protocol daemon to synchronize the system clock with a time server. Note that to use this application, you must be running the X Window System (see Appendix C, The X Window System for more information on this topic).
To start the tool, select SystemAdministrationDate & Time from the panel, or type the system-config-date command at a shell prompt (e.g., xterm or GNOME Terminal). Unless you are already authenticated, you will be prompted to enter the superuser password.
Authentication Query
Figure 2.1. Authentication Query

2.1.1. Date and Time Properties

As shown in Figure 2.2, “Date and Time Properties”, the Date/Time Properties tool is divided into two separate tabs. The tab containing the configuration of the current date and time is shown by default.
Date and Time Properties
Date and Time Properties
Figure 2.2. Date and Time Properties

To set up your system manually, follow these steps:
  1. Change the current date. Use the arrows to the left and right of the month and year to change the month and year respectively. Then click inside the calendar to select the day of the month.
  2. Change the current time. Use the up and down arrow buttons beside the Hour, Minute, and Second, or replace the values directly.
Click the OK button to apply the changes and exit the application.

2.1.2. Network Time Protocol Properties

If you prefer an automatic setup, select the checkbox labeled Synchronize date and time over the network instead. This will display the list of available NTP servers as shown in Figure 2.3, “Network Time Protocol Properties”.
Network Time Protocol Properties
Network Time Protocol Properties
Figure 2.3. Network Time Protocol Properties

Here you can choose one of the predefined servers, edit a predefined server by clicking the Edit button, or add a new server name by clicking Add. In the Advanced Options, you can also select whether you want to synchronize the system clock before starting the service, and if you wish to use a local time source.

Note

Your system does not start synchronizing with the NTP server until you click the OK button at the bottom of the window to confirm your changes.
Click the OK button to apply any changes made to the date and time settings and exit the application.

2.1.3. Time Zone Properties

To configure the system time zone, click the Time Zone tab as shown in Figure 2.4, “Time Zone Properties”.
Time Zone Properties
Time Zone Properties
Figure 2.4. Time Zone Properties

There are two common approaches to the time zone selection:
  1. Using the interactive map. Click “zoom in” and “zoom out” buttons next to the map, or click on the map itself to zoom into the selected region. Then choose the city specific to your time zone. A red X appears and the time zone selection changes in the list below the map.
  2. Use the list below the map. To make the selection easier, cities and countries are grouped within their specific continents. Note that non-geographic time zones have also been added to address needs in the scientific community.
If your system clock is set to use UTC, select the System clock uses UTC option. UTC stands for the Universal Time, Coordinated, also known as Greenwich Mean Time (GMT). Other time zones are determined by adding or subtracting from the UTC time.
Click OK to apply the changes and exit the program.

2.2. Command Line Configuration

In case your system does not have the Date/Time Properties tool installed, or the X Window Server is not running, you will have to change the system date and time on the command line. Note that in order to perform actions described in this section, you have to be logged in as a superuser:
~]$ su -
Password:

2.2.1. Date and Time Setup

The date command allows the superuser to set the system date and time manually:
  1. Change the current date. Type the command in the following form at a shell prompt, replacing the YYYY with a four-digit year, MM with a two-digit month, and DD with a two-digit day of the month:
    ~]# date +%D -s YYYY-MM-DD
    For example, to set the date to 2 June 2010, type:
    ~]# date +%D -s 2010-06-02
  2. Change the current time. Use the following command, where HH stands for an hour, MM is a minute, and SS is a second, all typed in a two-digit form:
    ~]# date +%T -s HH:MM:SS
    If your system clock is set to use UTC (Coordinated Universal Time), add the following option:
    ~]# date +%T -s HH:MM:SS -u
    For instance, to set the system clock to 11:26 PM using the UTC, type:
    ~]# date +%T -s 23:26:00 -u
You can check your current settings by typing date without any additional argument:
Example 2.1. Displaying the current date and time
~]$ date
Wed Jun  2 11:58:48 CEST 2010

2.2.2. Network Time Protocol Setup

As opposed to the manual setup described above, you can also synchronize the system clock with a remote server over the Network Time Protocol (NTP). For the one-time synchronization only, use the ntpdate command:
  1. Firstly, check whether the selected NTP server is accessible:
    ~]# ntpdate -q server_address
    For example:
    ~]# ntpdate -q 0.rhel.pool.ntp.org
  2. When you find a satisfactory server, run the ntpdate command followed by one or more server addresses:
    ~]# ntpdate server_address...
    For instance:
    ~]# ntpdate 0.rhel.pool.ntp.org 1.rhel.pool.ntp.org
    Unless an error message is displayed, the system time should now be set. You can check the current by setting typing date without any additional arguments as shown in Section 2.2.1, “Date and Time Setup”.
  3. In most cases, these steps are sufficient. Only if you really need one or more system services to always use the correct time, enable running the ntpdate at boot time:
    ~]# chkconfig ntpdate on
    For more information about system services and their setup, see Chapter 9, Services and Daemons.

    Note

    If the synchronization with the time server at boot time keeps failing, i.e., you find a relevant error message in the /var/log/boot.log system log, try to add the following line to /etc/sysconfig/network:
    NETWORKWAIT=1
However, the more convenient way is to set the ntpd daemon to synchronize the time at boot time automatically:
  1. Open the NTP configuration file /etc/ntp.conf in a text editor such as vi or nano, or create a new one if it does not already exist:
    ~]# nano /etc/ntp.conf
  2. Now add or edit the list of public NTP servers. If you are using Red Hat Enterprise Linux 6, the file should already contain the following lines, but feel free to change or expand these according to your needs:
    server 0.rhel.pool.ntp.org
    server 1.rhel.pool.ntp.org
    server 2.rhel.pool.ntp.org

    Speed up initial synchronization

    To speed the initial synchronization up, add the iburst directive at the end of each server line:
    server 0.rhel.pool.ntp.org iburst
    server 1.rhel.pool.ntp.org iburst
    server 2.rhel.pool.ntp.org iburst
  3. Once you have the list of servers complete, in the same file, set the proper permissions, giving the unrestricted access to localhost only:
    restrict default kod nomodify notrap nopeer noquery
    restrict -6 default kod nomodify notrap nopeer noquery
    restrict 127.0.0.1
    restrict -6 ::1
  4. Save all changes, exit the editor, and restart the NTP daemon:
    ~]# service ntpd restart
  5. Make sure that ntpd daemon is started at boot time:
    ~]# chkconfig ntpd on

Chapter 3. Managing Users and Groups

The control of users and groups is a core element of Red Hat Enterprise Linux system administration. This chapter explains how to add, manage, and delete users and groups in the graphical user interface and on the command line, and covers advanced topics, such as enabling password aging or creating group directories.

3.1. Introduction to Users and Groups

While users can be either people (meaning accounts tied to physical users) or accounts which exist for specific applications to use, groups are logical expressions of organization, tying users together for a common purpose. Users within a group can read, write, or execute files owned by that group.
Each user is associated with a unique numerical identification number called a user ID (UID). Likewise, each group is associated with a group ID (GID). A user who creates a file is also the owner and group owner of that file. The file is assigned separate read, write, and execute permissions for the owner, the group, and everyone else. The file owner can be changed only by root, and access permissions can be changed by both the root user and file owner.
Additionally, Red Hat Enterprise Linux supports access control lists (ACLs) for files and directories which allow permissions for specific users outside of the owner to be set. For more information about this feature, refer to the Access Control Lists chapter of the Storage Administration Guide.

3.1.1. User Private Groups

Red Hat Enterprise Linux uses a user private group (UPG) scheme, which makes UNIX groups easier to manage. A user private group is created whenever a new user is added to the system. It has the same name as the user for which it was created and that user is the only member of the user private group.
User private groups make it safe to set default permissions for a newly created file or directory, allowing both the user and the group of that user to make modifications to the file or directory.
The setting which determines what permissions are applied to a newly created file or directory is called a umask and is configured in the /etc/bashrc file. Traditionally on UNIX systems, the umask is set to 022, which allows only the user who created the file or directory to make modifications. Under this scheme, all other users, including members of the creator's group, are not allowed to make any modifications. However, under the UPG scheme, this group protection is not necessary since every user has their own private group.

3.1.2. Shadow Passwords

In environments with multiple users, it is very important to use shadow passwords provided by the shadow-utils package to enhance the security of system authentication files. For this reason, the installation program enables shadow passwords by default.
The following is a list of the advantages shadow passwords have over the traditional way of storing passwords on UNIX-based systems:
  • Shadow passwords improve system security by moving encrypted password hashes from the world-readable /etc/passwd file to /etc/shadow, which is readable only by the root user.
  • Shadow passwords store information about password aging.
  • Shadow passwords allow the /etc/login.defs file to enforce security policies.
Most utilities provided by the shadow-utils package work properly whether or not shadow passwords are enabled. However, since password aging information is stored exclusively in the /etc/shadow file, any commands which create or modify password aging information do not work. The following is a list of utilities and commands that do not work without first enabling shadow passwords:
  • The chage utility.
  • The gpasswd utility.
  • The usermod command with the -e or -f option.
  • The useradd command with the -e or -f option.

3.2. Using the User Manager Tool

The User Manager application allows you to view, modify, add, and delete local users and groups in the graphical user interface. To start the application, either select SystemAdministrationUsers and Groups from the panel, or type system-config-users at a shell prompt. Note that unless you have superuser privileges, the application will prompt you to authenticate as root.

3.2.1. Viewing Users and Groups

The main window of the User Manager is divided into two tabs: The Users tab provides a list of local users along with additional information about their user ID, primary group, home directory, login shell, and full name. The Groups tab provides a list of local groups with information about their group ID and group members.
Viewing users and groups
Viewing users and groups
Figure 3.1. Viewing users and groups

To find a specific user or group, type the first few letters of the name in the Search filter field and either press Enter, or click the Apply filter button. You can also sort the items according to any of the available columns by clicking the column header.
Red Hat Enterprise Linux reserves user and group IDs below 500 for system users and groups. By default, the User Manager does not display the system users. To view all users and groups, select EditPreferences to open the Preferences dialog box, and clear the Hide system users and groups check box.

3.2.2. Adding a New User

To add a new user, click the Add User button. A window as shown in Figure 3.2, “Adding a new user” appears.
Adding a new user
Adding a new user
Figure 3.2. Adding a new user

The Add New User dialog box allows you to provide information about the newly created user. In order to create a user, enter the username and full name in the appropriate fields and then type the user's password in the Password and Confirm Password fields. The password must be at least six characters long.

Password security advice

It is advisable to use a much longer password, as this makes it more difficult for an intruder to guess it and access the account without permission. It is also recommended that the password not be based on a dictionary term: use a combination of letters, numbers and special characters.
The Login Shell pulldown list allows you to select a login shell for the user. If you are not sure which shell to select, accept the default value of /bin/bash.
By default, the User Manager application creates the home directory for a new user in /home/username/. You can choose not to create the home directory by clearing the Create home directory check box, or change this directory by editing the content of the Home Directory text box. Note that when the home directory is created, default configuration files are copied into it from the /etc/skel/ directory.
Red Hat Enterprise Linux uses a user private group (UPG) scheme. Whenever you create a new user, a unique group with the same name as the user is created by default. If you do not want to create this group, clear the Create a private group for the user check box.
To specify a user ID for the user, select Specify user ID manually. If the option is not selected, the next available user ID above 500 is assigned to the new user. Because Red Hat Enterprise Linux reserves user IDs below 500 for system users, it is not advisable to manually assign user IDs 1–499.
Clicking the OK button creates the new user. To configure more advanced user properties, such as password expiration, modify the user's properties after adding the user.

3.2.3. Adding a New Group

To add a new user group, select Add Group from the toolbar. A window similar to Figure 3.3, “New Group” appears. Type the name of the new group. To specify a group ID for the new group, select Specify group ID manually and select the GID. Note that Red Hat Enterprise Linux also reserves group IDs lower than 500 for system groups.
New Group
Creating a new group
Figure 3.3. New Group

Click OK to create the group. The new group appears in the group list.

3.2.4. Modifying User Properties

To view the properties of an existing user, click on the Users tab, select the user from the user list, and click Properties from the menu (or choose FileProperties from the pulldown menu). A window similar to Figure 3.4, “User Properties” appears.
User Properties
Modifying user properties
Figure 3.4. User Properties

The User Properties window is divided into multiple tabbed pages:
  • User Data — Shows the basic user information configured when you added the user. Use this tab to change the user's full name, password, home directory, or login shell.
  • Account Info — Select Enable account expiration if you want the account to expire on a certain date. Enter the date in the provided fields. Select Local password is locked to lock the user account and prevent the user from logging into the system.
  • Password Info — Displays the date that the user's password last changed. To force the user to change passwords after a certain number of days, select Enable password expiration and enter a desired value in the Days before change required: field. The number of days before the user's password expires, the number of days before the user is warned to change passwords, and days before the account becomes inactive can also be changed.
  • Groups — Allows you to view and configure the Primary Group of the user, as well as other groups that you want the user to be a member of.

3.2.5. Modifying Group Properties

To view the properties of an existing group, select the group from the group list and click Properties from the menu (or choose FileProperties from the pulldown menu). A window similar to Figure 3.5, “Group Properties” appears.
Group Properties
Modifying group properties
Figure 3.5. Group Properties

The Group Users tab displays which users are members of the group. Use this tab to add or remove users from the group. Click OK to save your changes.

3.3. Using Command Line Tools

The easiest way to manage users and groups on Red Hat Enterprise Linux is to use the User Manager application as described in Section 3.2, “Using the User Manager Tool”. However, if you prefer command line tools or do not have the X Window System installed, you can use command line utilities that are listed in Table 3.1, “Command line utilities for managing users and groups”.
Table 3.1. Command line utilities for managing users and groups
Utilities Description
useradd, usermod, userdel Standard utilities for adding, modifying, and deleting user accounts.
groupadd, groupmod, groupdel Standard utilities for adding, modifying, and deleting groups.
gpasswd Standard utility for administering the /etc/group configuration file.
pwck, grpck Utilities that can be used for verification of the password, group, and associated shadow files.
pwconv, pwunconv Utilities that can be used for the conversion of passwords to shadow passwords, or back from shadow passwords to standard passwords.

3.3.1. Adding a New User

To add a new user to the system, typing the following at a shell prompt as root:
useradd [options] username
…where options are command line options as described in Table 3.2, “useradd command line options”.
By default, the useradd command creates a locked user account. To unlock the account, run the following command as root to assign a password:
passwd username
Optionally, you can set password aging policy. Refer to Section 3.3.3, “Enabling Password Aging” for information on how to enable password aging.
Table 3.2. useradd command line options
Option Description
-c 'comment' comment can be replaced with any string. This option is generally used to specify the full name of a user.
-d home_directory Home directory to be used instead of default /home/username/.
-e date Date for the account to be disabled in the format YYYY-MM-DD.
-f days Number of days after the password expires until the account is disabled. If 0 is specified, the account is disabled immediately after the password expires. If -1 is specified, the account is not be disabled after the password expires.
-g group_name Group name or group number for the user's default group. The group must exist prior to being specified here.
-G group_list List of additional (other than default) group names or group numbers, separated by commas, of which the user is a member. The groups must exist prior to being specified here.
-m Create the home directory if it does not exist.
-M Do not create the home directory.
-N Do not create a user private group for the user.
-p password The password encrypted with crypt.
-r Create a system account with a UID less than 500 and without a home directory.
-s User's login shell, which defaults to /bin/bash.
-u uid User ID for the user, which must be unique and greater than 499.

Explaining the Process

The following steps illustrate what happens if the command useradd juan is issued on a system that has shadow passwords enabled:
  1. A new line for juan is created in /etc/passwd:
    juan:x:501:501::/home/juan:/bin/bash
    The line has the following characteristics:
    • It begins with the username juan.
    • There is an x for the password field indicating that the system is using shadow passwords.
    • A UID greater than 499 is created. Under Red Hat Enterprise Linux, UIDs below 500 are reserved for system use and should not be assigned to users.
    • A GID greater than 499 is created. Under Red Hat Enterprise Linux, GIDs below 500 are reserved for system use and should not be assigned to users.
    • The optional GECOS information is left blank. The GECOS field can be used to provide additional information about the user, such as their full name or phone number.
    • The home directory for juan is set to /home/juan/.
    • The default shell is set to /bin/bash.
  2. A new line for juan is created in /etc/shadow:
    juan:!!:14798:0:99999:7:::
    The line has the following characteristics:
    • It begins with the username juan.
    • Two exclamation marks (!!) appear in the password field of the /etc/shadow file, which locks the account.

      Note

      If an encrypted password is passed using the -p flag, it is placed in the /etc/shadow file on the new line for the user.
    • The password is set to never expire.
  3. A new line for a group named juan is created in /etc/group:
    juan:x:501:
    A group with the same name as a user is called a user private group. For more information on user private groups, refer to Section 3.1.1, “User Private Groups”.
    The line created in /etc/group has the following characteristics:
    • It begins with the group name juan.
    • An x appears in the password field indicating that the system is using shadow group passwords.
    • The GID matches the one listed for user juan in /etc/passwd.
  4. A new line for a group named juan is created in /etc/gshadow:
    juan:!::
    The line has the following characteristics:
    • It begins with the group name juan.
    • An exclamation mark (!) appears in the password field of the /etc/gshadow file, which locks the group.
    • All other fields are blank.
  5. A directory for user juan is created in the /home/ directory:
    ~]# ls -l /home
    total 4
    drwx------. 4 juan juan 4096 Mar  3 18:23 juan
    This directory is owned by user juan and group juan. It has read, write, and execute privileges only for the user juan. All other permissions are denied.
  6. The files within the /etc/skel/ directory (which contain default user settings) are copied into the new /home/juan/ directory:
    ~]# ls -la /home/juan
    total 28
    drwx------. 4 juan juan 4096 Mar  3 18:23 .
    drwxr-xr-x. 5 root root 4096 Mar  3 18:23 ..
    -rw-r--r--. 1 juan juan   18 Jun 22  2010 .bash_logout
    -rw-r--r--. 1 juan juan  176 Jun 22  2010 .bash_profile
    -rw-r--r--. 1 juan juan  124 Jun 22  2010 .bashrc
    drwxr-xr-x. 2 juan juan 4096 Jul 14  2010 .gnome2
    drwxr-xr-x. 4 juan juan 4096 Nov 23 15:09 .mozilla
At this point, a locked account called juan exists on the system. To activate it, the administrator must next assign a password to the account using the passwd command and, optionally, set password aging guidelines.

3.3.2. Adding a New Group

To add a new group to the system, type the following at a shell prompt as root:
groupadd [options] group_name
…where options are command line options as described in Table 3.3, “groupadd command line options”.
Table 3.3. groupadd command line options
Option Description
-f, --force When used with -g gid and gid already exists, groupadd will choose another unique gid for the group.
-g gid Group ID for the group, which must be unique and greater than 499.
-K, --key key=value Override /etc/login.defs defaults.
-o, --non-unique Allow to create groups with duplicate.
-p, --password password Use this encrypted password for the new group.
-r Create a system group with a GID less than 500.

3.3.3. Enabling Password Aging

For security reasons, it is advisable to require users to change their passwords periodically. This can either be done when adding or editing a user on the Password Info tab of the User Manager application, or by using the chage command.

Shadow passwords must be enabled to use chage

Shadow passwords must be enabled to use the chage command. For more information, see Section 3.1.2, “Shadow Passwords”.
To configure password expiration for a user from a shell prompt, run the following command as root:
chage [options] username
…where options are command line options as described in Table 3.4, “chage command line options”. When the chage command is followed directly by a username (that is, when no command line options are specified), it displays the current password aging values and allows you to change them interactively.
Table 3.4. chage command line options
Option Description
-d days Specifies the number of days since January 1, 1970 the password was changed.
-E date Specifies the date on which the account is locked, in the format YYYY-MM-DD. Instead of the date, the number of days since January 1, 1970 can also be used.
-I days Specifies the number of inactive days after the password expiration before locking the account. If the value is 0, the account is not locked after the password expires.
-l Lists current account aging settings.
-m days Specify the minimum number of days after which the user must change passwords. If the value is 0, the password does not expire.
-M days Specify the maximum number of days for which the password is valid. When the number of days specified by this option plus the number of days specified with the -d option is less than the current day, the user must change passwords before using the account.
-W days Specifies the number of days before the password expiration date to warn the user.

You can configure a password to expire the first time a user logs in. This forces users to change passwords immediately.
  1. Set up an initial password. There are two common approaches to this step: you can either assign a default password, or you can use a null password.
    To assign a default password, type the following at a shell prompt as root:
    passwd username
    To assign a null password instead, use the following command:
    passwd -d username

    Avoid using null passwords whenever possible

    Using a null password, while convenient, is a highly insecure practice, as any third party can log in first and access the system using the insecure username. Always make sure that the user is ready to log in before unlocking an account with a null password.
  2. Force immediate password expiration by running the following command as root:
    chage -d 0 username
    This command sets the value for the date the password was last changed to the epoch (January 1, 1970). This value forces immediate password expiration no matter what password aging policy, if any, is in place.
Upon the initial log in, the user is now prompted for a new password.

3.3.4. Enabling Automatic Logouts

When the user is logged in as root, an unattended login session may pose a significant security risk. To reduce this risk, you can configure the system to automatically log out idle users after a fixed period of time:
  1. Make sure the screen package is installed. You can do so by running the following command as root:
    yum install screen
    For more information on how to install packages in Red Hat Enterprise Linux, refer to Section 5.2.4, “Installing Packages”.
  2. As root, add the following line at the beginning of the /etc/profile file to make sure the processing of this file cannot be interrupted:
    trap "" 1 2 3 15
  3. Add the following lines at the end of the /etc/profile file to start a screen session each time a user logs in to a virtual console or remotely:
    SCREENEXEC="screen"
    if [ -w $(tty) ]; then
      trap "exec $SCREENEXEC" 1 2 3 15
      echo -n 'Starting session in 10 seconds'
      sleep 10
      exec $SCREENEXEC
    fi
    Note that each time a new session starts, a message will be displayed and the user will have to wait ten seconds. To adjust the time to wait before starting a session, change the value after the sleep command.
  4. Add the following lines to the /etc/screenrc configuration file to close the screen session after a given period of inactivity:
    idle 120 quit
    autodetach off
    This will set the time limit to 120 seconds. To adjust this limit, change the value after the idle directive.
    Alternatively, you can configure the system to only lock the session by using the following lines instead:
    idle 120 lockscreen
    autodetach off
    This way, a password will be required to unlock the session.
The changes take effect the next time a user logs in to the system.

3.3.5. Creating Group Directories

System administrators usually like to create a group for each major project and assign people to the group when they need to access that project's files. With this traditional scheme, file managing is difficult; when someone creates a file, it is associated with the primary group to which they belong. When a single person works on multiple projects, it becomes difficult to associate the right files with the right group. However, with the UPG scheme, groups are automatically assigned to files created within a directory with the setgid bit set. The setgid bit makes managing group projects that share a common directory very simple because any files a user creates within the directory are owned by the group which owns the directory.
For example, a group of people need to work on files in the /opt/myproject/ directory. Some people are trusted to modify the contents of this directory, but not everyone.
  1. As root, create the /opt/myproject/ directory by typing the following at a shell prompt:
    mkdir /opt/myproject
  2. Add the myproject group to the system:
    groupadd myproject
  3. Associate the contents of the /opt/myproject/ directory with the myproject group:
    chown root:myproject /opt/myproject
  4. Allow users to create files within the directory, and set the setgid bit:
    chmod 2775 /opt/myproject
At this point, all members of the myproject group can create and edit files in the /opt/myproject/ directory without the administrator having to change file permissions every time users write new files. To verify that the permissions have been set correctly, run the following command:
~]# ls -l /opt
total 4
drwxrwsr-x. 3 root myproject 4096 Mar  3 18:31 myproject

3.4. Additional Resources

Refer to the following resources for more information about managing users and groups.

3.4.1. Installed Documentation

For information about various utilities for managing users and groups, refer to the following manual pages:
  • chage(1) — A command to modify password aging policies and account expiration.
  • gpasswd(1) — A command to administer the /etc/group file.
  • groupadd(8) — A command to add groups.
  • grpck(8) — A command to verify the /etc/group file.
  • groupdel(8) — A command to remove groups.
  • groupmod(8) — A command to modify group membership.
  • pwck(8) — A command to verify the /etc/passwd and /etc/shadow files.
  • pwconv(8) — A tool to convert standard passwords to shadow passwords.
  • pwunconv(8) — A tool to convert shadow passwords to standard passwords.
  • useradd(8) — A command to add users.
  • userdel(8) — A command to remove users.
  • usermod(8) — A command to modify users.
For information about related configuration files, see:
  • group(5) — The file containing group information for the system.
  • passwd(5) — The file containing user information for the system.
  • shadow(5) — The file containing passwords and account expiration information for the system.

Part II. Package Management

All software on a Red Hat Enterprise Linux system is divided into RPM packages, which can be installed, upgraded, or removed. This part focuses on product subscriptions and entitlements, and describes how to manage packages on Red Hat Enterprise Linux using both Yum and the PackageKit suite of graphical package management tools.

Table of Contents

4. Product Subscriptions and Entitlements
4.1. An Overview of Managing Subscriptions and Content
4.1.1. The Purpose of Subscription Management
4.1.2. Defining Subscriptions, Entitlements, and Products
4.1.3. Subscription Management Tools
4.1.4. Subscription and Content Architecture
4.1.5. Advanced Content Management: Extended Update Support
4.1.6. Certificate-based Red Hat Network versus RHN Classic
4.2. Using Red Hat Subscription Manager Tools
4.2.1. Launching Red Hat Subscription Manager
4.2.2. About subscription-manager
4.2.3. Looking at RHN Subscription Management
4.3. Managing Special Deployment Scenarios
4.3.1. Local Subscription Services, Local Content Providers, and Multi-Tenant Organizations
4.3.2. Virtual Guests and Hosts
4.3.3. Domains
4.4. Registering, Unregistering, and Reregistering a System
4.4.1. Registering Consumers in Hosted Environment
4.4.2. Registering Consumers to a Local Organization
4.4.3. Registering an Offline Consumer
4.4.4. Registering Consumers from the Command Line
4.4.5. Unregistering
4.4.6. Restoring a Registration
4.5. Handling Subscriptions
4.5.1. Subscribing and Unsubscribing through the GUI
4.5.2. Handling Subscriptions through the Command Line
4.5.3. Stacking Subscriptions
4.5.4. Manually Adding a New Subscription
4.6. Redeeming Subscriptions on a Machine
4.6.1. Redeeming Subscriptions through the GUI
4.6.2. Redeeming Subscriptions on a Machine through the Command Line
4.7. Viewing Available and Used Subscriptions
4.7.1. Viewing Subscriptions in the GUI
4.7.2. Listing Subscriptions with the Command Line
4.7.3. Viewing Subscriptions Used in Both RHN Classic and Certificate-based Red Hat Network
4.8. Working with Subscription yum Repos
4.9. Responding to Subscription Notifications
4.10. Healing Subscriptions
4.10.1. Enabling Healing
4.10.2. Changing the Healing Check Frequency
4.11. Viewing Organization Information
4.12. Updating Entitlements Certificates
4.12.1. Updating Entitlement Certificates
4.12.2. Updating Subscription Information
4.13. Configuring the Subscription Service
4.13.1. Red Hat Subscription Manager Configuration Files
4.13.2. Using the config Command
4.13.3. Using an HTTP Proxy
4.13.4. Changing the Subscription Server
4.13.5. Configuring Red Hat Subscription Manager to Use a Local Content Provider
4.13.6. Managing Secure Connections to the Subscription Server
4.13.7. Starting and Stopping the Subscription Service
4.13.8. Checking Logs
4.13.9. Showing and Hiding Incompatible Subscriptions
4.13.10. Checking and Adding System Facts
4.13.11. Regenerating Identity Certificates
4.13.12. Getting the System UUID
4.13.13. Viewing Package Profiles
4.13.14. Retrieving the Consumer ID, Registration Tokens, and Other Information
4.14. About Certificates and Managing Entitlements
4.14.1. The Structure of Identity Certificates
4.14.2. The Structure of Entitlement Certificates
4.14.3. The Structure of Product Certificates
4.14.4. Anatomy of Satellite Certificates
5. Yum
5.1. Checking For and Updating Packages
5.1.1. Checking For Updates
5.1.2. Updating Packages
5.1.3. Preserving Configuration File Changes
5.2. Packages and Package Groups
5.2.1. Searching Packages
5.2.2. Listing Packages
5.2.3. Displaying Package Information
5.2.4. Installing Packages
5.2.5. Removing Packages
5.2.6. Working with Transaction History
5.3. Configuring Yum and Yum Repositories
5.3.1. Setting [main] Options
5.3.2. Setting [repository] Options
5.3.3. Using Yum Variables
5.3.4. Viewing the Current Configuration
5.3.5. Adding, Enabling, and Disabling a Yum Repository
5.3.6. Creating a Yum Repository
5.4. Yum Plug-ins
5.4.1. Enabling, Configuring, and Disabling Yum Plug-ins
5.4.2. Installing Additional Yum Plug-ins
5.4.3. Plug-in Descriptions
5.5. Additional Resources
6. PackageKit
6.1. Updating Packages with Software Update
6.2. Using Add/Remove Software
6.2.1. Refreshing Software Sources (Yum Repositories)
6.2.2. Finding Packages with Filters
6.2.3. Installing and Removing Packages (and Dependencies)
6.2.4. Installing and Removing Package Groups
6.2.5. Viewing the Transaction Log
6.3. PackageKit Architecture
6.4. Additional Resources

Chapter 4. Product Subscriptions and Entitlements

4.1. An Overview of Managing Subscriptions and Content
4.1.1. The Purpose of Subscription Management
4.1.2. Defining Subscriptions, Entitlements, and Products
4.1.3. Subscription Management Tools
4.1.4. Subscription and Content Architecture
4.1.5. Advanced Content Management: Extended Update Support
4.1.6. Certificate-based Red Hat Network versus RHN Classic
4.2. Using Red Hat Subscription Manager Tools
4.2.1. Launching Red Hat Subscription Manager
4.2.2. About subscription-manager
4.2.3. Looking at RHN Subscription Management
4.3. Managing Special Deployment Scenarios
4.3.1. Local Subscription Services, Local Content Providers, and Multi-Tenant Organizations
4.3.2. Virtual Guests and Hosts
4.3.3. Domains
4.4. Registering, Unregistering, and Reregistering a System
4.4.1. Registering Consumers in Hosted Environment
4.4.2. Registering Consumers to a Local Organization
4.4.3. Registering an Offline Consumer
4.4.4. Registering Consumers from the Command Line
4.4.5. Unregistering
4.4.6. Restoring a Registration
4.5. Handling Subscriptions
4.5.1. Subscribing and Unsubscribing through the GUI
4.5.2. Handling Subscriptions through the Command Line
4.5.3. Stacking Subscriptions
4.5.4. Manually Adding a New Subscription
4.6. Redeeming Subscriptions on a Machine
4.6.1. Redeeming Subscriptions through the GUI
4.6.2. Redeeming Subscriptions on a Machine through the Command Line
4.7. Viewing Available and Used Subscriptions
4.7.1. Viewing Subscriptions in the GUI
4.7.2. Listing Subscriptions with the Command Line
4.7.3. Viewing Subscriptions Used in Both RHN Classic and Certificate-based Red Hat Network
4.8. Working with Subscription yum Repos
4.9. Responding to Subscription Notifications
4.10. Healing Subscriptions
4.10.1. Enabling Healing
4.10.2. Changing the Healing Check Frequency
4.11. Viewing Organization Information
4.12. Updating Entitlements Certificates
4.12.1. Updating Entitlement Certificates
4.12.2. Updating Subscription Information
4.13. Configuring the Subscription Service
4.13.1. Red Hat Subscription Manager Configuration Files
4.13.2. Using the config Command
4.13.3. Using an HTTP Proxy
4.13.4. Changing the Subscription Server
4.13.5. Configuring Red Hat Subscription Manager to Use a Local Content Provider
4.13.6. Managing Secure Connections to the Subscription Server
4.13.7. Starting and Stopping the Subscription Service
4.13.8. Checking Logs
4.13.9. Showing and Hiding Incompatible Subscriptions
4.13.10. Checking and Adding System Facts
4.13.11. Regenerating Identity Certificates
4.13.12. Getting the System UUID
4.13.13. Viewing Package Profiles
4.13.14. Retrieving the Consumer ID, Registration Tokens, and Other Information
4.14. About Certificates and Managing Entitlements
4.14.1. The Structure of Identity Certificates
4.14.2. The Structure of Entitlement Certificates
4.14.3. The Structure of Product Certificates
4.14.4. Anatomy of Satellite Certificates
Effective asset management requires a mechanism to handle the software inventory — both the type of products and the number of systems that the software is installed on. The subscription service provides that mechanism and gives transparency into both global allocations of subscriptions for an entire organization and the specific subscriptions assigned to a single system.
Red Hat Subscription Manager works with yum to unit content delivery with subscription management. The Subscription Manager handles only the subscription-system associations. yum or other package management tools handle the actual content delivery. Chapter 5, Yum describes how to use yum.
This chapter provides an overview of subscription management in Red Hat Enterprise Linux and the Red Hat Subscription Manager tools which are available.

4.1. An Overview of Managing Subscriptions and Content

Red Hat Enterprise Linux and other Red Hat products are sold through subscriptions, which make packages available and provide support for a set number of systems. Subscription management clarifies the relationships between local systems and available software resources because it gives a view into where software subscriptions are assigned, apart from installing the packages.

4.1.1. The Purpose of Subscription Management

New government and industry regulations are setting new mandates for businesses to track how their infrastructure assets are used. These changes include legislation like Sarbanes-Oxley in the United States, standards like Payment Card Industry Data Security Standard (PCI-DSS), or accreditation like SAS-70. Software inventory maintenance is increasingly important to meet accounting and governmental standards.
That means that there is increasing pressure on IT administrators to have an accurate, current accounting of the software used on their systems. Generally, this is called software license management; with Red Hat's subscription model, this is subscription management.
Managing Subscriptions for Software Inventory
Figure 4.1. Managing Subscriptions for Software Inventory

Effective subscription management helps organizations achieve four primary goals:
  • Maintain regulatory compliance. One of the key responsibilities of administrators is software compliance in conformance with legal or industry requirements. Subscription management helps track both subscription assignments and contract expiration, which helps administrators manage both systems and software inventories in accordance to their regulatory requirements.
  • Simplify IT audits. Having a central and clear inventory of both current subscriptions and current systems, IT administrators can monitor and report on their infrastructure better.
  • Get better performance by doing better at assigning subscriptions. The subscription service maintains dual inventories of available product subscriptions and registered server systems, with clear associations between subscriptions and systems. This makes it easier for IT administrators to assign relevant subscriptions to systems, because they have a view of what is in the inventory and what the system is currently subscribed to.
  • Lower costs and streamline procurement. While under-subscribing systems can run afoul of regulations, over- subscribing systems can cause a significant impact on IT budgets. Subscription management helps subscriptions be assigned most efficiently, so costs could actually be lowered.
With Red Hat's commitment to free and open software, subscription management is focused on delivering tools that help IT administrators monitor their software/systems inventory for their own benefit. Subscription management does not enforce or restrict access to products.

The Red Hat License Agreement

Most Red Hat products are licensed under a GNU General Public License (GPL), which allows free use of the software or code; this a different license than the Red Hat license agreement. A Red Hat license provides access to Red Hat services, like the Customer Portal and Content Delivery Network.
The Red Hat subscription requires that, as long as there is any active subscription for a product, then every system which uses the Red Hat product must have an active subscription assigned to it. Otherwise, the subscription is violated. See http://www.redhat.com/subscriptions/ and http://www.redhat.com/rhel/renew/faqs/#6 for more information on Red Hat's subscription model and terms.

4.1.2. Defining Subscriptions, Entitlements, and Products

The basis of everything is a subscription. A subscription contains both the products that are available, the support levels, and the quantities, or number of servers, that the product can be installed on.
Subscriptions are managed though the Certificate-Based Red Hat Network service, which ties into the Subscription and Content Delivery Network (CDN).
The subscription service maintains a complete list of subscriptions for an organization, identified by a unique ID (called a pool ID). A system is registered, or added, to the subscription service to allow it to manage the subscriptions for that system. Like the subscription, the system is also added to the subscription service inventory and is assigned a unique ID within the service. The subscriptions and system entries, together, comprise the inventory.
A system allocates one of the quantities of a product in a subscription to itself. When a subscription is consumed, it is an entitlement. (An entitlement is roughly analogous to a user license, in that it grants all of the rights to that product to that system. Unlike a user license, an entitlement does not grant the right to use the software; with the subscription model, an entitlement grants the ability to download the packages and receive updates.) Because the available quantity in a subscription lowers once a system subscribes to it, the system consumes the subscription.
Managing Subscriptions, Illustrated
Figure 4.2. Managing Subscriptions, Illustrated

The repository where the product software is located is organized according to the product. Each product group within the repository may contain the primary software packages and then any required dependencies or associated packages. Altogether, the product and its associated packages are called a content set. (A content set for a product even includes other versions of the product.) When a subscription grants access to a product, it includes access to all of the associated packages in that content set.
A single subscription can have multiple products, and each system can have multiple different subscriptions, depending on how many entitlement certificates are loaded on the machine.
Any number of products, for any number of different architectures, can be contained in a single subscription. The subscription options that are visible to a consumer are filtered, by default, according to whether the architecture for the product matches the architecture of the system. This is compatibility. Depending on compatible subscriptions makes sure that subscriptions are allocated efficiently, only to systems which can actually use the products.
Some subscriptions define some element count on the consumer, like the number of sockets on the machine, the number of virtual guests on a host, or the number of clients in a domain. Multiple subscriptions can be combined together to cover the counts on the consumer. For example, if there is a four socket server, two subscriptions for "RHEL Server for Two Sockets" can be consumed by the system to cover the socket count. Combining multiple subscriptions to cover the system count is called stacking.
The subscription tools can display even incompatible entitlements. Alternatively, the architecture definition for the system can be overridden by defining custom system facts for the subscription tools to use.
It is important to distinguish between subscribing to a product and installing a product. A subscription is essentially a statement of whatever products an organization has purchased. The act of subscribing to a subscription means that a system is allowed to install the product with a valid certificate, but subscribing does not actually perform any installation or updates. In the reverse, a product can also be installed apart from any entitlements for the system; the system just does not have a valid product certificate. Certificate-Based Red Hat Network and the Content Delivery Network harmonize with content delivery and installation by using yum plug-ins that come with the Subscription Manager tools.

4.1.3. Subscription Management Tools

Subscriptions are managed through GUI and CLI tools called Red Hat Subscription Manager. The Subscription Manager tracks and displays what entitlements are available to the local system and what entitlements have been consumed by the local system. The Subscription Manager works as a conduit back to the subscription service to synchronize changes like available product quantities or subscription expiration and renewals.

Note

The Red Hat Subscription Manager tools are always run as root because of the nature of the changes to the system. However, Red Hat Subscription Manager connects to the subscription service as a user account for the Customer Service Portal.
The Subscription Manager handles both registration and subscriptions for a system. The Subscription Manager is part of the firstboot process for configuring content and updates, but the system can be registered at any time through the Red Hat Subscription Manager GUI or CLI. New subscriptions, new products, and updates can be viewed and applied to a system through the Red Hat Subscription Manager tools.
The different Subscription Manager clients are covered in Section 4.2, “Using Red Hat Subscription Manager Tools”.

4.1.4. Subscription and Content Architecture

Content includes new downloads, ISOs, updates, and errata, anything that can be installed on a system.
Subscription management helps to clarify and to define the relationships between local server infrastructure and the content delivery systems. Subscription management and content delivery are tightly associated. Entitlements (assigned subscriptions) identify what a system is allowed to install and update. In other words, entitlements define access to content. The content delivery system actually provides the software packages.
There are three parties that are involved in subscriptions and content:
  • The subscription service
  • The Content Delivery Network
  • The system which uses the content
Relationship Among Systems, the Subscription Service, and Content Delivery Network
Figure 4.3. Relationship Among Systems, the Subscription Service, and Content Delivery Network

The subscription service handles the system registration (verifying that the system is allowed to access the content). It also supplies the system with information on what products are available and handles a central list of entitlements and remaining quantities for the entire organization.
The content delivery network is responsible for delivering the content to the system when requested. The content server is configured in the Red Hat Subscription Manager configuration and then tied into the system's yum service through the Red Hat Subscription Manager yum plug-in.
Both the entitlement server and the content server used by a system's Red Hat Subscription Manager tools can be customized. The default settings use the public subscription service and Content Delivery Network, but either one can be changed to use organization-specific services.
The operating infrastructure can be divided into completely separate organizations, which can be further divided into environments. The organization divisions allow a single parent to be able to partition content services and subscriptions to groups, and these groups are opaque to each other. This structure is very useful for ISPs, colocation facilities, or other service providers which may be customer groups that need to be independent of each other but still under the administrative control of the service provider itself. The multi-tenant structures are described in Section 4.3, “Managing Special Deployment Scenarios”.

Note

Systems have the option of using the older Red Hat Network and Satellite 5.x systems to deliver content. These content delivery mechanisms bypass the subscription service in Certificate-Based Red Hat Network, so there is no entitlement management. This is allowed for legacy infrastructures, but Red Hat strongly recommends registering new systems with the latest Certificate-based Red Hat Network.

4.1.5. Advanced Content Management: Extended Update Support

Sometimes software product installations are straightforward — you want to install a Red Hat Enterprise Linux server, so you install Red Hat Enterprise Linux. However, products can have dependencies with each other (product B is only worthwhile if product A is also installed) or products can interact with each other to provide extended functionality. There are two categories of these kinds of product interactions:
  • Dependencies, where one product requires or relies on another product directly
  • Modifiers, where a product provides enhanced functionality or services for existing products
Dependencies are common and can be handled directly when processing content through tools like yum.
Modifiers can be more subtle. A modifier subscription extends another entitlement and provides different repository access and support than the product entitlement alone.
If the system is subscribed to that product entitlement or combination of products, then the modifier subscription brings an enhanced content set for that product. The content set can include additional new products, new functionality, or extended service and support, depending on the product being modified.
One simple example of a modifier is extended update support (EUS), which extends support for a minor release of Red Hat Enterprise Linux from six months to 24 months. An EUS subscription provides an enhanced support path, rather than a new product. EUS works only in conjunction with another product, to extend its support profile; it does not stand alone.

Red Hat Enterprise Linux Add-ons and EUS Subscriptions

Red Hat Enterprise Linux add-ons have access to EUS streams as long as the underlying Red Hat Enterprise Linux product has an EUS subscription. For example, if an administrator has a Red Hat Enterprise Linux 2 Socket subscription, a File System subscription, and a Red Hat Enterprise Linux 2 Socket EUS subscription, then the system can access both non-EUS and EUS content for both the Red Hat Enterprise Linux server and the File System product.

4.1.6. Certificate-based Red Hat Network versus RHN Classic

During the firstboot process, there are two options given for the content server: (Certificate-based) Red Hat Network and RHN Classic. These systems are mutually exclusive, but they both handle software content and updates as well as subscriptions and system inventory.

Important

This entire chapter deals with entitlement and subscription management through Certificate-based Red Hat Network with the subscription service tools. This is the recommended content/subscription system for Red Hat Enterprise Linux 6.1 and later systems.
In Red Hat Enterprise Linux 6, entitlements and subscriptions are defined by available and installed products. However, in older versions of Red Hat Enterprise Linux, subscriptions were defined by channel access. These are two different approaches to content and entitlement access. Red Hat Network uses the product-based subscription model, while RHN Classic uses the channel-based model.
Certificate-based Red Hat Network is focused on two things:
  • Subscription management
  • Content delivery
Certificate-based Red Hat Network integrates the Customer Portal, Content Delivery Network, and subscription service (subscription management). It uses simple and streamlined local tools (the Red Hat Subscription Manager client) to give greater visibility into how entitlements and subscriptions are used and assigned and to help control software subscriptions as they are added and expire.
Since the client tools for subscription management (the focus of Certificate-based Red Hat Network) are only available in Red Hat Enterprise Linux 6.1 systems and later, Certificate-based Red Hat Network can only be utilized by 6.1 and later systems.
RHN Classic uses the traditional channel entitlement model, which provides a global view of content access but does not provide insight into system-level subscription uses. Along with content and global subscription management, RHN Classic also provides some systems management functions:
  • Kickstarting systems
  • Managing configuration files
  • Running scripts
  • Taking system snapshots
Satellite 5.x systems use a channel-based model similar to RHN Classic.
While RHN Classic has an expanded systems management feature set, RHN Classic does not provide the system-level view into installed and subscribed products that the enhanced Red Hat Network and subscription service do. RHN Classic is provided for older Red Hat Enterprise Linux systems (Red Hat Enterprise Linux 4.x, Red Hat Enterprise Linux 5.x, and Satellite 5.x) to migrate systems over to Red Hat Enterprise Linux 6.1 and later versions.
When a system is registered with RHN Classic, then the Red Hat Subscription Manager shows an error that the system is already registered and cannot be managed by the Subscription Manager tools. Likewise, similar errors are returned in the RHN Classic tools if a system is registered with Red Hat Network and the subscription service.
If a system was previously managed by RHN Classic, there is no direct, supported migration path from RHN Classic to Certificate-based Red Hat Network. If you upgrade to Red Hat Enterprise Linux 6.1 and want to use the new Certificate-based Red Hat Network, there are two ways to accomplish it:
  • Update the system using a boot ISO rather than yum.
  • Manually remove the system from RHN Classic and delete the host record, then register the system to Certificate-based Red Hat Network using the Red Hat Subscription Manager tools.

4.2. Using Red Hat Subscription Manager Tools

The Red Hat Subscription Manager tool set encompasses three different tools:
  • A GUI-based local client to manage the local machine
  • A CLI client for advanced users and administrators to manage a local machine (and which can be tied into other applications and actions, like kickstarting machines)
  • A web-based client for organizational, multi-system views of the subscriptions and inventoried resources
All of these tools, both local clients and the web-based tools, allow administrators to perform three major tasks directly related to managing subscriptions: registering machines, assigning subscriptions to systems, and updating the certificates required for authentication. Some minor operations, like updating system facts, are available to help display and track what subscriptions are available.

Note

Both the Red Hat Subscription Manager GUI and CLI must be run as root.

4.2.1. Launching Red Hat Subscription Manager

Red Hat Subscription Manager is listed as one of the administrative tools in the System => Administration menu in the top management bar.
Red Hat Subscription Manager Menu Option
Figure 4.4. Red Hat Subscription Manager Menu Option

Alternatively, the Red Hat Subscription Manager GUI can be opened from the command line with a single command:
[root@server1 ~]# subscription-manager-gui
The Red Hat Subscription Manager UI has a single window with tabbed sections that offer quick views into the current state of the system, showing installed products, subscriptions for the system, and available subscriptions the system has access to. These tabs also allow administrators to manage subscriptions by subscribing and unsubscribing the system.
The Red Hat Subscription Manager has three main areas to manage products and subscriptions:
  • The My Subscriptions area shows all of the current entitlements that the system is subscribed to.
  • The All Available Subscriptions area shows all of the subscriptions that are available to the system. The default displays only entitlements that are compatible with the hardware, but these can be filtered to show entitlements corresponding to other installed programs, only subscriptions that have not been installed, and subscriptions based on date.
  • The My Installed Software area shows the currently installed products on the system, along with their subscription status. This does not allow administrators to install software, only to view installed software.
Red Hat Subscription Manager Main Screen
Figure 4.5. Red Hat Subscription Manager Main Screen

The top right box contains the tools required to perform maintenance tasks like changing the registration connection information and viewing system facts.

4.2.2. About subscription-manager

Any of the operations that can be performed through the Red Hat Subscription Manager UI can also be performed by running the subscription-manager tool. This tools has the following format:
[root@server1 ~]# subscription-manager command [options]
Each command has its own set of options that are used with it. The subscription-manager help and manpage have more information.
Table 4.1. subscription-manager Commands
Command Description
register Registers or identifies a new system to the subscription service.
unregister Unregisters a machine, which strips its subscriptions and removes the machine from the subscription service.
subscribe Allocates a specific subscription to the machine.
redeem Autosubscribes a machine to a pre-specified subscription that was purchased from a vendor, based on its hardware and BIOS information.
refresh Pulls the latest entitlement data from the server. Normally, the system polls the entitlement server at a set interval (4 hours by default) to check for any changes in the available subscriptions. The refresh command checks with the entitlement server right then, outside the normal interval.
unsubscribe Removes a specific subscription or all subscriptions from the machine.
list Lists all of the subscriptions that are compatible with a machine, either subscriptions that are actually consumed by the machine or unused subscriptions that are available to the machine.
identity Handles the identity certificate and registration ID for a system. This command can be used to return the current UUID or generate a new identity certificate.
facts Lists the system information, like the release version, number of CPUs, and other architecture information.
clean Removes all of the subscription and identity data from the local system, without affecting the consumer information in the subscription service. Any of the subscriptions consumed by the system are still consumed and are not available for other systems to use. The clean command is useful in cases where the local entitlement information is corrupted or lost somehow, and the system will be reregistered using the register --consumerid=EXISTING_ID command.
orgs, repos, environments Lists all of the configured organizations, environments, and content repositories that are available to the given user account or system. These commands are used to view information in a multi-org infrastructure. They are not used to configure the local machine or multi-org infrastructure.

4.2.3. Looking at RHN Subscription Management

The ultimate goal of entitlement management is to allow administrators to identify the relationship between their systems and the subscriptions used by those systems. This can be done from two different perspectives: from the perspective of the local system looking externally to potential subscriptions and from the perspective of the organization, looking down at the total infrastructure of systems and all subscriptions.
The Red Hat Subscription Manager GUI and CLI are both local clients which manage only the local machine. These tools are somewhat limited in their view; they only disclose information (such as available entitlements) from the perspective of that one system, so expired and depleted subscriptions or subscriptions for other architectures are not displayed.
RHN Subscription Management in the Customer Portal is a global tool which is intended to give complete, organization-wide views into subscriptions and systems. It shows all subscriptions and all consumers for the entire organization. RHN Subscription Management can perform many of the tasks of the local tools, like registering consumers, assigning subscriptions, and viewing system facts and UUID. It can also manage the subscriptions themselves, such as viewing contract information and renewing subscriptions — a task not possible in the local clients.
RHN Subscription Management in the Customer Portal
Figure 4.6. RHN Subscription Management in the Customer Portal

Note

RHN Subscription Management gives a global view of all consumers, of all types, for an organization, which is crucial for planning and effectively assigning subscriptions. However, it does not provide any insight into what products are installed on a system and whether subscriptions are assigned for those products. To track the validity of installed products, you must use the local Subscription Manager tools.
RHN Subscription Management also provides a view of systems and subscriptions managed under RHN Classic and provides access to the RHN Classic web tools.
All of the subscriptions for an entire organization — the subscriptions that have been purchased and the systems to which they have been allocated — are viewable through the account pages at https://access.redhat.com/. Additional information about RHN Subscription Management is available with the portal documentation at https://access.redhat.com/knowledge/docs/Red_Hat_Customer_Portal/.

4.3. Managing Special Deployment Scenarios

There are different types of consumers and different ways of organizing consumers. The simplest environment has physical machines grouped together in one single, homogeneous group, connecting to Red Hat's hosted content and subscription services. While this is an easy arrangement to maintain, it does not accurately describe many enterprise environments, which have a lively mix of physical and virtual machines, divided across disparate organizational units and even subunits within those organizations and accessing locally-controlled content and subscription services.
The first change is the ability to group systems into divisions and subdivisions. This is called multi-tenancy, the ability create unrelated groups beneath the primary umbrella account. Multi-tenant (or multi-org) structures are for infrastructures which may have multiple content repositories or subscription services, and systems within the organization need to be grouped according to access to those repositories and services.
The other part of heterogeneous environments is recognizing consumers other than physical machines. Two special consumer types are common: virtual guests and server domains. The difference between these consumer types and physical, single-machine consumers is only in the type of information that the Red Hat Subscription Service uses and stores — not in any special configuration or management tasks.

4.3.1. Local Subscription Services, Local Content Providers, and Multi-Tenant Organizations

As Section 4.1.4, “Subscription and Content Architecture” outlines, the subscription service, content repository, and client tools and inventory all work together to define the entitlements structure for a customer. The way that these elements are organized depends on a lot of factors, like who is maintaining the individual services, how systems in the inventory are group, and how user access to the different services is controlled.
The most simplistic structure is the hosted structure. The content and subscription services are hosted by Red Hat, and all systems within the inventory are contained in one monolithic group. User access is defined only by Red Hat Customer Portal account access.
Hosted Structure
Figure 4.7. Hosted Structure

The next step allows a customer to have its own, local subscription service (Subscription Asset Manager), while still using Red Hat's hosted content delivery network. At this point, user access can be defined locally, within the Subscription Asset Manager configuration. Subscription Asset Manager can define independent groups, called organizations. Systems belong to those organizations, and users are granted access to those organizations. Systems and users in one organization are essentially invisible to systems and users in other organizations.
Hosted Content/Local Subscriptions Structure
Figure 4.8. Hosted Content/Local Subscriptions Structure

The last style of infrastructure is almost entirely local, with a System Engine server that provides locally-hosted content providers and an integrated local subscription service.
Local Subscriptions and Local Content Provider Structure
Figure 4.9. Local Subscriptions and Local Content Provider Structure

This allows the most control over how systems are grouped within the subscriptions/content. A customer's main account can be divided into separate and independent organizations. These organizations can use different content provider, can have different subscriptions allocated to them, and can have different users assigned to them with levels of access set per organization. Access control in this scenario is controlled entirely locally. The local System Engine server, not the remote Red Hat Customer Portal, processes user authentication requests and applies local access control policies.
A system is assigned to one organization. Within an organization, there can be different environments which define access to product versions and content sets. There can be overlap between environments, with a system belonging to multiple environments.
Multi-Org
Figure 4.10. Multi-Org

When there is only one organization — such as a hosted environment (where the single organization is implicit) — then the systems all default to use that one organization. When there are multiple organizations, then the organization for a system to use must be defined for that system. This affects register operations, where the system is registered to subscription service and then joined to the organization. It also affects other operations tangentially. It may affect subscribe operations because it affects repository availability and subscription allocations, and it affects redeem operations (activation of existing subscriptions) because subscriptions must be redeemed from the organization which issued the subscription.
For more information on configuring and managing organizations, environments, and content repositories, see the Subscription Asset Manager and System Engine documentation.

4.3.2. Virtual Guests and Hosts

When the Red Hat Subscription Manager process checks the system facts, it attempts to identify whether the system is a physical machine or a virtual guest. The Subscription Manager can detect guests for several different virtualization services, including:
  • KVM
  • Xen
  • HyperV
  • VMWare ESX
Subscription Manager records a unique identifier called a guest ID as one of the system facts for a virtual guest. A special process, libvirt-rhsm, checks VMWare, KVM, and Xen processes and then relays that information to Subscription Manager and any configured subscription service (Certificate-based Red Hat Network or a local Subscription Asset Manager). Each guest machine on a host is assigned a guest ID, and that guest ID is both associated with the host and used to generate the identity certificate for the guest when it is registered.
Some Red Hat Enterprise Linux variants are specifically planned for virtual hosts and guests. The corresponding subscriptions are divided into a certain quantity of physical hosts and then a quantity of allowed guests. Red Hat Enterprise Linux add-ons may even be inherited, so that when a host machine is subscribed to that entitlement, all of its guests are automatically included in that subscription. (Red Hat layered products usually do not draw any distinction between virtual and physical systems; the same type of subscription is used for both.) If the system is a guest, then virtual entitlements are listed with the available subscriptions. If no more virtual entitlements are available, then the subscription service will apply physical entitlements.
Virtual and physical subscriptions are identified in the Type column.
Virtual and Physical Subscription
Figure 4.11. Virtual and Physical Subscription

Note

The distinction of being a physical machine versus virtual machine matters only in the priority of how entitlements are consumed. Virtual machines are recorded in the subscription service inventory as a regular system type of consumer.
Virtual guests are registered to the subscription service inventory as regular systems and subscribe to entitlements just like any other consumer.
Virtual entitlements can only be used by virtual machines. Physical entitlements can be used by both physical and virtual machines. When ascertaining what subscriptions are available for autosubscription, preference is given first to virtual entitlements (which are more restrictive in the type of consumer which can use them), and then to physical entitlements.

4.3.3. Domains

Consumers in the subscription service inventory are identified by type. Most consumers will have a type of system, meaning that each individual server subscribes to its own entitlements for its own use. There is another type of consumer, though, which is available for server groups, the domain type. domain-based entitlements are not allocated to a single system; they are distributed across the group of servers to govern the behavior of that group of servers. (That server group is called a domain.)
There are two things to keep in mind about domain entitlements:
  • Each member of the domain is still registered to the subscription service as a system consumer and added to the inventory individually.
  • The domain entitlements apply to the behavior of the entire server group, not to any one system.
The domain entitlement simply governs the behavior of the domain. A domain entitlement is not limited to a specific type of behavior. Domain entitlements can describe a variety of types of behavior, such as storage quotas or the maximum number of messages to process per day. The entire domain is bound to the subscriptions when one of the domain servers subscribes to the domain entitlements using the Red Hat Subscription Manager tools, and the entitlement certificate is replicated between the domain servers.

4.4. Registering, Unregistering, and Reregistering a System

Entitlements are managed by organizing and maintaining the systems which use entitlement subscriptions. The entitlements and subscriptions are managed by Red Hat through the subscription service. A system is recognized to the subscription service by being registered with the service. The subscription service assigns the system (called a consumer) a unique ID (essentially as an inventory number) and issues that system an identifying certificate (with the UUID in its subject CN) to identify that system.
Whenever a subscription is purchased by an organization, the consumer can subscribe to that subscription. This means that a portion of the subscription is allocated to that consumer ID; when the consumer contacts the content delivery network and downloads the software, the licenses have been already assigned to the system. The system has valid certificates for its subscriptions.
Systems can be registered with an subscription service during the firstboot process or as part of the kickstart setup (both described in the Installation Guide). Systems can also be registered after they have been configured or removed from the subscription service inventory (unregistered) if they will no longer be managed within that entitlement system.

4.4.1. Registering Consumers in Hosted Environment

For infrastructures which use Red Hat's hosted subscription and content delivery network, all that is required to register the system is the username and password of the Red Hat Network account.
  1. Launch the Red Hat Subscription Manager GUI. For example:
    subscription-manager-gui
  2. If the system is not already registered, then there will be a Register button at the top of the window in the Tools area.
  3. Enter the username and password of the user account on the subscription service; this is the account used to access the Customer Portal.
  4. Optionally, select the Automatically subscribe... checkbox, so that the system is subscribed to the best matched subscription when it is registered. Otherwise, the system must be subscribed manually, as in Section 4.5, “Handling Subscriptions”.

4.4.2. Registering Consumers to a Local Organization

Infrastructures which manage their own local content repository and subscription service must have a defined organization. This organization is essentially a group definition, and systems must be assigned to that group as part of the registration process. This allows there to be multiple, discrete organizations or tenants within the infrastructure.
When a system is registered using the Subscription Manager GUI, Subscription Manager automatically scans the local subscription and content service to see what organizations are configured.
  1. Make sure that the rhsm.conf configuration file points to the local subscription service (in the hostname parameter) and the local content server (in the baseurl parameter). The Subscription Manager configuration is described in Section 4.13, “Configuring the Subscription Service”.
  2. Launch the Red Hat Subscription Manager GUI. For example:
    subscription-manager-gui
  3. Click the Register button at the top of the window in the Tools area.
  4. Enter the username and password of the user account on the subscription service; this is the account used to access the Customer Portal.
  5. Subscription Manager scans the network for available organizations.
    When the configured organizations are detected, Subscription Manager prompts for the organization for the system to join. It is only possible to register with one organization.
  6. If the selected organization has multiple environments available, then the Subscription Manager will detect them and provide a list. It is possible to join multiple environments. Use the Ctrl key to select multiple environments from the list.
    If no environment is selected, then Subscription Manager uses the default environment for the organization.

    NOTE

    It is only possible to join an environment during registration. The environments cannot be changed after registration.
  7. Optionally, select the Automatically subscribe... checkbox, so that the system is subscribed to the best matched subscription when it is registered. Otherwise, the system must be subscribed manually, as in Section 4.5, “Handling Subscriptions”.

4.4.3. Registering an Offline Consumer

Some systems may not have internet connectivity, but administrators still want to assign and track the subscriptions for that system. This can be done by manually registering the system, rather than depending on Subscription Manager to perform the registration. This has two major steps, first to create an entry on the subscriptions service and then to configure the system.
  1. Open the Subscriptions tab in the Customer Portal, and select the Overview item under the Certificate-Based Management area.
  2. In the summary of consumers, click the Register New System link to create the new inventory entry.
  3. Fill in the required information for the new consumer type. A system requires information about the architecture and hardware in order to ascertain what subscriptions are available to that system.
  4. Once the system is created, assign the appropriate subscriptions to that system.
    1. Open the Available Subscriptions tab.
    2. Click the check boxes by all of the subscriptions to assign, and then click the Add button.
  5. Once the subscriptions are added, open the Applied Subscriptions tab.
  6. Click the Download All Certificates button. This exports all of the entitlements certificates, for each product, to a single .zip file. Save the file to some kind of portable media, like a flash drive.
  7. Optionally, click the Download Identity Certificate button. This saves the identity certificate for the registered consumer and could be used by the consumer to connect to the subscription service. If the consumer will permanently be offline, then this is not necessary, but if the consumer could ever be brought onto the network, then this is useful.
  8. Copy the entitlements certificates from the media device over to the consumer.
  9. If all entitlement certificates were downloaded in an archive file, then there are multiple archives in the downloaded certificates.zip file. Unzip the directories until the PEM files for the entitlement certificates are available.
  10. Import the entitlement certificates. This can be done using the Import Certificates button in the Subscription Manager GUI or using the import command. For example:
    # subscription-manager import --certificate=/tmp/export/entitlement_certificates/596576341785244687.pem --certificate=/tmp/export/entitlement_certificates/3195996649750311162.pem
    Successfully imported certificate 596576341785244687.pem
    Successfully imported certificate 3195996649750311162.pem
  11. If you downloaded an identity certificate, copy the cert.pem file directly into the /etc/pki/consumer directory. For example:
    cp /tmp/downloads/cert.pem /etc/pki/consumer

4.4.4. Registering Consumers from the Command Line

The simplest way to register a machine is to pass the register command with the user account information required to authenticate to the Certificate-Based Red Hat Network (the credentials used to access subscription service or the Customer Portal). When the system is successfully authenticated, it echoes back the newly-assigned consumer ID and the user account name which registered it.
The register options are listed in Table 4.2, “register Options”.
Example 4.1. Registering a New Consumer
[root@server1 ~]# subscription-manager register --username admin-example --password secret

7d133d55-876f-4f47-83eb-0ee931cb0a97 admin-example (the new consumer UUID and the account used for registration)

In a multi-org environment, it is required that you specify which organization (essentially an independent group or unit within the main account) to join the system to. This is done by using the --org option in addition to the username and password. The given user must also have the access permissions to add systems to that organization.
Example 4.2. Registering a New Consumer with an Organization
If there is more than one organization, then the system must be assigned to one specific organization:
[root@server1 ~]# subscription-manager register --username admin-example --password secret --org="IT Department"

7d133d55-876f-4f47-83eb-0ee931cb0a97 admin-example (the new consumer UUID and the account used for registration)
Organizations can be subdivided into environments, which define access to content based on repositories, product versions, and content sets. While a consumer can only belong to a single organization, it can be assigned to multiple environments within that organization. If no environment is given, the subscription service uses the default environment.
A system can only be added to an environment during registration.
[root@server1 ~]# subscription-manager register --username admin-example --password secret --org="IT Department" --environment=Dev1,ITall

Note

If the system is in a multi-org environment and no organization is given, the register command returns a Remote Server error.
The register command has an option, --autosubscribe, which allows the system to be registered to the subscription service and immediately subscribed to the subscription which best matches its architecture in a single step.
Example 4.3. Automatically Subscribing While Registering
[root@server1 ~]# subscription-manager register --username admin-example --password secret --autosubscribe

Example 4.4. Applying Subscriptions During Registration
When using the command-line tools to register the system, there is an option that can pass the activation key to apply existing, already-assigned certificates along with the other registration information. The activation keys are set, in a comma-separated list, in the --activationkey option.
With an activation key, it is not necessary to give a username and password because the authentication is implicit in the activation key.
In hosted or single organization environments, it is not necessary to specify an organization with the --org option, but in multi-org environments, the --org option is required. The organization is not defined as part of the activation key.
For example:
# subscription-manager register --activationkey=1234abcd --org="IT Dept"

Table 4.2. register Options
Options Description Required
--username=name Gives the content server user account name. Required
--password=password Gives the password for the user account. Required
--org=name Gives the organization to which to join the system. Required, except for hosted environments
--environment=name Registers the consumer to an environment within an organization. Optional
--name=machine_name Sets the name of the consumer (machine) to register. This defaults to be the same as the hostname. Optional
--autosubscribe Automatically subscribes this system to the best-matched compatible subscription. This is good for automated setup operations, since the system can be configured in a single step. Optional
--activation_key Applies existing subscriptions as part of the registration process. The subscriptions are pre-assigned by a vendor or by a systems administrator using Subscription Asset Manager. Optional
--force Registers the system even if it is already registered. Normally, any register operations will fail if the machine is already registered. Optional

4.4.5. Unregistering

The only thing required to unregister a machine is to run the unregister command. This removes the system's entry from the subscription service, unsubscribes it from any subscriptions, and, locally, deletes its identity and entitlement certificates.
In the Red Hat Subscription Manager GUI, there is an Unregister button at the top of the window in the Tools area.
From the command line, this requires only the unregister.
Example 4.5. Unregistering a Consumer
[root@server1 ~]# subscription-manager unregister

4.4.6. Restoring a Registration

There are times when the local registration and subscription information could be lost or corrupted. There could be a hardware failure or system crash. Or other IT considerations may require that a system be moved to a different machine. Whatever the reason, the local subscription configuration is lost.
A system can be registered against an existing system entry in the Red Hat subscription service, which essentially restores or reregisters that consumer. The reregister operation uses the original consumer ID with the registration request, so that all of the previous subscriptions associated with the consumer entry are restored along with the registration.
Reregistering a system uses the register command. This command passes the original UUID for a system to issue a request to the subscription service to receive a new certificate using the same UUID. This essentially renews its previous registration.
Example 4.6. Registering a System Against an Existing Identity Certificate
The register command uses the original ID to identify itself to the subscription service and restore its previous subscriptions.
[root@server1 ~]# subscription-manager register --username admin-example --password secret --consumerid=7d133d55-876f-4f47-83eb-0ee931cb0a97

Table 4.3. register Options to Reregister the System
Options Description Required
--consumerid Gives the consumer UUID used by an existing consumer. The system's consumer entry must exist in the Red Hat subscription service for the reregister operation to succeed. Required
--username=name Gives the content server user account name. Optional
--password=password Gives the password for the user account. Optional

4.5. Handling Subscriptions

Assigning a subscription to a system gives the system the ability to install and update any Red Hat product in that subscription. A subscription is a list of all of the products, in all variations, that were purchased at one time, and it defines both the products and the number of times that subscription can be used (the quantity of that product). The quantity is roughly the number of user licenses available. When one of those licenses is allocated to a system, that system is subscribed to the subscription.
A subscription is available to a system based on the system's architecture and other installed products. Subscriptions that are available for a platform (based on its hardware and operating system) are compatible. When the subscription is actually assigned to the machine, the subscription is consumed.
A system can be subscribed to multiple subscriptions, a single subscription, or a single product. Subscribing a system requires the ID number of the subscription or the subscription key for the product.
Unsubscribing a machine removes the entitlement to any of the products in the subscription, but the machine remains registered with the subscription service. Unsubscribing one system frees the subscription so that it can be allocated to another system.

4.5.1. Subscribing and Unsubscribing through the GUI

4.5.1.1. Subscribing to a Product

  1. Launch the Red Hat Subscription Manager GUI. For example:
    subscription-manager-gui
  2. Open the All Available Subscriptions tab.
  3. Set the filters to use to search for available entitlements. Subscriptions can be filtered by their active date and by their name. The checkboxes provide more fine-grained filtering:
    • match my system shows only subscriptions which match the system architecture.
    • match my installed products shows subscriptions which work with currently installed products on the system.
    • have no overlap with existing subscriptions excludes subscriptions with duplicate products. If a system is already subscribed to an entitlement for a specific product or if multiple entitlements supply the same product, then the subscription service filters those subscriptions and shows only the best fit.
  4. Select the available entitlements. To select multiple subscriptions, use the Ctrl key.
  5. Click the Subscribe button.

4.5.1.2. Unsubscribing through the GUI

  1. Launch the Red Hat Subscription Manager GUI. For example:
    subscription-manager-gui
  2. Open the My Subscriptions tab.
    All of the active subscriptions to which the system is currently subscribed are listed. (The products available through the subscription may or may not be installed.)
  3. Select the entitlements to unsubscribe. To select multiple subscriptions, use the Ctrl key.
  4. Click the Unsubscribe button in the bottom right of the window.

4.5.2. Handling Subscriptions through the Command Line

4.5.2.1. Subscribing from the Command Line

Subscribing a machine through the command line requires specifying the individual product or subscription to subscribe to, using the --pool option.
[root@server1 ~]# subscription-manager subscribe --pool=XYZ01234567
The options for the subscribe command are listed in Table 4.4, “subscribe Options”.
The ID of the subscription pool for the purchased product must be specified, and this pool ID is listed with the product subscription information, from running the list command:
[root@server1 ~]# subscription-manager list --available

+-------------------------------------------+
    Available Subscriptions
+-------------------------------------------+
ProductName:            RHEL for Physical Servers
ProductId:              MKT-rhel-server
PoolId:                 ff8080812bc382e3012bc3845ca000cb
Quantity:               10
Expires:                2011-09-20
Alternatively, the system can be subscribed to the best-fitting subscriptions, as identified by the subscription service, by using the --auto option (which is analogous to the --autosubscribe option with the register command).
[root@server1 ~]# subscription-manager subscribe --auto
Table 4.4. subscribe Options
Options Description Required
--pool=pool-id Gives the ID for the subscription to subscribe the machine to. Required, unless --auto is used
--auto Automatically subscribes the system to the best-match subscription or subscriptions. Optional
--quantity Subscribes multiple counts of an entitlement to the system. This is used to cover subscriptions that define a count limit, like using two 2-socket server subscriptions to cover a 4-socket machine. Optional

4.5.2.2. Unsubscribing from the Command Line

A system can be subscribed to multiple subscriptions and products. The system can be unsubscribed from a single subscription or product or from every subscribed product.
Running the unsubscribe command with the --all unsubscribes the system from every product and subscription pool it is currently subscribed to.
[root@server1 ~]# subscription-manager unsubscribe --all
It is also possible to unsubscribe from a single product. Each product has an identifying X.509 certificate installed with it, and the product to unsubscribe from can be identified with the unsubscribe command to remove only that product subscription.
  1. Get the serial number for the product certificate, if you are unsubscribing from a single product. The serial number can be obtained from the cert.pem file or by using the list command. For example:
    [root@server1 ~]# subscription-manager list --consumed
    
    +-------------------------------------------+
        Consumed Product Subscriptions
    +-------------------------------------------+
    
    
    ProductName:         High availability (cluster suite)
    ContractNumber:      0
    SerialNumber:        11287514358600162
    Active:              True
    Begins:              2010-09-18
    Expires:             2011-11-18
  2. Run the subscription-manager tool with the --serial option to specify the certificate.
    [root@server1 ~]# subscription-manager unsubscribe --serial=11287514358600162

4.5.3. Stacking Subscriptions

Some subscriptions define a count which works as a restriction on the subscription. For example, counts can be set on the number of sockets or CPUs on a machine, the number of virtual guests on a host, or the number of clients in a domain.
The entire count must be covered for the system to be fully entitled. If there are four sockets on a machine, then the server subscriptions must cover four sockets, or if there are eight guests, then there must be enough to cover all eight guests.
Many subscriptions can be combined together to cover the count on the system. Two subscriptions for RHEL Server for 2-Sockets can be combined together to cover a four-socket machine. These subscriptions can be stacked.
There are some rules on what subscriptions can be stacked:
  • Subscriptions can be stacked by using multiple quantities from the same subscription set.
  • Subscriptions from different contracts can be stacked together.
  • Only the same product subscription can be stacked. RHEL Server for 2-Sockets can be stacked with another RHEL Server for 2-Sockets subscription, but not with RHEL Server for Virtualization, even if they both cover the socket count.
  • Stackable entitlements are indicated in the Subscription Manager UI with an asterisk (*). In the UI, available subscriptions are grouped first by what subscriptions are compatible for stacking, and then by other available subscriptions.
To stack subscriptions in the Subscription Manager UI, simply set the Quantity field to the required quantity to cover the count.
Stacking Quantities
Figure 4.12. Stacking Quantities

To stack subscriptions from the command line, use the --quantity option. The quantity taken applies to the product in the --pool option:
[root@server1 ~]# subscription-manager subscribe --pool=XYZ01234567 --quantity=2

4.5.4. Manually Adding a New Subscription

In certain situations, new product subscriptions can be added by uploading the X.509 entitlements certificate directly rather than polling the subscription service. For example, consumers which are offline must have subscriptions manually added because they cannot connect to the subscription service directly.
  1. Retrieve the certificate information for the consumer from the Customer Portal.
    1. Open the Subscriptions tab in the Customer Portal, and select the Overview item under the Certificate-Based Management area.
    2. In the summary of consumers, click the name of the offline consumer.
    3. If necessary, assign the subscriptions to the consumer.
    4. Open the Applied Subscriptions tab.
    5. Click the Download All Certificates button. This exports all of the entitlements certificates, for each product, to a single .zip file. Save the file to some kind of portable media, like a flash drive.
      To download individual entitlement certificates, click the Download link on the row for the subscription.
  2. Copy the certificates over to the consumer machine.
  3. If all certificates were downloaded in an archive file, then there are multiple archives in the downloaded certificates.zip file. Unzip the directories until the PEM files for the subscription certificates are available.
  4. Import the certificates.
    This can be done from the command line using the import command:
    # subscription-manager import --certificate=/tmp/export/entitlement_certificates/596576341785244687.pem --certificate=/tmp/export/entitlement_certificates/3195996649750311162.pem
    Successfully imported certificate 596576341785244687.pem
    Successfully imported certificate 3195996649750311162.pem
    This can also be performed through the Subscription Manager GUI:
    1. Launch the Red Hat Subscription Manager GUI. For example:
      subscription-manager-gui
    2. In the Tools area, click the Import Certificate button.
    3. Click the file folder icon at the right of the field to navigate to the .pem file of the product certificate.
    4. Click the Import Certificate button.
The consumer is then entitled for all of the subscription that were uploaded.

4.6. Redeeming Subscriptions on a Machine

Systems can be set up with pre-existing subscriptions already available to that system. For some systems which were purchased through third-party vendors, a subscription to Red Hat products is included with the purchase of the machine. Companies using the Subscription Asset Manager can allocate subscriptions to their own systems by creating activation keys which are used to claim those assigned subscriptions.
Red Hat Subscription Manager pulls information about the system hardware and the BIOS into the system facts to recognize the hardware vendor. If the vendor and BIOS information matches a certain configuration, then the subscription can be redeemed, which will allow the system to be automatically subscribed to the entitlements purchased with the machine.
This diverges from the normal subscription process by adding an extra step:
  1. The machine is registered first (Section 4.4, “Registering, Unregistering, and Reregistering a System”). This can be done as normal or the activation keys can be submitted with command-line registrations.
  2. The subscriptions are redeemed using the given activation keys.
  3. The system is then subscribed to its subscriptions (Section 4.5, “Handling Subscriptions”).

Note

Activation keys may be generated by a hardware vendor (external to your organization). Activation keys may also be generated using the Subscription Asset Manager, which is a local subscription service.
For information on generating activation keys, see the Subscription Asset Manager documentation.

4.6.1. Redeeming Subscriptions through the GUI

The Activate Subscription Button

If the machine does not have any subscriptions to be redeemed, then the Activate Subscription button is not there.
  1. Launch the Red Hat Subscription Manager GUI. For example:
    subscription-manager-gui
  2. At the top of the main window, click the Activate Subscription button.
  3. In the pop-up window, enter the email address to send the notification to when the redemption is complete.
  4. Click the Actiavte button.
It can take up to ten minutes for the confirmation email to arrive.

4.6.2. Redeeming Subscriptions on a Machine through the Command Line

The machine subscriptions are redeemed by running the redeem command, with an email address to send the redemption email to when the process is complete.
# subscription-manager redeem --email=jsmith@example.com
In a multi-organization environment, it is also necessary to specify the organization which issued the activation keys. For example:
# subscription-manager redeem --email=jsmith@example.com --org="IT Dept"

Note

The machine must be registered first so that the subscription service can properly identify the system and its subscriptions.

4.7. Viewing Available and Used Subscriptions

To manage subscriptions, administrators need to know both what subscriptions a system is currently consuming and what subscriptions are available to the system.

4.7.1. Viewing Subscriptions in the GUI

The Red Hat Subscription Manager tools give a more detailed view of subscriptions and entitlements than is available through the global tools of the Customer Portal. Three tabs summarize each of the subscriptions and products for the specific machine: installed products (with subscriptions), subscribed entitlements, and available subscriptions.
These summaries are always displayed in the Red Hat Subscription Manager UI.
Subscribed Entitlements
The My Subscriptions area shows all of the current entitlements that the system is subscribed to.
My Subscriptions Tab
Figure 4.13. My Subscriptions Tab

Available Subscriptions
The All Available Subscriptions area shows all of the subscriptions that are available to the system. The default displays only entitlements that are compatible with the hardware, but these can be filtered to show entitlements corresponding to other installed programs, only subscriptions that have not been installed, and subscriptions based on date.
All Available Subscriptions Tab
Figure 4.14. All Available Subscriptions Tab

The filters dynamically search for available entitlements. Subscriptions can be filtered by their active date and by their name. The checkboxes provide more fine-grained filtering:
  • match my system shows only subscriptions which match the system architecture.
  • match my installed products shows subscriptions which work with currently installed products on the system.
  • have no overlap with existing subscriptions excludes subscriptions with duplicate products. If a system is already subscribed to an entitlement for a specific product or if multiple entitlements supply the same product, then the subscription service filters those subscriptions and shows only the best fit.
My Installed Software
The My Installed Software area shows the currently installed products on the system, along with their subscription status. This does not allow administrators to install software, only to view installed software.
My Installed Software Tab
Figure 4.15. My Installed Software Tab

4.7.2. Listing Subscriptions with the Command Line

As with the three tabs in the UI, there are three different ways to use the list command to display different areas of the subscriptions and products on the system.
Table 4.5. subscription-manager list Options
Option Description
--installed (or nothing) Lists all of the installed and subscribed product on the system. If no option is given with list, it is the same as using the --installed argument.
--consumed Lists all of the subscriptions allocated to the system.
--available [--all] Using --available alone lists all of the compatible, active subscriptions for the system. Using --available --all lists all options, even ones not compatible with the system or with no more available quantities.
--ondate=YYYY-MM-DD Shows subscriptions which are active and available on the specified date. This is only used with the --available option. If this is not used, then the command uses the current date.
--installed Lists all of the products that are installed on the system (and whether they have a subscription) and it lists all of the product subscriptions which are assigned to the system (and whether those products are installed).

The list command shows all of the subscriptions that are currently allocated to the system by using the --consumed option.
[root@server1 ~]# subscription-manager list --consumed

+-------------------------------------------+
    Consumed Product Subscriptions
+-------------------------------------------+


ProductName:        	Red Hat Enterprise Linux Server
ContractNumber:     	1458961
SerialNumber:       	171286550006020205
Active:             	True
Begins:             	2009-01-01
Expires:            	2011-12-31
The list command shows all of the subscriptions that are compatible with and available to the system using the --available option. To include every subscription the organization has — both the ones that are compatible with the system and others for other platforms — use the --all option with the --available. The --ondate option shows only subscriptions which are active on that date, based on their activation and expiry dates.
[root@server1 ~]# subscription-manager list --available --all

+-------------------------------------------+
    Available Subscriptions
+-------------------------------------------+


ProductName:            RHEL for Physical Servers
ProductId:              MKT-rhel-server
PoolId:                 ff8080812bc382e3012bc3845ca000cb
Quantity:               10
Expires:                2011-09-20


ProductName:            RHEL Workstation
ProductId:              MKT-rhel-workstation-mkt
PoolId:                 5e09a31f95885cc4
Quantity:               10
Expires:                2011-09-20

[snip]
The --installed option correlates the products that are actually installed on the system (and their subscription status) and the products which could be installed on the system based on the assigned subscriptions (and whether those products are installed).
[root@server1 ~]# subscription-manager list --installed

+-------------------------------------------+
    Installed Product Status
+-------------------------------------------+
ProductName:         Red Hat Enterprise Linux 
Status:              Not Subscribed
Expires:
Subscription:
ContractNumber:
AccountNumber:


ProductName:         Awesome OS Server
Status:              Not Installed
Expires:             2012-02-20
Subscription:        54129829316535230
ContractNumber:      39
AccountNumber:       12331131231

4.7.3. Viewing Subscriptions Used in Both RHN Classic and Certificate-based Red Hat Network

Administrators need to have a sense of all of the subscriptions allocated for their organization, altogether, regardless of whether the system is managed in RHN Classic or Certificate-based Red Hat Network. The Customer Portal provides a way of looking at the total consumed subscriptions.
In the Subscriptions Overview page, the Subscription Utilization area at the top gives the current count for every active subscription for the entire organization, and a total count of every used subscription, regardless of whether it is used in RHN Classic or Certificate-based Red Hat Network. These numbers are updated whenever the subscription count changes in the subscription server. (The subsequent Certificate-based Red Hat Network and RHN Classic sections gives usage subcounts based on system which are registered to that specific subscription service.)
Total Counts of Subscriptions for All Subscription Services
Figure 4.16. Total Counts of Subscriptions for All Subscription Services

NOTE

RHN Classic is provided for legacy systems. Red Hat Enterprise Linux 5.7 and 6.1 and later systems should use Certificate-based Red Hat Network to manage subscriptions for systems.

4.8. Working with Subscription yum Repos

As Section 4.1.4, “Subscription and Content Architecture” says, Red Hat Subscription Manager works with package management tools like yum. Subscription Manager has its own yum plug-ins: product-id for subscription-related information for products and subscription-manager which is used for the content repositories.
As systems are subscribed to products, the associated content repositories (identified in the entitlement certificate) are made available to the system. The content repositories are based on the product and on the content delivery network, defined in the baseurl parameter of the rhsm.conf file.
A subscription may include access to optional content channels along with the default channels. This optional channels must be enabled before the packages in them can be installed (even if the system is fully entitled to the products in those channels).
For example:
# yum install rubygems --enablerepo=rhel-6-server-optional-rpms
Loaded plugins: product-id, refresh-packagekit, subscription-manager
Updating Red Hat repositories.
....
Using yum is described in Chapter 5, Yum.

4.9. Responding to Subscription Notifications

The Red Hat Subscription Manager provides a series of log and UI messages that indicate any changes to the valid certificates of any installed products for a system. In the Subscription Manager GUI, the status of the system entitlements is color-coded, where green means all products are fully subscribed, yellow means that some products may not be subscribed but updates are still in effect, and red means that updates are disabled.
Color-Coded Status Views
Figure 4.17. Color-Coded Status Views

The command-line tools also indicate that status of the machine. The green-yellow-red codes translate to text status messages of subscribed, partially subscribed, and expired/not subscribed, respectively.
[root@server ~]# subscription-manager list
+-------------------------------------------+
    Installed Product Status
+-------------------------------------------+

ProductName:            Red Hat Enterprise Linux Server
Status: Not Subscribed
Expires:                                         
SerialNumber:                                    
ContractNumber:                                  
AccountNumber:
Whenever there is a warning about subscription changes, a small icon appears in the top menu bar, similar to a fuel gauge.
Subscription Notification Icon
Figure 4.18. Subscription Notification Icon

As any installed product nears the expiration date of the subscription, the Subscription Manager daemon will issue a warning. A similar message is given when the system has products without a valid certificate, meaning either the system is not subscribed to a subscription that entitles that product or the product is installed past the expiration of the subscription. Clicking the Manage My Subscriptions... button in the subscription notification window opens the Red Hat Subscription Manager GUI to view and update subscriptions.
Subscription Warning Message
Figure 4.19. Subscription Warning Message

When the Subscription Manager UI opens, whether it was opened through a notification or just opened normally, there is a box in the upper left corner that shows the number of products that lack a valid certificate. The easiest way to allocate subscriptions which match invalidated products is to click the Update Certificates button.
Update Certificates Button
Figure 4.20. Update Certificates Button

The Subscription Assistant pop-up window shows a targeted list of available subscriptions that apply to the specific products that do not have valid certificates (assuming subscriptions are available).
Subscription Assistant
Figure 4.21. Subscription Assistant

Alternatively, you can respond to entitlements notifications by managing subscriptions generally:

4.10. Healing Subscriptions

Subscription Manager can monitor all of the active entitlements for a system. Along with passively warning that a subscription is close to expiration (Section 4.9, “Responding to Subscription Notifications”), Subscription Manager can be configured to re-subscribe to subscriptions, automatically and actively, as one nears its expiry. This is system healing.
System healing prevents a system from having unentitled products as long as any valid subscription is available for it.
System healing is configured as part of the Subscription Manager daemon, rhsmcertd. This daemon checks the certificate validity dates daily. If a subscription is within 24 hours of expiring, then Subscription Manager will check for any available compatible subscriptions and automatically re-subscribes the system, much like auto-subscribing during registration.

4.10.1. Enabling Healing

System healing is disabled by default. It can be enabled by manually adding the autoheal parameter to the Subscription Manager configuration.
  1. Open the Subscription Manager configuration file.
    vim /etc/rhsm/rhsm.conf
  2. In the [rhsmcertd] area, add the autoheal line, and set the value to true.
    [rhsmcertd]
    certFrequency = 240
    healFrequency = 1440
    autoheal = true
The configuration can also be updated using the config command:
[root@server1 ~]# subscription-manager config --rhsmcertd.autoheal=true

4.10.2. Changing the Healing Check Frequency

NOTE

Healing cannot be disabled by changing the time interval. Setting the healFrequency parameter to zero means that Subscription Manager simply uses the default time setting.
  1. Open the Subscription Manager configuration file:
    # vim /etc/rhsm/rhsm.conf
  2. In the [rhsmcertd] section, set the healFrequency parameter to the time, in minutes, to check for changed subscriptions.
    [rhsmcertd]
    certFrequency = 240
    healFrequency = 1440
  3. Restart the rhsmcertd daemon to reload the configuration.
    # service rhsmcertd start

4.11. Viewing Organization Information

Infrastructures that have their own local content and subscription services, such as System Engine, can define groups that organize their systems. The primary division is organizations, which create independent units. The systems and users in one organization are invisible to the systems and users in another organization. Organizations can be subdivided into environments, which provide associations with content repositories and allowed products, versions, and content sets. A system can belong to multiple environments.
Organizations, environments, and repositories are created and configured in the service application, such as System Engine or Subscription Asset Manager. However, the organization structure for a system or for a user account can be viewed using the Subscription Manager command-line tools. The orgs, environments, and repos commands list the organization, environment, and repository information for the system, depending on the organization and environments it belongs to.
For example:
subscription-manager orgs --username=jsmith --password=secret
+-------------------------------------------+
           admin Organizations
+-------------------------------------------+

OrgName:         Admin Owner
OrgKey:         admin

OrgName:         Dev East
OrgKey:         deveast

OrgName:         Dev West
OrgKey:         devwest
		
	
subscription-manager environments --username=jsmith --password=secret --org=admin
+-------------------------------------------+
           Environments
+-------------------------------------------+

Name:                        Locker
Description:                 None


Name:                        Dev
Description:                 


Name:                        Prod
Description:  


	
subscription-manager repos --list
+----------------------------------------------------------+
     Entitled Repositories in /etc/yum.repos.d/redhat.repo
+----------------------------------------------------------+

RepoName:                    never-enabled-content
RepoId:                      never-enabled-content
RepoUrl:                     https://content.example.com/repos/optional
Enabled:                     0


RepoName:                    always-enabled-content
RepoId:                      always-enabled-content
RepoUrl:                     https://content.example.com/repos/dev
Enabled:                     1


RepoName:                    content
RepoId:                      content-label
RepoUrl:                     https://content.example.com/repos/prod
Enabled:                     1

4.12. Updating Entitlements Certificates

An entitlement certificate represents a subscription that has been consumed by a given system. It includes all of the products which are included in the subscription for service and support, the subscription's start and end dates, and the number of entitlements included for each product. An entitlement certificate does not list products that are currently installed on the system; rather, it lists all of that products that are available to the system.
The entitlement certificate is an X.509 certificate and is stored in a base 64-encoded blob in a .pem file.
When a subscription expires or is changed, then the entitlement certificate must be updated to account for the changes. The Red Hat Subscription Manager polls the subscription service periodically to check for updated entitlement certificates; this can also be updated immediately or pulled down from the Customer Portal. The entitlement certificates are updated by revoking the previous entitlement certificate and generating a new one to replace it.

4.12.1. Updating Entitlement Certificates

  1. Open the Red Hat Customer Portal.
    https://access.redhat.com/
  2. Click the Subscriptions tab to open the subscriptions menu, and select the Consumers List option under Certificate-Based Management.
  3. Click the system name in the list of consumers.
  4. Open the Applied Subscriptions tab for the list of all active, assigned subscriptions for the consumer.
  5. Click the Download All Certificates button above the list of subscriptions. If there is only one subscription, then click the Download button by the certificate.
    To retrieve an individual entitlement certificate, click the Download link in the subscription row.
  6. If all entitlement certificates were downloaded in an archive file, then there are multiple archives in the downloaded certificates.zip file. Unzip the directories until the PEM files for the entitlement certificates are available.
  7. Import the certificate PEM file. This can be done using the Import Certificates button in the Subscription Manager GUI or using the import command:
    # subscription-manager import --certificate=/tmp/export/entitlement_certificates/596576341785244687.pem --certificate=/tmp/export/entitlement_certificates/3195996649750311162.pem
    Successfully imported certificate 596576341785244687.pem
    Successfully imported certificate 3195996649750311162.pem

4.12.2. Updating Subscription Information

The refresh command updates all of the subscription information that is available to the consumer. This removes expired subscriptions and adds new subscriptions to the list. This does not subscribe the machine, but it does pull in the newest data for administrators to use.
[root@server1 ~]# subscription-manager refresh

4.13. Configuring the Subscription Service

By default, Red Hat Subscription Manager (both GUI and CLI) talk to the subscription service and the Customer Portal for their subscription services and content delivery, respectively. Red Hat Subscription Manager can be configured to use different content servers or subscription services. Other aspects of the Red Hat Subscription Manager — like the locations to look for system and product certificates or the system information used by Red Hat Subscription Manager to identify compatible entitlements — can also be customized to fit the network environment.

4.13.1. Red Hat Subscription Manager Configuration Files

The primary configuration file for Red Hat Subscription Manager, both the GUI and CLI tools, is the rhsm.conf configuration file. There are other support files that either influence the Red Hat Subscription Manager service or can help administrators better use the Subscription Manager.

4.13.1.1. All Files Used by Red Hat Subscription Manager

All of the files related to the configuration of Red Hat Subscription Manager are used by both the GUI and CLI; there is no separate configuration.
Table 4.6. Red Hat Subscription Manager Files and Directories
File or Directory Description
/etc/rhsm The primary Red Hat Subscription Manager configuration directory.
/etc/rhsm/rhsm.conf The Red Hat Subscription Manager configuration file. This is used by both the GUI and the CLI.
/etc/rhsm/facts Any user-defined JSON files that override or add system facts to determine entitlement compatibility. Any facts files must end in .facts.
/var/lib/rhsm/cache/installed_products.json A master list of installed products, which is sent by Subscription Manager to a hosted content service, such as System Engine.
/var/lib/rhsm/facts/facts.facts The default system facts filed, gathered by the Subscription Manager.
/var/lib/rhsm/packages/ The package profile cache (a list of installed products) which is gathered and periodically updated by the Subscription Manager.
/var/log/rhsm The Red Hat Subscription Manager log directory.
/var/log/rhsm/rhsm.log The log for the Red Hat Subscription Manager tools.
/var/log/rhsm/rhsmcertd.log The log for the Red Hat Subscription Manager daemon, rhsmcertd.
/etc/pki/consumer The directory which contains the identity certificates used by the system to identify itself to the subscription service.
/etc/pki/consumer/cert.pem The base-64 consumer identity certificate file.
/etc/pki/consumer/key.pem The base-64 consumer identity key file.
/etc/pki/entitlement The directory which contains the entitlement certificates for the available subscriptions.
/etc/pki/product/product_serial#.pem The product certificates for installed software products.
/var/run/subsys/rhsm Runtime files for Red Hat Subscription Manager
/etc/init.d/rhsmcertd The subscription certificate daemon.
/etc/cron.daily/rhsm-complianced and /usr/libexec/rhsm-complianced Files to run daily checks and notifications for subscription validity.
/etc/yum/pluginconf.d/rhsmplugin.conf The configuration file to include the Red Hat Subscription Manager plug-in in the yum configuration.
/usr/share/rhsm All of the Python and script files used by both Red Hat Subscription Manager tool to perform subscription tasks.
/usr/share/rhsm/gui All of the Python script and image files used to render the Red Hat Subscription Manager GUI.

4.13.1.2. About the rhsm.conf File

The main configuration file for the Subscription Manager is rhsm.conf. This file configures several important aspects of how Red Hat Subscription Manager interacts with both entitlements and content services:
  • The subscription service connection information, including the server host and port
  • The content service to use, in the form of a web address
  • The location of all of the different certificates used by the subscription service, including CA certificates for SSL authentication, identity certificates for the system, and entitlement and product certificates
The rhsm.conf file is divided into three sections. Two major sections defined the subscription service ([server]) and content and product delivery ([rhsm]). The third section relates to the rhsmcertd daemon. Each assertion is a simple attribute= value pair. Any of the default values can be edited; all possible attributes are present and active in the default rhsm.conf file.
Example 4.7. Default rhsm.conf File
# Red Hat Subscription Manager Configuration File:

# Unified Entitlement Platform Configuration
[server]
# Server hostname:
hostname = subscription.rhn.redhat.com

# Server prefix:
prefix = /subscription

# Server port:
port = 443

# Set to 1 to disable certificate validation:
insecure = 0

# Set the depth of certs which should be checked
# when validating a certificate
ssl_verify_depth = 3

# Server CA certificate location:
ca_cert_dir = /etc/rhsm/ca/

# an http proxy server to use
proxy_hostname =

# port for http proxy server
proxy_port = 

# user name for authenticating to an http proxy, if needed
proxy_user =

# password for basic http proxy auth, if needed
proxy_password =

[rhsm]
# Content base URL:
baseurl= https://cdn.redhat.com

# Default CA cert to use when generating yum repo configs:
repo_ca_cert = %(ca_cert_dir)sredhat-uep.pem

# Where the certificates should be stored
productCertDir = /etc/pki/product
entitlementCertDir = /etc/pki/entitlement
consumerCertDir = /etc/pki/consumer

[rhsmcertd]
# Frequency of certificate refresh (in minutes):
certFrequency = 240
# Frequency of autoheal check (1440 min = 1 day):
healFrequency = 1440

Table 4.7. rhsm.conf Parameters
Parameter Description Default Value
[server] Parameters
hostname Gives the IP address or fully-qualified domain name of the subscription service. subscription.rhn.redhat.com
prefix Gives the directory, in the URL, to use to connect to the subscription service. /subscription
port Gives the port to use to connect to the subscription service. 443
insecure Sets whether to use a secure (0) or insecure (1) connection for connections between the Subscription Manager clients and the subscription service. 0
ssl_verify_depth Sets how far back in the certificate chain to verify the certificate. 3
proxy_hostname Gives the hostname of the proxy server. This is required.
proxy_port Gives the port of the proxy server. This is required.
proxy_user Gives the user account to use to access the proxy server. This may not be required, depending on the proxy server configuration.
proxy_password Gives the password credentials to access the proxy server. This may not be required, depending on the proxy server configuration.
ca_cert_dir Gives the location for the CA certificate for the CA which issued the subscription service's certificates. This allows the client to identify and trust the subscription service for authentication for establishing an SSL connection. /etc/rhsm/ca
[rhsm] Parameters
baseurl Gives the full URL to access the content delivery system. https://cdn.redhat.com
repo_ca_cert Identifies the default CA certificate to use to set the yum repo configuration. %(ca_cert_dir)sredhat-uep.pem
showIncompatiblePools
Sets whether to display subscription pools which are not compatible with the system's architecture but which have been purchased by an organization. By default, Subscription Manager only displays subscriptions which are compatible with, and therefore available to, the system.
This parameter only applies to the Subscription Manager GUI. Incompatible subscriptions can be displayed in the CLI by using the --all option with the list command.
0
productCertDir Sets the root directory where the product certificates are stored and can be accessed by Subscription Manager. /etc/pki/product
consumerCertDir Sets the directory where the identity certificate for the system is stored and can be accessed by Subscription Manager. /etc/pki/consumer
entitlementCertDir Sets the directory where the entitlement certificates for the system are stored and can be accessed by Subscription Manager. Each subscription has its own entitlement certificate. /etc/pki/entitlement
[rhsmcertd] Parameters
certFrequency Sets the interval, in minutes, to check and update entitlement certificates used by Subscription Manager. 240
healFrequency Sets the interval, in minutes, to check for change subscriptions and installed products and to allocate subscriptions, as necessary, to maintain subscription status for all products. 240

4.13.2. Using the config Command

subscription-manager has a subcommand that can change the rhsm.conf configuration file. Almost all of the connection information used by Subscription Manager to access the subscription server, content server, and any proxies is set in the configuration file, as well as general configuration parameters like the frequency Subscription Manager checks for entitlements updates. There are major divisions in the rhsm.conf file, such as [server] which is used to configure the subscription server. When changing the Subscription Manager configuration, the settings are identified with the format section.parameter and then the new value. For example:
server.hostname=newsubscription.example.com
When changing the value for a parameter, the parameter is passed as an argument to the config command:
[root@server1 ~]# subscription-manager config --section.parameter=newValue
For example, to change the hostname of the subscription service:
[root@server1 ~]# subscription-manager config --server.hostname=subscription.example.com
All of the rhsm.conf file parameters are listed in Table 4.7, “rhsm.conf Parameters”. This is most commonly used to change connection settings:
  • server.hostname (subscription server)
  • server.proxy
  • server.proxy_port
  • server.proxy_user
  • server.proxy_password
  • rhsm.baseurl (content server)
  • rhsm.certFrequency
The config command also has a --remove option. This deletes the the current value for the parameter without supplying a new parameter. A blank value tells Subscription Manager to use any default values that are set for that parameter rather than a user-defined value. For example:
[root@server1 ~]# subscription-manager config --remove=rhsm.certFrequency

The default value for rhsm.certFrequency will now be used.
If a value does not have a default, then the command returns simply that the value has been removed:
[root@server1 ~]# subscription-manager config --remove=server.proxy

You have removed the value in section server for parameter proxy.

4.13.3. Using an HTTP Proxy

Some network environments may only allow external Internet access or access to content servers by going through an HTTP proxy.

4.13.3.1. Configuring an HTTP Proxy for GUI Use

The Red Hat Subscription Manager GUI can be configured to use an HTTP proxy for all of its connections to the subscription service. (This is also an advanced configuration option at firstboot.) To configure the proxy:
  1. Launch the Red Hat Subscription Manager GUI. For example:
    subscription-manager-gui
  2. Click the Proxy Configuration button at the top of the window in the Tools area.
  3. Check the ...Connect to Red Hat Network via an HTTP Proxy checkbox and enter the server location, in the format hostname:port.
  4. If the proxy requires a username/password to allow access, then also select the User authentication checkbox and fill in the user credentials.
  5. The configuration is automatically applied, so when the proxy is configured, simply close the window.

4.13.3.2. Configuring HTTP Proxy in the rhsm.conf File

The HTTP proxy settings can be configured in the rhsm.conf file; this is the same as configuring it in the Subscription Manager GUI. The proxy configuration is stored and used for every connection between the subscription service and the local system.
  1. Open the Subscription Manager configuration file.
    vim /etc/rhsm/rhsm.conf
  2. Change the settings in the [server] section that relate to the HTTP proxy. All parameters are described in Table 4.7, “rhsm.conf Parameters”. There are four parameters directly related to the proxy:
    • proxy_hostname for the IP address or fully-qualified domain name of the proxy server; this is required.

      Note

      Leaving the proxy_hostname argument blank means that no HTTP proxy is used.
    • proxy_port for the proxy server port.
    • proxy_user for the user account to connect to the proxy; this may not be required, depending on the proxy server's configuration.
    • proxy_password for the password for the user account to connect to the proxy; this may not be required, depending on the proxy server's configuration.
    [server]
    
    # an http proxy server to use
    proxy_hostname = proxy.example.com
    
    # port for http proxy server
    proxy_port = 443
    
    # user name for authenticating to an http proxy, if needed
    proxy_user =
    
    # password for basic http proxy auth, if needed
    proxy_password =

4.13.3.3. Passing HTTP Proxy Information with subscription-manager Commands

Rather than using a permanently-configured HTTP proxy, as the GUI does, HTTP proxy information can be passed with a command invocations. The arguments listed in Table 4.8, “Proxy Arguments” are available to every command used with subscription-manager.
Table 4.8. Proxy Arguments
Argument Description Required for a Proxy Connection?
--proxy Gives the proxy server to connect to, in the format hostname:port. Yes
--proxyuser Gives the username to use to authenticate. This is only required if user authentication is required. No
--proxypass Gives the password to use with the user account. This is only required if user authentication is required. No

The proxy information can be passed with any subscription-manager operation. For example:
[root@server1 ~]# subscription-manager subscribe --pool=ff8080812bc382e3012bc3845ca000cb --proxy=proxy.example.com:8443 --proxyuser=jsmith --proxypass=secret

4.13.4. Changing the Subscription Server

The Subscription Manager usually connects to the subscription service, and the public server is configured in the rhsm.conf file. The subscription service connection settings are in the [server] section of the configuration file.
  1. Open the Subscription Manager configuration file.
    vim /etc/rhsm/rhsm.conf
  2. Change the settings in the [server] section that relate to the subscription service connection. All parameters are described in Table 4.7, “rhsm.conf Parameters”. There are three parameters directly related to the connection:
    • hostname for the IP address or fully-qualified domain name of the machine
    • prefix for the subscription service directory
    • port for the subscription service port
    [server]
    hostname=entitlements.server.example.com
    prefix=/candlepin
    port=8443

4.13.5. Configuring Red Hat Subscription Manager to Use a Local Content Provider

By default, the Subscription Manager is configured to use Red Hat's content delivery service, which is available at https://cdn.redhat.com. This can be changed to use a different external content delivery system or to use an organization-managed content system, such as System Engine.
  1. Open the Subscription Manager configuration file.
    vim /etc/rhsm/rhsm.conf
  2. Change the baseurl directive in the [rhsm] section. This is the full URL to the service.
    [rhsm]
    # Content base URL:
    baseurl= http://content.example.com/content

4.13.6. Managing Secure Connections to the Subscription Server

Red Hat Subscription Manager assumes, by default, that the subscription clients connect to the subscription service using a secure (SSL) connection. This requires that the CA certificate of the subscription service be downloaded and available locally for the client and that the appropriate connections be configured.
  1. Open the Subscription Manager configuration file.
    vim /etc/rhsm/rhsm.conf
  2. Change the settings in the [server] section that relate to a secure connection. All parameters are described in Table 4.7, “rhsm.conf Parameters”. There are three parameters directly related to the connection:
    • insecure to set whether to use a secure (0) or insecure (1) connection
    • ca_cert_dir for the directory location for the CA certificate for authentication and verification
    • port for the subscription service port; this should be an SSL port if a secure connection is required
    [server]
    port=8443
    insecure = 1
    ca_cert = /etc/rhsm/ca

4.13.7. Starting and Stopping the Subscription Service

The Red Hat Subscription Manager daemon, rhsmcertd, runs as a service on the system. The daemon, by default, starts with the system, and it can be started, stopped, or checked with the service command.
service rhsmcertd status
rhsmcertd (pid 13084) is running...
Red Hat Enterprise Linux has a tool called chkconfig which manages the automatic startup and shutdown settings for each process on the server, described in Section 9.2.3, “Using the chkconfig Utility”. When a system reboots, some services can be automatically restarted. chkconfig also defines startup settings for different run levels of the server.
The Red Hat Subscription Manager service, which runs routinely to check for changes in the entitlements for an organization, can be controlled by chkconfig. By default, the Red Hat Subscription Manager daemon, rhsmcertd, is configured to run at levels 3, 4, and 5, so that the service is started automatically when the server reboots.
The run level settings can be reset using chkconfig. For example, to enable run level 2:
chkconfig --level 2345 rhsmcertd on
To remove the rhsmcertd from the start list, change the run level settings off:
chkconfig --level 2345 rhsmcertd off
Red Hat Enterprise Linux also has a GUI console that can manage the service and chkconfig settings.
  1. In the main menu, select the System link and open the Administration submenu.
  2. Open the Services link.

    The Services wizard depends on system-config-services

    The system-config-services package must be installed for the Services wizard to be available.
  3. Scroll to the rhsmcertd item in the list of services on the left, and then edit the service as desired.

4.13.8. Checking Logs

There are two log files maintained for Red Hat Subscription Manager in the /var/log/rhsm directory:
  • rhsm.log shows every invocation and result of running the Subscription Manager GUI or CLI
  • rhsmcertd.log shows every time a new certificate is generated, which happens on a schedule defined by the certFrequency parameter in the rhsm.conf file.
The rhsm.log log contains the sequence of every Python call for every operation invoked through the Subscription Manager tools. Each entry has this format:
YYYY-MM-DD HH:MM:SS,process_id [MESSAGE_TYPE] call python_script response
The response in the log entry can be very complex, spanning multiple lines, or relatively simply, with just a status code.
Because each log entry in rhsm.log relates to the Python script or function that was called, there can be multiple log entries for a single operation.
Example 4.8. rhsm.log Entry
2010-10-01 17:27:57,874 [INFO] _request() @connection.py:97 - status code: 200
2010-10-01 17:27:57,875 [INFO] perform() @certlib.py:132 - updated:
Total updates: 0
Found (local) serial# []
Expected (UEP) serial# []
Added (new)
  <NONE>
Deleted (rogue):
  <NONE>
Expired (not deleted):
  <NONE>
Expired (deleted):
  <NONE>
2010-10-01 17:27:57,878 [INFO] __init__() @connection.py:193 - Using certificate authentication: key = /etc/pki/consumer/key.pem, cert = /etc/pki/consumer/cert.pem, ca = /etc/pki/CA/candlepin.pem, insecure = True
2010-10-01 17:27:57,878 [INFO] __init__() @connection.py:196 - Connection Established: host: candlepin1.devlab.phx1.redhat.com, port: 443, handler: /candlepin

The entries in the rhsmcertd.log file are much simpler. The log only records when the rhsmcertd daemon starts or stops and every time a certificate is updated.
Example 4.9. rhsmcertd.log Entry
Fri Oct  1 13:27:44 2010: started: interval = 240 minutes
Fri Oct  1 13:27:50 2010: certificates updated

4.13.9. Showing and Hiding Incompatible Subscriptions

The entitlements that are made available to a consumer are filtered, by default, according to whether the architecture for the product matches the architecture of the system. This is compatibility. The Red Hat Subscription Manager can be configured to display even incompatible entitlements.
When running the command-line tools, the incompatible facts can be displayed simply by using the --all option:
[root@server1 ~]# subscription-manager list --available --all
To have the incompatible subscriptions displayed in the GUI and through the command-line by default, edit the rhsm.conf configuration file.
  1. Open the Subscription Manager configuration file.
    vim /etc/rhsm/rhsm.conf
  2. Change the showIncompatiblePools directive in the [rhsm] section. A value of 0 shows only compatible entitlements.
    [rhsm]
    # Content base URL:
    showIncompatiblePools = 1

4.13.10. Checking and Adding System Facts

Entitlements are available to a system based on whether the software is compatible with the system's architecture. For example, there are different products and subscriptions for 32-bit and 64-bit platforms. Red Hat Subscription Manager determines compatibility by collecting a range of facts about the system's hardware and architecture and then comparing it with all available entitlements.
The collected facts can be viewed, updated to acknowledge a hardware or configuration change, or overridden to force compatibility in the specified areas.
The system facts are very similar to the information in /etc/redhat-release or /etc/sysconfig. In both the Red Hat Subscription Manager GUI and CLI, the facts are represented as simple attribute: value pairs.

Note

Updating the facts resends the information about the system to the Red Hat subscription service so that it can update the list of subscriptions which match the system architecture. Updating the facts is a very good thing to do after hardware upgrades or other important system changes.

4.13.10.1. Checking Facts from the Red Hat Subscription Manager UI

  1. Launch the Red Hat Subscription Manager GUI. For example:
    subscription-manager-gui
  2. In the Tools at the top of the window, click the View System Facts button.
  3. All of the current facts for the system are listed in the table, broken down into categories. Each category is in a closed list; to reveal all of the facts in that category, click the arrow by the category name.
    To update the facts, click the Update Facts button in the bottom right of the window.

4.13.10.2. Checking Facts with subscription-manager

To simply list the facts, run the facts with the --list option.
[root@server1 ~]# subscription-manager facts --list

cpu.architecture: i686
cpu.core(s)_per_socket: 4
cpu.cpu(s): 4
cpu.cpu_family: 6
cpu.cpu_mhz: 2000.010
cpu.cpu_op-mode(s): 32-bit, 64-bit
cpu.cpu_socket(s): 1
cpu.l1d_cache: 32K
cpu.l1i_cache: 32K
cpu.l2_cache: 6144K
cpu.model: 23
cpu.stepping: 6
cpu.thread(s)_per_core: 1
cpu.vendor_id: GenuineIntel
cpu.virtualization: VT-x
distribution.id: Santiago
distribution.name: Red Hat Enterprise Linux Workstation
distribution.version: 6
dmi.baseboard.manufacturer: IBM
dmi.baseboard.product_name: Server Blade
... [snip] ...
To update the facts after a system change, use the --update option with the facts command.
[root@server1 ~]# subscription-manager facts --update

4.13.10.3. Overriding the Default System Facts

The system facts, as collected, are stored in /var/lib/rhsm/facts/facts.facts. These facts are stored as attribute: value pairs, in a comma-separated list.
{"fact1": "value1","fact2": "value2"}
The primary file is generated and maintained by the Subscription Manager service. However, these values can be overridden to force architecture or platform compatibility (and thereby widening the available compatible subscriptions) by creating additional JSON facts files and dropping them in the /etc/rhsm/facts directory. These JSON files can override existing facts or even add new facts to be used by the subscription service.
Example 4.10. Example Facts Override File
vim /etc/rhsm/facts/my-example.facts

{"uname.machine": "x86","kernel_version": "2.6.32","physical_location": "MTV colo rack 5"}

4.13.11. Regenerating Identity Certificates

To regenerate the consumer's identity certificate (meaning it is revoked and replaced), use the identity command. Although not required, using the --force option will require the username and password and will cause the Subscription Manager to prompt for the credentials if they are not passed in the command:
[root@server1 ~]# subscription-manager identity --regenerate --force
Username: jsmith@example.com
Password:
Identity certificate has been regenerated.

4.13.12. Getting the System UUID

The consumer or system UUID is a unique identifier used in the inventory subscription service. This UUID can be used to re-register the system if there is some kind of corruption or for internal tracking. In the GUI (Section 4.13.10.1, “Checking Facts from the Red Hat Subscription Manager UI”), this is listed as one of the system facts, under the system category:
From the command-line, use the identity command to return the current UUID. The UUID is the Current identity is value.
[root@server1 ~]# subscription-manager identity
Current identity is: 63701087-f625-4519-8ab2-633bb50cb261
name: server1.example.com
org name: 6340056
org id: 8a85f981302cbaf201302d89931e059a

4.13.13. Viewing Package Profiles

A package profile is the list of installed packages on a system (regardless of its subscription status). Red Hat Subscription Manager maintains a local list of installed packages to track the subscription status of the system. The package profile contains some general information about each package in the list:
  • Package name
  • Package version
  • Epoch
  • Publisher
This package manifest is always visible locally in the My Installed Software tab of the UI or by using the list --installed command with the command-line tools.
The Subscription Manager daemon, rhsmcertd, checks the system periodically — once when it is first registered and then when it runs a refresh operation every four hours — to get the most current list of installed products. When the system is registered and then whenever there is a change to the package list, Subscription Manager sends an updated package profile to the subscription service.
The package profile is stored in a cache file in /var/lib/rhsm/packages/.
Having an updated package profile for a system helps the subscription service identify compatible subscriptions.

4.13.14. Retrieving the Consumer ID, Registration Tokens, and Other Information

Some pieces of information are used frequently when managing entitlements using the subscription-manager script. Information like the consumer ID or subscription pool ID is pulled up and referenced automatically in the Red Hat Subscription Manager UI, but it has to be entered manually in the command line.
Table 4.9, “Locations and Descriptions of Entitlement Data” lists common information that is used to manage subscriptions, the operations they're used in, and the places to find the data.
Table 4.9. Locations and Descriptions of Entitlement Data
Information Description Operations Used In Find It In ...
Consumer ID A unique identifier for each system that is registered to the subscription service. identity The simplest method is to use the identity command to return the current UUID.
[root@server1 ~]# subscription-manager identity
Current identity is: 63701087-f625-4519-8ab2-633bb50cb261
name: consumer-1.example.com
org name: 6340056
org id: 8a85f981302cbaf201302d89931e059a
The Subject CN element of the identity certificate for the system, /etc/pki/consumer/cert.pem. The UUID can also be returned by using openssl to pretty-print the certificate.
openssl x509 -text -in /etc/pki/consumer/cert.pem

Certificate:
... snip ...
Subject: CN=7d133d55 876f 4f47 83eb 0ee931cb0a97
Pool ID An identifier for a specific set of subscriptions. This set is created when subscriptions are purchased. Whenever a system needs to subscribe to a product, it references a pool ID to identify which purchased set of subscriptions to use. subscribe The PoolID value given for a product when listing available subscriptions. For example:
[root@server1 ~]# subscription-manager list --available
+----------------------+
Available Subscriptions
+----------------------+
ProductName: Red Hat Enterprise Linux, Standard (up to 2 sockets) 3 year
ProductId: MCT0346F3
PoolId: ff8080812bc382e3012bc3845ca000cb
Quantity: 2
Expires: 2011-02-28
Product certificate serial number The identification used for a specific, installed product. A certificate with a unique serial number is generated when a product is installed; this serial number is used to identify that specific product installation when managing subscriptions. unsubscribe The SerialNumber line in the product subscription information. This can be returned by running list --consumed.
[root@server1 ~]# subscription-manager list --consumed

+-----------------------------+
Consumed Product Subscriptions
+-----------------------------+

ProductName: High availability (cluster suite)
ContractNumber: 0
SerialNumber: 11287514358600162
....
Product ID The internal identifier used to identify a type of product. The ProductID value given for a product when listing available subscriptions. For example:
[root@server1 ~]# subscription-manager list --available
+----------------------+
Available Subscriptions
+----------------------+

ProductName: RHEL for Physical Servers
ProductId: MKT-rhel-server
... snip ...

4.14. About Certificates and Managing Entitlements

Part of managing subscriptions requires verifying the identity of everything involved, such as the system, the subscription service, and the available products. The subscription service uses X.509 certificates to handle the identity and authentication aspects of the subscription service. These X.509 certificates also contain the actual data about available subscriptions and installed products.
The first time a system is subscribed to a subscription, it downloads a certificate from the subscription service. The entitlement certificate contains all of the information about products that are available through that subscription. The entitlement certificate is revoked and reissued any time there is a change in the subscriptions for an organization. Once a product is actually installed on a machine, then another certificate is issued to manage the entitlements for the product on the system.
Each certificate issued and used by the Subscription Manager services is a .pem formatted file. This file format stores both keys and certificates in a base-64 blob. For example:
-----BEGIN CERTIFICATE-----
MIIDaTCCAtKgAwIBAgICBZYwDQYJKoZIhvcNAQEFBQAwSzEqMCgGA1UEAxMhY2Fu
ZGxlcGluMS5kZXZsYWIucGh4MS5yZWRoYXQuY29tMQswCQYDVQQGEwJVUzEQMA4G
A1UEBxMHUmFsZWlnaDAeFw0xMDEwMDYxNjMyMDVaFw0xMTEwMDYyMzU5NTlaMC8x
LTArBgNVBAMMJDQ4ODFiZDJmLTg2OGItNDM4Yy1hZjk2LThiMWQyODNkYWZmYzCC
ASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKNyLw6+IMtjY03F7Otxj2GL
GTz5VKx1kfWY7q4OD4w+XlBHTkt+2tQV9S+4TFkUZ7XoI80LDL/BONpy/gq5c5cw
yKvjv2gjSS/pihgYNXc5zUOIfSj1vb3fHGHOkzdCcZMyWq1z0N/zaLClp/zP/pcM
og4NTAg2niNPjFYvkQ+oIl16WmQpefM0y0SY7N7oJd2T8dZjOiuLV2cVZLfwjrwG
9UpkT2J03g+n1ZA9q95ibLD5NVOdTy9+2lfRhdDViZaVoFiQXvg86qBHQ0ieENuF
a6bCvGgpTxcBuVXmsnl2+9dnMiwoDqPZp1HB6G2uNmyNe/IvkTOPFJ/ZVbtBTYUC
AwEAAaOB8zCB8DARBglghkgBhvhCAQEEBAMCBaAwCwYDVR0PBAQDAgSwMHsGA1Ud
IwR0MHKAFGiY1N2UtulxcMFy0j6gQGLTyo6CoU+kTTBLMSowKAYDVQQDEyFjYW5k
bGVwaW4xLmRldmxhYi5waHgxLnJlZGhhdC5jb20xCzAJBgNVBAYTAlVTMRAwDgYD
VQQHEwdSYWxlaWdoggkA1s54sVacN0EwHQYDVR0OBBYEFGbB5fqOzh32g4Wqrwhc
/96IupIgMBMGA1UdJQQMMAoGCCsGAQUFBwMCMB0GA1UdEQQWMBSkEjAQMQ4wDAYD
VQQDDAV4ZW9wczANBgkqhkiG9w0BAQUFAAOBgQANxHRsev4fYfnHO9kYcHo4UeK7
owN+fq92gl76iRHRnhzkPlhWL+uV2tyqGG9zJASOX+qEDOqN5sVAB4iNQTDGiUbK
z757igD2hsQ4ewv9Vq3QtnajWnfdaUZH919GgWs09Etg6ucsKwgfx1fqjSRLBbOo
lZuvBTYROOX6W2vKXw==
-----END CERTIFICATE-----
Tools like openssl or pk12util can be used to extract and view information from these certificates, in a pretty-print format. The product- and subscription-related information is extracted and viewable in the Red Hat Subscription Manager GUI or command-line tools.
This section describes the different certificates used by the subscription service and the entitlement information contained in those certificates. A much more detailed description of X.509 certificates and a public key infrastructure (PKI) is given in the Red Hat Certificate System documentation in chapter 1, "Introduction to Public-Key Cryptography," in the Red Hat Certificate System Deployment Guide.
Table 4.10. Types of Certificates Used for Content and Entitlements
Certificate Type Description Default Location
Consumer Identity Certificate Used to identify the system (consumer) to the subscription service. This contains a unique ID which is assigned to the system when it is registered to the system. The identity certificate itself is generated by the subscription service when the system is registered and then sent to the consumer. /etc/pki/consumer
Entitlement Certificate Contains a list of products that are available to a system to install, based on the subscriptions that the system has been subscribed to. The entitlement certificate defines the software products, the content delivery location, and validity dates. The presence of an entitlement certificate means that the system has consumed one of the quantities from the subscription. /etc/pki/entitlement
Product Certificate Contains the information about a product after it has been installed. /etc/pki/product/product_serial#.pem
CA Certificate A certificate for the certificate authority which issued the SSL server certificate used by the subscription service. This must be installed on a system for the system to use SSl to connect to the subscription service. /etc/rhsm/ca/candlepin-ca.pem
Satellite Certificate An XML-formatted certificate which contains a product list. This is used by local Satellite 5.x systems, not the newer subscription service.

4.14.1. The Structure of Identity Certificates

An identity certificate is a standard SSL client certificate. This certificate is issued by the subscription service when the system registers to it. The system consumer subsequently uses this certificate to authenticate to the subscription service whenever it contacts the service after registration.
The certificate contains three important pieces of information:
  • The consumer UUID, in the subject CN of the certificate
  • The subscription service which the system is registered to, in the issuer field of the certificate
  • The user account which registered the system, as the DirName value in the Subject Alt Name
The validity period of this certificate is associated with the time when the system was registered, not to any subscription contract periods or user account settings.
Example 4.11. Identity Certificate
Certificate:
    Data:
        Version: 3 (0x2)
        Serial Number: 1430 (0x596)
        Signature Algorithm: sha1WithRSAEncryption
        Issuer: CN=entitlement.server.example.com, C=US, L=Raleigh  
        Validity
            Not Before: Oct  6 16:32:05 2010 GMT
            Not After : Oct  6 23:59:59 2011 GMT
        Subject: CN=4881bd2f-868b-438c-af96-8b1d283daffc  
        Subject Public Key Info:
            Public Key Algorithm: rsaEncryption
                Public-Key: (2048 bit)
                Modulus:
                    00:a3:72:2f:0e:be:20:cb:63:63:4d:c5:ec:eb:71:
                    8f:61:8b:19:3c:f9:54:ac:75:91:f5:98:ee:ae:0e:
                    0f:8c:3e:5e:50:47:4e:4b:7e:da:d4:15:f5:2f:b8:
                    4c:59:14:67:b5:e8:23:cd:0b:0c:bf:c1:38:da:72:
                    fe:0a:b9:73:97:30:c8:ab:e3:bf:68:23:49:2f:e9:
                    8a:18:18:35:77:39:cd:43:88:7d:28:f5:bd:bd:df:
                    1c:61:ce:93:37:42:71:93:32:5a:ad:73:d0:df:f3:
                    68:b0:a5:a7:fc:cf:fe:97:0c:a2:0e:0d:4c:08:36:
                    9e:23:4f:8c:56:2f:91:0f:a8:22:5d:7a:5a:64:29:
                    79:f3:34:cb:44:98:ec:de:e8:25:dd:93:f1:d6:63:
                    3a:2b:8b:57:67:15:64:b7:f0:8e:bc:06:f5:4a:64:
                    4f:62:74:de:0f:a7:d5:90:3d:ab:de:62:6c:b0:f9:
                    35:53:9d:4f:2f:7e:da:57:d1:85:d0:d5:89:96:95:
                    a0:58:90:5e:f8:3c:ea:a0:47:43:48:9e:10:db:85:
                    6b:a6:c2:bc:68:29:4f:17:01:b9:55:e6:b2:79:76:
                    fb:d7:67:32:2c:28:0e:a3:d9:a7:51:c1:e8:6d:ae:
                    36:6c:8d:7b:f2:2f:91:33:8f:14:9f:d9:55:bb:41:
                    4d:85
                Exponent: 65537 (0x10001)
        X509v3 extensions:
            Netscape Cert Type:
                SSL Client, S/MIME
            X509v3 Key Usage:
                Digital Signature, Key Encipherment, Data Encipherment
            X509v3 Authority Key Identifier:
                keyid:68:98:D4:DD:94:B6:E9:71:70:C1:72:D2:3E:A0:40:62:D3:CA:8E:82
                DirName:/CN=entitlement.server.example.com/C=US/L=Raleigh
                serial:D6:CE:78:B1:56:9C:37:41

            X509v3 Subject Key Identifier:
                66:C1:E5:FA:8E:CE:1D:F6:83:85:AA:AF:08:5C:FF:DE:88:BA:92:20
            X509v3 Extended Key Usage:
                TLS Web Client Authentication
            X509v3 Subject Alternative Name:  
                DirName:/CN=admin-example  
    Signature Algorithm: sha1WithRSAEncryption
        0d:c4:74:6c:7a:fe:1f:61:f9:c7:3b:d9:18:70:7a:38:51:e2:
        bb:a3:03:7e:7e:af:76:82:5e:fa:89:11:d1:9e:1c:e4:3e:58:
        56:2f:eb:95:da:dc:aa:18:6f:73:24:04:8e:5f:ea:84:0c:ea:
        8d:e6:c5:40:07:88:8d:41:30:c6:89:46:ca:cf:be:7b:8a:00:
        f6:86:c4:38:7b:0b:fd:56:ad:d0:b6:76:a3:5a:77:dd:69:46:
        47:f7:5f:46:81:6b:34:f4:4b:60:ea:e7:2c:2b:08:1f:c7:57:
        ea:8d:24:4b:05:b3:a8:95:9b:af:05:36:11:38:e5:fa:5b:6b:
        ca:5f

4.14.2. The Structure of Entitlement Certificates

An entitlement is analogous to an assigned software license. Entitlement certificates contain a list of available products for a system — software that the system has been granted rights to download and update. When a system is subscribed to a subscription pool, the system pulls down the entitlement certificate from the subscription service, which contains all of the information about available products.
An entitlement certificate contains a list of every potential product from every potential content source. The structure of the entitlement certificate, then, allows multiple namespaces, each, for products, content servers, roles, orders, and systems. An entitlement certificate also contains complete information about the subscribed pool, even for products which may not be compatible with the specific system. In an entitlement certificate, the architecture and version definitions contain all of the allowed architectures and versions.

Note

The local Subscription Manager polls the subscription service routinely (every four hours by default) to check for changes in the entitlements. When a subscription is changed in some way, then the original entitlement certificate is revoked and is replaced with a new entitlement certificate.
The entitlement certificate is a *.pem file stored in the entitlement certificates directory, /etc/pki/entitlement. The name of the *.pem file is a generated numeric identifier that is generated by the subscription service. This ID is an inventory number that is used to associate a subscription quantity with the system in the software inventory.
The heading of the certificate contains the name of the entitlement server which issued it, the validity period of the certificate (which is tied to the installation date of the product), and then the serial number of the installation of the product.
Certificate:
    Data:
        Version: 3 (0x2)
        Serial Number:
            3c:da:6c:06:90:7f:ff
        Signature Algorithm: sha1WithRSAEncryption
        Issuer: CN=candlepin1.devlab.phx1.redhat.com, C=US, L=Raleigh
        Validity
            Not Before: Oct  8 17:55:28 2010 GMT
            Not After : Oct  2 23:59:59 2011 GMT
        Subject: CN=8a878c912b875189012b8cfbc3f2264a
... [snip] ...
The key definition of the product is given in custom certificate extensions that are appended to the certificate. Each namespace defines certain information about a product, including its name, content servers which can deliver it, the format of delivery, and a GPG key to identify the release. Every individual entry is identified by a numeric object identifier (OID) with the same basic format:
1.3.6.1.4.1.2312.9.2.product_#.config_#:
   ..config_value
The 2 indicates that it is a product entry. product_# is a unique ID which identifies the specific product or variant. config_# relates to the installation information for that product, like its content server or the quantity available.

OID numbers for entitlements-related extensions

Every entitlements-related extension begins with the OID base 1.3.6.1.4.1.2312.9. The subsequent numbers identify different subscription areas:
  • .2. is the product-specific information
  • .1. is the subscription information
  • .4. contains the contract information, like its ID number and start and end dates
  • .5. contains the consumer information, like the consumer ID which installed a product
A product definition contains a series of entries which configure all of the information required to identify and install the product. Each type of information has its own ID, the config_# in the OID, that is used consistently for all products. An example product is listed in Example 4.12, “Annotated Red Hat Enterprise Linux High Availability Product Extensions in an Entitlement Certificate”.
Example 4.12. Annotated Red Hat Enterprise Linux High Availability Product Extensions in an Entitlement Certificate
            content repository type  
            1.3.6.1.4.1.2312.9.2.30393.1:
                ..yum
            product  
            1.3.6.1.4.1.2312.9.2.30393.1.1:
                .HRed Hat Enterprise Linux High Availability (for RHEL Entitlement) (RPMs)
            channel name  
            1.3.6.1.4.1.2312.9.2.30393.1.2:
                .Dred-hat-enterprise-linux-high-availability-for-rhel-entitlement-rpms
            vendor  
            1.3.6.1.4.1.2312.9.2.30393.1.5:
                ..Red Hat
            download URL  
            1.3.6.1.4.1.2312.9.2.30393.1.6:
                .Q/content/dist/rhel/entitlement/releases/$releasever/$basearch/highavailability/os
            key download URL  
            1.3.6.1.4.1.2312.9.2.30393.1.7:
                .2file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
            flex quantity  
            1.3.6.1.4.1.2312.9.2.30393.1.4:
                ..0
            quantity  
            1.3.6.1.4.1.2312.9.2.30393.1.3:
                ..25
            repo enabled setting  
            1.3.6.1.4.1.2312.9.2.30393.1.8:
                ..1

4.14.3. The Structure of Product Certificates

The products that are installed on a system through the subscriptions assigned to a system are identified by X.509 certificates. When an available product is installed, the subscription service generates a product certificate, which contains the information about the product contract and the specific installation.
Structurally, entitlement certificates and product certificates are very similar, because they both provide much of the same information about products. The main difference is that a product certificate contains information about a single product that has been installed, so no other subscription information (like other available products or other product versions) is included in a product certificate the way that it is in an entitlement certificate.
A product certificate contains a single product namespace (meaning, a single product definition) which shows only what is actually installed on the system. The architecture and version definitions in a product certificate reflect the architecture and version of the product that is actually installed.
The product certificate is a *.pem file stored in the entitlement certificates directory, /etc/pki/product/product_serial#.pem. The name of the *.pem file is a generated numeric identifier that is generated by the subscription service. As with entitlement tracking, the generated ID is an inventory number, used to track installed products and associate them with systems within the subscription service.

4.14.4. Anatomy of Satellite Certificates

Satellite certificates

Satellite certificates are used by Satellite 5.x deployments. They are not used on Red Hat Enterprise Linux 6 or by the subscription service.
Every system has to have a secure, authoritative way to identify what subscriptions are available. For Satellite 5.x systems, this identification is done through a digitally-signed XML document that lists the products and quantities that a customer has purchased.
As with entitlement certificates, a Satellite certificate contains the information about the subscription that was purchased, including the total number of systems that can be registered against that subscription and its start and end dates.
There are two types of subscriptions:
  • System entitlements are subscriptions for services that can be performed, such as monitoring, provisioning, and virtualization.
  • Channel entitlements, or content entitlements, provide access to the different software product download channels on Red Hat Network. These include Red Hat Enterprise Linux add-ons like Supplementary and FastTrack and layered products like Red Hat Directory Server.
Both types can be included in a single Satellite certificate.
A system entitlement and the metadata for an entitlement are both configured similarly in the certificate:
<rhn-cert-field name="configuration_area">value</rhn-cert-field>
The name argument identifies what entity is being configured. This can be the organization which ordered the subscription (name="owner"), the start and end dates for the entitlement (name="issued" and name="expires"), or the entitlement itself. A system entitlement uses the name argument to set the service being entitled; every content entitlement is set as a name="channel-family" type, with the specific product identified in an additional family argument.
The first section of the Satellite certificate is the metadata. The metadata identifies the organization which purchased it and the start and end dates of the entitlement. The field being set is in the name argument, while the value is between the tags. The last lines of the certificate also set metadata for the subscription, including the version of the Satellite and the signature that signs the XML document (and allows the XML file to be used as a certificate).
  <rhn-cert-field name="product">RHN-SATELLITE-001</rhn-cert-field>
  <rhn-cert-field name="owner">Example Corp</rhn-cert-field>
  <rhn-cert-field name="issued">2009-04-07 10:18:33</rhn-cert-field>
  <rhn-cert-field name="expires">2009-11-25 00:00:00</rhn-cert-field>

... [snip] ...

  <rhn-cert-field name="satellite-version">5.3</rhn-cert-field>
  <rhn-cert-field name="generation">2</rhn-cert-field>
  <rhn-cert-signature>
-----BEGIN PGP SIGNATURE-----
Version: Crypt::OpenPGP 1.03

iQBGBAARAwAGBQJJ22C+AAoJEJ5ynaAAAAkyyZ0An18+4hK5Ozt4HWieFvahsTnF
aPcaAJ0e5neOfdDZRLOgDE+Tp/Im3Hc3Rg==
=gqP7
-----END PGP SIGNATURE-----
</rhn-cert-signature>
The name="slot" field lists how many total systems are allowed to use this Satellite certificate to receive content. It is a global quantity.
  <rhn-cert-field name="slots">119</rhn-cert-field>
The system entitlements are set by identifying the service type in the name argument and then setting the quantity as the value within the tags.
  <rhn-cert-field name="provisioning-slots">117</rhn-cert-field>
  <rhn-cert-field name="monitoring-slots">20</rhn-cert-field>
  <rhn-cert-field name="virtualization_host">67</rhn-cert-field>
The content entitlements can include any combination of products, including base Red Hat Enterprise Linux subscriptions, variations of Red Hat Enterprise Linux, Red Hat Enterprise Linux add-ons, and general software products. General Red Hat Enterprise Linux server subscriptions are listed in the rhel-server family, while a specific Virtualization Server subscription provides an additional rhel-server-vt family..
  <rhn-cert-field name="channel-families" quantity="95" family="rhel-server"/>
  <rhn-cert-field name="channel-families" quantity="67" family="rhel-server-vt"/>
Add-ons and products for Red Hat Enterprise Linux systems (but not necessarily operating system products) are also in a rhel-* family, because that refers to the platform the product is supported on. In this example, Red Hat Directory Server is in the rhel-rhdirserv family.
  <rhn-cert-field name="channel-families" quantity="3" family="rhel-rhdirserv"/>
Most subscriptions will also include a subscription tool set to manage and enable within clients features such as provisioning or configuration management when registered to RHN Classic or Satellite 5.x.
  <rhn-cert-field name="channel-families" quantity="212" family="rhn-tools"/>

Chapter 5. Yum

Yum is the Red Hat package manager that is able to query for information about packages, fetch packages from repositories, install and uninstall packages using automatic dependency resolution, and update an entire system to the latest available packages. Yum performs automatic dependency resolution on packages you are updating, installing or removing, and thus is able to automatically determine, fetch and install all available dependent packages. Yum can be configured with new, additional repositories, or package sources, and also provides many plug-ins which enhance and extend its capabilities. Yum is able to perform many of the same tasks that RPM can; additionally, many of the command line options are similar. Yum enables easy and simple package management on a single machine or on groups of them.

Secure package management with GPG-signed packages

Yum provides secure package management by enabling GPG (Gnu Privacy Guard; also known as GnuPG) signature verification on GPG-signed packages to be turned on for all package repositories (i.e. package sources), or for individual repositories. When signature verification is enabled, Yum will refuse to install any packages not GPG-signed with the correct key for that repository. This means that you can trust that the RPM packages you download and install on your system are from a trusted source, such as Red Hat, and were not modified during transfer. Refer to Section 5.3, “Configuring Yum and Yum Repositories” for details on enabling signature-checking with Yum, or Section B.3, “Checking a Package's Signature” for information on working with and verifying GPG-signed RPM packages in general.
Yum also enables you to easily set up your own repositories of RPM packages for download and installation on other machines.
Learning Yum is a worthwhile investment because it is often the fastest way to perform system administration tasks, and it provides capabilities beyond those provided by the PackageKit graphical package management tools. Refer to Chapter 6, PackageKit for details on using PackageKit.

Yum and superuser privileges

You must have superuser privileges in order to use yum to install, update or remove packages on your system. All examples in this chapter assume that you have already obtained superuser privileges by using either the su or sudo command.

5.1. Checking For and Updating Packages

5.1.1. Checking For Updates

To see which installed packages on your system have updates available, use the following command:
yum check-update
For example:
~]# yum check-update
Loaded plugins: product-id, refresh-packagekit, subscription-manager
Updating Red Hat repositories.
INFO:rhsm-app.repolib:repos updated: 0
PackageKit.x86_64                  0.5.8-2.el6                rhel
PackageKit-glib.x86_64             0.5.8-2.el6                rhel
PackageKit-yum.x86_64              0.5.8-2.el6                rhel
PackageKit-yum-plugin.x86_64       0.5.8-2.el6                rhel
glibc.x86_64                       2.11.90-20.el6             rhel
glibc-common.x86_64                2.10.90-22                 rhel
kernel.x86_64                      2.6.31-14.el6              rhel
kernel-firmware.noarch             2.6.31-14.el6              rhel
rpm.x86_64                         4.7.1-5.el6                rhel
rpm-libs.x86_64                    4.7.1-5.el6                rhel
rpm-python.x86_64                  4.7.1-5.el6                rhel
udev.x86_64                        147-2.15.el6               rhel
yum.noarch                         3.2.24-4.el6               rhel
The packages in the above output are listed as having updates available. The first package in the list is PackageKit, the graphical package manager. The line in the example output tells us:
  • PackageKit — the name of the package
  • x86_64 — the CPU architecture the package was built for
  • 0.5.8 — the version of the updated package to be installed
  • rhel — the repository in which the updated package is located
The output also shows us that we can update the kernel (the kernel package), Yum and RPM themselves (the yum and rpm packages), as well as their dependencies (such as the kernel-firmware, rpm-libs, and rpm-python packages), all using yum.

5.1.2. Updating Packages

You can choose to update a single package, multiple packages, or all packages at once. If any dependencies of the package (or packages) you update have updates available themselves, then they are updated too.

Updating a Single Package

To update a single package, run the following command as root:
yum update package_name
For example, to update the udev package, type:
~]# yum update udev
Loaded plugins: product-id, refresh-packagekit, subscription-manager
Updating Red Hat repositories.
INFO:rhsm-app.repolib:repos updated: 0
Setting up Update Process
Resolving Dependencies
--> Running transaction check
---> Package udev.x86_64 0:147-2.15.el6 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

===========================================================================
 Package       Arch            Version                 Repository     Size
===========================================================================
Updating:
 udev          x86_64          147-2.15.el6            rhel          337 k

Transaction Summary
===========================================================================
Install       0 Package(s)
Upgrade       1 Package(s)

Total download size: 337 k
Is this ok [y/N]:
This output contains several items of interest:
  1. Loaded plugins: product-id, refresh-packagekit, subscription-manageryum always informs you which Yum plug-ins are installed and enabled. Here, yum is using the product-id, refresh-packagekit, and subscription-manager plug-ins. Refer to Section 5.4, “Yum Plug-ins” for general information on Yum plug-ins, or to Section 5.4.3, “Plug-in Descriptions” for descriptions of specific plug-ins.
  2. udev.x86_64 — you can download and install new udev package.
  3. yum presents the update information and then prompts you as to whether you want it to perform the update; yum runs interactively by default. If you already know which transactions yum plans to perform, you can use the -y option to automatically answer yes to any questions yum may ask (in which case it runs non-interactively). However, you should always examine which changes yum plans to make to the system so that you can easily troubleshoot any problems that might arise.
    If a transaction does go awry, you can view Yum's transaction history by using the yum history command as described in Section 5.2.6, “Working with Transaction History”.

Updating and installing kernels with Yum

yum always installs a new kernel in the same sense that RPM installs a new kernel when you use the command rpm -i kernel. Therefore, you do not need to worry about the distinction between installing and upgrading a kernel package when you use yum: it will do the right thing, regardless of whether you are using the yum update or yum install command.
When using RPM, on the other hand, it is important to use the rpm -i kernel command (which installs a new kernel) instead of rpm -u kernel (which replaces the current kernel). Refer to Section B.2.2, “Installing and Upgrading” for more information on installing/updating kernels with RPM.

Updating All Packages and Their Dependencies

To update all packages and their dependencies, simply enter yum update (without any arguments):
yum update

Updating Security-Related Packages

Discovering which packages have security updates available and then updating those packages quickly and easily is important. Yum provides the plug-in for this purpose. The security plug-in extends the yum command with a set of highly-useful security-centric commands, subcommands and options. Refer to Section 5.4.3, “Plug-in Descriptions” for specific information.

5.1.3. Preserving Configuration File Changes

You will inevitably make changes to the configuration files installed by packages as you use your Red Hat Enterprise Linux system. RPM, which Yum uses to perform changes to the system, provides a mechanism for ensuring their integrity. Refer to Section B.2.2, “Installing and Upgrading” for details on how to manage changes to configuration files across package upgrades.

5.2. Packages and Package Groups

5.2.1. Searching Packages

You can search all RPM package names, descriptions and summaries by using the following command:
yum search term
This command displays the list of matches for each term. For example, to list all packages that match meld or kompare, type:
~]# yum search meld kompare
Loaded plugins: product-id, refresh-packagekit, subscription-manager
Updating Red Hat repositories.
INFO:rhsm-app.repolib:repos updated: 0
============================ Matched: kompare =============================
kdesdk.x86_64 : The KDE Software Development Kit (SDK)
Warning: No matches found for: meld
The yum search command is useful for searching for packages you do not know the name of, but for which you know a related term.

5.2.2. Listing Packages

yum list and related commands provide information about packages, package groups, and repositories.
All of Yum's list commands allow you to filter the results by appending one or more glob expressions as arguments. Glob expressions are normal strings of characters which contain one or more of the wildcard characters * (which expands to match any character multiple times) and ? (which expands to match any one character).

Filtering results with glob expressions

Be careful to escape the glob expressions when passing them as arguments to a yum command, otherwise the Bash shell will interpret these expressions as pathname expansions, and potentially pass all files in the current directory that match the globs to yum. To make sure the glob expressions are passed to yum as intended, either:
  • escape the wildcard characters by preceding them with a backslash character
  • double-quote or single-quote the entire glob expression.
yum list glob_expression
Lists information on installed and available packages matching all glob expressions.
Example 5.1. Listing all ABRT addons and plug-ins using glob expressions
Packages with various ABRT addons and plug-ins either begin with abrt-addon-, or abrt-plugin-. To list these packages, type the following at a shell prompt:
~]# yum list abrt-addon\* abrt-plugin\*
Loaded plugins: product-id, refresh-packagekit, subscription-manager
Updating Red Hat repositories.
INFO:rhsm-app.repolib:repos updated: 0
Installed Packages
abrt-addon-ccpp.x86_64                        1.0.7-5.el6             @rhel
abrt-addon-kerneloops.x86_64                  1.0.7-5.el6             @rhel
abrt-addon-python.x86_64                      1.0.7-5.el6             @rhel
abrt-plugin-bugzilla.x86_64                   1.0.7-5.el6             @rhel
abrt-plugin-logger.x86_64                     1.0.7-5.el6             @rhel
abrt-plugin-sosreport.x86_64                  1.0.7-5.el6             @rhel
abrt-plugin-ticketuploader.x86_64             1.0.7-5.el6             @rhel

yum list all
Lists all installed and available packages.
yum list installed
Lists all packages installed on your system. The rightmost column in the output lists the repository from which the package was retrieved.
Example 5.2. Listing installed packages using a double-quoted glob expression
To list all installed packages that begin with krb followed by exactly one character and a hyphen, type:
~]# yum list installed "krb?-*"
Loaded plugins: product-id, refresh-packagekit, subscription-manager
Updating Red Hat repositories.
INFO:rhsm-app.repolib:repos updated: 0
Installed Packages
krb5-libs.x86_64                         1.8.1-3.el6                  @rhel
krb5-workstation.x86_64                  1.8.1-3.el6                  @rhel

yum list available
Lists all available packages in all enabled repositories.
Example 5.3. Listing available packages using a single glob expression with escaped wildcard characters
To list all available packages with names that contain gstreamer and then plugin, run the following command:
~]# yum list available gstreamer\*plugin\*
Loaded plugins: product-id, refresh-packagekit, subscription-manager
Updating Red Hat repositories.
INFO:rhsm-app.repolib:repos updated: 0
Available Packages
gstreamer-plugins-bad-free.i686               0.10.17-4.el6            rhel
gstreamer-plugins-base.i686                   0.10.26-1.el6            rhel
gstreamer-plugins-base-devel.i686             0.10.26-1.el6            rhel
gstreamer-plugins-base-devel.x86_64           0.10.26-1.el6            rhel
gstreamer-plugins-good.i686                   0.10.18-1.el6            rhel

yum grouplist
Lists all package groups.
yum repolist
Lists the repository ID, name, and number of packages it provides for each enabled repository.

5.2.3. Displaying Package Information

To display information about one or more packages (glob expressions are valid here as well), use the following command:
yum info package_name
For example, to display information about the abrt package, type:
~]# yum info abrt
Loaded plugins: product-id, refresh-packagekit, subscription-manager
Updating Red Hat repositories.
INFO:rhsm-app.repolib:repos updated: 0
Installed Packages
Name       : abrt
Arch       : x86_64
Version    : 1.0.7
Release    : 5.el6
Size       : 578 k
Repo       : installed
From repo  : rhel
Summary    : Automatic bug detection and reporting tool
URL        : https://fedorahosted.org/abrt/
License    : GPLv2+
Description: abrt is a tool to help users to detect defects in applications
           : and to create a bug report with all informations needed by
           : maintainer to fix it. It uses plugin system to extend its
           : functionality.
The yum info package_name command is similar to the rpm -q --info package_name command, but provides as additional information the ID of the Yum repository the RPM package is found in (look for the From repo: line in the output).
You can also query the Yum database for alternative and useful information about a package by using the following command:
yumdb info package_name
This command provides additional information about a package, including the checksum of the package (and algorithm used to produce it, such as SHA-256), the command given on the command line that was invoked to install the package (if any), and the reason that the package is installed on the system (where user indicates it was installed by the user, and dep means it was brought in as a dependency). For example, to display additional information about the yum package, type:
~]# yumdb info yum
Loaded plugins: product-id, refresh-packagekit, subscription-manager
yum-3.2.27-4.el6.noarch
     checksum_data = 23d337ed51a9757bbfbdceb82c4eaca9808ff1009b51e9626d540f44fe95f771
     checksum_type = sha256
     from_repo = rhel
     from_repo_revision = 1298613159
     from_repo_timestamp = 1298614288
     installed_by = 4294967295
     reason = user
     releasever = 6.1
For more information on the yumdb command, refer to the yumdb(8) manual page.

5.2.4. Installing Packages

Yum allows you to install both a single package and multiple packages, as well as a package group of your choice.

Installing Individual Packages

To install a single package and all of its non-installed dependencies, enter a command in the following form:
yum install package_name
You can also install multiple packages simultaneously by appending their names as arguments:
yum install package_name package_name
If you are installing packages on a multilib system, such as an AMD64 or Intel64 machine, you can specify the architecture of the package (as long as it is available in an enabled repository) by appending .arch to the package name. For example, to install the sqlite2 package for i586, type:
~]# yum install sqlite2.i586
You can use glob expressions to quickly install multiple similarly-named packages:
~]# yum install audacious-plugins-\*
In addition to package names and glob expressions, you can also provide file names to yum install. If you know the name of the binary you want to install, but not its package name, you can give yum install the path name:
~]# yum install /usr/sbin/named
yum then searches through its package lists, finds the package which provides /usr/sbin/named, if any, and prompts you as to whether you want to install it.

Finding which package owns a file

If you know you want to install the package that contains the named binary, but you do not know in which bin or sbin directory is the file installed, use the yum provides command with a glob expression:
~]# yum provides "*bin/named"
Loaded plugins: product-id, refresh-packagekit, subscription-manager
Updating Red Hat repositories.
INFO:rhsm-app.repolib:repos updated: 0
32:bind-9.7.0-4.P1.el6.x86_64 : The Berkeley Internet Name Domain (BIND)
                              : DNS (Domain Name System) server
Repo        : rhel
Matched from:
Filename    : /usr/sbin/named
yum provides "*/file_name" is a common and useful trick to find the package(s) that contain file_name.

Installing a Package Group

A package group is similar to a package: it is not useful by itself, but installing one pulls a group of dependent packages that serve a common purpose. A package group has a name and a groupid. The yum grouplist -v command lists the names of all package groups, and, next to each of them, their groupid in parentheses. The groupid is always the term in the last pair of parentheses, such as kde-desktop in the following example:
~]# yum -v grouplist kde\*
Loading "product-id" plugin
Loading "refresh-packagekit" plugin
Loading "subscription-manager" plugin
Updating Red Hat repositories.
INFO:rhsm-app.repolib:repos updated: 0
Config time: 0.123
Yum Version: 3.2.29
Setting up Group Process
Looking for repo options for [rhel]
rpmdb time: 0.001
group time: 1.291
Available Groups:
   KDE Desktop (kde-desktop)
Done
You can install a package group by passing its full group name (without the groupid part) to groupinstall:
yum groupinstall group_name
You can also install by groupid:
yum groupinstall groupid
You can even pass the groupid (or quoted name) to the install command if you prepend it with an @-symbol (which tells yum that you want to perform a groupinstall):
yum install @group
For example, the following are alternative but equivalent ways of installing the KDE Desktop group:
~]# yum groupinstall "KDE Desktop"
~]# yum groupinstall kde-desktop
~]# yum install @kde-desktop

5.2.5. Removing Packages

Similarly to package installation, Yum allows you to uninstall (remove in RPM and Yum terminology) both individual packages and a package group.

Removing Individual Packages

To uninstall a particular package, as well as any packages that depend on it, run the following command as root:
yum remove package_name
As when you install multiple packages, you can remove several at once by adding more package names to the command. For example, to remove totem, rhythmbox, and sound-juicer, type the following at a shell prompt:
~]# yum remove totem rhythmbox sound-juicer
Similar to install, remove can take these arguments:
  • package names
  • glob expressions
  • file lists
  • package provides

Removing a package when other packages depend on it

Yum is not able to remove a package without also removing packages which depend on it. This type of operation can only be performed by RPM, is not advised, and can potentially leave your system in a non-functioning state or cause applications to misbehave and/or crash. For further information, refer to Section B.2.4, “Uninstalling” in the RPM chapter.

Removing a Package Group

You can remove a package group using syntax congruent with the install syntax:
yum groupremove group
yum remove @group
The following are alternative but equivalent ways of removing the KDE Desktop group:
~]# yum groupremove "KDE Desktop"
~]# yum groupremove kde-desktop
~]# yum remove @kde-desktop

Intelligent package group removal

When you tell yum to remove a package group, it will remove every package in that group, even if those packages are members of other package groups or dependencies of other installed packages. However, you can instruct yum to remove only those packages which are not required by any other packages or groups by adding the groupremove_leaf_only=1 directive to the [main] section of the /etc/yum.conf configuration file. For more information on this directive, refer to Section 5.3.1, “Setting [main] Options”.

5.2.6. Working with Transaction History

The yum history command allows users to review information about a timeline of Yum transactions, the dates and times on when they occurred, the number of packages affected, whether transactions succeeded or were aborted, and if the RPM database was changed between transactions. Additionally, this command can be used to undo or redo certain transactions.

Listing Transactions

To display a list of twenty most recent transactions, as root, either run yum history with no additional arguments, or type the following at a shell prompt:
yum history list
To display all transactions, add the all keyword:
yum history list all
To display only transactions in a given range, use the command in the following form:
yum history list start_id..end_id
You can also list only transactions regarding a particular package or packages. To do so, use the command with a package name or a glob expression:
yum history list glob_expression
For example, the list of first five transactions may look as follows:
~]# yum history list 1..5
Loaded plugins: product-id, refresh-packagekit, subscription-manager
ID     | Login user               | Date and time    | Action(s)      | Altered
-------------------------------------------------------------------------------
     5 | Jaromir ... <jhradilek>  | 2011-07-29 15:33 | Install        |    1
     4 | Jaromir ... <jhradilek>  | 2011-07-21 15:10 | Install        |    1
     3 | Jaromir ... <jhradilek>  | 2011-07-16 15:27 | I, U           |   73
     2 | System <unset>           | 2011-07-16 15:19 | Update         |    1
     1 | System <unset>           | 2011-07-16 14:38 | Install        | 1106
history list
All forms of the yum history list command produce tabular output with each row consisting of the following columns:
  • ID — an integer value that identifies a particular transaction.
  • Login user — the name of the user whose login session was used to initiate a transaction. This information is typically presented in the Full Name <username> form. For transactions that were not issued by a user (such as an automatic system update), System <unset> is used instead.
  • Date and time — the date and time when a transaction was issued.
  • Action(s) — a list of actions that were performed during a transaction as described in Table 5.1, “Possible values of the Action(s) field”.
  • Altered — the number of packages that were affected by a transaction, possibly followed by additional information as described in Table 5.2, “Possible values of the Altered field”.
Table 5.1. Possible values of the Action(s) field
Action Abbreviation Description
Downgrade D At least one package has been downgraded to an older version.
Erase E At least one package has been removed.
Install I At least one new package has been installed.
Obsoleting O At least one package has been marked as obsolete.
Reinstall R At least one package has been reinstalled.
Update U At least one package has been updated to a newer version.

Table 5.2. Possible values of the Altered field
Symbol Description
< Before the transaction finished, the rpmdb database was changed outside Yum.
> After the transaction finished, the rpmdb database was changed outside Yum.
* The transaction failed to finish.
# The transaction finished successfully, but yum returned a non-zero exit code.
E The transaction finished successfully, but an error or a warning was displayed.
P The transaction finished successfully, but problems already existed in the rpmdb database.
s The transaction finished successfully, but the --skip-broken command line option was used and certain packages were skipped.

Yum also allows you to display a summary of all past transactions. To do so, run the command in the following form as root:
yum history summary
To display only transactions in a given range, type:
yum history summary start_id..end_id
Similarly to the yum history list command, you can also display a summary of transactions regarding a certain package or packages by supplying a package name or a glob expression:
yum history summary glob_expression
For instance, a summary of the transaction history displayed above would look like the following:
~]# yum history summary 1..5
Loaded plugins: product-id, refresh-packagekit, subscription-manager
Login user                 | Time                | Action(s)        | Altered 
-------------------------------------------------------------------------------
Jaromir ... <jhradilek>    | Last day            | Install          |        1
Jaromir ... <jhradilek>    | Last week           | Install          |        1
Jaromir ... <jhradilek>    | Last 2 weeks        | I, U             |       73
System <unset>             | Last 2 weeks        | I, U             |     1107
history summary
All forms of the yum history summary command produce simplified tabular output similar to the output of yum history list.
As shown above, both yum history list and yum history summary are oriented towards transactions, and although they allow you to display only transactions related to a given package or packages, they lack important details, such as package versions. To list transactions from the perspective of a package, run the following command as root:
yum history package-list glob_expression
For example, to trace the history of subscription-manager and related packages, type the following at a shell prompt:
~]# yum history package-list subscription-manager\*
Loaded plugins: product-id, refresh-packagekit, subscription-manager
ID     | Action(s)      | Package
-------------------------------------------------------------------------------
     3 | Updated        | subscription-manager-0.95.11-1.el6.x86_64
     3 | Update         |                      0.95.17-1.el6_1.x86_64
     3 | Updated        | subscription-manager-firstboot-0.95.11-1.el6.x86_64
     3 | Update         |                                0.95.17-1.el6_1.x86_64
     3 | Updated        | subscription-manager-gnome-0.95.11-1.el6.x86_64
     3 | Update         |                            0.95.17-1.el6_1.x86_64
     1 | Install        | subscription-manager-0.95.11-1.el6.x86_64
     1 | Install        | subscription-manager-firstboot-0.95.11-1.el6.x86_64
     1 | Install        | subscription-manager-gnome-0.95.11-1.el6.x86_64
history package-list
In this example, three packages were installed during the initial system installation: subscription-manager, subscription-manager-firstboot, and subscription-manager-gnome. In the third transaction, all these packages were updated from version 0.95.11 to version 0.95.17.

Examining Transactions

To display the summary of a single transaction, as root, use the yum history summary command in the following form:
yum history summary id
To examine a particular transaction or transactions in more detail, run the following command as root:
yum history info id
The id argument is optional and when you omit it, yum automatically uses the last transaction. Note that when specifying more than one transaction, you can also use a range:
yum history info start_id..end_id
The following is sample output for two transactions, each installing one new package:
~]# yum history info 4..5
Loaded plugins: product-id, refresh-packagekit, subscription-manager
Transaction ID : 4..5
Begin time     : Thu Jul 21 15:10:46 2011
Begin rpmdb    : 1107:0c67c32219c199f92ed8da7572b4c6df64eacd3a
End time       :            15:33:15 2011 (22 minutes)
End rpmdb      : 1109:1171025bd9b6b5f8db30d063598f590f1c1f3242
User           : Jaromir Hradilek <jhradilek>
Return-Code    : Success
Command Line   : install screen
Command Line   : install yum-plugin-fs-snapshot
Transaction performed with:
    Installed     rpm-4.8.0-16.el6.x86_64
    Installed     yum-3.2.29-17.el6.noarch
    Installed     yum-metadata-parser-1.1.2-16.el6.x86_64
Packages Altered:
    Install screen-4.0.3-16.el6.x86_64
    Install yum-plugin-fs-snapshot-1.1.30-6.el6.noarch
history info
You can also view additional information, such as what configuration options were used at the time of the transaction, or from what repository and why were certain packages installed. To determine what additional information is available for a certain transaction, type the following at a shell prompt as root:
yum history addon-info id
Similarly to yum history info, when no id is provided, yum automatically uses the latest transaction. Another way to refer to the latest transaction is to use the last keyword:
yum history addon-info last
For instance, for the first transaction in the previous example, the yum history addon-info command would provide the following output:
~]# yum history addon-info 4
Loaded plugins: product-id, refresh-packagekit, subscription-manager
Transaction ID: 4
Available additional history information:
  config-main
  config-repos
  saved_tx

history addon-info
In this example, three types of information are available:
  • config-main — global Yum options that were in use during the transaction. Refer to Section 5.3.1, “Setting [main] Options” for information on how to change global options.
  • config-repos — options for individual Yum repositories. Refer to Section 5.3.2, “Setting [repository] Options” for information on how to change options for individual repositories.
  • saved_tx — the data that can be used by the yum load-transaction command in order to repeat the transaction on another machine (see below).
To display selected type of additional information, run the following command as root:
yum history addon-info id information

Reverting and Repeating Transactions

Apart from reviewing the transaction history, the yum history command provides means to revert or repeat a selected transaction. To revert a transaction, type the following at a shell prompt as root:
yum history undo id
To repeat a particular transaction, as root, run the following command:
yum history redo id
Both commands also accept the last keyword to undo or repeat the latest transaction.
Note that both yum history undo and yum history redo commands merely revert or repeat the steps that were performed during a transaction: if the transaction installed a new package, the yum history undo command will uninstall it, and vice versa. If possible, this command will also attempt to downgrade all updated packages to their previous version, but these older packages may no longer be available. If you need to be able to restore the system to the state before an update, consider using the fs-snapshot plug-in described in Section 5.4.3, “Plug-in Descriptions”.
When managing several identical systems, Yum also allows you to perform a transaction on one of them, store the transaction details in a file, and after a period of testing, repeat the same transaction on the remaining systems as well. To store the transaction details to a file, type the following at a shell prompt as root:
yum -q history addon-info id saved_tx > file_name
Once you copy this file to the target system, you can repeat the transaction by using the following command as root:
yum load-transaction file_name
Note, however that the rpmdb version stored in the file must by identical to the version on the target system. You can verify the rpmdb version by using the yum version nogroups command.

Starting New Transaction History

Yum stores the transaction history in a single SQLite database file. To start new transaction history, run the following command as root:
yum history new
This will create a new, empty database file in the /var/lib/yum/history/ directory. The old transaction history will be kept, but will not be accessible as long as a newer database file is present in the directory.

5.3. Configuring Yum and Yum Repositories

The configuration file for yum and related utilities is located at /etc/yum.conf. This file contains one mandatory [main] section, which allows you to set Yum options that have global effect, and may also contain one or more [repository] sections, which allow you to set repository-specific options. However, best practice is to define individual repositories in new or existing .repo files in the /etc/yum.repos.d/directory. The values you define in the [main] section of the /etc/yum.conf file may override values set in individual [repository] sections.
This section shows you how to:
  • set global Yum options by editing the [main] section of the /etc/yum.conf configuration file;
  • set options for individual repositories by editing the [repository] sections in /etc/yum.conf and .repo files in the /etc/yum.repos.d/ directory;
  • use Yum variables in /etc/yum.conf and files in the /etc/yum.repos.d/ directory so that dynamic version and architecture values are handled correctly;
  • add, enable, and disable Yum repositories on the command line; and,
  • set up your own custom Yum repository.

5.3.1. Setting [main] Options

The /etc/yum.conf configuration file contains exactly one [main] section, and while some of the key-value pairs in this section affect how yum operates, others affect how Yum treats repositories. You can add many additional options under the [main] section heading in /etc/yum.conf.
A sample /etc/yum.conf configuration file can look like this:
[main]
cachedir=/var/cache/yum/$basearch/$releasever
keepcache=0
debuglevel=2
logfile=/var/log/yum.log
exactarch=1
obsoletes=1
gpgcheck=1
plugins=1
installonly_limit=3

[comments abridged]

# PUT YOUR REPOS HERE OR IN separate files named file.repo
# in /etc/yum.repos.d
The following are the most commonly-used options in the [main] section:
assumeyes=value
…where value is one of:
0yum should prompt for confirmation of critical actions it performs. This is the default.
1 — Do not prompt for confirmation of critical yum actions. If assumeyes=1 is set, yum behaves in the same way that the command line option -y does.
cachedir=directory
…where directory is an absolute path to the directory where Yum should store its cache and database files. By default, Yum's cache directory is /var/cache/yum/$basearch/$releasever.
Refer to Section 5.3.3, “Using Yum Variables” for descriptions of the $basearch and $releasever Yum variables.
debuglevel=value
…where value is an integer between 1 and 10. Setting a higher debuglevel value causes yum to display more detailed debugging output. debuglevel=0 disables debugging output, while debuglevel=2 is the default.
exactarch=value
…where value is one of:
0 — Do not take into account the exact architecture when updating packages.
1 — Consider the exact architecture when updating packages. With this setting, yum will not install an i686 package to update an i386 package already installed on the system. This is the default.
exclude=package_name [more_package_names]
This option allows you to exclude packages by keyword during installation/updates. Listing multiple packages for exclusion can be accomplished by quoting a space-delimited list of packages. Shell globs using wildcards (for example, * and ?) are allowed.
gpgcheck=value
…where value is one of:
0 — Disable GPG signature-checking on packages in all repositories, including local package installation.
1 — Enable GPG signature-checking on all packages in all repositories, including local package installation. gpgcheck=1 is the default, and thus all packages' signatures are checked.
If this option is set in the [main] section of the /etc/yum.conf file, it sets the GPG-checking rule for all repositories. However, you can also set gpgcheck=value for individual repositories instead; that is, you can enable GPG-checking on one repository while disabling it on another. Setting gpgcheck=value for an individual repository in its corresponding .repo file overrides the default if it is present in /etc/yum.conf.
For more information on GPG signature-checking, refer to Section B.3, “Checking a Package's Signature”.
groupremove_leaf_only=value
…where value is one of:
0yum should not check the dependencies of each package when removing a package group. With this setting, yum removes all packages in a package group, regardless of whether those packages are required by other packages or groups. groupremove_leaf_only=0 is the default.
1yum should check the dependencies of each package when removing a package group, and remove only those packages which are not not required by any other package or group.
For more information on removing packages, refer to Intelligent package group removal.
installonlypkgs=space separated list of packages
Here you can provide a space-separated list of packages which yum can install, but will never update. Refer to the yum.conf(5) manual page for the list of packages which are install-only by default.
If you add the installonlypkgs directive to /etc/yum.conf, you should ensure that you list all of the packages that should be install-only, including any of those listed under the installonlypkgs section of yum.conf(5). In particular, kernel packages should always be listed in installonlypkgs (as they are by default), and installonly_limit should always be set to a value greater than 2 so that a backup kernel is always available in case the default one fails to boot.
installonly_limit=value
…where value is an integer representing the maximum number of versions that can be installed simultaneously for any single package listed in the installonlypkgs directive.
The defaults for the installonlypkgs directive include several different kernel packages, so be aware that changing the value of installonly_limit will also affect the maximum number of installed versions of any single kernel package. The default value listed in /etc/yum.conf is installonly_limit=3, and it is not recommended to decrease this value, particularly below 2.
keepcache=value
…where value is one of:
0 — Do not retain the cache of headers and packages after a successful installation. This is the default.
1 — Retain the cache after a successful installation.
logfile=file_name
…where file_name is an absolute path to the file in which yum should write its logging output. By default, yum logs to /var/log/yum.log.
multilib_policy=value
…where value is one of:
best — install the best-choice architecture for this system. For example, setting multilib_policy=best on an AMD64 system causes yum to install 64-bit versions of all packages.
all — always install every possible architecture for every package. For example, with multilib_policy set to all on an AMD64 system, yum would install both the i586 and AMD64 versions of a package, if both were available.
obsoletes=value
…where value is one of:
0 — Disable yum's obsoletes processing logic when performing updates.
1 — Enable yum's obsoletes processing logic when performing updates. When one package declares in its spec file that it obsoletes another package, the latter package will be replaced by the former package when the former package is installed. Obsoletes are declared, for example, when a package is renamed. obsoletes=1 the default.
plugins=value
…where value is one of:
0 — Disable all Yum plug-ins globally.

Disabling all plug-ins is not advised

Disabling all plug-ins is not advised because certain plug-ins provide important Yum services. In particular, rhnplugin provides support for RHN Classic, and product-id and subscription-manager plug-ins provide support for the certificate-based Content Delivery Network (CDN). Disabling plug-ins globally is provided as a convenience option, and is generally only recommended when diagnosing a potential problem with Yum.
1 — Enable all Yum plug-ins globally. With plugins=1, you can still disable a specific Yum plug-in by setting enabled=0 in that plug-in's configuration file.
For more information about various Yum plug-ins, refer to Section 5.4, “Yum Plug-ins”. For further information on controlling plug-ins, see Section 5.4.1, “Enabling, Configuring, and Disabling Yum Plug-ins”.
reposdir=directory
…where directory is an absolute path to the directory where .repo files are located. All .repo files contain repository information (similar to the [repository] sections of /etc/yum.conf). yum collects all repository information from .repo files and the [repository] section of the /etc/yum.conf file to create a master list of repositories to use for transactions. If reposdir is not set, yum uses the default directory /etc/yum.repos.d/.
retries=value
…where value is an integer 0 or greater. This value sets the number of times yum should attempt to retrieve a file before returning an error. Setting this to 0 makes yum retry forever. The default value is 10.
For a complete list of available [main] options, refer to the [main] OPTIONS section of the yum.conf(5) manual page.

5.3.2. Setting [repository] Options

The [repository] sections, where repository is a unique repository ID such as my_personal_repo (spaces are not permitted), allow you to define individual Yum repositories.
The following is a bare-minimum example of the form a [repository] section takes:
[repository]
name=repository_name
baseurl=repository_url
Every [repository] section must contain the following directives:
name=repository_name
…where repository_name is a human-readable string describing the repository.
baseurl=repository_url
…where repository_url is a URL to the directory where the repodata directory of a repository is located:
  • If the repository is available over HTTP, use: http://path/to/repo
  • If the repository is available over FTP, use: ftp://path/to/repo
  • If the repository is local to the machine, use: file:///path/to/local/repo
  • If a specific online repository requires basic HTTP authentication, you can specify your username and password by prepending it to the URL as username:password@link. For example, if a repository on http://www.example.com/repo/ requires a username of user and a password of password, then the baseurl link could be specified as http://user:password@www.example.com/repo/.
Usually this URL is an HTTP link, such as:
baseurl=http://path/to/repo/releases/$releasever/server/$basearch/os/
Note that Yum always expands the $releasever, $arch, and $basearch variables in URLs. For more information about Yum variables, refer to Section 5.3.3, “Using Yum Variables”.
Another useful [repository] directive is the following:
enabled=value
…where value is one of:
0 — Do not include this repository as a package source when performing updates and installs. This is an easy way of quickly turning repositories on and off, which is useful when you desire a single package from a repository that you do not want to enable for updates or installs.
1 — Include this repository as a package source.
Turning repositories on and off can also be performed by passing either the --enablerepo=repo_name or --disablerepo=repo_name option to yum, or through the Add/Remove Software window of the PackageKit utility.
Many more [repository] options exist. For a complete list, refer to the [repository] OPTIONS section of the yum.conf(5) manual page.
Example 5.4. A sample /etc/yum.repos.d/redhat.repo file
The following is a sample /etc/yum.repos.d/redhat.repo file:
#
# Red Hat Repositories
# Managed by (rhsm) subscription-manager
#

[red-hat-enterprise-linux-scalable-file-system-for-rhel-6-entitlement-rpms]
name = Red Hat Enterprise Linux Scalable File System (for RHEL 6 Entitlement) (RPMs)
baseurl = https://cdn.redhat.com/content/dist/rhel/entitlement-6/releases/$releasever/$basearch/scalablefilesystem/os
enabled = 1
gpgcheck = 1
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
sslverify = 1
sslcacert = /etc/rhsm/ca/redhat-uep.pem
sslclientkey = /etc/pki/entitlement/key.pem
sslclientcert = /etc/pki/entitlement/11300387955690106.pem

[red-hat-enterprise-linux-scalable-file-system-for-rhel-6-entitlement-source-rpms]
name = Red Hat Enterprise Linux Scalable File System (for RHEL 6 Entitlement) (Source RPMs)
baseurl = https://cdn.redhat.com/content/dist/rhel/entitlement-6/releases/$releasever/$basearch/scalablefilesystem/source/SRPMS
enabled = 0
gpgcheck = 1
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
sslverify = 1
sslcacert = /etc/rhsm/ca/redhat-uep.pem
sslclientkey = /etc/pki/entitlement/key.pem
sslclientcert = /etc/pki/entitlement/11300387955690106.pem

[red-hat-enterprise-linux-scalable-file-system-for-rhel-6-entitlement-debug-rpms]
name = Red Hat Enterprise Linux Scalable File System (for RHEL 6 Entitlement) (Debug RPMs)
baseurl = https://cdn.redhat.com/content/dist/rhel/entitlement-6/releases/$releasever/$basearch/scalablefilesystem/debug
enabled = 0
gpgcheck = 1
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
sslverify = 1
sslcacert = /etc/rhsm/ca/redhat-uep.pem
sslclientkey = /etc/pki/entitlement/key.pem
sslclientcert = /etc/pki/entitlement/11300387955690106.pem

5.3.3. Using Yum Variables

You can use and reference the following built-in variables in yum commands and in all Yum configuration files (that is, /etc/yum.conf and all .repo files in the /etc/yum.repos.d/ directory):
$releasever
You can use this variable to reference the release version of Red Hat Enterprise Linux. Yum obtains the value of $releasever from the distroverpkg=value line in the /etc/yum.conf configuration file. If there is no such line in /etc/yum.conf, then yum infers the correct value by deriving the version number from the redhat-release package.
$arch
You can use this variable to refer to the system's CPU architecture as returned when calling Python's os.uname() function. Valid values for $arch include: i586, i686 and x86_64.
$basearch
You can use $basearch to reference the base architecture of the system. For example, i686 and i586 machines both have a base architecture of i386, and AMD64 and Intel64 machines have a base architecture of x86_64.
$YUM0-9
These ten variables are each replaced with the value of any shell environment variables with the same name. If one of these variables is referenced (in /etc/yum.conf for example) and a shell environment variable with the same name does not exist, then the configuration file variable is not replaced.
To define a custom variable or to override the value of an existing one, create a file with the same name as the variable (without the $ sign) in the /etc/yum/vars/ directory, and add the desired value on its first line.
For example, repository descriptions often include the operating system name. To define a new variable called $osname, create a new file with Red Hat Enterprise Linux on the first line and save it as /etc/yum/vars/osname:
~]# echo "Red Hat Enterprise Linux" > /etc/yum/vars/osname
Instead of Red Hat Enterprise Linux 6, you can now use the following in the .repo files:
name=$osname $releasever

5.3.4. Viewing the Current Configuration

To display the current values of global Yum options (that is, the options specified in the [main] section of the /etc/yum.conf file), run the yum-config-manager with no command line options:
yum-config-manager
To list the content of a different configuration section or sections, use the command in the following form:
yum-config-manager section
You can also use a glob expression to display the configuration of all matching sections:
yum-config-manager glob_expression
For example, to list all configuration options and their corresponding values, type the following at a shell prompt:
~]$ yum-config-manager main \*
Loaded plugins: product-id, refresh-packagekit, subscription-manager
================================== main ===================================
[main]
alwaysprompt = True
assumeyes = False
bandwith = 0
bugtracker_url = https://bugzilla.redhat.com/enter_bug.cgi?product=Red%20Hat%20Enterprise%20Linux%206&component=yum
cache = 0
[output truncated]

5.3.5. Adding, Enabling, and Disabling a Yum Repository

Section 5.3.2, “Setting [repository] Options” described various options you can use to define a Yum repository. This section explains how to add, enable, and disable a repository by using the yum-config-manager command.

The /etc/yum.repos.d/redhat.repo file

When the system is registered with the certificate-based Red Hat Network, the Red Hat Subscription Manager tools are used to manage repositories in the /etc/yum.repos.d/redhat.repo file. Refer to Chapter 4, Product Subscriptions and Entitlements for more information how to register a system with Red Hat Network and use the Red Hat Subscription Manager tools to manage subscriptions.

Adding a Yum Repository

To define a new repository, you can either add a [repository] section to the /etc/yum.conf file, or to a .repo file in the /etc/yum.repos.d/ directory. All files with the .repo file extension in this directory are read by yum, and best practice is to define your repositories here instead of in /etc/yum.conf.

Be careful when using untrusted software sources

Obtaining and installing software packages from unverified or untrusted software sources other than Red Hat Network constitutes a potential security risk, and could lead to security, stability, compatibility maintainability issues.
Yum repositories commonly provide their own .repo file. To add such a repository to your system and enable it, run the following command as root:
yum-config-manager --add-repo repository_url
…where repository_url is a link to the .repo file. For example, to add a repository located at http://www.example.com/example.repo, type the following at a shell prompt:
~]# yum-config-manager --add-repo http://www.example.com/example.repo
Loaded plugins: product-id, refresh-packagekit, subscription-manager
adding repo from: http://www.example.com/example.repo
grabbing file http://www.example.com/example.repo to /etc/yum.repos.d/example.repo
example.repo                                             |  413 B     00:00
repo saved to /etc/yum.repos.d/example.repo

Enabling a Yum Repository

To enable a particular repository or repositories, type the following at a shell prompt as root:
yum-config-manager --enable repository
…where repository is the unique repository ID (use yum repolist all to list available repository IDs). Alternatively, you can use a glob expression to enable all matching repositories:
yum-config-manager --enable glob_expression
For example, to disable repositories defined in the [example], [example-debuginfo], and [example-source]sections, type:
~]# yum-config-manager --enable example\*
Loaded plugins: product-id, refresh-packagekit, subscription-manager
============================== repo: example ==============================
[example]
bandwidth = 0
base_persistdir = /var/lib/yum/repos/x86_64/6Server
baseurl = http://www.example.com/repo/6Server/x86_64/
cache = 0
cachedir = /var/cache/yum/x86_64/6Server/example
[output truncated]
When successful, the yum-config-manager --enable command displays the current repository configuration.

Disabling a Yum Repository

To disable a Yum repository, run the following command as root:
yum-config-manager --disable repository
…where repository is the unique repository ID (use yum repolist all to list available repository IDs). Similarly to yum-config-manager --enable, you can use a glob expression to disable all matching repositories at the same time:
yum-config-manager --disable glob_expression
When successful, the yum-config-manager --disable command displays the current configuration.

5.3.6. Creating a Yum Repository

To set up a Yum repository, follow these steps:
  1. Install the createrepo package:
    ~]# yum install createrepo
  2. Copy all of the packages into one directory, such as /mnt/local_repo/.
  3. Run the createrepo --database command on that directory:
    ~]# createrepo --database /mnt/local_repo

    Using the createrepo command on Red Hat Enterprise Linux 5

    Because RPM packages for Red Hat Enterprise Linux 6 are compressed using the XZ lossless data compression format, and may also be signed using alternative (and stronger) hash algorithms such as SHA-256, it is not possible to run createrepo on Red Hat Enterprise Linux 5 to create the package metadata for Red Hat Enterprise Linux 6 packages. The createrepo command relies on rpm to open and inspect the packages, and rpm on Red Hat Enterprise Linux 5 is not able to open the improved Red Hat Enterprise Linux 6 RPM package format.
This will create the necessary metadata for your Yum repository, as well as the sqlite database for speeding up yum operations.

5.4. Yum Plug-ins

Yum provides plug-ins that extend and enhance its operations. Certain plug-ins are installed by default. Yum always informs you which plug-ins, if any, are loaded and active whenever you call any yum command. For example:
~]# yum info yum
Loaded plugins: product-id, refresh-packagekit, subscription-manager
[output truncated]
Note that the plug-in names which follow Loaded plugins are the names you can provide to the --disableplugins=plugin_name option.

5.4.1. Enabling, Configuring, and Disabling Yum Plug-ins

To enable Yum plug-ins, ensure that a line beginning with plugins= is present in the [main] section of /etc/yum.conf, and that its value is set to 1:
plugins=1
You can disable all plug-ins by changing this line to plugins=0.

Disabling all plug-ins is not advised

Disabling all plug-ins is not advised because certain plug-ins provide important Yum services. In particular, rhnplugin provides support for RHN Classic, and product-id and subscription-manager plug-ins provide support for the certificate-based Content Delivery Network (CDN). Disabling plug-ins globally is provided as a convenience option, and is generally only recommended when diagnosing a potential problem with Yum.
Every installed plug-in has its own configuration file in the /etc/yum/pluginconf.d/ directory. You can set plug-in specific options in these files. For example, here is the refresh-packagekit plug-in's refresh-packagekit.conf configuration file:
[main]
enabled=1
Plug-in configuration files always contain a [main] section (similar to Yum's /etc/yum.conf file) in which there is (or you can place if it is missing) an enabled= option that controls whether the plug-in is enabled when you run yum commands.
If you disable all plug-ins by setting enabled=0 in /etc/yum.conf, then all plug-ins are disabled regardless of whether they are enabled in their individual configuration files.
If you merely want to disable all Yum plug-ins for a single yum command, use the --noplugins option.
If you want to disable one or more Yum plug-ins for a single yum command, add the --disableplugin=plugin_name option to the command. For example, to disable the presto plug-in while updating a system, type:
~]# yum update --disableplugin=presto
The plug-in names you provide to the --disableplugin= option are the same names listed after the Loaded plugins line in the output of any yum command. You can disable multiple plug-ins by separating their names with commas. In addition, you can match multiple plug-in names or shorten long ones by using glob expressions:
~]# yum update --disableplugin=presto,refresh-pack*

5.4.2. Installing Additional Yum Plug-ins

Yum plug-ins usually adhere to the yum-plugin-plugin_name package-naming convention, but not always: the package which provides the presto plug-in is named yum-presto, for example. You can install a Yum plug-in in the same way you install other packages. For instance, to install the security plug-in, type the following at a shell prompt:
~]# yum install yum-plugin-security

5.4.3. Plug-in Descriptions

The following list provides descriptions of a few useful Yum plug-ins:
fs-snapshot (yum-plugin-fs-snapshot)
The fs-snapshot plug-in extends Yum to create a snapshot of a file system before proceeding with a transaction such as a system update or package removal. When a user decides that the changes made by the transaction are unwanted, this mechanism allows the user to roll back to the changes that are stored in a snapshot.
In order for the plug-in to work, the root file system (that is, /) must be on an LVM (Logical Volume Manager) or Btrfs volume. To use the fs-snapshot plug-in on an LVM volume, take the following steps:
  1. Make sure that the volume group with the root file system has enough free extents. The required size is a function of the amount of changes to the original logical volume that is expected during the life of the snapshot. The reasonable default is 50–80 % of the original logical volume size.
    To display detailed information about a particular volume group, run the vgdisplay command in the following form as root:
    vgdisplay volume_group
    The number of free extents is listed on the Free PE / Size line.
  2. If the volume group with the root file system does not have enough free extents, add a new physical volume:
    1. As root, run the pvcreate command in the following form to initialize a physical volume for use with the Logical Volume Manager:
      pvcreate device
    2. Use the vgextend command in the following form as root to add the physical volume to the volume group:
      vgextend volume_group physical_volume
  3. Edit the configuration file located in /etc/yum/pluginconf.d/fs-snapshot.conf, and make the following changes to the [lvm] section:
    1. Change the value of the enabled option to 1:
      enabled = 1
    2. Remove the hash sign (that is, #) from the beginning of the lvcreate_size_args line, and adjust the number of logical extents to be allocated for a snapshot. For example, to allocate 80 % of the size of the original logical volume, use:
      lvcreate_size_args = -l 80%ORIGIN
    Refer to Table 5.3, “Supported fs-snapshot.conf directives” for a complete list of available configuration options.
  4. Run the desired yum command, and make sure fs-snapshot is included in the list of loaded plug-ins (the Loaded plugins line) before you confirm the changes and proceed with the transaction. The fs-snapshot plug-in displays a line in the following form for each affected logical volume:
    fs-snapshot: snapshotting file_system (/dev/volume_group/logical_volume): logical_volume_yum_timestamp
  5. Verify that the system is working as expected:
    • If you decide to keep the changes, remove the snapshot by running the lvremove command as root:
      lvremove /dev/volume_group/logical_volume_yum_timestamp
    • If you decide to revert the changes and restore the file system to a state that is saved in a snapshot, take the following steps:
      1. As root, run the command in the following form to merge a snapshot into its original logical volume:
        lvconvert --merge /dev/volume_group/logical_volume_yum_timestamp
        The lvconvert command will inform you that a restart is required in order for the changes to take effect.
      2. Restart the system as instructed. You can do so by typing the following at a shell prompt as root:
        reboot
To use the fs-snapshot plug-in on a Btrfs file system, take the following steps:
  1. Run the desired yum command, and make sure fs-snapshot is included in the list of loaded plug-ins (the Loaded plugins line) before you confirm the changes and proceed with the transaction. The fs-snapshot plug-in displays a line in the following form for each affected file system:
    fs-snapshot: snapshotting file_system: file_system/yum_timestamp
  2. Verify that the system is working as expected:
    • If you decide to keep the changes, you can optionally remove unwanted snapshots. To remove a Btrfs snapshot, use the command in the following form as root:
      btrfs subvolume delete file_system/yum_timestamp
    • If you decide to revert the changes and restore a file system to a state that is saved in a snapshot, take the following steps:
      1. Determine the identifier of a particular snapshot by using the following command as root:
        btrfs subvolume list file_system
      2. As root, configure the system to mount this snapshot by default:
        btrfs subvolume set-default id file_system
      3. Restart the system. You can do so by typing the following at a shell prompt as root:
        reboot
Note that in Red Hat Enterprise Linux 6, Btrfs is included as a technology preview to allow you to experiment with this file system, and is only available on 64-bit x86 architectures. Do not use Btrfs for partitions that will contain valuable data or that are essential for the operation of important systems.
For more information on logical volume management, Btrfs, and file system snapshots, see the Red Hat Enterprise Linux 6 Storage Administration Guide. For additional information about the plug-in and its configuration, refer to the yum-fs-snapshot(1) and yum-fs-snapshot.conf(5) manual pages.
Table 5.3. Supported fs-snapshot.conf directives
Section Directive Description
[main] enabled=value Allows you to enable or disable the plug-in. The value must be either 1 (enabled), or 0 (disabled). When installed, the plug-in is enabled by default.
exclude=list Allows you to exclude certain file systems. The value must be a space-separated list of mount points you do not want to snapshot (for example, /srv /mnt/backup). This option is not included in the configuration file by default.
[lvm] enabled=value Allows you to enable or disable the use of the plug-in on LVM volumes. The value must be either 1 (enabled), or 0 (disabled). This option is disabled by default.
lvcreate_size_args=value Allows you to specify the size of a logical volume snapshot. The value must be the -l or -L command line option for the lvcreate utility followed by a valid argument (for example, -l 80%ORIGIN).

kabi (kabi-yum-plugins)
The kabi plug-in checks whether a driver update package conforms with official Red Hat kernel Application Binary Interface (kABI). With this plug-in enabled, when a user attempts to install a package that uses kernel symbols which are not on a whitelist, a warning message is written to the system log. Additionally, configuring the plug-in to run in enforcing mode prevents such packages from being installed at all.
To configure the kabi plug-in, edit the configuration file located in /etc/yum/pluginconf.d/kabi.conf. Refer to Table 5.4, “Supported kabi.conf directives” for a list of directives that can be used in the [main] section.
Table 5.4. Supported kabi.conf directives
Directive Description
enabled=value Allows you to enable or disable the plug-in. The value must be either 1 (enabled), or 0 (disabled). When installed, the plug-in is enabled by default.
whitelists=directory Allows you to specify the directory in which the files with supported kernel symbols are located. By default, the kabi plug-in uses files provided by the kabi-whitelists package (that is, the /lib/modules/kabi/ directory).
enforce=value Allows you to enable or disable enforcing mode. The value must be either 1 (enabled), or 0 (disabled). By default, this option is commented out and the kabi plug-in only displays a warning message.

presto (yum-presto)
The presto plug-in adds support to Yum for downloading delta RPM packages, during updates, from repositories which have presto metadata enabled. Delta RPMs contain only the differences between the version of the package installed on the client requesting the RPM package and the updated version in the repository.
Downloading a delta RPM is much quicker than downloading the entire updated package, and can speed up updates considerably. Once the delta RPMs are downloaded, they must be rebuilt to apply the difference to the currently-installed package and thus create the full, updated package. This process takes CPU time on the installing machine. Using delta RPMs is therefore a tradeoff between time-to-download, which depends on the network connection, and time-to-rebuild, which is CPU-bound. Using the presto plug-in is recommended for fast machines and systems with slower network connections, while slower machines on very fast connections may benefit more from downloading normal RPM packages, that is, by disabling presto.
product-id (subscription-manager)
The product-id plug-in manages product identity certificates for products installed from the Content Delivery Network. The product-id plug-in is installed by default.
Refer to Section 4.14.3, “The Structure of Product Certificates” for more information about product certificates.
protect-packages (yum-plugin-protect-packages)
The protect-packages plug-in prevents the yum package and all packages it depends on from being deliberately or accidentally removed. This prevents many of the most important packages necessary for your system to run from being removed. In addition, you can list more packages, one per line, in the /etc/sysconfig/protected-packages file[1] (which you should create if it does not exist), and protect-packages will extend protection-from-removal to those packages as well.
To temporarily override package protection, use the --override-protection option with an applicable yum command.
refresh-packagekit (PackageKit-yum-plugin)
The refresh-packagekit plug-in updates metadata for PackageKit whenever yum is run. The refresh-packagekit plug-in is installed by default.
rhnplugin (yum-rhn-plugin)
The rhnplugin provides support for connecting to RHN Classic. This allows systems registered with RHN Classic to update and install packages from this system. Note that RHN Classic is only provided for older Red Hat Enterprise Linux systems (that is, Red Hat Enterprise Linux 4.x, Red Hat Enterprise Linux 5.x, and Satellite 5.x) in order to migrate them over to Red Hat Enterprise Linux 6. The rhnplugin is installed by default.
Refer to the rhnplugin(8) manual page for more information about the plug-in. For more information about RHN Classic, see Section 4.1.6, “Certificate-based Red Hat Network versus RHN Classic”.
security (yum-plugin-security)
Discovering information about and applying security updates easily and often is important to all system administrators. For this reason Yum provides the security plug-in, which extends yum with a set of highly-useful security-related commands, subcommands and options.
You can check for security-related updates as follows:
~]# yum check-update --security
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
Updating Red Hat repositories.
INFO:rhsm-app.repolib:repos updated: 0
Limiting package lists to security relevant ones
Needed 3 of 7 packages, for security
elinks.x86_64                   0.12-0.13.el6               rhel
kernel.x86_64                   2.6.30.8-64.el6             rhel
kernel-headers.x86_64           2.6.30.8-64.el6             rhel
You can then use either yum update --security or yum update-minimal --security to update those packages which are affected by security advisories. Both of these commands update all packages on the system for which a security advisory has been issued. yum update-minimal --security updates them to the latest packages which were released as part of a security advisory, while yum update --security will update all packages affected by a security advisory to the latest version of that package available.
In other words, if:
  • the kernel-2.6.30.8-16 package is installed on your system;
  • the kernel-2.6.30.8-32 package was released as a security update;
  • then kernel-2.6.30.8-64 was released as a bug fix update,
...then yum update-minimal --security will update you to kernel-2.6.30.8-32, and yum update --security will update you to kernel-2.6.30.8-64. Conservative system administrators may want to use update-minimal to reduce the risk incurred by updating packages as much as possible.
Refer to the yum-security(8) manual page for usage details and further explanation of the enhancements the security plug-in adds to yum.
subscription-manager (subscription-manager)
The subscription-manager plug-in provides support for connecting to Red Hat Network. This allows systems registered with Red Hat Network to update and install packages from the certificate-based Content Delivery Network. The subscription-manager plug-in is installed by default.
Refer to Chapter 4, Product Subscriptions and Entitlements for more information how to manage product subscriptions and entitlements.

5.5. Additional Resources

http://yum.baseurl.org/wiki/Guides
The Yum Guides section of the Yum wiki contains more documentation.


[1] You can also place files with the extension .list in the /etc/sysconfig/protected-packages.d/ directory (which you should create if it does not exist), and list packages—one per line—in these files. protect-packages will protect these too.

Chapter 6. PackageKit

Red Hat provides PackageKit for viewing, managing, updating, installing and uninstalling packages compatible with your system. PackageKit consists of several graphical interfaces that can be opened from the GNOME panel menu, or from the Notification Area when PackageKit alerts you that updates are available. For more information on PackageKit's architecture and available front ends, refer to Section 6.3, “PackageKit Architecture”.

6.1. Updating Packages with Software Update

PackageKit displays a starburst icon in the Notification Area whenever updates are available to be installed on your system.
PackageKit's icon in the Notification Area
PackageKit's icon in the Notification Area.
Figure 6.1. PackageKit's icon in the Notification Area

Clicking on the notification icon opens the Software Update window. Alternatively, you can open Software Updates by clicking SystemAdministrationSoftware Update from the GNOME panel, or running the gpk-update-viewer command at the shell prompt. In the Software Updates window, all available updates are listed along with the names of the packages being updated (minus the .rpm suffix, but including the CPU architecture), a short summary of the package, and, usually, short descriptions of the changes the update provides. Any updates you do not wish to install can be de-selected here by unchecking the checkbox corresponding to the update.
Installing updates with Software Update
Installing updates with PackageKit's Software Update window.
Figure 6.2. Installing updates with Software Update

The updates presented in the Software Updates window only represent the currently-installed packages on your system for which updates are available; dependencies of those packages, whether they are existing packages on your system or new ones, are not shown until you click Install Updates.
PackageKit utilizes the fine-grained user authentication capabilities provided by the PolicyKit toolkit whenever you request it to make changes to the system. Whenever you instruct PackageKit to update, install or remove packages, you will be prompted to enter the superuser password before changes are made to the system.
If you instruct PackageKit to update the kernel package, then it will prompt you after installation, asking you whether you want to reboot the system and thereby boot into the newly-installed kernel.

Setting the Update-Checking Interval

Right-clicking on PackageKit's Notification Area icon and clicking Preferences opens the Software Update Preferences window, where you can define the interval at which PackageKit checks for package updates, as well as whether or not to automatically install all updates or only security updates. Leaving the Check for updates when using mobile broadband box unchecked is handy for avoiding extraneous bandwidth usage when using a wireless connection on which you are charged for the amount of data you download.
Setting PackageKit's update-checking interval
Setting the update-checking interval for packagekit by right-clicking on the notification area applet.
Figure 6.3. Setting PackageKit's update-checking interval

6.2. Using Add/Remove Software

PackageKit's Software Update GUI window is a separate application from its Add/Remove Software application, although the two have intuitively similar interfaces. To find and install a new package, on the GNOME panel click on SystemAdministrationAdd/Remove Software, or run the gpk-application command at the shell prompt.
PackageKit's Add/Remove Software window
Viewing PackageKit's Add/Remove Software window.
Figure 6.4. PackageKit's Add/Remove Software window

6.2.1. Refreshing Software Sources (Yum Repositories)

PackageKit refers to Yum repositories as software sources. It obtains all packages from enabled software sources. You can view the list of all configured and unfiltered (see below) Yum repositories by opening Add/Remove Software and clicking SystemSoftware sources. The Software Sources dialog shows the repository name, as written on the name=<My Repository Name> field of all [repository] sections in the /etc/yum.conf configuration file, and in all repository.repo files in the /etc/yum.repos.d/ directory.
Entries which are checked in the Enabled column indicate that the corresponding repository will be used to locate packages to satisfy all update and installation requests (including dependency resolution). The Enabled column corresponds to the enabled=<1 or 0> field in [repository] sections. Checking an unchecked box enables the Yum repository, and unchecking it disables it. Performing either function causes PolicyKit to prompt for superuser authentication to enable or disable the repository. PackageKit actually inserts the enabled=<1 or 0> line into the correct [repository] section if it does not exist, or changes the value if it does. This means that enabling or disabling a repository through the Software Sources window causes that change to persist after closing the window or rebooting the system. The ability to quickly enable and disable repositories based on our needs is a highly-convenient feature of PackageKit.
Note that it is not possible to add or remove Yum repositories through PackageKit.

Showing source RPM, test and debuginfo repositories

Checking the box at the bottom of the Software Sources window causes PackageKit to display source RPM, testing and debuginfo repositories as well. This box is unchecked by default.
After enabling and/or disabling the correct Yum repositories, ensure that you have the latest list of available packages. Click on SystemRefresh package lists and PackageKit will obtain the latest lists of packages from all enabled software sources, i.e. Yum repositories.

6.2.2. Finding Packages with Filters

Once the software sources have been updated, it is often beneficial to apply some filters so that PackageKit retrieves the results of our Find queries faster. This is especially helpful when performing many package searches. Four of the filters in the Filters drop-down menu are used to split results by matching or not matching a single criterion. By default when PackageKit starts, these filters are all unapplied (No filter), but once you do filter by one of them, that filter remains set until you either change it or close PackageKit.
Because you are usually searching for available packages that are not installed on the system, click FiltersInstalled and select the Only available radio button.
Filtering out already-installed packages
Filtering out packages which are already installed.
Figure 6.5. Filtering out already-installed packages

Also, unless we require development files such as C header files, we can filter for Only end user files and, in doing so, filter out all of the <package_name>-devel packages we are not interested in.
Filtering out development packages from the list of Find results
Filtering out development packages from our results.
Figure 6.6. Filtering out development packages from the list of Find results

The two remaining filters with submenus are:
Graphical
Narrows the search to either applications which provide a GUI interface (Only graphical) or those that do not. This filter is useful when browsing for GUI applications that perform a specific function.
Free
Search for packages which are considered to be free software. Refer to the Fedora Licensing List for details on approved licenses.
The remaining checkbox filters are always either checked or unchecked. They are:
Hide subpackages
Checking the Hide subpackages checkbox filters out generally-uninteresting packages that are typically only dependencies of other packages that we want. For example, checking Hide subpackages and searching for <package> would cause the following related packages to be filtered out of the Find results (if it exists):
  • <package>-devel
  • <package>-libs
  • <package>-libs-devel
  • <package>-debuginfo
Only Newest Packages
Checking Only newest packages filters out all older versions of the same package from the list of results, which is generally what we want.

Using the Only newest packages filter

Checking Only newest packages filters out all but the most recent version of any package from the results list. This filter is often combined with the Only available filter to search for the latest available versions of new (not installed) packages.
Only native packages
Checking the Only native packages box on a multilib system causes PackageKit to omit listing results for packages compiled for the architecture that runs in compatibility mode. For example, enabling this filter on a 64-bit system with an AMD64 CPU would cause all packages built for the 32-bit x86 CPU architecture not to be shown in the list of results, even though those packages are able to run on an AMD64 machine. Packages which are architecture-agnostic (i.e. noarch packages such as crontabs-1.10-32.1.el6.noarch.rpm) are never filtered out by checking Only native packages. This filter has no affect on non-multilib systems, such as x86 machines.

6.2.3. Installing and Removing Packages (and Dependencies)

With the two filters selected, Only available and Only end user files, search for the screen window manager for the command line and highlight the package. You now have access to some very useful information about it, including: a clickable link to the project homepage; the Yum package group it is found in, if any; the license of the package; a pointer to the GNOME menu location from where the application can be opened, if applicable; and the size of the package, which is relevant when we download and install it.
Viewing and installing a package with PackageKit's Add/Remove Software window
Viewing and installing a package with PackageKit's Add/Remove Software window.
Figure 6.7. Viewing and installing a package with PackageKit's Add/Remove Software window

When the checkbox next to a package or group is checked, then that item is already installed on the system. Checking an unchecked box causes it to be marked for installation, which only occurs when the Apply button is clicked. In this way, you can search for and select multiple packages or package groups before performing the actual installation transactions. Additionally, you can remove installed packages by unchecking the checked box, and the removal will occur along with any pending installations when Apply is pressed. Dependency resolution, which may add additional packages to be installed or removed, is performed after pressing Apply. PackageKit will then display a window listing those additional packages to install or remove, and ask for confirmation to proceed.
Check screen and click the Apply button. You will then be prompted for the superuser password; enter it, and PackageKit will install screen. One nice feature of PackageKit is that, following installation, it sometimes presents you with a list of your newly-installed applications and offers you the choice of running them immediately. Alternatively, you will remember that finding a package and selecting it in the Add/Remove Software window shows you the Location of where in the GNOME menus its application shortcut is located, which is helpful when you want to run it.
Once it is installed, you can run screen, a screen manager that allows you to have multiple logins on one terminal, by typing screen at a shell prompt.
screen is nifty, but we decide that we do not need it and we want to uninstall it. Remembering that we need to change the Only available filter we recently used to install it to Only installed in FiltersInstalled, we search for screen again and uncheck it. The program did not install any dependencies of its own; if it had, those would be automatically removed as well, as long as they were not also dependencies of any other packages still installed on our system.

Removing a package when other packages depend on it

Although PackageKit automatically resolves dependencies during package installation and removal, it is unable to remove a package without also removing packages which depend on it. This type of operation can only be performed by RPM, is not advised, and can potentially leave your system in a non-functioning state or cause applications to misbehave and/or crash.
Removing a package with PackageKit's Add/Remove Software window
Removing a package with PackageKit's Add/Remove Software window.
Figure 6.8. Removing a package with PackageKit's Add/Remove Software window

6.2.4. Installing and Removing Package Groups

PackageKit also has the ability to install Yum package groups, which it calls Package collections. Clicking on Package collections in the top-left list of categories in the Software Updates window allows us to scroll through and find the package group we want to install. In this case, we want to install Czech language support (the Czech Support group). Checking the box and clicking apply informs us how many additional packages must be installed in order to fulfill the dependencies of the package group.
Installing the Czech Support package group
Install Czech language support with PackageKit's Add/Remove Software window.
Figure 6.9. Installing the Czech Support package group

Similarly, installed package groups can be uninstalled by selecting Package collections, unchecking the appropriate checkbox, and applying.

6.2.5. Viewing the Transaction Log

PackageKit maintains a log of the transactions that it performs. To view the log, from the Add/Remove Software window, click SystemSoftware log, or run the gpk-log command at the shell prompt.
The Software Log Viewer shows the Action, such as Updated packages or Installed packages, the Date on which that action was performed, the Username of the user who performed the action, and the front end Application the user used (such as Update System). The Details column provides the types of the transactions, such as Updated, Installed or Removed, as well as the list of packages the transactions were performed on.
Typing the name of a package in the top text entry field filters the list of transactions to those which affected that package.
Viewing the log of package management transactions with the Software Log Viewer
Viewing the log of package management transactions with PackageKit's Software Log viewer window.
Figure 6.10. Viewing the log of package management transactions with the Software Log Viewer

6.3. PackageKit Architecture

Red Hat provides the PackageKit suite of applications for viewing, updating, installing and uninstalling packages and package groups compatible with your system. Architecturally, PackageKit consists of several graphical front ends that communicate with the packagekitd daemon back end, which communicates with a package manager-specific back end that utilizes Yum to perform the actual transactions, such as installing and removing packages, etc.
Table 6.1, “PackageKit GUI windows, menu locations, and shell prompt commands” shows the name of the GUI window, how to start the window from the GNOME desktop or from the Add/Remove Software window, and the name of the command line application that opens that window.
Table 6.1. PackageKit GUI windows, menu locations, and shell prompt commands
Window Title Function How to Open Shell Command
Add/Remove Software Install, remove or view package info
From the GNOME panel: SystemAdministrationAdd/Remove Software
gpk-application
Software Update Perform package updates
From the GNOME panel: SystemAdministrationSoftware Update
gpk-update-viewer
Software Sources Enable and disable Yum repositories
From Add/Remove Software: SystemSoftware Sources
gpk-repo
Software Log Viewer View the transaction log
From Add/Remove Software: SystemSoftware Log
gpk-log
Software Update Preferences Set PackageKit preferences gpk-prefs
(Notification Area Alert) Alerts you when updates are available
From the GNOME panel: SystemPreferencesStartup Applications, the Startup Programs tab
gpk-update-icon

The packagekitd daemon runs outside the user session and communicates with the various graphical front ends. The packagekitd daemon[2] communicates via the DBus system message bus with another back end, which utilizes Yum's Python API to perform queries and make changes to the system. On Linux systems other than Red Hat and Fedora, packagekitd can communicate with other back ends that are able to utilize the native package manager for that system. This modular architecture provides the abstraction necessary for the graphical interfaces to work with many different package managers to perform essentially the same types of package management tasks. Learning how to use the PackageKit front ends means that you can use the same familiar graphical interface across many different Linux distributions, even when they utilize a native package manager other than Yum.
In addition, PackageKit's separation of concerns provides reliability in that a crash of one of the GUI windows—or even the user's X Window session—will not affect any package management tasks being supervised by the packagekitd daemon, which runs outside of the user session.
All of the front end graphical applications discussed in this chapter are provided by the gnome-packagekit package instead of by PackageKit and its dependencies.
Finally, PackageKit also comes with a console-based front end called pkcon.

6.4. Additional Resources

PackageKit home page — http://www.packagekit.org/index.html
Information about and mailing lists for PackageKit.
PackageKit FAQ — http://www.packagekit.org/pk-faq.html
An informative list of Frequently Asked Questions for the PackageKit software suite.
PackageKit Feature Matrix — http://www.packagekit.org/pk-matrix.html
Cross-reference PackageKit-provided features with the long list of package manager back ends.


[2] System daemons are typically long-running processes that provide services to the user or to other programs, and which are started, often at boot time, by special initialization scripts (often shortened to init scripts). Daemons respond to the service command and can be turned on or off permanently by using the chkconfig on or chkconfig offcommands. They can typically be recognized by a d appended to their name, such as the packagekitd daemon. Refer to Chapter 9, Services and Daemons for information about system services.

Part III. Networking

Chapter 7. NetworkManager

NetworkManager is a dynamic network control and configuration system that attempts to keep network devices and connections up and active when they are available. NetworkManager consists of a core daemon, a GNOME Notification Area applet that provides network status information, and graphical configuration tools that can create, edit and remove connections and interfaces. NetworkManager can be used to configure the following types of connections: Ethernet, wireless, mobile broadband (such as cellular 3G), and DSL and PPPoE (Point-to-Point over Ethernet). In addition, NetworkManager allows for the configuration of network aliases, static routes, DNS information and VPN connections, as well as many connection-specific parameters. Finally, NetworkManager provides a rich API via D-Bus which allows applications to query and control network configuration and state.
Previous versions of Red Hat Enterprise Linux shipped with the Network Administration Tool, which was commonly known as system-config-network after its command line invocation. In Red Hat Enterprise Linux 6, NetworkManager replaces the former Network Administration Tool while providing enhanced functionality, such as user-specific and mobile broadband configuration. It is also possible to configure the network in Red Hat Enterprise Linux 6 by editing interface configuration files; refer to Chapter 8, Network Interfaces for more information.
NetworkManager may be installed by default on Red Hat Enterprise Linux. To ensure that it is, first run the following command as the root user:
~]# yum install NetworkManager

7.1. The NetworkManager Daemon

The NetworkManager daemon runs with root privileges and is usually configured to start up at boot time. You can determine whether the NetworkManager daemon is running by entering this command as root:
~]# service NetworkManager status
NetworkManager (pid  1527) is running...
The service command will report NetworkManager is stopped if the NetworkManager service is not running. To start it for the current session:
~]# service NetworkManager start
Run the chkconfig command to ensure that NetworkManager starts up every time the system boots:
~]# chkconfig NetworkManager on
For more information on starting, stopping and managing services and runlevels, refer to Chapter 9, Services and Daemons.

7.2. Interacting with NetworkManager

Users do not interact with the NetworkManager system service directly. Instead, you can perform network configuration tasks via NetworkManager's Notification Area applet. The applet has multiple states that serve as visual indicators for the type of connection you are currently using. Hover the pointer over the applet icon for tooltip information on the current connection state.
NetworkManager applet states
If you do not see the NetworkManager applet in the GNOME panel, and assuming that the NetworkManager package is installed on your system, you can start the applet by running the following command as a normal user (not root):
~]$ nm-applet &
After running this command, the applet appears in your Notification Area. You can ensure that the applet runs each time you log in by clicking SystemPreferencesStartup Applications to open the Startup Applications Preferences window. Then, select the Startup Programs tab and check the box next to NetworkManager.

7.2.1. Connecting to a Network

When you left-click on the applet icon, you are presented with:
  • a list of categorized networks you are currently connected to (such as Wired and Wireless);
  • a list of all Available Networks NetworkManager has detected;
  • options for connecting to any configured Virtual Private Networks (VPNs); and,
  • options for connecting to hidden or new wireless networks.
When many networks are available (as when there are many wireless access points in the area), the More networks expandable menu entry appears. If you are connected to a network, its name is presented in bold typeface under its network type, such as Wired or Wireless.
The NetworkManager applet's left-click menu, showing all available and connected-to networks

7.2.2. Configuring New and Editing Existing Connections

Next, right-click on the NetworkManager applet to open its context menu, which is the main point of entry for interacting with NetworkManager to configure connections.
The NetworkManager applet's context menu
Ensure that the Enable Networking box is checked. if the system has detected a wireless card, then you will also see an Enable Wireless menu option. Check the Enable Wireless checkbox as well. NetworkManager notifies you of network connection status changes if you check the Enable Notifications box. Clicking the Connection Information entry presents an informative Connection Information window that lists the connection type and interface, your IP address and routing details, and so on. Useful network information is thus always two clicks away.
Finally, clicking on Edit Connections opens the Network Connections window, from where you can perform most of your network configuration tasks. Note that this window can also be opened by running, as a normal user:
~]$ nm-connection-editor &
Configure networks using the Network Connections window

7.2.3. Connecting to a Network Automatically

For any connection type you add or configure, you can choose whether you want NetworkManager to try to connect to that network automatically when it is available.
Procedure 7.1. Configuring NetworkManager to Connect to a Network Automatically When Detected
  1. Right-click on the NetworkManager applet icon in the Notification Area and click Edit Connections. The Network Connections window appears.
  2. Select the tab for the type of network connection you want to configure.
  3. Select the specific connection that you want to configure and click Edit.
  4. Check Connect automatically to cause NetworkManager to auto-connect to the connection whenever NetworkManager detects that it is available. Uncheck the checkbox if you do not want NetworkManager to connect automatically. If the box is unchecked, you will have to select that connection manually in the NetworkManager applet's left-click menu to cause it to connect.

7.2.4. User and System Connections

NetworkManager connections are always either user connections or system connections. Depending on the system-specific policy that the administrator has configured, users may need root privileges to create and modify system connections. NetworkManager's default policy enables users to create and modify user connections, but requires them to have root privileges to add, modify or delete system connections.
User connections are so-called because they are specific to the user who creates them. In contrast to system connections, whose configurations are stored under the /etc/sysconfig/network-scripts/ directory (mainly in ifcfg-<network_type> interface configuration files), user connection settings are stored in the GConf configuration database and the GNOME keyring, and are only available during login sessions for the user who created them. Thus, logging out of the desktop session causes user-specific connections to become unavailable.

Increase security by making VPN connections user-specific

Because NetworkManager uses the GConf and GNOME keyring applications to store user connection settings, and because these settings are specific to your desktop session, it is highly recommended to configure your personal VPN connections as user connections. If you do so, other non-root users on the system cannot view or access these connections in any way.
System connections, on the other hand, become available at boot time and can be used by other users on the system without first logging in to a desktop session.
NetworkManager can quickly and conveniently convert user to system connections and vice versa. Converting a user connection to a system connection causes NetworkManager to create the relevant interface configuration files under the /etc/sysconfig/network-scripts/ directory, and to delete the GConf settings from the user's session. Conversely, converting a system to a user-specific connection causes NetworkManager to remove the system-wide configuration files and create the corresponding GConf/GNOME keyring settings.
The Available to all users checkbox controls whether connections are user-specific or system-wide
Procedure 7.2. Changing a Connection to be User-Specific instead of System-Wide, or Vice-Versa

Depending on the system's policy, root privileges may be required

As discussed, you may need root privileges on the system in order to change whether a connection is user-specific or system-wide.
  1. Right-click on the NetworkManager applet icon in the Notification Area and click Edit Connections. The Network Connections window appears.
  2. Select the tab for the type of network connection you want to configure.
  3. Select the specific connection that you want to configure and click Edit.
  4. Check the Available to all users checkbox to ask NetworkManager to make the connection a system-wide connection. Depending on system policy, you may then be prompted for the root password by the PolicyKit application. If so, enter the root password to finalize the change.
    Conversely, uncheck the Available to all users checkbox to make the connection user-specific.

Chapter 8. Network Interfaces

Under Red Hat Enterprise Linux, all network communications occur between configured software interfaces and physical networking devices connected to the system.
The configuration files for network interfaces are located in the /etc/sysconfig/network-scripts/ directory. The scripts used to activate and deactivate these network interfaces are also located here. Although the number and type of interface files can differ from system to system, there are three categories of files that exist in this directory:
  1. Interface configuration files
  2. Interface control scripts
  3. Network function files
The files in each of these categories work together to enable various network devices.
This chapter explores the relationship between these files and how they are used.

8.1. Network Configuration Files

Before delving into the interface configuration files, let us first itemize the primary configuration files used in network configuration. Understanding the role these files play in setting up the network stack can be helpful when customizing a Red Hat Enterprise Linux system.
The primary network configuration files are as follows:
/etc/hosts
The main purpose of this file is to resolve hostnames that cannot be resolved any other way. It can also be used to resolve hostnames on small networks with no DNS server. Regardless of the type of network the computer is on, this file should contain a line specifying the IP address of the loopback device (127.0.0.1) as localhost.localdomain. For more information, refer to the hosts(5) manual page.
/etc/resolv.conf
This file specifies the IP addresses of DNS servers and the search domain. Unless configured to do otherwise, the network initialization scripts populate this file. For more information about this file, refer to the resolv.conf(5) manual page.
/etc/sysconfig/network
This file specifies routing and host information for all network interfaces. For more information about this file and the directives it accepts, refer to Section D.1.13, “/etc/sysconfig/network”.
/etc/sysconfig/network-scripts/ifcfg-interface-name
For each network interface, there is a corresponding interface configuration script. Each of these files provide information specific to a particular network interface. Refer to Section 8.2, “Interface Configuration Files” for more information on this type of file and the directives it accepts.

Network interface names

Network interface names may be different on different hardware types. Refer to Appendix A, Consistent Network Device Naming for more information.

The /etc/sysconfig/networking/ directory

The /etc/sysconfig/networking/ directory is used by the Network Administration Tool (system-config-network) and its contents should not be edited manually. Using only one method for network configuration is strongly encouraged, due to the risk of configuration deletion. For more information about configuring network interfaces using the Network Administration Tool, refer to Chapter 7, NetworkManager.

8.2. Interface Configuration Files

Interface configuration files control the software interfaces for individual network devices. As the system boots, it uses these files to determine what interfaces to bring up and how to configure them. These files are usually named ifcfg-name, where name refers to the name of the device that the configuration file controls.

8.2.1. Ethernet Interfaces

One of the most common interface files is ifcfg-eth0, which controls the first Ethernet network interface card or NIC in the system. In a system with multiple NICs, there are multiple ifcfg-ethX files (where X is a unique number corresponding to a specific interface). Because each device has its own configuration file, an administrator can control how each interface functions individually.
The following is a sample ifcfg-eth0 file for a system using a fixed IP address:
DEVICE=eth0
BOOTPROTO=none
ONBOOT=yes
NETMASK=255.255.255.0
IPADDR=10.0.1.27
USERCTL=no
The values required in an interface configuration file can change based on other values. For example, the ifcfg-eth0 file for an interface using DHCP looks different because IP information is provided by the DHCP server:
DEVICE=eth0
BOOTPROTO=dhcp
ONBOOT=yes
The Network Administration Tool (system-config-network) is an easy way to make changes to the various network interface configuration files (refer to Chapter 7, NetworkManager for detailed instructions on using this tool).
However, it is also possible to manually edit the configuration files for a given network interface.
Below is a listing of the configurable parameters in an Ethernet interface configuration file:
BONDING_OPTS=parameters
sets the configuration parameters for the bonding device, and is used in /etc/sysconfig/network-scripts/ifcfg-bondN (see Section 8.2.2, “Channel Bonding Interfaces”). These parameters are identical to those used for bonding devices in /sys/class/net/bonding_device/bonding, and the module parameters for the bonding driver as described in bonding Module Directives.
This configuration method is used so that multiple bonding devices can have different configurations. It is highly recommended to place all of your bonding options after the BONDING_OPTS directive in ifcfg-name. Do not specify options for the bonding device in /etc/modprobe.d/bonding.conf, or in the deprecated /etc/modprobe.conf file.
BOOTPROTO=protocol
where protocol is one of the following:
  • none — No boot-time protocol should be used.
  • bootp — The BOOTP protocol should be used.
  • dhcp — The DHCP protocol should be used.
BROADCAST=address
where address is the broadcast address. This directive is deprecated, as the value is calculated automatically with ipcalc.
DEVICE=name
where name is the name of the physical device (except for dynamically-allocated PPP devices where it is the logical name).
DHCP_HOSTNAME=name
where name is a short hostname to be sent to the DHCP server. Use this option only if the DHCP server requires the client to specify a hostname before receiving an IP address.
DNS{1,2}=address
where address is a name server address to be placed in /etc/resolv.conf if the PEERDNS directive is set to yes.
ETHTOOL_OPTS=options
where options are any device-specific options supported by ethtool. For example, if you wanted to force 100Mb, full duplex:
ETHTOOL_OPTS="autoneg off speed 100 duplex full"
Instead of a custom initscript, use ETHTOOL_OPTS to set the interface speed and duplex settings. Custom initscripts run outside of the network init script lead to unpredictable results during a post-boot network service restart.

Set autoneg off before changing speed or duplex settings

Changing speed or duplex settings almost always requires disabling autonegotiation with the autoneg off option. This needs to be stated first, as the option entries are order-dependent.
GATEWAY=address
where address is the IP address of the network router or gateway device (if any).
HOTPLUG=answer
where answer is one of the following:
  • yes — This device should be activated when it is hot-plugged (this is the default option).
  • no — This device should not be activated when it is hot-plugged.
The HOTPLUG=no option can be used to prevent a channel bonding interface from being activated when a bonding kernel module is loaded.
Refer to Section 8.2.2, “Channel Bonding Interfaces” for more about channel bonding interfaces.
HWADDR=MAC-address
where MAC-address is the hardware address of the Ethernet device in the form AA:BB:CC:DD:EE:FF. This directive must be used in machines containing more than one NIC to ensure that the interfaces are assigned the correct device names regardless of the configured load order for each NIC's module. This directive should not be used in conjunction with MACADDR.
IPADDR=address
where address is the IP address.
LINKDELAY=time
where time is the number of seconds to wait for link negotiation before configuring the device.
MACADDR=MAC-address
where MAC-address is the hardware address of the Ethernet device in the form AA:BB:CC:DD:EE:FF. This directive is used to assign a MAC address to an interface, overriding the one assigned to the physical NIC. This directive should not be used in conjunction with HWADDR.
MASTER=bond-interface
where bond-interface is the channel bonding interface to which the Ethernet interface is linked.
This directive is used in conjunction with the SLAVE directive.
Refer to Section 8.2.2, “Channel Bonding Interfaces” for more information about channel bonding interfaces.
NETMASK=mask
where mask is the netmask value.
NETWORK=address
where address is the network address. This directive is deprecated, as the value is calculated automatically with ipcalc.
ONBOOT=answer
where answer is one of the following:
  • yes — This device should be activated at boot-time.
  • no — This device should not be activated at boot-time.
PEERDNS=answer
where answer is one of the following:
  • yes — Modify /etc/resolv.conf if the DNS directive is set. If using DHCP, then yes is the default.
  • no — Do not modify /etc/resolv.conf.
SLAVE=answer
where answer is one of the following:
  • yes — This device is controlled by the channel bonding interface specified in the MASTER directive.
  • no — This device is not controlled by the channel bonding interface specified in the MASTER directive.
This directive is used in conjunction with the MASTER directive.
Refer to Section 8.2.2, “Channel Bonding Interfaces” for more about channel bonding interfaces.
SRCADDR=address
where address is the specified source IP address for outgoing packets.
USERCTL=answer
where answer is one of the following:
  • yes — Non-root users are allowed to control this device.
  • no — Non-root users are not allowed to control this device.

8.2.2. Channel Bonding Interfaces

Red Hat Enterprise Linux allows administrators to bind multiple network interfaces together into a single channel using the bonding kernel module and a special network interface called a channel bonding interface. Channel bonding enables two or more network interfaces to act as one, simultaneously increasing the bandwidth and providing redundancy.
To create a channel bonding interface, create a file in the /etc/sysconfig/network-scripts/ directory called ifcfg-bondN, replacing N with the number for the interface, such as 0.
The contents of the file can be identical to whatever type of interface is getting bonded, such as an Ethernet interface. The only difference is that the DEVICE directive must be bondN, replacing N with the number for the interface.
The following is a sample channel bonding configuration file:
Example 8.1. Sample ifcfg-bond0 interface configuration file
DEVICE=bond0
IPADDR=192.168.1.1
NETMASK=255.255.255.0
ONBOOT=yes
BOOTPROTO=none
USERCTL=no
BONDING_OPTS="bonding parameters separated by spaces"

After the channel bonding interface is created, the network interfaces to be bound together must be configured by adding the MASTER and SLAVE directives to their configuration files. The configuration files for each of the channel-bonded interfaces can be nearly identical.
For example, if two Ethernet interfaces are being channel bonded, both eth0 and eth1 may look like the following example:
DEVICE=ethN
BOOTPROTO=none
ONBOOT=yes
MASTER=bond0
SLAVE=yes
USERCTL=no
In this example, replace N with the numerical value for the interface.
For a channel bonding interface to be valid, the kernel module must be loaded. To ensure that the module is loaded when the channel bonding interface is brought up, create a new file as root named bonding.conf in the /etc/modprobe.d/ directory. Note that you can name this file anything you like as long as it ends with a .conf extension. Insert the following line in this new file:
alias bondN bonding
Replace N with the interface number, such as 0. For each configured channel bonding interface, there must be a corresponding entry in your new /etc/modprobe.d/bonding.conf file.

Put all bonding module parameters in ifcfg-bondN files

Parameters for the bonding kernel module must be specified as a space-separated list in the BONDING_OPTS="bonding parameters" directive in the ifcfg-bondN interface file. Do not specify options for the bonding device in /etc/modprobe.d/bonding.conf, or in the deprecated /etc/modprobe.conf file. For further instructions and advice on configuring the bonding module and to view the list of bonding parameters, refer to Section 24.7.2, “Using Channel Bonding”.

8.2.3. Alias and Clone Files

Two lesser-used types of interface configuration files are alias and clone files.
Alias interface configuration files, which are used to bind multiple addresses to a single interface, use the ifcfg-if-name:alias-value naming scheme.
For example, an ifcfg-eth0:0 file could be configured to specify DEVICE=eth0:0 and a static IP address of 10.0.0.2, serving as an alias of an Ethernet interface already configured to receive its IP information via DHCP in ifcfg-eth0. Under this configuration, eth0 is bound to a dynamic IP address, but the same physical network card can receive requests via the fixed, 10.0.0.2 IP address.

Warning

Alias interfaces do not support DHCP.
A clone interface configuration file should use the following naming convention: ifcfg-if-name-clone-name. While an alias file allows multiple addresses for an existing interface, a clone file is used to specify additional options for an interface. For example, a standard DHCP Ethernet interface called eth0, may look similar to this:
DEVICE=eth0
ONBOOT=yes
BOOTPROTO=dhcp
Since the default value for the USERCTL directive is no if it is not specified, users cannot bring this interface up and down. To give users the ability to control the interface, create a clone by copying ifcfg-eth0 to ifcfg-eth0-user and add the following line to ifcfg-eth0-user:
USERCTL=yes
This way a user can bring up the eth0 interface using the /sbin/ifup eth0-user command because the configuration options from ifcfg-eth0 and ifcfg-eth0-user are combined. While this is a very basic example, this method can be used with a variety of options and interfaces.
The easiest way to create alias and clone interface configuration files is to use the graphical Network Administration Tool. For more information on using this tool, refer to Chapter 7, NetworkManager.

8.2.4. Dialup Interfaces

If you are connecting to the Internet via a dialup connection, a configuration file is necessary for the interface.
PPP interface files are named using the following format:
ifcfg-pppX
where X is a unique number corresponding to a specific interface.
The PPP interface configuration file is created automatically when wvdial, the Network Administration Tool or Kppp is used to create a dialup account. It is also possible to create and edit this file manually.
The following is a typical ifcfg-ppp0 file:
DEVICE=ppp0
NAME=test
WVDIALSECT=test
MODEMPORT=/dev/modem
LINESPEED=115200
PAPNAME=test
USERCTL=true
ONBOOT=no
PERSIST=no
DEFROUTE=yes
PEERDNS=yes
DEMAND=no
IDLETIMEOUT=600
Serial Line Internet Protocol (SLIP) is another dialup interface, although it is used less frequently. SLIP files have interface configuration file names such as ifcfg-sl0.
Other options that may be used in these files include:
DEFROUTE=answer
where answer is one of the following:
  • yes — Set this interface as the default route.
  • no — Do not set this interface as the default route.
DEMAND=answer
where answer is one of the following:
  • yes — This interface allows pppd to initiate a connection when someone attempts to use it.
  • no — A connection must be manually established for this interface.
IDLETIMEOUT=value
where value is the number of seconds of idle activity before the interface disconnects itself.
INITSTRING=string
where string is the initialization string passed to the modem device. This option is primarily used in conjunction with SLIP interfaces.
LINESPEED=value
where value is the baud rate of the device. Possible standard values include 57600, 38400, 19200, and 9600.
MODEMPORT=device
where device is the name of the serial device that is used to establish the connection for the interface.
MTU=value
where value is the Maximum Transfer Unit (MTU) setting for the interface. The MTU refers to the largest number of bytes of data a frame can carry, not counting its header information. In some dialup situations, setting this to a value of 576 results in fewer packets dropped and a slight improvement to the throughput for a connection.
NAME=name
where name is the reference to the title given to a collection of dialup connection configurations.
PAPNAME=name
where name is the username given during the Password Authentication Protocol (PAP) exchange that occurs to allow connections to a remote system.
PERSIST=answer
where answer is one of the following:
  • yes — This interface should be kept active at all times, even if deactivated after a modem hang up.
  • no — This interface should not be kept active at all times.
REMIP=address
where address is the IP address of the remote system. This is usually left unspecified.
WVDIALSECT=name
where name associates this interface with a dialer configuration in /etc/wvdial.conf. This file contains the phone number to be dialed and other important information for the interface.

8.2.5. Other Interfaces

Other common interface configuration files include the following:
ifcfg-lo
A local loopback interface is often used in testing, as well as being used in a variety of applications that require an IP address pointing back to the same system. Any data sent to the loopback device is immediately returned to the host's network layer.

Do not manually edit the ifcfg-lo script

The loopback interface script, /etc/sysconfig/network-scripts/ifcfg-lo, should never be edited manually. Doing so can prevent the system from operating correctly.
ifcfg-irlan0
An infrared interface allows information between devices, such as a laptop and a printer, to flow over an infrared link. This works in a similar way to an Ethernet device except that it commonly occurs over a peer-to-peer connection.
ifcfg-plip0
A Parallel Line Interface Protocol (PLIP) connection works much the same way as an Ethernet device, except that it utilizes a parallel port.

8.3. Interface Control Scripts

The interface control scripts activate and deactivate system interfaces. There are two primary interface control scripts that call on control scripts located in the /etc/sysconfig/network-scripts/ directory: /sbin/ifdown and /sbin/ifup.
The ifup and ifdown interface scripts are symbolic links to scripts in the /sbin/ directory. When either of these scripts are called, they require the value of the interface to be specified, such as:
ifup eth0

Use the ifup and ifdown interface scripts

The ifup and ifdown interface scripts are the only scripts that the user should use to bring up and take down network interfaces.
The following scripts are described for reference purposes only.
Two files used to perform a variety of network initialization tasks during the process of bringing up a network interface are /etc/rc.d/init.d/functions and /etc/sysconfig/network-scripts/network-functions. Refer to Section 8.5, “Network Function Files” for more information.
After verifying that an interface has been specified and that the user executing the request is allowed to control the interface, the correct script brings the interface up or down. The following are common interface control scripts found within the /etc/sysconfig/network-scripts/ directory:
ifup-aliases
Configures IP aliases from interface configuration files when more than one IP address is associated with an interface.
ifup-ippp and ifdown-ippp
Brings ISDN interfaces up and down.
ifup-ipv6 and ifdown-ipv6
Brings IPv6 interfaces up and down.
ifup-plip
Brings up a PLIP interface.
ifup-plusb
Brings up a USB interface for network connections.
ifup-post and ifdown-post
Contains commands to be executed after an interface is brought up or down.
ifup-ppp and ifdown-ppp
Brings a PPP interface up or down.
ifup-routes
Adds static routes for a device as its interface is brought up.
ifdown-sit and ifup-sit
Contains function calls related to bringing up and down an IPv6 tunnel within an IPv4 connection.
ifup-wireless
Brings up a wireless interface.

Be careful when removing or modifying network scripts!

Removing or modifying any scripts in the /etc/sysconfig/network-scripts/ directory can cause interface connections to act irregularly or fail. Only advanced users should modify scripts related to a network interface.
The easiest way to manipulate all network scripts simultaneously is to use the /sbin/service command on the network service (/etc/rc.d/init.d/network), as illustrated the following command:
/sbin/service network action
Here, action can be either start, stop, or restart.
To view a list of configured devices and currently active network interfaces, use the following command:
/sbin/service network status

8.4. Configuring Static Routes

If static routes are required, they can be configured for each interface. This can be useful if you have multiple interfaces in different subnets. Use the route command to display the IP routing table.
Static route configuration is stored in a /etc/sysconfig/network-scripts/route-interface file. For example, static routes for the eth0 interface would be stored in the /etc/sysconfig/network-scripts/route-eth0 file. The route-interface file has two formats: IP command arguments and network/netmask directives.

IP Command Arguments Format

Define a default gateway on the first line. This is only required if the default gateway is not set via DHCP:
default via X.X.X.X dev interface
X.X.X.X is the IP address of the default gateway. The interface is the interface that is connected to, or can reach, the default gateway.
Define a static route. Each line is parsed as an individual route:
X.X.X.X/X via X.X.X.X dev interface
X.X.X.X/X is the network number and netmask for the static route. X.X.X.X and interface are the IP address and interface for the default gateway respectively. The X.X.X.X address does not have to be the default gateway IP address. In most cases, X.X.X.X will be an IP address in a different subnet, and interface will be the interface that is connected to, or can reach, that subnet. Add as many static routes as required.
The following is a sample route-eth0 file using the IP command arguments format. The default gateway is 192.168.0.1, interface eth0. The two static routes are for the 10.10.10.0/24 and 172.16.1.0/24 networks:
default via 192.168.0.1 dev eth0
10.10.10.0/24 via 192.168.0.1 dev eth0
172.16.1.0/24 via 192.168.0.1 dev eth0
Static routes should only be configured for other subnets. The above example is not necessary, since packets going to the 10.10.10.0/24 and 172.16.1.0/24 networks will use the default gateway anyway. Below is an example of setting static routes to a different subnet, on a machine in a 192.168.0.0/24 subnet. The example machine has an eth0 interface in the 192.168.0.0/24 subnet, and an eth1 interface (10.10.10.1) in the 10.10.10.0/24 subnet:
10.10.10.0/24 via 10.10.10.1 dev eth1

Duplicate default gateways

If the default gateway is already assigned from DHCP, the IP command arguments format can cause one of two errors during start-up, or when bringing up an interface from the down state using the ifup command: "RTNETLINK answers: File exists" or 'Error: either "to" is a duplicate, or "X.X.X.X" is a garbage.', where X.X.X.X is the gateway, or a different IP address. These errors can also occur if you have another route to another network using the default gateway. Both of these errors are safe to ignore.

Network/Netmask Directives Format

You can also use the network/netmask directives format for route-interface files. The following is a template for the network/netmask format, with instructions following afterwards:
ADDRESS0=X.X.X.X NETMASK0=X.X.X.X GATEWAY0=X.X.X.X
  • ADDRESS0=X.X.X.X is the network number for the static route.
  • NETMASK0=X.X.X.X is the netmask for the network number defined with ADDRESS0=X.X.X.X.
  • GATEWAY0=X.X.X.X is the default gateway, or an IP address that can be used to reach ADDRESS0=X.X.X.X
The following is a sample route-eth0 file using the network/netmask directives format. The default gateway is 192.168.0.1, interface eth0. The two static routes are for the 10.10.10.0/24 and 172.16.1.0/24 networks. However, as mentioned before, this example is not necessary as the 10.10.10.0/24 and 172.16.1.0/24 networks would use the default gateway anyway:
ADDRESS0=10.10.10.0
NETMASK0=255.255.255.0
GATEWAY0=192.168.0.1
ADDRESS1=172.16.1.0
NETMASK1=255.255.255.0
GATEWAY1=192.168.0.1
Subsequent static routes must be numbered sequentially, and must not skip any values. For example, ADDRESS0, ADDRESS1, ADDRESS2, and so on.
Below is an example of setting static routes to a different subnet, on a machine in the 192.168.0.0/24 subnet. The example machine has an eth0 interface in the 192.168.0.0/24 subnet, and an eth1 interface (10.10.10.1) in the 10.10.10.0/24 subnet:
ADDRESS0=10.10.10.0
NETMASK0=255.255.255.0
GATEWAY0=10.10.10.1
Note that if DHCP is used, it can assign these settings automatically.

8.5. Network Function Files

Red Hat Enterprise Linux makes use of several files that contain important common functions used to bring interfaces up and down. Rather than forcing each interface control file to contain these functions, they are grouped together in a few files that are called upon when necessary.
The /etc/sysconfig/network-scripts/network-functions file contains the most commonly used IPv4 functions, which are useful to many interface control scripts. These functions include contacting running programs that have requested information about changes in the status of an interface, setting hostnames, finding a gateway device, verifying whether or not a particular device is down, and adding a default route.
As the functions required for IPv6 interfaces are different from IPv4 interfaces, a /etc/sysconfig/network-scripts/network-functions-ipv6 file exists specifically to hold this information. The functions in this file configure and delete static IPv6 routes, create and remove tunnels, add and remove IPv6 addresses to an interface, and test for the existence of an IPv6 address on an interface.

8.6. Additional Resources

The following are resources which explain more about network interfaces.

8.6.1. Installed Documentation

/usr/share/doc/initscripts-version/sysconfig.txt
A guide to available options for network configuration files, including IPv6 options not covered in this chapter.
/usr/share/doc/iproute-version/ip-cref.ps
This file contains a wealth of information about the ip command, which can be used to manipulate routing tables, among other things. Use the ggv or kghostview application to view this file.

Part IV. Infrastructure Services

This part provides information how to configure services and daemons, configure authentication, and enable remote logins.

Table of Contents

9. Services and Daemons
9.1. Configuring the Default Runlevel
9.2. Configuring the Services
9.2.1. Using the Service Configuration Utility
9.2.2. Using the ntsysv Utility
9.2.3. Using the chkconfig Utility
9.3. Running the Services
9.3.1. Checking the Service Status
9.3.2. Running the Service
9.3.3. Stopping the Service
9.3.4. Restarting the Service
9.4. Additional Resources
9.4.1. Installed Documentation
9.4.2. Related Books
10. Configuring Authentication
10.1. Configuring System Authentication
10.1.1. Launching the Authentication Configuration Tool UI
10.1.2. Selecting the Identity Store for Authentication
10.1.3. Configuring Alternative Authentication Features
10.1.4. Configuring Authentication from the Command Line
10.1.5. Using Custom Home Directories
10.2. Using and Caching Credentials with SSSD
10.2.1. About the sssd.conf File
10.2.2. Starting and Stopping SSSD
10.2.3. Configuring Services
10.2.4. Creating Domains
10.2.5. Configuring Access Control for SSSD Domains
10.2.6. Configuring Domain Failover
10.2.7. Deleting Domain Cache Files
10.2.8. Using NSCD with SSSD
10.2.9. Troubleshooting SSSD
11. OpenSSH
11.1. The SSH Protocol
11.1.1. Why Use SSH?
11.1.2. Main Features
11.1.3. Protocol Versions
11.1.4. Event Sequence of an SSH Connection
11.2. Configuring OpenSSH
11.2.1. Configuration Files
11.2.2. Starting an OpenSSH Server
11.2.3. Requiring SSH for Remote Connections
11.2.4. Using a Key-Based Authentication
11.3. OpenSSH Clients
11.3.1. Using the ssh Utility
11.3.2. Using the scp Utility
11.3.3. Using the sftp Utility
11.4. More Than a Secure Shell
11.4.1. X11 Forwarding
11.4.2. Port Forwarding
11.5. Additional Resources
11.5.1. Installed Documentation
11.5.2. Useful Websites

Chapter 9. Services and Daemons

Maintaining security on your system is extremely important, and one approach for this task is to manage access to system services carefully. Your system may need to provide open access to particular services (for example, httpd if you are running a web server). However, if you do not need to provide a service, you should turn it off to minimize your exposure to possible bug exploits.
This chapter explains the concept of runlevels, and describes how to set the default one. It also covers the setup of the services to be run in each of these runlevels, and provides information on how to start, stop, and restart the services on the command line using the service command.

Keep the system secure

When you allow access for new services, always remember that both the firewall and SELinux need to be configured as well. One of the most common mistakes committed when configuring a new service is neglecting to implement the necessary firewall configuration and SELinux policies to allow access for it. Refer to the Red Hat Enterprise Linux Security Guide (see Section 9.4, “Additional Resources”) for more information.

9.1. Configuring the Default Runlevel

A runlevel is a state, or mode, defined by services that are meant to be run when this runlevel is selected. Seven numbered runlevels exist (indexed from 0):
Table 9.1. Runlevels in Red Hat Enterprise Linux
Runlevel Description
0 Used to halt the system. This runlevel is reserved and cannot be changed.
1 Used to run in a single-user mode. This runlevel is reserved and cannot be changed.
2 Not used by default. You are free to define it yourself.
3 Used to run in a full multi-user mode with a command line user interface.
4 Not used by default. You are free to define it yourself.
5 Used to run in a full multi-user mode with a graphical user interface.
6 Used to reboot the system. This runlevel is reserved and cannot be changed.

To check in which runlevel you are operating, type the following:
~]$ runlevel
N 5
The runlevel command displays previous and current runlevel. In this case it is number 5, which means the system is running in a full multi-user mode with a graphical user interface.
The default runlevel can be changed by modifying the /etc/inittab file, which contains a line near the end of the file similar to the following:
id:5:initdefault:
In order to edit this file, you must have superuser privileges. To obtain them, log in as root by typing the following command:
~]$ su -
Password:
Now open the file in a text editor such as vi or nano:
~]# nano /etc/inittab
Then change the number in this line to the desired value and exit the editor. Note that the change does not take effect until you reboot the system.

9.2. Configuring the Services

To allow you to configure which services are started at boot time, Red Hat Enterprise Linux is shipped with the following utilities: the Service Configuration graphical application, the ntsysv text user interface, and the chkconfig command line tool.

Enabling the irqbalance service

To ensure optimal performance on POWER architecture, it is recommended that the irqbalance service is enabled. In most cases, this service is installed and configured to run during the Red Hat Enterprise Linux 6 installation. To verify that irqbalance is running, as root, type the following at a shell prompt:
~]# service irqbalance status
irqbalance (pid  1234) is running...
For information on how to enable and run a service using a graphical user interface, refer to Section 9.2.1, “Using the Service Configuration Utility”. For instructions on how to perform these task on the command line, see Section 9.2.3, “Using the chkconfig Utility” and Section 9.3, “Running the Services” respectively.

9.2.1. Using the Service Configuration Utility

The Service Configuration utility is a graphical application developed by Red Hat to configure which services are started in a particular runlevel, as well as to start, stop, and restart them from the menu.
To start the utility, select SystemAdministrationServices from the panel, or type the command system-config-services at a shell prompt (e.g., xterm or GNOME Terminal).
The Service Configuration utility
The Service Configuration Utility
Figure 9.1. The Service Configuration utility

The utility displays the list of all available services (i.e., both the services from the /etc/rc.d/init.d/ directory, and the services controlled by xinetd) along with their description and the current status. See Table 9.2, “Possible service states” for a complete list of used icons and an explanation of their meaning.
Table 9.2. Possible service states
Icon Description
Green bullet
The service is enabled.
Red bullet
The service is disabled.
Control panel
The service is enabled for selected runlevels only.
Plugged plug
The service is running.
Unplugged plug
The service is stopped.
Exclamation mark
There is something wrong with the service.
Question mark
The status of the service is unknown.

Unless you are already authenticated, you will be prompted to enter the superuser password the first time you make a change:
Authentication Query
Authentication Query
Figure 9.2. Authentication Query

9.2.1.1. Enabling the Service

To enable a service, select it from the list and either click the Enable button on the toolbar, or choose ServiceEnable from the main menu.

9.2.1.2. Disabling the Service

To disable the service, select it from the list and either click the Disable button on the toolbar, or choose ServiceDisable from the main menu.

9.2.1.3. Running the Service

To run the service, select it from the list and either click the Start button on the toolbar, or choose ServiceStart from the main menu. Note that this option is not available for services controlled by xinetd, as they are started by it on demand.

9.2.1.4. Stopping the Service

To stop the service, select it from the list and either click the Stop button on the toolbar, or choose ServiceStop from the main menu. Note that this option is not available for services controlled by xinetd, as they are stopped by it when their job is finished.

9.2.1.5. Restarting the Running Service

To restart the running service, select it from the list and either click the Restart button on the toolbar, or choose ServiceRestart from the main menu. Note that this option is not available for services controlled by xinetd, as they are started and stopped by it automatically.

9.2.1.6. Selecting the Runlevels

To enable the service for certain runlevels only, select it from the list and either click the Customize button on the toolbar, or choose ServiceCustomize from the main menu. Then select the checkbox beside each runlevel in which you want the service to run. Note that this option is not available for services controlled by xinetd.

9.2.2. Using the ntsysv Utility

The ntsysv utility is a command line application with a simple text user interface to configure which services are to be started in selected runlevels. Note that in order to use the utility, you must obtain superuser privileges first:
~]$ su -
Password:
To start the utility, type the following command:
~]# ntsysv
The ntsysv utility
The ntsysv utility
Figure 9.3. The ntsysv utility

The utility displays the list of available services (i.e., the services from the /etc/rc.d/init.d/ directory) along with their current status and a description obtainable by pressing F1. See Table 9.3, “Possible service states” for a list of used symbols and an explanation of their meaning.
Table 9.3. Possible service states
Symbol Description
[*] The service is enabled.
[ ] The service is disabled.

9.2.2.1. Enabling the Service

To enable a service, navigate through the list using the Up and Down arrows keys, and select it with the Spacebar. An asterisk (*) should appear in the brackets. Once you are done, use Tab to navigate to the Ok button, and confirm the changes by pressing Enter.
Please, keep in mind that ntsysv does not actually run the service. If you need to start the service immediately, use the service command as described in Section 9.3.2, “Running the Service”.

9.2.2.2. Disabling the Service

To disable a service, navigate through the list using the Up and Down arrows keys, and toggle its status with the Spacebar. An asterisk (*) in the brackets should disappear. Once you are done, use Tab to navigate to the Ok button, and confirm the changes by pressing Enter.
Please, keep in mind that ntsysv does not actually stop the service. If you need to stop the service immediately, use the service command as described in Section 9.3.3, “Stopping the Service”.

9.2.2.3. Selecting the Runlevels

By default, the ntsysv utility affects the current runlevel only. To enable or disable services for other runlevels, run the command with the additional --level option followed by the string of numbers from 0 to 6 representing each runlevel you want to configure. For example, to configure runlevels 3 and 5, type:
~]# ntsysv --level 35

9.2.3. Using the chkconfig Utility

The chkconfig utility is a command line application to configure which services are to be started in selected runlevels. It also allows you to list all available services along with their current setting. Note that with the exception of listing, you must have superuser privileges to use this command. To obtain them, log in as root by typing:
~]$ su -
Password:

9.2.3.1. Listing the Services

To display a list of system services (i.e., both the services from the /etc/rc.d/init.d/ directory, and the services controlled by xinetd), either type chkconfig --list, or use chkconfig with no additional arguments. You should be presented with an output similar to this:
Example 9.1. Listing the services
~]# chkconfig --list
NetworkManager  0:off   1:off   2:on    3:on    4:on    5:on    6:off
abrtd           0:off   1:off   2:off   3:on    4:off   5:on    6:off
acpid           0:off   1:off   2:on    3:on    4:on    5:on    6:off
anamon          0:off   1:off   2:off   3:off   4:off   5:off   6:off
atd             0:off   1:off   2:off   3:on    4:on    5:on    6:off
auditd          0:off   1:off   2:on    3:on    4:on    5:on    6:off
avahi-daemon    0:off   1:off   2:off   3:on    4:on    5:on    6:off
... several lines omitted ...
wpa_supplicant  0:off   1:off   2:off   3:off   4:off   5:off   6:off

xinetd based services:
        chargen-dgram:  off
        chargen-stream: off
        cvs:            off
        daytime-dgram:  off
        daytime-stream: off
        discard-dgram:  off
... several lines omitted ...
        time-stream:    off

As you can see, each line consists of the name of the service followed by its status (on or off) for each of the seven numbered runlevels. For example, in the listing above, NetworkManager is enabled for runlevel 2, 3, 4, and 5, while abrtd runs in runlevel 3 and 5. The xinetd based services are listed at the end, being either on, or off.
To display the current settings for selected service only, use chkconfig --list followed by the name of the service:
Example 9.2. Listing a single service
~]# chkconfig --list sshd
sshd            0:off   1:off   2:on    3:on    4:on    5:on    6:off

You can also use chkconfig --list service to display the status of a service that is managed by xinetd. In that case, the output will simply contain the information whether the service is enabled or disabled:
Example 9.3. Listing a service that is managed by xinetd
~]# chkconfig --list rsync
rsync           off

9.2.3.2. Enabling the Service

To enable the service for runlevels 2, 3, 4, and 5 at the same time, type chkconfig service on. For instance:
~]# chkconfig httpd on
To enable the service for certain runlevels only, add the --level option followed by the string of numbers from 0 to 6 representing each runlevel in which you want the service to run. For example, to enable the abrtd for runlevels 3 and 5, type:
~]# chkconfig abrtd on --level 35
The service will be started the next time you enter one of these runlevels. If you need to start the service immediately, use the service command as described in Section 9.3.2, “Running the Service”.
To enable the service that is managed by xinetd, use chkconfig service on only, as the --level option is not allowed:
~]# chkconfig rsync on
If the xinetd daemon is running, the service is immediately enabled without having to restart the daemon manually.

9.2.3.3. Disabling the Service

To disable the service for runlevels 2, 3, 4, and 5 at the same time, type chkconfig service off. For instance:
~]# chkconfig httpd off
To disable the service for certain runlevels only, add the --level option followed by the string of numbers from 0 to 6 representing each runlevel in which you do not want the service to run. For example, to disable the abrtd for runlevels 2 and 4, type:
~]# chkconfig abrtd off --level 24
The service will be stopped the next time you enter one of these runlevels. If you need to stop the service immediately, use the service command as described in Section 9.3.3, “Stopping the Service”.
To disable the service that is managed by xinetd, use chkconfig service off only, as the --level option is not allowed:
~]# chkconfig rsync off
If the xinetd daemon is running, the service is immediately disabled without having to restart the daemon manually.

9.3. Running the Services

The service utility enables you to start, stop, or restart the services from the /etc/init.d/ directory. To use it, make sure you have superuser privileges:
~]$ su -
Password:

Use the Service Configuration utility

If you are running a graphical user interface, you can also use the Service Configuration utility. See Section 9.2.1, “Using the Service Configuration Utility” for more information.

9.3.1. Checking the Service Status

To check the current status of the service, type service service_name status. For example:
Example 9.4. Checking the status of httpd
~]# service httpd status
httpd (pid  7474) is running...

You can also display the status of all available services at once using the --status-all option:
Example 9.5. Checking the status of all services
~]# service --status-all
abrt (pid  1492) is running...
acpid (pid  1305) is running...
atd (pid  1540) is running...
auditd (pid  1103) is running...
automount (pid 1315) is running...
Avahi daemon is running
cpuspeed is stopped
... several lines omitted ...
wpa_supplicant (pid  1227) is running...

9.3.2. Running the Service

To run the service, type service service_name start. For example:
~]# service httpd start
Starting httpd:                                            [  OK  ]

9.3.3. Stopping the Service

To stop the service, type service service_name stop. For example:
~]# service httpd stop
Stopping httpd:                                            [  OK  ]

9.3.4. Restarting the Service

To restart the service, type service service_name restart. For example:
~]# service httpd restart
Stopping httpd:                                            [  OK  ]
Starting httpd:                                            [  OK  ]

9.4. Additional Resources

9.4.1. Installed Documentation

man chkconfig
The manual page for the chkconfig utility containing the full documentation on its usage.
man ntsysv
The manual page for the ntsysv utility containing the full documentation on its usage.
man service
The manual page for the service utility containing the full documentation on its usage.
man system-config-services
The manual page for the system-config-services utility containing the full documentation on its usage.

9.4.2. Related Books

Security Guide
A guide to securing Red Hat Enterprise Linux. It contains valuable information on how to set up the firewall, as well as the configuration of SELinux.

Chapter 10. Configuring Authentication

Authentication is the way that a user is identified and verified to a system. The authentication process requires presenting some sort of identity and credentials, like a username and password. The credentials are then compared to information stored in some data store on the system. In Red Hat Enterprise Linux, the Authentication Configuration Tool helps configure what kind of data store to use for user credentials, such as LDAP.
For convenience and potentially part of single sign-on, Red Hat Enterprise Linux can use a central daemon to store user credentials for a number of different data stores. The System Security Services Daemon (SSSD) can interact with LDAP, Kerberos, NIS, and PAM for authentication modules and can be accessed by external applications, like Red Hat Enterprise IPA, to check for user credentials. The Authentication Configuration Tool can be configured to work with SSSD, so that authentication processing and caching can be combined.

10.1. Configuring System Authentication

When a user logs into a Red Hat Enterprise Linux system, that user presents some sort of credential to establish the user identity. The system then checks those credentials against its stored information. If the credentials match and the user account is active, then the user is authenticated and can successfully access the server.
The information to verify the user can be located on the local system or the local system can reference a user database on a remote system.
The system must have a configured list of valid account databases for it to check for user authentication. On Red Hat Enterprise Linux, the Authentication Configuration Tool has both GUI and command-line options to configure any user data stores.
A local system can use a variety of different data stores for user information, including Lightweight Directory Access Protocol (LDAP), Network Information Service (NIS), and Winbind. Additionally, both LDAP and NIS data stores can use Kerberos authentication.

Note

If a medium or high security level is set during installation or with the Security Level Configuration Tool, then the firewall prevents NIS authentication. For more information about firewalls, see the "Firewalls" section of the Security Guide.

10.1.1. Launching the Authentication Configuration Tool UI

To open the Authentication Configuration Tool:
  1. Open the System.
  2. Select the Administration menu.
  3. Select the Authentication item.
Alternatively, run the system-config-authentication command.

Important

Any changes take effect immediately when the Authentication Configuration Tool UI is closed.
There are two configuration tabs in the Authentication dialog box:
  • Identity & Authentication, which configures the resource used as the identity store (the data repository where the user IDs and corresponding credentials are stored)
  • Advanced Options, which allows authentication methods other than passwords or certificates, like smart cards and fingerprint.

10.1.2. Selecting the Identity Store for Authentication

The Identity & Authentication tab sets how users should be authenticated. The default is to use local system authentication, meaning the users and their passwords are checked against local system accounts. A Red Hat Enterprise Linux machine can also use external resources which contain the users and credentials, including LDAP, NIS, and Winbind.
Local Authentication
Figure 10.1. Local Authentication

10.1.2.1. Configuring LDAP Authentication

The openldap-clients package must be installed in order to use an LDAP server for the user database.
  1. Open the Authentication Configuration Tool, as in Section 10.1.1, “Launching the Authentication Configuration Tool UI”.
  2. Select LDAP in the User Account Database drop-down menu.
  3. Set the information that is required to connect to the LDAP server.
    • LDAP Search Base DN gives the root suffix or distinguished name (DN) for the user directory. All of the user entries used for identity/authentication will exist below this parent entry. For example, ou=people,dc=example,dc=com.
    • LDAP Server gives the URL of the LDAP server. This usually requires both the hostname and port number of the LDAP server, such as ldap://ldap.example.com:389.
    • Use TLS to encrypt connections sets whether to use Start TLS to encrypt the connections to the LDAP server. This enables a secure connection over a standard port.
      Selecting TLS enables the Download CA Certificate button, which retrieves the issuing CA certificate for the LDAP server from whatever certificate authority issued it. The CA certificate must be in the privacy enhanced mail (PEM) format.

      Important

      Do not select Use TLS to encrypt connections if the server URL uses a secure protocol (ldaps).
  4. Select the authentication method. LDAP allows simple password authentication or Kerberos authentication.
    The LDAP password option uses PAM applications to use LDAP authentication. This option requires either a secure (ldaps://) URL or the TLS option to connect to the LDAP server.

10.1.2.2. Configuring NIS Authentication

The ypbind package must be installed in order to use NIS authentication. When it is configured, the portmap and ypbind services are started and enabled to start at boot time.
  1. Open the Authentication Configuration Tool, as in Section 10.1.1, “Launching the Authentication Configuration Tool UI”.
  2. Select NIS in the User Account Database drop-down menu.
  3. Set the information to connect to the NIS server, meaning the NIS domain name and the server hostname. If the NIS server is not specified, the authconfig daemon scans for the NIS server.
  4. Select the authentication method. NIS allows simple password authentication or Kerberos authentication.
For more information about NIS, see the "Securing NIS" section of the Security Guide.

10.1.2.3. Configuring Winbind Authentication

  1. Open the Authentication Configuration Tool, as in Section 10.1.1, “Launching the Authentication Configuration Tool UI”.
  2. Select Winbind in the User Account Database drop-down menu.
  3. Set the information that is required to connect to the Microsoft Active Directory or Windows NT domain controller.
    • Winbind Domain gives the Windows domain to connect to.
    • Security Model sets the security model to use for Samba clients. authconfig supports four types of security models:
      • ads configures Samba to act as a domain member in an Active Directory Server (ADS) realm. To operate in this mode, the krb5-server package must be installed and Kerberos must be configured properly.
      • domain has Samba validate the username/password by authenticating it through a Windows NT primary or backup domain controller, much like a Windows NT server.
      • server has a local Samba server validate the username/password by authenticating it through another server, such as a Windows NT server). If the server authentication attempt fails, the system then attempts to authentication using user mode.
      • user requires a client to log in with a valid username and password. This mode does support encrypted passwords.
        This is the default option.
    • Winbind ADS Realm gives the Active Directory realm that the Samba server will join. This is only used with the ads security model.
    • Winbind Domain Controllers gives the domain controller to use. For more information about domain controllers, please refer to Section 17.1.6.3, “Domain Controller”.
    • Template Shell sets which login shell to use for Windows NT user account settings.
    • Allow offline login allows authentication information to be stored in a local cache provided by SSSD. The cache is referenced when a user attempts to authenticate to system resources while the system is offline. SSSD is described in Section 10.2, “Using and Caching Credentials with SSSD”.
For more information about the winbindd service, refer to Section 17.1.2, “Samba Daemons and Related Services”.

10.1.2.4. Using Kerberos with LDAP or NIS Authentication

Both LDAP and NIS authentication stores support Kerberos authentication methods. Using Kerberos has a couple of benefits:
  • It uses a security layer for communication while still allowing connections over standard ports.
  • It automatically uses credentials caching with SSSD, which allows offline logins.
Using Kerberos authentication requires the krb5-libs and krb5-workstation packages.
The Kerberos authentication selection automatically opens the fields required to connect to the Kerberos realm.
Kerberos Fields
Figure 10.2. Kerberos Fields

  • Realm gives the name for the realm for the Kerberos server. The realm is the network that uses Kerberos, composed of one or more KDCs and a potentially large number of clients.
  • KDCs gives a comma-separated list of servers that issue Kerberos tickets (key distribution center or KDC).
  • Admin Servers gives a list of administration servers running the kadmind process in the realm.
  • Optionally, use DNS to resolve server hostname and to find additional KDCs within the realm.
For more information about Kerberos, refer to section "Using Kerberos" of the Red Hat Enterprise Linux 6 Managing Single Sign-On and Smart Cards guide.

10.1.3. Configuring Alternative Authentication Features

The Authentication Configuration Tool also configures settings related to authentication behavior, apart from the identity store. This includes entirely different authentication methods (fingerprint scans and smart cards) or local authentication rules.
Advanced Options
Figure 10.3. Advanced Options

10.1.3.1. Setting Local Authentication Parameters

There are two options in the Local Authentication Options area which define authentication behavior on the local system:
  • Enable local access control instructs the /etc/security/access.conf file to check for local user authorization rules.
  • Password Hashing Algorithm sets the hashing algorithm to use to encrypt locally-stored passwords.

10.1.3.2. Using Fingerprint Authentication

When there is appropriate hardware available, the Enable fingerprint reader support option allows fingerprint scans to be used to authenticate local users rather than other credentials.

10.1.3.3. Enabling Smart Card Authentication

When there are appropriate smart card readers available, a system can accept smart cards (or tokens) instead of other user credentials to authenticate.
Once the Enable smart card support option is selected, then the behaviors of smart card authentication can be defined:
  • Card Removal Action tells the system how to respond when the card is removed from the card reader during an active session. A system can either ignore the removal and allow the user to access resources as normal, or a system can immediately lock until the smart card is supplied.
  • Require smart card login sets whether a smart card is required for logins or simply allowed for logins. When this option is selected, all other methods of authentication are immediately blocked.

    Warning

    Do not select this option until you have successfully authenticated to the system using a smart card.
Using smart cards requires the pam_pkcs11 package. For more information about smart cards, see the Managing Single Sign-On and Smart Cards Guide.

10.1.3.4. Creating User Home Directories

There is an option (Create home directories on the first login) to create a home directory automatically the first time that a user logs in.

10.1.4. Configuring Authentication from the Command Line

The authconfig command-line tool updates all of the configuration files and services required for system authentication, according to the settings passed to the script. Along with allowing all of the identity and authentication configuration options that can be set through the UI, the authconfig tool can also be used to create backup and kickstart files.
For a complete list of authconfig options, check the help output and the man page.

10.1.4.1. Tips for Using authconfig

There are some things to remember when running authconfig:
  • With every command, use either the --update or --test option. One of those options is required for the command to run successfully. Using --update writes the configuration changes. --test prints the changes to stdout but does not apply the changes to the configuration.
  • Each enable option has a corresponding disable option.

10.1.4.2. Configuring LDAP User Stores

To use an LDAP identity store, use the --enableldap. To use LDAP as the authentication source, use --enableldapauth and then the requisite connection information, like the LDAP server name, base DN for the user suffix, and (optionally) whether to use TLS. The authconfig command also has options to enable or disable RFC 2307bis schema for user entries, which is not possible through the Authentication Configuration UI.
Be sure to use the full LDAP URL, including the protocol (ldap or ldaps) and the port number. Do not use a secure LDAP URL (ldaps) with the --enableldaptls option.
authconfig --enableldap --enableldapauth --ldapserver=ldap://ldap.example.com:389,ldap://ldap2.example.com:389 --ldapbasedn="ou=people,dc=example,dc=com" --enableldaptls --ldaploadcacert=https://ca.server.example.com/caCert.crt --update
Instead of using --ldapauth for LDAP password authentication, it is possible to use Kerberos with the LDAP user store. These options are described in Section 10.1.4.5, “Configuring Kerberos Authentication”.

10.1.4.3. Configuring NIS User Stores

To use a NIS identity store, use the --enablenis. This automatically uses NIS authentication, unless the Kerberos parameters are explicitly set, so it uses Kerberos authentication (Section 10.1.4.5, “Configuring Kerberos Authentication”). The only parameters are to identify the NIS server and NIS domain; if these are not used, then the authconfig service scans the network for NIS servers.
authconfig --enablenis --nisdomain EXAMPLE --nisserver nis.example.com --update

10.1.4.4. Configuring Winbind User Stores

Windows domains have several different security models, and the security model used in the domain determines the authentication configuration for the local system.
For user and server security models, the Winbind configuration requires only the domain (or workgroup) name and the domain controller hostnames.
authconfig --enablewinbind --enablewinbindauth --smbsecurity user|server  --enablewinbindoffline --smbservers=ad.example.com --smbworkgroup=EXAMPLE --update
For ads and domain security models, the Winbind configuration allows additional configuration for the template shell and realm (ads only). For example:
authconfig --enablewinbind --enablewinbindauth --smbsecurity ads  --enablewinbindoffline --smbservers=ad.example.com --smbworkgroup=EXAMPLE --smbrealm EXAMPLE.COM --winbindtemplateshell=/bin/sh --update
There are a lot of other options for configuring Windows-based authentication and the information for Windows user accounts, such as name formats, whether to require the domain name with the username, and UID ranges. These options are listed in the authconfig help.

10.1.4.5. Configuring Kerberos Authentication

Both LDAP and NIS allow Kerberos authentication to be used in place of their native authentication mechanisms. At a minimum, using Kerberos authentication requires specifying the realm, the KDC, and the administrative server. There are also options to use DNS to resolve client names and to find additional admin servers.
authconfig NIS or LDAP options --enablekrb5 --krb5realm EXAMPLE --krb5kdc kdc.example.com:88,server.example.com:88 --krb5adminserver server.example.com:749 --enablekrb5kdcdns --enablekrb5realmdns --update

10.1.4.6. Configuring Local Authentication Settings

The Authentication Configuration Tool can also control some user settings that relate to security, such as creating home directories, setting password hash algorithms, and authorization. These settings are done independently of identity/user store settings.
For example, to create user home directories:
authconfig --enablemkhomedir --update
To set or change the hash algorithm used to encrypt user passwords:
authconfig --passalgo=sha512 --update

10.1.4.7. Configuring Fingerprint Authentication

There is one option to enable support for fingerprint readers. This option can be used alone or in conjunction with other authconfig settings, like LDAP user stores.
authconfig --enablefingerprint --update

10.1.4.8. Configuring Smart Card Authentication

All that is required to use smart cards with a system is to set the --enablesmartcard option:
authconfig --enablesmartcard --update
There are other configuration options for smart cards, such as changing the default smart card module, setting the behavior of the system when the smart card is removed, and requiring smart cards for login. For example, this tells the system to lock out a user immediately if the smart card is removed (a setting of 1 ignores it if the smart card is removed):
authconfig --enablesmartcard --smartcardaction=0 --update

Warning

Do not use the --enablerequiresmartcard option until you have successfully authenticated to the system using a smart card. Otherwise, users may be unable to log into the system.

10.1.4.9. Managing Kickstart and Configuration Files

The --update option updates all of the configuration files with the configuration changes. There are a couple of alternative options with slightly different behavior:
  • --kickstart writes the updated configuration to a kickstart file.
  • --test prints the full configuration, with changes, to stdout but does not edit any configuration files.
Additionally, authconfig can be used to back up and restore previous configurations. All archives are saved to a unique subdirectory in the /var/lib/authconfig/ directory. For example, the --savebackup option gives the backup directory as 2011-07-01:
authconfig --savebackup=2011-07-01
This backs up all of the authentication configuration files beneath the /var/lib/authconfig/backup-2011-07-01 directory.
Any of the backups can be used to restore the configuration using the --restorebackup option. authconfig automatically makes a backup of the configuration before it applies any changes (with the --update option). The configuration can be restored from that automatic backup using the --restorelastbackup option.

10.1.5. Using Custom Home Directories

If LDAP users have home directories that are not in /home and the system is configured to create home directories the first time users log in, then these directories are created with the wrong permissions.
  1. Apply the correct SELinux context and permissions from the /home directory to the home directory that is created on the local system. For example:
    # semanage fcontext -a -e /home /home/locale
  2. Install the oddjob-mkhomedir package on the system.
    This package provides the pam_oddjob_mkhomedir.so library, which the Authentication Configuration Tool uses to create home directories. The pam_oddjob_mkhomedir.so library, unlike the default pam_mkhomedir.so library, can create SELinux labels.
    The Authentication Configuration Tool automatically uses the pam_oddjob_mkhomedir.so library if it is available. Otherwise, it will default to using pam_mkhomedir.so.
  3. Make sure the oddjobd service is running.
  4. Re-run the Authentication Configuration Tool and enable home directories, as in Section 10.1.3, “Configuring Alternative Authentication Features”.
If home directories were created before the home directory configuration was changed, then correct the permissions and SELinux contexts. For example:
# semanage fcontext -a -e /home /home/locale
# restorecon -R -v /home/locale

10.2. Using and Caching Credentials with SSSD

The System Security Services Daemon (SSSD) provides access to different identity and authentication providers. SSSD is an intermediary between local clients and any configured data store. The local clients connect to SSSD and then SSSD contacts the external providers. This brings a number of benefits for administrators:
  • Reducing the load on identification/authentication servers. Rather than having every client service attempt to contact the identification server directly, all of the local clients can contact SSSD which can connect to the identification server or check its cache.
  • Permitting offline authentication. SSSD can optionally keep a cache of user identities and credentials that it retrieves from remote services. This allows users to authenticate to resources successfully, even if the remote identification server is offline or the local machine is offline.
  • Using a single user account. Remote users frequently have two (or even more) user accounts, such as one for their local system and one for the organizational system. This is necessary to connect to a virtual private network (VPN). Because SSSD supports caching and offline authentication, remote users can connect to network resources simply by authenticating to their local machine and then SSSD maintains their network credentials.
The System Security Services Daemon does not require any additional configuration or tuning to work with the Authentication Configuration Tool. However, SSSD can work with other application, and the daemon may require configuration changes to improve the performance of those applications.

10.2.1. About the sssd.conf File

SSSD services and domains are configured in a .conf file. The default file is /etc/sssd/sssd.conf, although alternative files can be passed to SSSD by using the --c option with the sssd command:
# sssd --c /etc/sssd/customfile.conf
Both services and domains are configured individually, in separate sections on the configuration identified by [type/name] divisions, such as [domain/LDAP]. The configuration file uses simple key = value lines to set the configuration. Comment lines are set by either a hash sign (#) or a semicolon (;)
For example:
[section]
# Comment line
key1 = val1
key10 = val1,val2

10.2.2. Starting and Stopping SSSD

Note

Configure at least one domain before starting SSSD for the first time. See Section 10.2.4, “Creating Domains”.
Either the service command or the /etc/init.d/sssd script can start SSSD. For example:
# service start sssd.service
By default, SSSD is configured not to start automatically. To change this behavior, enable SSSD with the authconfig command:
# authconfig --enablesssd --update

10.2.3. Configuring Services

SSSD worked with specialized services that run in tandem with the SSSD process itself. SSSD and its associated services are configured in the sssd.conf file. on sections. The [sssd] section also lists the services that are active and should be started when sssd starts within the services directive.
SSSD currently provides several services:
  • An NSS provider service that answers NSS requests from the sssd_nss module. This is configured in the [nss] section of the configuration.
  • A PAM provider service that manages a PAM conversation through the sssd_pam PAM module. This is configured in the [pam] section of the configuration.
  • monitor, a special service that monitors and starts or restarts all other SSSD services. Its options are specified in the [sssd] section of the /etc/sssd/sssd.conf configuration file.

Note

If a DNS lookup fails to return an IPv4 address for a hostname, SSSD attempts to look up an IPv6 address before returning a failure. This only ensures that the asynchronous resolver identifies the correct address.

10.2.3.1. Configuring the NSS Service

SSSD provides an NSS module, sssd_nss, which instructs the system to use SSSD to retrieve user information. The NSS configuration must include a reference to the SSSD module, and then the SSSD configuration sets how SSSD interacts with NSS.
To configure the NSS service:
  1. Open the sssd.conf file.
    # vim /etc/sssd/sssd.conf
  2. Make sure that NSS is listed as one of the services that works with SSSD.
    [sssd]
    config_file_version = 2
    reconnection_retries = 3
    sbus_timeout = 30
    services = nss, pam
  3. In the [nss] section, change any of the NSS parameters. These are listed in Table 10.1, “SSSD [nss] Configuration Parameters”.
    [nss]
    filter_groups = root
    filter_users = root
    reconnection_retries = 3
    entry_cache_timeout = 300
    entry_cache_nowait_percentage = 75
  4. Restart SSSD.
    service sssd restart
Table 10.1. SSSD [nss] Configuration Parameters
Parameter Value Format Description
enum_cache_timeout integer Specifies how long, in seconds, sssd_nss should cache requests for information about all users (enumerations).
entry_cache_nowait_percentage integer Specifies how long sssd_nss should return cached entries before refreshing the cache. Setting this to zero (0) disables the entry cache refresh.
This configures the entry cache to update entries in the background automatically if they are requested if the time before the next update is a certain percentage of the next interval. For example, if the interval is 300 seconds and the cache percentage is 75, then the entry cache will begin refreshing when a request comes in at 225 seconds — 75% of the interval.
The values for this option are 0 to 99, which sets the percentage based on the entry_cache_timeout value.
entry_negative_timeout integer Specifies how long, in seconds, sssd_nss should cache negative cache hits. A negative cache hit is a query for an invalid database entries, including non-existent entries.
filter_users, filter_groups string Tells SSSD to exclude certain users from being fetched from the NSS database. This is particularly useful for system accounts such as root.
filter_users_in_groups Boolean Sets whether users listed in the filter_users list appear in group memberships when performing group lookups. If set to FALSE, group lookups return all users that are members of that group. If not specified, this value defaults to TRUE, which filters the group member lists.

10.2.3.2. Configuring the PAM Service

Warning

A mistake in the PAM configuration file can lock users out of the system completely. Always back up the configuration files before performing any changes, and keep a session open so that any changes can be reverted.
SSSD provides a PAM module, sssd_pam, which instructs the system to use SSSD to retrieve user information. The PAM configuration must include a reference to the SSSD module, and then the SSSD configuration sets how SSSD interacts with PAM.
To configure the PAM service:
  1. Use authconfig to enable SSSD for system authentication.
    # authconfig --update --enablesssd --enablesssdauth
    This automatically updates the PAM configuration to reference all of the SSSD modules:
    #%PAM-1.0
    # This file is auto-generated.
    # User changes will be destroyed the next time authconfig is run.
    auth        required      pam_env.so
    auth        sufficient    pam_unix.so nullok try_first_pass
    auth        requisite     pam_succeed_if.so uid >= 500 quiet
    auth sufficient pam_sss.so use_first_pass
    auth        required      pam_deny.so
    
    account     required      pam_unix.so 
    account     sufficient    pam_localuser.so
    account     sufficient    pam_succeed_if.so uid < 500 quiet
    account [default=bad success=ok user_unknown=ignore] pam_sss.so
    account     required      pam_permit.so
    
    password    requisite     pam_cracklib.so try_first_pass retry=3
    password    sufficient    pam_unix.so sha512 shadow nullok try_first_pass use_authtok
    password sufficient pam_sss.so use_authtok
    password    required      pam_deny.so
    
    session     optional      pam_keyinit.so revoke
    session     required      pam_limits.so
    session     [success=1 default=ignore] pam_succeed_if.so service in crond quiet use_uid
    session sufficient pam_sss.so
    session     required      pam_unix.so
    
    These modules can be set to include statements, as necessary.
  2. Open the sssd.conf file.
    # vim /etc/sssd/sssd.conf
  3. Make sure that PAM is listed as one of the services that works with SSSD.
    [sssd]
    config_file_version = 2
    reconnection_retries = 3
    sbus_timeout = 30
    services = nss, pam
  4. In the [pam] section, change any of the PAM parameters. These are listed in Table 10.2, “SSSD [pam] Configuration Parameters”.
    [pam]
    reconnection_retries = 3
    offline_credentials_expiration = 2
    offline_failed_login_attempts = 3
    offline_failed_login_delay = 5
  5. Restart SSSD.
    service sssd restart
Table 10.2. SSSD [pam] Configuration Parameters
Parameter Value Format Description
offline_credentials_expiration integer Sets how long, in days, to allow cached logins if the authentication provider is offline. This value is measured from the last successful online login. If not specified, this defaults to zero (0), which is unlimited.
offline_failed_login_attempts integer Sets how many failed login attempts are allowed if the authentication provider is offline. If not specified, this defaults to zero (0), which is unlimited.
offline_failed_login_delay integer Sets how long to prevent login attempts if a user hits the failed login attempt limit. If set to zero (0), the user cannot authenticate while the provider is offline once he hits the failed attempt limit. Only a successful online authentication can re-enable offline authentication. If not specified, this defaults to five (5).

10.2.4. Creating Domains

SSSD recognizes domains, which are associated with the different identity servers. Domains are a combination of an identity provider and an authentication method. SSSD works with LDAP identity providers (including OpenLDAP, Red Hat Directory Server, and Microsoft Active Directory) and can use native LDAP authentication or Kerberos authentication.
As long as they belong to different domains, SSSD can recognize different users with the same username. For example, SSSD can successfully authenticate both jsmith in the ldap.example.com domain and jsmith in the ldap.otherexample.com domain. SSSD allows requests using fully-qualified domain names, so requesting information for jsmith@ldap.example.com returns the the proper user account. Specifying only the username returns the user for whichever domain comes first in the lookup order.

Tip

SSSD has a filter_users option, which excludes the specified users from being returned in a search.
Configuring a domain defines both where user information is stored and how those users are allowed to authenticate to the system. The possible combinations are listed in Table 10.3, “Identity Store and Authentication Type Combinations”.
Table 10.3. Identity Store and Authentication Type Combinations
Identification Provider Authentication Provider
LDAP LDAP
LDAP Kerberos
proxy LDAP
proxy Kerberos
proxy proxy

10.2.4.1. General Rules and Options for Configuring a Domain

A domain configuration defines the identity provider, the authentication provider, and any specific configuration to access the information in those providers. There are two types of identity providers — LDAP and proxy —three types of authentication providers — LDAP, Kerberos, and proxy. The identity and authentication providers can be configured in any combination in a domain entry.
Along with the domain entry itself, the domain name must be added to the list of domains that SSSD will query. For example:
domains = LOCAL,Name

[domain/Name]
id_provider = type
auth_provider = type
provider_specific = value
global = value
global attributes are available to any type of domain, such as cache and time out settings. Each identity and authentication provider has its own set of required and optional configuration parameters.
Table 10.4. General [domain] Configuration Parameters
Parameter Value Format Description
id_provider string Specifies the data provider identity backend to use for this domain. The supported identity backends are:
  • ldap
  • proxy for a legacy NSS provider, such as nss_nis. Using a proxy ID provider also requires specifying the legacy NSS library to load to start successfully, set in the proxy_lib_name option.
  • local, the SSSD internal local provider
auth_provider string Sets the authentication provider used for the domain. The default value for this option is the value of id_provider. The supported authentication providers are ldap, krb5 (Kerberos), proxy, and none.
min_id,max_id integer Optional. Specifies the UID and GID range for the domain. If a domain contains entries that are outside that range, they are ignored. The default value for min_id is 1; the default value for max_id is 0, which is unlimited.

Important

The default min_id value is the same for all types of identity provider. If LDAP directories are using UID numbers that start at one, it could cause conflicts with users in the local /etc/passwd file. To avoid these conflicts, set min_id to 1000 or higher as possible.
enumerate Boolean Optional. Specifies whether to list the users and groups of a domain. Enumeration means that the entire set of available users and groups on the remote source is cached on the local machine. When enumeration is disabled, users and groups are only cached as they are requested.

Warning

When enumeration is enabled, reinitializing a client results in a complete refresh of the entire set of available users and groups from the remote source. Similarly, when SSSD is connected to a new server, the entire set of available users and groups from the remote source is pulled and cached on the local machine. In a domain with a large number of clients connected to a remote source, this refresh process can harm the network performance because of frequent queries from the clients. If the set of available users and groups is large enough, it degrades client performance as well.
The default value for this parameter is false, which disables enumeration.
timeout integer Optional. Specifies the timeout in seconds for the domain. The default value is ten seconds. The timeout setting checks that the provider is available for requests and is useful for networks with long lag times or that are geographically dispersed.
If the timeout value is zero (0), SSSD reverts to the default value. A timeout value of zero cannot be enforced because this forces SSSD into a loop.
cache_credentials Boolean Optional. Specifies whether to store user credentials in the local SSSD domain database cache. The default value for this parameter is false. Set this value to true for domains other than the LOCAL domain to enable offline authentication.
entry_cache_timeout integer Optional. Specifies how long, in seconds, SSSD should cache positive cache hits. A positive cache hit is a successful query.
use_fully_qualified_names Boolean Optional. Specifies whether requests to this domain require fully-qualified domain names. If set to true, all requests to this domain must use fully-qualified domain names. It also means that the output from the request displays the fully-qualified name. Restricting requests to fully-qualified user names allows SSSD to differentiate between domains with users with conflicting usernames.
If use_fully_qualified_names is set to false, it is possible to use the fully-qualified name in the requests, but only the simplified version is displayed in the output.
SSSD can only parse names based on the domain name, not the realm name. The same name can be used for both domains and realms, however.

10.2.4.2. Configuring an LDAP Domain

An LDAP domain simply means that SSSD uses an LDAP directory as the identity provider (and, optionally, also as an authentication provider). SSSD supports several major directory services:
  • Red Hat Directory Server
  • OpenLDAP
  • Microsoft Active Directory 2003 and 2003R2, with Services for UNIX
  • Microsoft Active Directory 2003 and 2003R2, with Subsystem for UNIX-based Applications

Note

DNS service discovery allows the LDAP backend to find the appropriate DNS servers to connect to automatically using a special DNS query.
10.2.4.2.1. Parameters for Configuring an LDAP Domain
An LDAP directory can function as both an identity provider and an authentication provider. The configuration requires enough information to identify and connect to the user directory in the LDAP server. Other options are available to provide more fine-grained control, like specifying a user account to use to connect to the LDAP server or using different LDAP servers for password operations. The most common options are listed in Table 10.5, “LDAP Domain Configuration Parameters”. All of the options listed in Section 10.2.4.1, “General Rules and Options for Configuring a Domain” are also available for LDAP domains.

Tip

Many other options are listed in the man page for LDAP domain configuration, sssd-ldap(5).
Table 10.5. LDAP Domain Configuration Parameters
Parameter Description Required or Optional
ldap_uri Gives a comma-separated list of the URIs of the LDAP servers to which SSSD will connect. The list is given in order of preference, so the first server in the list is tried first. Listing additional servers provides failover protection. Required
ldap_search_base Gives the base DN to use for performing LDAP user operations. Required
ldap_tls_reqcert Specifies how to check for SSL server certificates in a TLS session. There are four options:
  • never disables requests for certificates.
  • allow requests a certificate, but proceeds normally even if no certificate is given or a bad certificate is given.
  • try requests a certificate and proceeds normally if no certificate is given, If a bad certificate is given, the session terminates.
  • demand and hard are the same option. This requires a valid certificate or the session is terminated.
The default is hard.
Required (unless LDAPS is used)
ldap_tls_cacert Gives the full path and file name to the file that contains the CA certificates for all of the CAs that SSSD recognizes. SSSD will accept any certificate issued by these CAs. Required (unless LDAPS is used)
ldap_referrals Sets whether SSSD will use LDAP referrals, meaning forwarding queries from one LDAP database to another. SSSD supports database-level and subtree referrals. For referrals within the same LDAP server, SSSD will adjust the DN of the entry being queried. For referrals that go to different LDAP servers, SSSD does an exact match on the DN. Setting this value to true enables referrals; by default, referrals are disabled. Optional
ldap_schema Sets what version of schema to use when searching for user entries. This can be either rfc2307 or rfc2307bis. The default is rfc2307.
In RFC 2307, group objects use a multi-valued attribute, memberuid, which lists the names of the users that belong to that group. In RFC 2307bis, group objects use the member attribute, which contains the full distinguished name (DN) of the user entry. Since this enables more accurate member locations, RFC 2307bis allows nested groups. Because these different schema use different definitions for group membership, using the wrong LDAP schema with SSSD can affect both viewing and managing network resources, even if the appropriate permissions are in place.
For example, with RFC 2307bis, all groups are returned when using nested groups or primary/secondary groups.
$ id
uid=500(myserver) gid=500(myserver) groups=500(myserver),510(myothergroup)
If SSSD is using RFC 2307 schema, only the primary group is returned.
This setting only affects how SSSD determines the group members. It does not change the actual user data.
Optional
ldap_search_timeout Sets the time, in seconds, that LDAP searches are allowed to run before they are canceled and cached results are returned. This defaults to five when the enumerate value is false and defaults to 30 when enumerate is true.
When an LDAP search times out, SSSD automatically switches to offline mode.
Optional
ldap_network_timeout Sets the time, in seconds, SSSD attempts to poll an LDAP server after a connection attempt fails. The default is six seconds. Optional
ldap_opt_timeout Sets the time, in seconds, to wait before aborting synchronous LDAP operations if no response is received from the server. This option also controls the timeout when communicating with the KDC in case of a SASL bind. The default is five seconds. Optional

10.2.4.2.2. LDAP Domain Examples
The LDAP configuration is very flexible, depending on your specific environment and how general or specific you need the SSSD behavior to be. These are some common examples of an LDAP domain, but the SSSD configuration is not limited to these examples.

Note

Along with creating the domain entry, add the new domain to the list of domains for SSSD to query in the sssd.conf file. For example:
domains = LOCAL,LDAP1,AD,PROXYNIS
Example 10.1. A Basic LDAP Domain Configuration
An LDAP domain requires three things:
  • An LDAP server
  • The search base
  • A way to establish a secure connection
The last item depends on the LDAP environment. SSSD requires a secure connection since it handles sensitive information. This connection can be a dedicated TLS/SSL connection or it can use Start TLS.
Using a dedicated TLS/SSL connection simply uses an LDAPS connection to connect to the server and is therefore set as part of the ldap_uri option:
# A native LDAP domain
[domain/LDAP]
enumerate = false
cache_credentials = TRUE

id_provider = ldap
auth_provider = ldap

ldap_uri = ldaps://ldap.example.com:636
ldap_search_base = dc=example,dc=com
Using Start TLS requires a way to input the certificate information to establish a secure connection dynamically over an insecure port. This is done using the ldap_tls_reqcert option to use Start TLS and then ldap_tls_cacert to identify the CA certificate which issued the SSL server certificates.
# A native LDAP domain
[domain/LDAP]
enumerate = false
cache_credentials = TRUE

id_provider = ldap
auth_provider = ldap

ldap_uri = ldap://ldap.example.com
ldap_search_base = dc=example,dc=com
ldap_tls_reqcert = demand
ldap_tls_cacert = /etc/pki/tls/certs/ca-bundle.crt

To configure any Active Directory server as an LDAP domain requires two things:
  • Installing Windows Services for UNIX (2003 and 2003 R2) or the Subsystem for UNIX-based Applications (2008).

    Note

    Services for Unix is not supported on 64-bit operating systems.
  • Running the c_rehash function to create the appropriate symlinks.
Example 10.2. An Active Directory 2003 Domain
As with an OpenLDAP or Directory Server domain, Active Directory requires the search base and the LDAP URI of the Active Directory server, but SSSD requires more information about directory entries and the user account to use to connect because of the differences between an Active Directory-style database and an OpenLDAP/Directory Server-style database.
These options are described in the man page for LDAP domain configuration, sssd-ldap(5).
# Example LDAP domain where the LDAP server is an Active Directory 2003 server.

[domain/AD]
description = LDAP domain with AD server
enumerate = false
min_id = 1000
;
id_provider = ldap
auth_provider = ldap
ldap_uri = ldap://your.ad.server.com
ldap_schema = rfc2307bis
ldap_search_base = dc=example,dc=com
ldap_default_bind_dn = cn=Administrator,cn=Users,dc=example,dc=com
ldap_default_authtok_type = password
ldap_default_authtok = secret
ldap_user_object_class = person
ldap_user_name = msSFU30Name
ldap_user_uid_number = msSFU30UidNumber
ldap_user_gid_number = msSFU30GidNumber
ldap_user_home_directory = msSFU30HomeDirectory
ldap_user_shell = msSFU30LoginShell
ldap_user_principal = userPrincipalName
ldap_group_object_class = group
ldap_group_name = msSFU30Name
ldap_group_gid_number = msSFU30GidNumber

Example 10.3. A Basic Active Directory 2003 R2 or 2008 Domain
Configuring a Microsoft Active Directory 2003 R2 or 2008 domain is similar, but not identical, to configuring an Active Directory 2003 domain. Using later Active Directory servers requires less group configuration information.
These options are described in the man page for LDAP domain configuration, sssd-ldap(5).
# Example LDAP domain where the LDAP server is an Active Directory 2003 R2 or an Active Directory 2008 server.

[domain/AD]
description = LDAP domain with AD server
; debug_level = 9
enumerate = false

id_provider = ldap
auth_provider = ldap
chpass_provider = ldap

ldap_uri = ldap://your.ad.server.com
ldap_tls_cacertdir = /etc/openldap/cacerts
ldap_tls_cacert = /etc/openldap/cacerts/test.cer
ldap_search_base = dc=example,dc=com
ldap_default_bind_dn = cn=Administrator,cn=Users,dc=example,dc=com
ldap_default_authtok_type = password
ldap_default_authtok = secret
ldap_pwd_policy = none
ldap_user_object_class = user
ldap_group_object_class = group

10.2.4.2.3. Using IP Addresses in Certificate Subject Names
Using an IP address in the ldap_uri option instead of the server name may cause the TLS/SSL connection to fail. TLS/SSL certificates contain the server name, not the IP address. However, the subject alternative name field in the certificate can be used to include the IP address of the server, which allows a successful secure connection using an IP address.
  1. Convert an existing certificate into a certificate request. The signing key (-signkey) is the key of the issuer of whatever CA originally issued the certificate. If this is done by an external CA, it requires a separate PEM file; if the certificate is self-signed, then this is the certificate itself. For example:
    openssl x509 -x509toreq -in old_cert.pem -out req.pem -signkey key.pem
    With a self-signed certificate:
    openssl x509 -x509toreq -in old_cert.pem -out req.pem -signkey old_cert.pem
  2. Edit the /etc/pki/tls/openssl.cnf configuration file to include the server's IP address under the [ v3_ca ] section:
    subjectAltName = IP:10.0.0.10
  3. Use the generated certificate request to generate a new self-signed certificate with the specified IP address:
    openssl x509 -req -in req.pem -out new_cert.pem -extfile ./openssl.cnf -extensions v3_ca -signkey old_cert.pem
    The -extensions option sets which extensions to use with the certificate. For this, it should be v3_ca to load the appropriate section.
  4. Copy the private key block from the old_cert.pem file into the new_cert.pem file to keep all relevant information in one file.
When creating a certificate through the certutil utility provided by the nss-utils package, note that certutil supports DNS subject alternative names for certificate creation only.

10.2.4.3. Configuring Kerberos Authentication with a Domain

Both LDAP and proxy identity providers can use a separate Kerberos domain to supply authentication. Configuring a Kerberos authentication provider requires the key distribution center (KDC) and the Kerberos domain. All of the principal names must be available in the specified identity provider; if they are not, SSSD constructs the principals using the format username@REALM.

Note

Kerberos can only provide authentication; it cannot provider an identity database.
SSSD makes some operating assumptions about the Kerberos connections:
  • SSSD requires Simple Authentication and Security Layer (SASL) connections using Generic Security Services API (GSS-API). The directory services must be configured to allow SASL connections using the GSS-API mechanism before SSSD can use Kerberos to connect to the LDAP server. See the LDAP server documentation for instructions to configure SASL/GSS-API.
  • SSSD assumes that the Kerberos KDC is also a Kerberos kadmin server. However, production environments commonly have multiple, read-only replicas of the KDC and only a single kadmin server. Use the krb5_kpasswd option to specify where the password changing service is running or if it is running on a non-default port. If the krb5_kpasswd option is not defined, SSSD tries to use the Kerberos KDC to change the password.
The basic Kerberos configuration options are listed in Table 10.6, “Kerberos Authentication Configuration Parameters”. The sssd-krb5(5) man page has more information about Kerberos configuration options.
Example 10.4. Basic Kerberos Authentication
# A domain with identities provided by LDAP and authentication by Kerberos
[domain/KRBDOMAIN]
enumerate = false
id_provider = ldap
chpass_provider = krb5
ldap_uri = ldap://ldap.example.com
ldap_search_base = dc=example,dc=com
ldap-tls_reqcert = demand
ldap_tls_cacert = /etc/pki/tls/certs/ca-bundle.crt

auth_provider = krb5
krb5_server = 192.168.1.1
krb5_realm = EXAMPLE.COM
krb5_kpasswd = kadmin/changepw
krb5_auth_timeout = 15

Table 10.6. Kerberos Authentication Configuration Parameters
Parameter Description
chpass_provider Specifies which service to use for password change operations. This is assumed to be the same as the authentication provider. To use Kerberos, set this to krb5.
krb5_server Gives a comma-separated list of IP addresses or hostnames of Kerberos servers to which SSSD will connect. The list is given in order of preference, so the first server in the list is tried first. Listing additional servers provides failover protection.
When using service discovery for KDC or kpasswd servers, SSSD first searches for DNS entries that specify UDP as the connection protocol, and then falls back to TCP.
krb5_realm Gives the Kerberos realm to use for SASL/GSS-API authentication.
krb5_lifetime Requests a Kerberos ticket with the specified lifetime in seconds (s), minutes (m), hours (h) or days (d).
krb5_renewable_lifetime Requests a renewable Kerberos ticket with a total lifetime that is specified in seconds (s), minutes (m), hours (h) or days (d).
krb5_renew_interval Sets the time, in seconds, for SSSD to check if tickets should be renewed. Tickets are renewed automatically once they exceed half their lifetime. If this option is missing or set to zero, then automatic ticket renewal is disabled.
krb5_store_password_if_offline Sets whether to store user passwords if the Kerberos authentication provider is offline, and then to use that cache to request tickets when the provider is back online. The default is false, which does not store passwords.
krb5_kpasswd Lists alternate Kerberos kadmin servers to use if the change password service is not running on the KDC.
krb5_ccname_template Gives the directory to use to store the user's credential cache. This can be templatized, and the following tokens are supported:
  • %u, the user's login name
  • %U, the user's login UID
  • %p, the user's principal name
  • %r, the realm name
  • %h, the user's home directory
  • %d, the value of the krb5ccache_dir parameter
  • %P, the process ID of the SSSD client.
  • %%, a literal percent sign (%)
  • XXXXXX, a string at the end of the template which instructs SSSD to create a unique filename safely
For example:
krb5_ccname_template = FILE:%d/krb5cc_%U_XXXXXX
krb5_ccachedir Specifies the directory to store credential caches. This can be templatized, using the same tokens as krb5_ccname_template, except for %d and %P. If %u, %U, %p, or %h are used, then SSSD creates a private directory for each user; otherwise, it creates a public directory.
krb5_auth_timeout Gives the time, in seconds, before an online authentication or change password request is aborted. If possible, the authentication request is continued offline. The default is 15 seconds.

10.2.4.4. Configuring a Proxy Domain

A proxy with SSSD is just a relay, an intermediary configuration. SSSD connects to its proxy service, and then that proxy loads the specified libraries. This allows SSSD to use some resources that it otherwise would not be able to use. For example, SSSD only supports LDAP and Kerberos as authentication providers, but using a proxy allows SSSD to use alternative authentication methods like a fingerprint scanner or smart card.
Table 10.7. Proxy Domain Configuration Parameters
Parameter Description
proxy_pam_target Specifies the target to which PAM must proxy as an authentication provider.. The PAM target is a file containing PAM stack information in the default PAM directory, /etc/pam.d/.
This is used to proxy an authentication provider.

Important

Ensure that the proxy PAM stack does not recursively include pam_sss.so.
proxy_lib_name Specifies which existing NSS library to proxy identity requests through.
This is used to proxy an identity provider.

Example 10.5. Proxy Identity and Kerberos Authentication
The proxy library is loaded using the proxy_lib_name parameter. This library can be anything as long as it is compatible with the given authentication service. For a Kerberos authentication provider, it must be a Kerberos-compatible library, like NIS.
[domain/PROXY_KRB5]
auth_provider = krb5
krb5_server = 192.168.1.1
krb5_realm = EXAMPLE.COM

id_provider = proxy
proxy_lib_name = nis
enumerate = true
cache_credentials = true

Example 10.6. LDAP Identity and Proxy Authentication
The proxy library is loaded using the proxy_pam_target parameter. This library must be a PAM module that is compatible with the given identity provider. For example, this uses a PAM module with LDAP:
[domain/LDAP_PROXY]
id_provider = ldap
ldap_uri = ldap://example.com
ldap_search_base = dc=example,dc=com

auth_provider = proxy
proxy_pam_target = sssdpamproxy
enumerate = true
cache_credentials = true
After the SSSD domain is configured, make sure that the specified PAM files are configured. In this, the target is sssdpamproxy, so create a /etc/pam.d/sssdpamproxy file and load the PAM/LDAP modules:
auth          required      pam_ldap.so
account       required      pam_ldap.so
password      required      pam_ldap.so
session       required      pam_ldap.so

Note

To use the proxy identity provider, the nss-pam-ldapd package must be installed.
Example 10.7. Proxy Identity and Authentication
SSSD can have a domain with both identity and authentication proxies. The only configuration given then are the proxy settings, proxy_pam_target for the authentication PAM module and proxy_lib_name for the service, like NIS or LDAP.
[domain/PROXY_PROXY]
auth_provider = proxy
id_provider = proxy
proxy_lib_name = ldap
proxy_pam_target = sssdproxyldap
enumerate = true 
cache_credentials = true
Once the SSSD domain is added, then update the system settings to configure the proxy service:
  1. Create a /etc/pam.d/sssdproxyldap file which requires the pam_ldap.so module:
    auth          required      pam_ldap.so
    account       required      pam_ldap.so
    password      required      pam_ldap.so
    session       required      pam_ldap.so
  2. Edit the /etc/nslcd.conf file, the configuration file for the LDAP name service daemon, to contain the information for the LDAP directory:
    uid nslcd
    gid ldap
    uri ldaps://ldap.example.com:636
    base dc=example,dc=com
    ssl on
    tls_cacertdir /etc/openldap/cacerts

10.2.5. Configuring Access Control for SSSD Domains

SSSD provides a rudimentary access control for domain configuration, allowing either simple user allow/deny lists or using the LDAP backend itself.

10.2.5.1. Using the Simple Access Provider

The Simple Access Provider allows or denies access based on a list of usernames or groups.
The Simple Access Provider is a way to restrict access to certain, specific machines. For example, if a company uses laptops, the Simple Access Provider can be used to restrict access to only a specific user or a specific group, even if a different user authenticated successfully against the same authentication provider.
The most common options are simple_allow_users and simple_allow_groups, which grant access explicitly to specific users (either the given users or group members) and deny access to everyone else. It is also possible to create deny lists (which deny access only to explicit people and implicitly allow everyone else access).
The Simple Access Provider adheres to the following three rules to determine which users should or should not be granted access:
  • If both the allow and deny lists are empty, access is granted.
  • If simple_allow_users|groups is set, only users from this list are allowed access. This setting supersedes the simple_deny_users list.
  • If the simple_allow_users|groups list is empty, users are allowed access unless they appear in the simple_deny_users list.

Important

Defining both simple_allow_users|groups and simple_deny_users|groups is a configuration error. If this occurs, SSSD will output an error to the /var/log/sssd/sssd_default.log log file when loading the backend, but continue to start normally.
For example, this grants access to two users and anyone who belongs to the IT group; implicitly, all other users are denied.
[domain/example.com]
access_provider = simple
simple_allow_users = jsmith,bjensen
simple_allow_groups = itgroup

Note

The LOCAL domain in SSSD does not support simple as an access provider.
Other options are listed in the sssd-simple man page, but these are rarely used.

10.2.5.2. Using the LDAP Access Provider

The LDAP server itself can provide the access control rules. The associated filter option (ldap_access_filter) specifies which users are granted access to the specified host. The user filter must be used or all users are denied access.
For example:
[domain/example.com]
access_provider = ldap
ldap_access_filter = memberOf=cn=allowedusers,ou=Groups,dc=example,dc=com

Note

Offline caching for LDAP access providers is limited to determining whether the user's last online login attempt was successful. Users that were granted access during their last login will continue to be granted access while offline.

10.2.6. Configuring Domain Failover

SSSD attempts to connect to machines and to services separately.
When SSSD tries to connect to one of its domain backends, it first tries to resolve the hostname of a given machine. If this resolution attempt fails, the machine is considered offline, and SSSD no longer attempts to connect to this machine for any other service.
If the resolution attempt succeeds, the backend tries to connect to a service on this machine. If the service connection attempt fails, then only this particular service is considered offline and the backend automatically switches over to the next service. The machine is still considered online and might still be tried for another service.
SSSD only tries the first IP address given in the DNS A record. To find multiple servers with a single request, SSSD relies on SRV records.
Connections are retried to offline machines or services every 30 seconds, until SSSD can successfully connect to the backend.

10.2.6.1. Configuring Failover

Configuring failover allows SSSD to switch automatically to a different server if the primary server fails. These servers are entered as a case-insensitive, comma-separated list in the [domain/Name] sections of the /etc/sssd/sssd.conf file. The servers are listed in order of preference. This list can contain any number of servers.
For example, for a native LDAP domain:
ldap_uri = ldap://ldap0.example.com, ldap://ldap1.example.com, ldap://ldap2.example.com
The first entry, ldap://ldap0.example.com, is the primary server. If this server fails, SSSD first attempts to connect to ldap1.example.com and then ldap2.example.com.
If the server parameter is not specified, then SSSD uses service discovery to try to find another server on the network.

Important

Do not use multiple server connection parameters to specify the failover servers. The failover servers must be entered as a comma-separated list of values for a single parameter. If there are multiple parameters, SSSD only recognizes the last entry.

10.2.6.2. Using SRV Records with Failover

SSSD supports SRV records in its failover configuration. The SSSD configuration can specify a server that is later resolved into a list of specific servers using SRV requests.
For every service with which to use service discovery, add a special DNS record to the DNS server:
_service._protocol._domain TTL priority weight port hostname
The priority and weight attributes of SRV records provide fine-grained control over which servers to contact first if the primary server fails.
A typical configuration contains multiple such records, each with a different priority for failover and different weights for load balancing.
For more information on SRV records, see RFC 2782.

10.2.7. Deleting Domain Cache Files

SSSD can define multiple domains of the same type and different types of domain. SSSD maintains a separate database file for each domain, meaning each domain has its own cache. These cache files are stored in the /var/lib/sss/db/ directory.
If there is ever a problem with a domain, it is easy to purge the cache by stopping SSSD and deleting the cache file for that domain.
All cache files are named for the domain. For example, for a domain named exampleldap, the cache file is named cache_exampleldap.ldb.
Be careful when you delete a cache file:
  • Deleting the cache file deletes all user data, both identification and cached credentials. Consequently, do delete a cache file unless the system is online and can authenticate with a username against the domain's servers. Without a credentials cache, offline authentication will fail.
  • If the configuration is changed to reference a different identity provider, SSSD will recognize users from both providers until the cached entries from the original provider time out.
    It is possible to avoid this by purging the cache, but the better option is to use a different domain name for the new provider. When SSSD is restarted, it creates a new cache file with the new name and the old file is ignored.

10.2.8. Using NSCD with SSSD

SSSD is not designed to be used with the NSCD daemon. Even though SSSD does not directly conflict with NSCD, using both services can result in unexpected behavior, especially with how long entries are cached.
The most common evidence of a problem is conflicts with NFS. When using Network Manager to manage network connections, it may take several minutes for the network interface to come up. During this time, various services attempt to start. If these services start before the network is up and the DNS servers are available, these services fail to identify the forward or reverse DNS entries they need. These services will read an incorrect or possibly empty resolv.conf file. This file is typically only read once, and so any changes made to this file are not automatically applied. This can cause NFS locking to fail on the machine where the NSCD service is running, unless that service is manually restarted.
To avoid this problem, enable caching for hosts and services in the /etc/nscd.conf file and rely on the SSSD cache for the passwd, group, and netgroup entries.
Change the /etc/nscd.conf file:
enable-cache hosts yes
enable-cache passwd no
enable-cache group no
enable-cache netgroup no
With NSCD answering hosts requests, these entries will be cached by NSCD and returned by NSCD during the boot process. All other entries are handled by SSSD.

10.2.9. Troubleshooting SSSD

10.2.9.1. Using SSSD Log Files

SSSD uses a number of log files to report information about its operation, located in the /var/log/sssd/ directory. SSSD produces a log file for each domain, as well as an sssd_pam.log and an sssd_nss.log file.
Additionally, the /var/log/secure file logs authentication failures and the reason for the failure.
Increasing the log level can provide more information about problems with SSSD. To change the log level:
# sssd --debug-level=9 --debug-timestamps=1

10.2.9.2. Problems with SSSD Configuration

SSSD fails to start
SSSD requires that the configuration file be properly set up, with all the required entries, before the daemon will start.
  • SSSD requires at least one properly configured domain before the service will start. Without a domain, attempting to start SSSD returns an error that no domains are configured:
    # sssd -d4
    
    [sssd] [ldb] (3): server_sort:Unable to register control with rootdse!
    [sssd] [confdb_get_domains] (0): No domains configured, fatal error!
    [sssd] [get_monitor_config] (0): No domains configured.
    
    Edit the /etc/sssd/sssd.conf file and create at least one domain.
  • SSSD also requires at least one available service provider before it will start. If the problem is with the service provider configuration, the error message indicates that there are no services configured:
    [sssd] [get_monitor_config] (0): No services configured!
    
    Edit the /etc/sssd/sssd.conf file and configure at least one service provider.

    Important

    SSSD requires that service providers be configured as a comma-separated list in a single services entry in the /etc/sssd/sssd.conf file. If services are listed in multiple entries, only the last entry is recognized by SSSD.
NSS fails to return user information
This usually means that SSSD cannot connect to the NSS service.
  • Ensure that NSS is running:
    # systemctl is-active sssd.service
    sssd (pid 21762) is running...
    
  • If NSS is running, make sure that the provider is properly configured in the [nss] section of the /etc/sssd/sssd.conf file. Especially check the filter_users and filter_groups attributes.
  • Make sure that NSS is included in the list of services that SSSD uses.
  • Check the configuration in the /etc/nsswitch.conf file.
NSS returns incorrect user information
If searches are returning the incorrect user information, check that there are not conflicting usernames in separate domains. When there are multiple domains, set the use_fully_qualified_domains attribute to TRUE in the /etc/sssd/sssd.conf file. This differentiates between different users in different domains with the same name.
Setting the password for the local SSSD user prompts twice for the password
When attempting to change a local SSSD user's password, it may prompt for the password twice:
[root@clientF11 tmp]# passwd user1000
Changing password for user user1000.
New password:
Retype new password:
New Password:
Reenter new Password:
passwd: all authentication tokens updated successfully.
This is the result of an incorrect PAM configuration. Ensure that the use_authtok option is correctly configured in your /etc/pam.d/system-auth file.

Chapter 11. OpenSSH

SSH (Secure Shell) is a protocol which facilitates secure communications between two systems using a client/server architecture and allows users to log into server host systems remotely. Unlike other remote communication protocols, such as FTP or Telnet, SSH encrypts the login session, rendering the connection difficult for intruders to collect unencrypted passwords.
The ssh program is designed to replace older, less secure terminal applications used to log into remote hosts, such as telnet or rsh. A related program called scp replaces older programs designed to copy files between hosts, such as rcp. Because these older applications do not encrypt passwords transmitted between the client and the server, avoid them whenever possible. Using secure methods to log into remote systems decreases the risks for both the client system and the remote host.
Red Hat Enterprise Linux includes the general OpenSSH package (openssh) as well as the OpenSSH server (openssh-server) and client (openssh-clients) packages. Note, the OpenSSH packages require the OpenSSL package (openssl) which installs several important cryptographic libraries, enabling OpenSSH to provide encrypted communications.

11.1. The SSH Protocol

11.1.1. Why Use SSH?

Potential intruders have a variety of tools at their disposal enabling them to disrupt, intercept, and re-route network traffic in an effort to gain access to a system. In general terms, these threats can be categorized as follows:
Interception of communication between two systems
The attacker can be somewhere on the network between the communicating parties, copying any information passed between them. He may intercept and keep the information, or alter the information and send it on to the intended recipient.
This attack is usually performed using a packet sniffer, a rather common network utility that captures each packet flowing through the network, and analyzes its content.
Impersonation of a particular host
Attacker's system is configured to pose as the intended recipient of a transmission. If this strategy works, the user's system remains unaware that it is communicating with the wrong host.
This attack can be performed using a technique known as DNS poisoning, or via so-called IP spoofing. In the first case, the intruder uses a cracked DNS server to point client systems to a maliciously duplicated host. In the second case, the intruder sends falsified network packets that appear to be from a trusted host.
Both techniques intercept potentially sensitive information and, if the interception is made for hostile reasons, the results can be disastrous. If SSH is used for remote shell login and file copying, these security threats can be greatly diminished. This is because the SSH client and server use digital signatures to verify their identity. Additionally, all communication between the client and server systems is encrypted. Attempts to spoof the identity of either side of a communication does not work, since each packet is encrypted using a key known only by the local and remote systems.

11.1.2. Main Features

The SSH protocol provides the following safeguards:
No one can pose as the intended server
After an initial connection, the client can verify that it is connecting to the same server it had connected to previously.
No one can capture the authentication information
The client transmits its authentication information to the server using strong, 128-bit encryption.
No one can intercept the communication
All data sent and received during a session is transferred using 128-bit encryption, making intercepted transmissions extremely difficult to decrypt and read.
Additionally, it also offers the following options:
It provides secure means to use graphical applications over a network
Using a technique called X11 forwarding, the client can forward X11 (X Window System) applications from the server.
It provides a way to secure otherwise insecure protocols
The SSH protocol encrypts everything it sends and receives. Using a technique called port forwarding, an SSH server can become a conduit to securing otherwise insecure protocols, like POP, and increasing overall system and data security.
It can be used to create a secure channel
The OpenSSH server and client can be configured to create a tunnel similar to a virtual private network for traffic between server and client machines.
It supports the Kerberos authentication
OpenSSH servers and clients can be configured to authenticate using the GSSAPI (Generic Security Services Application Program Interface) implementation of the Kerberos network authentication protocol.

11.1.3. Protocol Versions

Two varieties of SSH currently exist: version 1, and newer version 2. The OpenSSH suite under Red Hat Enterprise Linux uses SSH version 2, which has an enhanced key exchange algorithm not vulnerable to the known exploit in version 1. However, for compatibility reasons, the OpenSSH suite does support version 1 connections as well.

Avoid using SSH version 1

To ensure maximum security for your connection, it is recommended that only SSH version 2-compatible servers and clients are used whenever possible.

11.1.4. Event Sequence of an SSH Connection

The following series of events help protect the integrity of SSH communication between two hosts.
  1. A cryptographic handshake is made so that the client can verify that it is communicating with the correct server.
  2. The transport layer of the connection between the client and remote host is encrypted using a symmetric cipher.
  3. The client authenticates itself to the server.
  4. The remote client interacts with the remote host over the encrypted connection.

11.1.4.1. Transport Layer

The primary role of the transport layer is to facilitate safe and secure communication between the two hosts at the time of authentication and during subsequent communication. The transport layer accomplishes this by handling the encryption and decryption of data, and by providing integrity protection of data packets as they are sent and received. The transport layer also provides compression, speeding the transfer of information.
Once an SSH client contacts a server, key information is exchanged so that the two systems can correctly construct the transport layer. The following steps occur during this exchange:
  • Keys are exchanged
  • The public key encryption algorithm is determined
  • The symmetric encryption algorithm is determined
  • The message authentication algorithm is determined
  • The hash algorithm is determined
During the key exchange, the server identifies itself to the client with a unique host key. If the client has never communicated with this particular server before, the server's host key is unknown to the client and it does not connect. OpenSSH gets around this problem by accepting the server's host key. This is done after the user is notified and has both accepted and verified the new host key. In subsequent connections, the server's host key is checked against the saved version on the client, providing confidence that the client is indeed communicating with the intended server. If, in the future, the host key no longer matches, the user must remove the client's saved version before a connection can occur.

Always verify the integrity of a new SSH server

It is possible for an attacker to masquerade as an SSH server during the initial contact since the local system does not know the difference between the intended server and a false one set up by an attacker. To help prevent this, verify the integrity of a new SSH server by contacting the server administrator before connecting for the first time or in the event of a host key mismatch.
SSH is designed to work with almost any kind of public key algorithm or encoding format. After an initial key exchange creates a hash value used for exchanges and a shared secret value, the two systems immediately begin calculating new keys and algorithms to protect authentication and future data sent over the connection.
After a certain amount of data has been transmitted using a given key and algorithm (the exact amount depends on the SSH implementation), another key exchange occurs, generating another set of hash values and a new shared secret value. Even if an attacker is able to determine the hash and shared secret value, this information is only useful for a limited period of time.

11.1.4.2. Authentication

Once the transport layer has constructed a secure tunnel to pass information between the two systems, the server tells the client the different authentication methods supported, such as using a private key-encoded signature or typing a password. The client then tries to authenticate itself to the server using one of these supported methods.
SSH servers and clients can be configured to allow different types of authentication, which gives each side the optimal amount of control. The server can decide which encryption methods it supports based on its security model, and the client can choose the order of authentication methods to attempt from the available options.

11.1.4.3. Channels

After a successful authentication over the SSH transport layer, multiple channels are opened via a technique called multiplexing[3]. Each of these channels handles communication for different terminal sessions and for forwarded X11 sessions.
Both clients and servers can create a new channel. Each channel is then assigned a different number on each end of the connection. When the client attempts to open a new channel, the clients sends the channel number along with the request. This information is stored by the server and is used to direct communication to that channel. This is done so that different types of sessions do not affect one another and so that when a given session ends, its channel can be closed without disrupting the primary SSH connection.
Channels also support flow-control, which allows them to send and receive data in an orderly fashion. In this way, data is not sent over the channel until the client receives a message that the channel is open.
The client and server negotiate the characteristics of each channel automatically, depending on the type of service the client requests and the way the user is connected to the network. This allows great flexibility in handling different types of remote connections without having to change the basic infrastructure of the protocol.

11.2. Configuring OpenSSH

In order to perform tasks described in this section, you must have superuser privileges. To obtain them, log in as root by typing:
~]$ su -
Password:

11.2.1. Configuration Files

There are two different sets of configuration files: those for client programs (that is, ssh, scp, and sftp), and those for the server (the sshd daemon).
System-wide SSH configuration information is stored in the /etc/ssh/ directory. See Table 11.1, “System-wide configuration files” for a description of its content.
Table 11.1. System-wide configuration files
Configuration File Description
/etc/ssh/moduli Contains Diffie-Hellman groups used for the Diffie-Hellman key exchange which is critical for constructing a secure transport layer. When keys are exchanged at the beginning of an SSH session, a shared, secret value is created which cannot be determined by either party alone. This value is then used to provide host authentication.
/etc/ssh/ssh_config The default SSH client configuration file. Note that it is overridden by ~/.ssh/config if it exists.
/etc/ssh/sshd_config The configuration file for the sshd daemon.
/etc/ssh/ssh_host_dsa_key The DSA private key used by the sshd daemon.
/etc/ssh/ssh_host_dsa_key.pub The DSA public key used by the sshd daemon.
/etc/ssh/ssh_host_key The RSA private key used by the sshd daemon for version 1 of the SSH protocol.
/etc/ssh/ssh_host_key.pub The RSA public key used by the sshd daemon for version 1 of the SSH protocol.
/etc/ssh/ssh_host_rsa_key The RSA private key used by the sshd daemon for version 2 of the SSH protocol.
/etc/ssh/ssh_host_rsa_key.pub The RSA public key used by the sshd for version 2 of the SSH protocol.

User-specific SSH configuration information is stored in the user's home directory within the ~/.ssh/ directory. See Table 11.2, “User-specific configuration files” for a description of its content.
Table 11.2. User-specific configuration files
Configuration File Description
~/.ssh/authorized_keys Holds a list of authorized public keys for servers. When the client connects to a server, the server authenticates the client by checking its signed public key stored within this file.
~/.ssh/id_dsa Contains the DSA private key of the user.
~/.ssh/id_dsa.pub The DSA public key of the user.
~/.ssh/id_rsa The RSA private key used by ssh for version 2 of the SSH protocol.
~/.ssh/id_rsa.pub The RSA public key used by ssh for version 2 of the SSH protocol
~/.ssh/identity The RSA private key used by ssh for version 1 of the SSH protocol.
~/.ssh/identity.pub The RSA public key used by ssh for version 1 of the SSH protocol.
~/.ssh/known_hosts Contains DSA host keys of SSH servers accessed by the user. This file is very important for ensuring that the SSH client is connecting the correct SSH server.

Refer to the ssh_config and sshd_config man pages for information concerning the various directives available in the SSH configuration files.

11.2.2. Starting an OpenSSH Server

Make sure you have relevant packages installed

To run an OpenSSH server, you must have the openssh-server and openssh packages installed. Refer to Section 5.2.4, “Installing Packages” for more information on how to install new packages in Red Hat Enterprise Linux.
To start the sshd daemon, type the following at a shell prompt:
~]# service sshd start
To stop the running sshd daemon, use the following command:
~]# service sshd stop
If you want the daemon to start automatically at the boot time, type:
~]# chkconfig sshd on
This will enable the service for all runlevels. For more configuration options, refer to Chapter 9, Services and Daemons for the detailed information on how to manage services.
Note that if you reinstall the system, a new set of identification keys will be created. As a result, clients who had connected to the system with any of the OpenSSH tools before the reinstall will see the following message:
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that the RSA host key has just been changed.
To prevent this, you can backup the relevant files from the /etc/ssh/ directory (see Table 11.1, “System-wide configuration files” for a complete list), and restore them whenever you reinstall the system.

11.2.3. Requiring SSH for Remote Connections

For SSH to be truly effective, using insecure connection protocols should be prohibited. Otherwise, a user's password may be protected using SSH for one session, only to be captured later while logging in using Telnet. Some services to disable include telnet, rsh, rlogin, and vsftpd.
To disable these services, type the following commands at a shell prompt:
~]# chkconfig telnet off
~]# chkconfig rsh off
~]# chkconfig rlogin off
~]# chkconfig vsftpd off
For more information on runlevels and configuring services in general, refer to Chapter 9, Services and Daemons.

11.2.4. Using a Key-Based Authentication

To improve the system security even further, you can enforce the key-based authentication by disabling the standard password authentication. To do so, open the /etc/ssh/sshd_config configuration file in a text editor such as vi or nano, and change the PasswordAuthentication option as follows:
PasswordAuthentication no
To be able to use ssh, scp, or sftp to connect to the server from a client machine, generate an authorization key pair by following the steps below. Note that keys must be generated for each user separately.
Red Hat Enterprise Linux 6 uses SSH Protocol 2 and RSA keys by default (see Section 11.1.3, “Protocol Versions” for more information).

Do not generate key pairs as root

If you complete the steps as root, only root will be able to use the keys.

Backup your ~/.ssh/ directory

If you reinstall your system and want to keep previously generated key pair, backup the ~/.ssh/ directory. After reinstalling, copy it back to your home directory. This process can be done for all users on your system, including root.

11.2.4.1. Generating Key Pairs

To generate an RSA key pair for version 2 of the SSH protocol, follow these steps:
  1. Generate an RSA key pair by typing the following at a shell prompt:
    ~]$ ssh-keygen -t rsa
    Generating public/private rsa key pair.
    Enter file in which to save the key (/home/john/.ssh/id_rsa):
  2. Press Enter to confirm the default location (that is, ~/.ssh/id_rsa) for the newly created key.
  3. Enter a passphrase, and confirm it by entering it again when prompted to do so. For security reasons, avoid using the same password as you use to log in to your account.
    After this, you will be presented with a message similar to this:
    Your identification has been saved in /home/john/.ssh/id_rsa.
    Your public key has been saved in /home/john/.ssh/id_rsa.pub.
    The key fingerprint is:
    e7:97:c7:e2:0e:f9:0e:fc:c4:d7:cb:e5:31:11:92:14 john@penguin.example.com
    The key's randomart image is:
    +--[ RSA 2048]----+
    |             E.  |
    |            . .  |
    |             o . |
    |              . .|
    |        S .    . |
    |         + o o ..|
    |          * * +oo|
    |           O +..=|
    |           o*  o.|
    +-----------------+
  4. Change the permissions of the ~/.ssh/ directory:
    ~]$ chmod 755 ~/.ssh
  5. Copy the content of ~/.ssh/id_rsa.pub into the ~/.ssh/authorized_keys on the machine to which you want to connect, appending it to its end if the file already exists.
  6. Change the permissions of the ~/.ssh/authorized_keys file using the following command:
    ~]$ chmod 644 ~/.ssh/authorized_keys
To generate a DSA key pair for version 2 of the SSH protocol, follow these steps:
  1. Generate a DSA key pair by typing the following at a shell prompt:
    ~]$ ssh-keygen -t dsa
    Generating public/private dsa key pair.
    Enter file in which to save the key (/home/john/.ssh/id_dsa):
  2. Press Enter to confirm the default location (that is, ~/.ssh/id_dsa) for the newly created key.
  3. Enter a passphrase, and confirm it by entering it again when prompted to do so. For security reasons, avoid using the same password as you use to log in to your account.
    After this, you will be presented with a message similar to this:
    Your identification has been saved in /home/john/.ssh/id_dsa.
    Your public key has been saved in /home/john/.ssh/id_dsa.pub.
    The key fingerprint is:
    81:a1:91:a8:9f:e8:c5:66:0d:54:f5:90:cc:bc:cc:27 john@penguin.example.com
    The key's randomart image is:
    +--[ DSA 1024]----+
    |   .oo*o.        |
    |  ...o Bo        |
    | .. . + o.       |
    |.  .   E o       |
    | o..o   S        |
    |. o= .           |
    |. +              |
    | .               |
    |                 |
    +-----------------+
  4. Change the permissions of the ~/.ssh/ directory:
    ~]$ chmod 775 ~/.ssh
  5. Copy the content of ~/.ssh/id_dsa.pub into the ~/.ssh/authorized_keys on the machine to which you want to connect, appending it to its end if the file already exists.
  6. Change the permissions of the ~/.ssh/authorized_keys file using the following command:
    ~]$ chmod 644 ~/.ssh/authorized_keys
To generate an RSA key pair for version 1 of the SSH protocol, follow these steps:
  1. Generate an RSA key pair by typing the following at a shell prompt:
    ~]$ ssh-keygen -t rsa1
    Generating public/private rsa1 key pair.
    Enter file in which to save the key (/home/john/.ssh/identity):
  2. Press Enter to confirm the default location (that is, ~/.ssh/identity) for the newly created key.
  3. Enter a passphrase, and confirm it by entering it again when prompted to do so. For security reasons, avoid using the same password as you use to log into your account.
    After this, you will be presented with a message similar to this:
    Your identification has been saved in /home/john/.ssh/identity.
    Your public key has been saved in /home/john/.ssh/identity.pub.
    The key fingerprint is:
    cb:f6:d5:cb:6e:5f:2b:28:ac:17:0c:e4:62:e4:6f:59 john@penguin.example.com
    The key's randomart image is:
    +--[RSA1 2048]----+
    |                 |
    |     . .         |
    |    o o          |
    |     + o E       |
    |    . o S        |
    |       = +   .   |
    |      . = . o . .|
    |       . = o o..o|
    |       .o o  o=o.|
    +-----------------+
  4. Change the permissions of the ~/.ssh/ directory:
    ~]$ chmod 755 ~/.ssh
  5. Copy the content of ~/.ssh/identity.pub into the ~/.ssh/authorized_keys on the machine to which you want to connect, appending it to its end if the file already exists.
  6. Change the permissions of the ~/.ssh/authorized_keys file using the following command:
    ~]$ chmod 644 ~/.ssh/authorized_keys
Refer to Section 11.2.4.2, “Configuring ssh-agent” for information on how to set up your system to remember the passphrase.

Never share your private key

The private key is for your personal use only, and it is important that you never give it to anyone.

11.2.4.2. Configuring ssh-agent

To store your passphrase so that you do not have to enter it each time you initiate a connection with a remote machine, you can use the ssh-agent authentication agent. If you are running GNOME, you can configure it to prompt you for your passphrase whenever you log in and remember it during the whole session. Otherwise you can store the passphrase for a certain shell prompt.
To save your passphrase during your GNOME session, follow these steps:
  1. Make sure you have the openssh-askpass package installed. If not, refer to Section 5.2.4, “Installing Packages” for more information on how to install new packages in Red Hat Enterprise Linux.
  2. Select SystemPreferencesStartup Applications from the panel. The Startup Applications Preferences will be started, and the tab containing a list of available startup programs will be shown by default.
    Startup Applications Preferences
    Startup Applications Preferences
    Figure 11.1. Startup Applications Preferences

  3. Click the Add button on the right, and enter /usr/bin/ssh-add in the Command field.
    Adding new application
    Adding new application
    Figure 11.2. Adding new application

  4. Click Add and make sure the check box next to the newly added item is selected.
    Enabling the application
    Enabling the application
    Figure 11.3. Enabling the application

  5. Log out and then log back in. A dialog box will appear prompting you for your passphrase. From this point on, you should not be prompted for a password by ssh, scp, or sftp.
    Entering a passphrase
    Entering a passphrase
    Figure 11.4. Entering a passphrase

To save your passphrase for a certain shell prompt, use the following command:
~]$ ssh-add
Enter passphrase for /home/john/.ssh/id_rsa:
Note that when you log out, your passphrase will be forgotten. You must execute the command each time you log in to a virtual console or a terminal window.

11.3. OpenSSH Clients

Make sure you have relevant packages installed

To connect to an OpenSSH server from a client machine, you must have the openssh-clients and openssh packages installed. Refer to Section 5.2.4, “Installing Packages” for more information on how to install new packages in Red Hat Enterprise Linux.

11.3.1. Using the ssh Utility

ssh allows you to log in to a remote machine and execute commands there. It is a secure replacement for the rlogin, rsh, and telnet programs.
Similarly to telnet, to log in to a remote machine named penguin.example.com, type the following command at a shell prompt:
~]$ ssh penguin.example.com
This will log you in with the same username you are using on a local machine. If you want to specify a different one, use a command in the ssh username@hostname form. For example, to log in as john, type:
~]$ ssh john@penguin.example.com
The first time you initiate a connection, you will be presented with a message similar to this:
The authenticity of host 'penguin.example.com' can't be established.
RSA key fingerprint is 94:68:3a:3a:bc:f3:9a:9b:01:5d:b3:07:38:e2:11:0c.
Are you sure you want to continue connecting (yes/no)?
Type yes to confirm. You will see a notice that the server has been added to the list of known hosts, and a prompt asking for your password:
Warning: Permanently added 'penguin.example.com' (RSA) to the list of known hosts.
john@penguin.example.com's password:

Updating the host key of an SSH server

If the SSH server's host key changes, the client notifies the user that the connection cannot proceed until the server's host key is deleted from the ~/.ssh/known_hosts file. To do so, open the file in a text editor, and remove a line containing the remote machine name at the beginning. Before doing this, however, contact the system administrator of the SSH server to verify the server is not compromised.
After entering the password, you will be provided with a shell prompt for the remote machine.
Alternatively, the ssh program can be used to execute a command on the remote machine without logging in to a shell prompt. The syntax for that is ssh [username@]hostname command. For example, if you want to execute the whoami command on penguin.example.com, type:
~]$ ssh john@penguin.example.com whoami
john@penguin.example.com's password:
john
After you enter the correct password, the username will be displayed, and you will return to your local shell prompt.

11.3.2. Using the scp Utility

scp can be used to transfer files between machines over a secure, encrypted connection. In its design, it is very similar to rcp.
To transfer a local file to a remote system, use a command in the following form:
scp localfile username@hostname:remotefile
For example, if you want to transfer taglist.vim to a remote machine named penguin.example.com, type the following at a shell prompt:
~]$ scp taglist.vim john@penguin.example.com:.vim/plugin/taglist.vim
john@penguin.example.com's password:
taglist.vim                                   100%  144KB 144.5KB/s   00:00
Multiple files can be specified at once. To transfer the contents of .vim/plugin/ to the same directory on the remote machine penguin.example.com, type the following command:
~]$ scp .vim/plugin/* john@penguin.example.com:.vim/plugin/
john@penguin.example.com's password:
closetag.vim                                  100%   13KB  12.6KB/s   00:00    
snippetsEmu.vim                               100%   33KB  33.1KB/s   00:00    
taglist.vim                                   100%  144KB 144.5KB/s   00:00
To transfer a remote file to the local system, use the following syntax:
scp username@hostname:remotefile localfile
For instance, to download the .vimrc configuration file from the remote machine, type:
~]$ scp john@penguin.example.com:.vimrc .vimrc
john@penguin.example.com's password:
.vimrc                                        100% 2233     2.2KB/s   00:00

11.3.3. Using the sftp Utility

The sftp utility can be used to open a secure, interactive FTP session. In its design, it is similar to ftp except that it uses a secure, encrypted connection.
To connect to a remote system, use a command in the following form:
sftp username@hostname
For example, to log in to a remote machine named penguin.example.com with john as a username, type:
~]$ sftp john@penguin.example.com
john@penguin.example.com's password:
Connected to penguin.example.com.
sftp>
After you enter the correct password, you will be presented with a prompt. The sftp utility accepts a set of commands similar to those used by ftp (see Table 11.3, “A selection of available sftp commands”).
Table 11.3. A selection of available sftp commands
Command Description
ls [directory] List the content of a remote directory. If none is supplied, a current working directory is used by default.
cd directory Change the remote working directory to directory.
mkdir directory Create a remote directory.
rmdir path Remove a remote directory.
put localfile [remotefile] Transfer localfile to a remote machine.
get remotefile [localfile] Transfer remotefile from a remote machine.

For a complete list of available commands, refer to the sftp man page.

11.4. More Than a Secure Shell

A secure command line interface is just the beginning of the many ways SSH can be used. Given the proper amount of bandwidth, X11 sessions can be directed over an SSH channel. Or, by using TCP/IP forwarding, previously insecure port connections between systems can be mapped to specific SSH channels.

11.4.1. X11 Forwarding

To open an X11 session over an SSH connection, use a command in the following form:
ssh -Y username@hostname
For example, to log in to a remote machine named penguin.example.com with john as a username, type:
~]$ ssh -Y john@penguin.example.com
john@penguin.example.com's password:
When an X program is run from the secure shell prompt, the SSH client and server create a new secure channel, and the X program data is sent over that channel to the client machine transparently.
X11 forwarding can be very useful. For example, X11 forwarding can be used to create a secure, interactive session of the Printer Configuration utility. To do this, connect to the server using ssh and type:
~]$ system-config-printer &
The Printer Configuration Tool will appear, allowing the remote user to safely configure printing on the remote system.

11.4.2. Port Forwarding

SSH can secure otherwise insecure TCP/IP protocols via port forwarding. When using this technique, the SSH server becomes an encrypted conduit to the SSH client.
Port forwarding works by mapping a local port on the client to a remote port on the server. SSH can map any port from the server to any port on the client. Port numbers do not need to match for this technique to work.

Using reserved port numbers

Setting up port forwarding to listen on ports below 1024 requires root level access.
To create a TCP/IP port forwarding channel which listens for connections on the localhost, use a command in the following form:
ssh -L local-port:remote-hostname:remote-port username@hostname
For example, to check email on a server called mail.example.com using POP3 through an encrypted connection, use the following command:
~]$ ssh -L 1100:mail.example.com:110 mail.example.com
Once the port forwarding channel is in place between the client machine and the mail server, direct a POP3 mail client to use port 1100 on the localhost to check for new email. Any requests sent to port 1100 on the client system will be directed securely to the mail.example.com server.
If mail.example.com is not running an SSH server, but another machine on the same network is, SSH can still be used to secure part of the connection. However, a slightly different command is necessary:
~]$ ssh -L 1100:mail.example.com:110 other.example.com
In this example, POP3 requests from port 1100 on the client machine are forwarded through the SSH connection on port 22 to the SSH server, other.example.com. Then, other.example.com connects to port 110 on mail.example.com to check for new email. Note that when using this technique, only the connection between the client system and other.example.com SSH server is secure.
Port forwarding can also be used to get information securely through network firewalls. If the firewall is configured to allow SSH traffic via its standard port (that is, port 22) but blocks access to other ports, a connection between two hosts using the blocked ports is still possible by redirecting their communication over an established SSH connection.

A connection is only as secure as a client system

Using port forwarding to forward connections in this manner allows any user on the client system to connect to that service. If the client system becomes compromised, the attacker also has access to forwarded services.
System administrators concerned about port forwarding can disable this functionality on the server by specifying a No parameter for the AllowTcpForwarding line in /etc/ssh/sshd_config and restarting the sshd service.

11.5. Additional Resources

The OpenSSH and OpenSSL projects are in constant development, and the most up-to-date information for them is available from their websites. The man pages for OpenSSH and OpenSSL tools are also good sources of detailed information.

11.5.1. Installed Documentation

man ssh
The manual page for ssh containing the full documentation on its usage.
man scp
The manual page for scp containing the full documentation on its usage.
man sftp
The manual page for sftp containing the full documentation on its usage.
man sshd
The manual page for sshd containing the full documentation on its usage.
man ssh-keygen
The manual page for ssh-keygen containing the full documentation on its usage.
man ssh_config
The manual page with full description of available SSH client configuration options.
man sshd_config
The manual page with full description of available SSH daemon configuration options.

11.5.2. Useful Websites

http://www.openssh.com/
The OpenSSH home page containing further documentation, frequently asked questions, links to the mailing lists, bug reports, and other useful resources.
http://www.openssl.org/
The OpenSSL home page containing further documentation, frequently asked questions, links to the mailing lists, and other useful resources.
http://www.freesshd.com/
Another implementation of an SSH server.


[3] A multiplexed connection consists of several signals being sent over a shared, common medium. With SSH, different channels are sent over a common secure connection.

Part V. Servers

This part discusses various topics related to servers such as how to set up a Web server or share files and directories over the network.

Table of Contents

12. DHCP Servers
12.1. Why Use DHCP?
12.2. Configuring a DHCP Server
12.2.1. Configuration File
12.2.2. Lease Database
12.2.3. Starting and Stopping the Server
12.2.4. DHCP Relay Agent
12.3. Configuring a DHCP Client
12.4. Configuring a Multihomed DHCP Server
12.4.1. Host Configuration
12.5. DHCP for IPv6 (DHCPv6)
12.6. Additional Resources
12.6.1. Installed Documentation
13. DNS Servers
13.1. Introduction to DNS
13.1.1. Nameserver Zones
13.1.2. Nameserver Types
13.1.3. BIND as a Nameserver
13.2. BIND
13.2.1. Configuring the named Service
13.2.2. Editing Zone Files
13.2.3. Using the rndc Utility
13.2.4. Using the dig Utility
13.2.5. Advanced Features of BIND
13.2.6. Common Mistakes to Avoid
13.2.7. Additional Resources
14. Web Servers
14.1. The Apache HTTP Server
14.1.1. New Features
14.1.2. Notable Changes
14.1.3. Updating the Configuration
14.1.4. Running the httpd Service
14.1.5. Editing the Configuration Files
14.1.6. Working with Modules
14.1.7. Setting Up Virtual Hosts
14.1.8. Setting Up an SSL Server
14.1.9. Additional Resources
15. Mail Servers
15.1. Email Protocols
15.1.1. Mail Transport Protocols
15.1.2. Mail Access Protocols
15.2. Email Program Classifications
15.2.1. Mail Transport Agent
15.2.2. Mail Delivery Agent
15.2.3. Mail User Agent
15.3. Mail Transport Agents
15.3.1. Postfix
15.3.2. Sendmail
15.3.3. Fetchmail
15.3.4. Mail Transport Agent (MTA) Configuration
15.4. Mail Delivery Agents
15.4.1. Procmail Configuration
15.4.2. Procmail Recipes
15.5. Mail User Agents
15.5.1. Securing Communication
15.6. Additional Resources
15.6.1. Installed Documentation
15.6.2. Useful Websites
15.6.3. Related Books
16. Directory Servers
16.1. OpenLDAP
16.1.1. Introduction to LDAP
16.1.2. Installing the OpenLDAP Suite
16.1.3. Configuring an OpenLDAP Server
16.1.4. Running an OpenLDAP Server
16.1.5. Configuring a System to Authenticate Using OpenLDAP
16.1.6. Additional Resources
17. File and Print Servers
17.1. Samba
17.1.1. Introduction to Samba
17.1.2. Samba Daemons and Related Services
17.1.3. Connecting to a Samba Share
17.1.4. Configuring a Samba Server
17.1.5. Starting and Stopping Samba
17.1.6. Samba Server Types and the smb.conf File
17.1.7. Samba Security Modes
17.1.8. Samba Account Information Databases
17.1.9. Samba Network Browsing
17.1.10. Samba with CUPS Printing Support
17.1.11. Samba Distribution Programs
17.1.12. Additional Resources
17.2. FTP
17.2.1. The File Transfer Protocol
17.2.2. FTP Servers
17.2.3. Files Installed with vsftpd
17.2.4. Starting and Stopping vsftpd
17.2.5. vsftpd Configuration Options
17.2.6. Additional Resources
17.3. Printer Configuration
17.3.1. Starting the Printer Configuration Tool
17.3.2. Starting Printer Setup
17.3.3. Adding a Local Printer
17.3.4. Adding an AppSocket/HP JetDirect printer
17.3.5. Adding an IPP Printer
17.3.6. Adding an LPD/LPR Host or Printer
17.3.7. Adding a Samba (SMB) printer
17.3.8. Selecting the Printer Model and Finishing
17.3.9. Printing a test page
17.3.10. Modifying Existing Printers
17.3.11. Additional Resources

Chapter 12. DHCP Servers

Dynamic Host Configuration Protocol (DHCP) is a network protocol that automatically assigns TCP/IP information to client machines. Each DHCP client connects to the centrally located DHCP server, which returns that client's network configuration (including the IP address, gateway, and DNS servers).

12.1. Why Use DHCP?

DHCP is useful for automatic configuration of client network interfaces. When configuring the client system, the administrator chooses DHCP instead of specifying an IP address, netmask, gateway, or DNS servers. The client retrieves this information from the DHCP server. DHCP is also useful if an administrator wants to change the IP addresses of a large number of systems. Instead of reconfiguring all the systems, he can just edit one DHCP configuration file on the server for the new set of IP addresses. If the DNS servers for an organization changes, the changes are made on the DHCP server, not on the DHCP clients. When the administrator restarts the network or reboots the clients, the changes will go into effect.
If an organization has a functional DHCP server properly connected to a network, laptops and other mobile computer users can move these devices from office to office.

12.2. Configuring a DHCP Server

The dhcp package contains an ISC DHCP server. First, install the package as the superuser:
~]# yum install dhcp
Installing the dhcp package creates a file, /etc/dhcp/dhcpd.conf, which is merely an empty configuration file:
~]# cat /etc/dhcp/dhcpd.conf
#
# DHCP Server Configuration file.
#   see /usr/share/doc/dhcp*/dhcpd.conf.sample
The sample configuration file can be found at /usr/share/doc/dhcp-<version>/dhcpd.conf.sample. You should use this file to help you configure /etc/dhcp/dhcpd.conf, which is explained in detail below.
DHCP also uses the file /var/lib/dhcpd/dhcpd.leases to store the client lease database. Refer to Section 12.2.2, “Lease Database” for more information.

12.2.1. Configuration File

The first step in configuring a DHCP server is to create the configuration file that stores the network information for the clients. Use this file to declare options and global options for client systems.
The configuration file can contain extra tabs or blank lines for easier formatting. Keywords are case-insensitive and lines beginning with a hash sign (#) are considered comments.
There are two types of statements in the configuration file:
  • Parameters — State how to perform a task, whether to perform a task, or what network configuration options to send to the client.
  • Declarations — Describe the topology of the network, describe the clients, provide addresses for the clients, or apply a group of parameters to a group of declarations.
The parameters that start with the keyword option are referred to as options. These options control DHCP options; whereas, parameters configure values that are not optional or control how the DHCP server behaves.
Parameters (including options) declared before a section enclosed in curly brackets ({ }) are considered global parameters. Global parameters apply to all the sections below it.

Restart the DHCP daemon for the changes to take effect

If the configuration file is changed, the changes do not take effect until the DHCP daemon is restarted with the command service dhcpd restart.

Use the omshell command

Instead of changing a DHCP configuration file and restarting the service each time, using the omshell command provides an interactive way to connect to, query, and change the configuration of a DHCP server. By using omshell, all changes can be made while the server is running. For more information on omshell, refer to the omshell man page.
In Example 12.1, “Subnet declaration”, the routers, subnet-mask, domain-search, domain-name-servers, and time-offset options are used for any host statements declared below it.
Additionally, a subnet can be declared, a subnet declaration must be included for every subnet in the network. If it is not, the DHCP server fails to start.
In this example, there are global options for every DHCP client in the subnet and a range declared. Clients are assigned an IP address within the range.
Example 12.1. Subnet declaration
subnet 192.168.1.0 netmask 255.255.255.0 {
        option routers                  192.168.1.254;
        option subnet-mask              255.255.255.0;
        option domain-search              "example.com";
        option domain-name-servers       192.168.1.1;
        option time-offset              -18000;     # Eastern Standard Time
	range 192.168.1.10 192.168.1.100;
}

To configure a DHCP server that leases a dynamic IP address to a system within a subnet, modify Example 12.2, “Range parameter” with your values. It declares a default lease time, maximum lease time, and network configuration values for the clients. This example assigns IP addresses in the range 192.168.1.10 and 192.168.1.100 to client systems.
Example 12.2. Range parameter
default-lease-time 600;
max-lease-time 7200;
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.1.255;
option routers 192.168.1.254;
option domain-name-servers 192.168.1.1, 192.168.1.2;
option domain-search "example.com";
subnet 192.168.1.0 netmask 255.255.255.0 {
   range 192.168.1.10 192.168.1.100;
}

To assign an IP address to a client based on the MAC address of the network interface card, use the hardware ethernet parameter within a host declaration. As demonstrated in Example 12.3, “Static IP address using DHCP”, the host apex declaration specifies that the network interface card with the MAC address 00:A0:78:8E:9E:AA always receives the IP address 192.168.1.4.
Note that the optional parameter host-name can also be used to assign a host name to the client.
Example 12.3. Static IP address using DHCP
host apex {
   option host-name "apex.example.com";
   hardware ethernet 00:A0:78:8E:9E:AA;
   fixed-address 192.168.1.4;
}

All subnets that share the same physical network should be declared within a shared-network declaration as shown in Example 12.4, “Shared-network declaration”. Parameters within the shared-network, but outside the enclosed subnet declarations, are considered to be global parameters. The name of the shared-network must be a descriptive title for the network, such as using the title 'test-lab' to describe all the subnets in a test lab environment.
Example 12.4. Shared-network declaration
shared-network name {
    option domain-search              "test.redhat.com";
    option domain-name-servers      ns1.redhat.com, ns2.redhat.com;
    option routers                  192.168.0.254;
    more parameters for EXAMPLE shared-network
    subnet 192.168.1.0 netmask 255.255.252.0 {
        parameters for subnet
        range 192.168.1.1 192.168.1.254;
    }
    subnet 192.168.2.0 netmask 255.255.252.0 {
        parameters for subnet
        range 192.168.2.1 192.168.2.254;
    }
}

As demonstrated in Example 12.5, “Group declaration”, the group declaration is used to apply global parameters to a group of declarations. For example, shared networks, subnets, and hosts can be grouped.
Example 12.5. Group declaration
group {
   option routers                  192.168.1.254;
   option subnet-mask              255.255.255.0;
   option domain-search              "example.com";
   option domain-name-servers       192.168.1.1;
   option time-offset              -18000;     # Eastern Standard Time
   host apex {
      option host-name "apex.example.com";
      hardware ethernet 00:A0:78:8E:9E:AA;
      fixed-address 192.168.1.4;
   }
   host raleigh {
      option host-name "raleigh.example.com";
      hardware ethernet 00:A1:DD:74:C3:F2;
      fixed-address 192.168.1.6;
   }
}

Using the sample configuration file

The sample configuration file provided can be used as a starting point and custom configuration options can be added to it. To copy it to the proper location, use the following command:
cp /usr/share/doc/dhcp-<version-number>/dhcpd.conf.sample /etc/dhcp/dhcpd.conf
... where <version-number> is the DHCP version number.
For a complete list of option statements and what they do, refer to the dhcp-options man page.

12.2.2. Lease Database

On the DHCP server, the file /var/lib/dhcpd/dhcpd.leases stores the DHCP client lease database. Do not change this file. DHCP lease information for each recently assigned IP address is automatically stored in the lease database. The information includes the length of the lease, to whom the IP address has been assigned, the start and end dates for the lease, and the MAC address of the network interface card that was used to retrieve the lease.
All times in the lease database are in Coordinated Universal Time (UTC), not local time.
The lease database is recreated from time to time so that it is not too large. First, all known leases are saved in a temporary lease database. The dhcpd.leases file is renamed dhcpd.leases~ and the temporary lease database is written to dhcpd.leases.
The DHCP daemon could be killed or the system could crash after the lease database has been renamed to the backup file but before the new file has been written. If this happens, the dhcpd.leases file does not exist, but it is required to start the service. Do not create a new lease file. If you do, all old leases are lost which causes many problems. The correct solution is to rename the dhcpd.leases~ backup file to dhcpd.leases and then start the daemon.

12.2.3. Starting and Stopping the Server

Starting the DHCP server for the first time

When the DHCP server is started for the first time, it fails unless the dhcpd.leases file exists. Use the command touch /var/lib/dhcpd/dhcpd.leases to create the file if it does not exist.
If the same server is also running BIND as a DNS server, this step is not necessary, as starting the named service automatically checks for a dhcpd.leases file.
To start the DHCP service, use the command /sbin/service dhcpd start. To stop the DHCP server, use the command /sbin/service dhcpd stop.
By default, the DHCP service does not start at boot time. To configure the daemon to start automatically at boot time, refer to Chapter 9, Services and Daemons.
If more than one network interface is attached to the system, but the DHCP server should only be started on one of the interfaces, configure the DHCP server to start only on that device. In /etc/sysconfig/dhcpd, add the name of the interface to the list of DHCPDARGS:
# Command line options here
DHCPDARGS=eth0
This is useful for a firewall machine with two network cards. One network card can be configured as a DHCP client to retrieve an IP address to the Internet. The other network card can be used as a DHCP server for the internal network behind the firewall. Specifying only the network card connected to the internal network makes the system more secure because users can not connect to the daemon via the Internet.
Other command line options that can be specified in /etc/sysconfig/dhcpd include:
  • -p <portnum> — Specifies the UDP port number on which dhcpd should listen. The default is port 67. The DHCP server transmits responses to the DHCP clients at a port number one greater than the UDP port specified. For example, if the default port 67 is used, the server listens on port 67 for requests and responses to the client on port 68. If a port is specified here and the DHCP relay agent is used, the same port on which the DHCP relay agent should listen must be specified. Refer to Section 12.2.4, “DHCP Relay Agent” for details.
  • -f — Runs the daemon as a foreground process. This is mostly used for debugging.
  • -d — Logs the DHCP server daemon to the standard error descriptor. This is mostly used for debugging. If this is not specified, the log is written to /var/log/messages.
  • -cf <filename> — Specifies the location of the configuration file. The default location is /etc/dhcp/dhcpd.conf.
  • -lf <filename> — Specifies the location of the lease database file. If a lease database file already exists, it is very important that the same file be used every time the DHCP server is started. It is strongly recommended that this option only be used for debugging purposes on non-production machines. The default location is /var/lib/dhcpd/dhcpd.leases.
  • -q — Do not print the entire copyright message when starting the daemon.

12.2.4. DHCP Relay Agent

The DHCP Relay Agent (dhcrelay) allows for the relay of DHCP and BOOTP requests from a subnet with no DHCP server on it to one or more DHCP servers on other subnets.
When a DHCP client requests information, the DHCP Relay Agent forwards the request to the list of DHCP servers specified when the DHCP Relay Agent is started. When a DHCP server returns a reply, the reply is broadcast or unicast on the network that sent the original request.
The DHCP Relay Agent listens for DHCP requests on all interfaces unless the interfaces are specified in /etc/sysconfig/dhcrelay with the INTERFACES directive.
To start the DHCP Relay Agent, use the command service dhcrelay start.

12.3. Configuring a DHCP Client

To configure a DHCP client manually, modify the /etc/sysconfig/network file to enable networking and the configuration file for each network device in the /etc/sysconfig/network-scripts directory. In this directory, each device should have a configuration file named ifcfg-eth0, where eth0 is the network device name.
The /etc/sysconfig/network-scripts/ifcfg-eth0 file should contain the following lines:
DEVICE=eth0
BOOTPROTO=dhcp
ONBOOT=yes
A configuration file is needed for each device to be configured to use DHCP.
Other options for the network script includes:
  • DHCP_HOSTNAME — Only use this option if the DHCP server requires the client to specify a hostname before receiving an IP address. (The DHCP server daemon in Red Hat Enterprise Linux does not support this feature.)
  • PEERDNS=<answer>, where <answer> is one of the following:
    • yes — Modify /etc/resolv.conf with information from the server. If using DHCP, then yes is the default.
    • no — Do not modify /etc/resolv.conf.
If you prefer using a graphical interface, refer to Chapter 7, NetworkManager for instructions on using the Network Administration Tool to configure a network interface to use DHCP.

Advanced configurations

For advanced configurations of client DHCP options such as protocol timing, lease requirements and requests, dynamic DNS support, aliases, as well as a wide variety of values to override, prepend, or append to client-side configurations, refer to the dhclient and dhclient.conf man pages.

12.4. Configuring a Multihomed DHCP Server

A multihomed DHCP server serves multiple networks, that is, multiple subnets. The examples in these sections detail how to configure a DHCP server to serve multiple networks, select which network interfaces to listen on, and how to define network settings for systems that move networks.
Before making any changes, back up the existing /etc/sysconfig/dhcpd and /etc/dhcp/dhcpd.conf files.
The DHCP daemon listens on all network interfaces unless otherwise specified. Use the /etc/sysconfig/dhcpd file to specify which network interfaces the DHCP daemon listens on. The following /etc/sysconfig/dhcpd example specifies that the DHCP daemon listens on the eth0 and eth1 interfaces:
DHCPDARGS="eth0 eth1";
If a system has three network interfaces cards -- eth0, eth1, and eth2 -- and it is only desired that the DHCP daemon listens on eth0, then only specify eth0 in /etc/sysconfig/dhcpd:
DHCPDARGS="eth0";
The following is a basic /etc/dhcp/dhcpd.conf file, for a server that has two network interfaces, eth0 in a 10.0.0.0/24 network, and eth1 in a 172.16.0.0/24 network. Multiple subnet declarations allow different settings to be defined for multiple networks:
default-lease-time 600;
max-lease-time 7200;
subnet 10.0.0.0 netmask 255.255.255.0 {
	option subnet-mask 255.255.255.0;
	option routers 10.0.0.1;
	range 10.0.0.5 10.0.0.15;
}
subnet 172.16.0.0 netmask 255.255.255.0 {
	option subnet-mask 255.255.255.0;
	option routers 172.16.0.1;
	range 172.16.0.5 172.16.0.15;
}
subnet 10.0.0.0 netmask 255.255.255.0;
A subnet declaration is required for every network your DHCP server is serving. Multiple subnets require multiple subnet declarations. If the DHCP server does not have a network interface in a range of a subnet declaration, the DHCP server does not serve that network.
If there is only one subnet declaration, and no network interfaces are in the range of that subnet, the DHCP daemon fails to start, and an error such as the following is logged to /var/log/messages:
dhcpd: No subnet declaration for eth0 (0.0.0.0).
dhcpd: ** Ignoring requests on eth0.  If this is not what
dhcpd:    you want, please write a subnet declaration
dhcpd:    in your dhcpd.conf file for the network segment
dhcpd:    to which interface eth1 is attached. **
dhcpd:
dhcpd:
dhcpd: Not configured to listen on any interfaces!
option subnet-mask 255.255.255.0;
The option subnet-mask option defines a subnet mask, and overrides the netmask value in the subnet declaration. In simple cases, the subnet and netmask values are the same.
option routers 10.0.0.1;
The option routers option defines the default gateway for the subnet. This is required for systems to reach internal networks on a different subnet, as well as external networks.
range 10.0.0.5 10.0.0.15;
The range option specifies the pool of available IP addresses. Systems are assigned an address from the range of specified IP addresses.
For further information, refer to the dhcpd.conf(5) man page.

Do not use alias interfaces

Alias interfaces are not supported by DHCP. If an alias interface is the only interface, in the only subnet specified in /etc/dhcp/dhcpd.conf, the DHCP daemon fails to start.

12.4.1. Host Configuration

Before making any changes, back up the existing /etc/sysconfig/dhcpd and /etc/dhcp/dhcpd.conf files.
Configuring a single system for multiple networks
The following /etc/dhcp/dhcpd.conf example creates two subnets, and configures an IP address for the same system, depending on which network it connects to:
default-lease-time 600;
max-lease-time 7200;
subnet 10.0.0.0 netmask 255.255.255.0 {
	option subnet-mask 255.255.255.0;
	option routers 10.0.0.1;
	range 10.0.0.5 10.0.0.15;
}
subnet 172.16.0.0 netmask 255.255.255.0 {
	option subnet-mask 255.255.255.0;
	option routers 172.16.0.1;
	range 172.16.0.5 172.16.0.15;
}
host example0 {
	hardware ethernet 00:1A:6B:6A:2E:0B;
	fixed-address 10.0.0.20;
}
host example1 {
	hardware ethernet 00:1A:6B:6A:2E:0B;
	fixed-address 172.16.0.20;
}
host example0
The host declaration defines specific parameters for a single system, such as an IP address. To configure specific parameters for multiple hosts, use multiple host declarations.
Most DHCP clients ignore the name in host declarations, and as such, this name can anything, as long as it is unique to other host declarations. To configure the same system for multiple networks, use a different name for each host declaration, otherwise the DHCP daemon fails to start. Systems are identified by the hardware ethernet option, not the name in the host declaration.
hardware ethernet 00:1A:6B:6A:2E:0B;
The hardware ethernet option identifies the system. To find this address, run the ip link command.
fixed-address 10.0.0.20;
The fixed-address option assigns a valid IP address to the system specified by the hardware ethernet option. This address must be outside the IP address pool specified with the range option.
If option statements do not end with a semicolon, the DHCP daemon fails to start, and an error such as the following is logged to /var/log/messages:
/etc/dhcp/dhcpd.conf line 20: semicolon expected.
dhcpd: }
dhcpd: ^
dhcpd: /etc/dhcp/dhcpd.conf line 38: unexpected end of file
dhcpd:
dhcpd: ^
dhcpd: Configuration file errors encountered -- exiting
Configuring systems with multiple network interfaces
The following host declarations configure a single system, that has multiple network interfaces, so that each interface receives the same IP address. This configuration will not work if both network interfaces are connected to the same network at the same time:
host interface0 {
	hardware ethernet 00:1a:6b:6a:2e:0b;
	fixed-address 10.0.0.18;
}
host interface1 {
	hardware ethernet 00:1A:6B:6A:27:3A;
	fixed-address 10.0.0.18;
}
For this example, interface0 is the first network interface, and interface1 is the second interface. The different hardware ethernet options identify each interface.
If such a system connects to another network, add more host declarations, remembering to:
  • assign a valid fixed-address for the network the host is connecting to.
  • make the name in the host declaration unique.
When a name given in a host declaration is not unique, the DHCP daemon fails to start, and an error such as the following is logged to /var/log/messages:
dhcpd: /etc/dhcp/dhcpd.conf line 31: host interface0: already exists
dhcpd: }
dhcpd: ^
dhcpd: Configuration file errors encountered -- exiting
This error was caused by having multiple host interface0 declarations defined in /etc/dhcp/dhcpd.conf.

12.5. DHCP for IPv6 (DHCPv6)

The ISC DHCP includes support for IPv6 (DHCPv6) since the 4.x release with a DHCPv6 server, client and relay agent functionality. The server, client and relay agents support both IPv4 and IPv6. However, the client and the server can only manage one protocol at a time — for dual support they must be started separately for IPv4 and IPv6.
The DHCPv6 server configuration file can be found at /etc/dhcp/dhcpd6.conf.
The sample server configuration file can be found at /usr/share/doc/dhcp-<version>/dhcpd6.conf.sample.
To start the DHCPv6 service, use the command /sbin/service dhcpd6 start.
A simple DHCPv6 server configuration file can look like this:
subnet6 2001:db8:0:1::/64 {
        range6 2001:db8:0:1::129 2001:db8:0:1::254;
        option dhcp6.name-servers fec0:0:0:1::1;
        option dhcp6.domain-search "domain.example";
}

12.6. Additional Resources

For additional information, refer to The DHCP Handbook; Ralph Droms and Ted Lemon; 2003 or the following resources.

12.6.1. Installed Documentation

  • dhcpd man page — Describes how the DHCP daemon works.
  • dhcpd.conf man page — Explains how to configure the DHCP configuration file; includes some examples.
  • dhcpd.leases man page — Describes a persistent database of leases.
  • dhcp-options man page — Explains the syntax for declaring DHCP options in dhcpd.conf; includes some examples.
  • dhcrelay man page — Explains the DHCP Relay Agent and its configuration options.
  • /usr/share/doc/dhcp-<version>/ — Contains sample files, README files, and release notes for current versions of the DHCP service.

Chapter 13. DNS Servers

DNS (Domain Name System), also known as a nameserver, is a network system that associates hostnames with their respective IP addresses. For users, this has the advantage that they can refer to machines on the network by names that are usually easier to remember than the numerical network addresses. For system administrators, using the nameserver allows them to change the IP address for a host without ever affecting the name-based queries, or to decide which machines handle these queries.

13.1. Introduction to DNS

DNS is usually implemented using one or more centralized servers that are authoritative for certain domains. When a client host requests information from a nameserver, it usually connects to port 53. The nameserver then attempts to resolve the name requested. If it does not have an authoritative answer, or does not already have the answer cached from an earlier query, it queries other nameservers, called root nameservers, to determine which nameservers are authoritative for the name in question, and then queries them to get the requested name.

13.1.1. Nameserver Zones

In a DNS server such as BIND, all information is stored in basic data elements called resource records (RR). The resource record is usually a fully qualified domain name (FQDN) of a host, and is broken down into multiple sections organized into a tree-like hierarchy. This hierarchy consists of a main trunk, primary branches, secondary branches, and so on.
Example 13.1. A simple resource record
bob.sales.example.com

Each level of the hierarchy is divided by a period (that is, .). In Example 13.1, “A simple resource record”, com defines the top-level domain, example its subdomain, and sales the subdomain of example. In this case, bob identifies a resource record that is part of the sales.example.com domain. With the exception of the part furthest to the left (that is, bob), each of these sections is called a zone and defines a specific namespace.
Zones are defined on authoritative nameservers through the use of zone files, which contain definitions of the resource records in each zone. Zone files are stored on primary nameservers (also called master nameservers), where changes are made to the files, and secondary nameservers (also called slave nameservers), which receive zone definitions from the primary nameservers. Both primary and secondary nameservers are authoritative for the zone and look the same to clients. Depending on the configuration, any nameserver can also serve as a primary or secondary server for multiple zones at the same time.

13.1.2. Nameserver Types

There are two nameserver configuration types:
authoritative
Authoritative nameservers answer to resource records that are part of their zones only. This category includes both primary (master) and secondary (slave) nameservers.
recursive
Recursive nameservers offer resolution services, but they are not authoritative for any zone. Answers for all resolutions are cached in a memory for a fixed period of time, which is specified by the retrieved resource record.
Although a nameserver can be both authoritative and recursive at the same time, it is recommended not to combine the configuration types. To be able to perform their work, authoritative servers should be available to all clients all the time. On the other hand, since the recursive lookup takes far more time than authoritative responses, recursive servers should be available to a restricted number of clients only, otherwise they are prone to distributed denial of service (DDoS) attacks.

13.1.3. BIND as a Nameserver

BIND consists of a set of DNS-related programs. It contains a monolithic nameserver called named, an administration utility called rndc, and a debugging tool called dig. Refer to Chapter 9, Services and Daemons for more information on how to run a service in Red Hat Enterprise Linux.

13.2. BIND

This chapter covers BIND (Berkeley Internet Name Domain), the DNS server included in Red Hat Enterprise Linux. It focuses on the structure of its configuration files, and describes how to administer it both locally and remotely.

13.2.1. Configuring the named Service

When the named service is started, it reads the configuration from the files as described in Table 13.1, “The named service configuration files”.
Table 13.1. The named service configuration files
Path Description
/etc/named.conf The main configuration file.
/etc/named/ An auxiliary directory for configuration files that are included in the main configuration file.

The configuration file consists of a collection of statements with nested options surrounded by opening and closing curly brackets (that is, { and }). Note that when editing the file, you have to be careful not to make any syntax error, otherwise the named service will not start. A typical /etc/named.conf file is organized as follows:
statement-1 ["statement-1-name"] [statement-1-class] {
  option-1;
  option-2;
  option-N;
};
statement-2 ["statement-2-name"] [statement-2-class] {
  option-1;
  option-2;
  option-N;
};
statement-N ["statement-N-name"] [statement-N-class] {
  option-1;
  option-2;
  option-N;
};

Running BIND in a chroot environment

If you have installed the bind-chroot package, the BIND service will run in the /var/named/chroot environment. In that case, the initialization script will mount the above configuration files using the mount --bind command, so that you can manage the configuration outside this environment.

13.2.1.1. Common Statement Types

The following types of statements are commonly used in /etc/named.conf:
acl
The acl (Access Control List) statement allows you to define groups of hosts, so that they can be permitted or denied access to the nameserver. It takes the following form:
acl acl-name {
  match-element;
  ...
};
The acl-name statement name is the name of the access control list, and the match-element option is usually an individual IP address (such as 10.0.1.1) or a CIDR network notation (for example, 10.0.1.0/24). For a list of already defined keywords, see Table 13.2, “Predefined access control lists”.
Table 13.2. Predefined access control lists
Keyword Description
any Matches every IP address.
localhost Matches any IP address that is in use by the local system.
localnets Matches any IP address on any network to which the local system is connected.
none Does not match any IP address.

The acl statement can be especially useful with conjunction with other statements such as options. Example 13.2, “Using acl in conjunction with options” defines two access control lists, black-hats and red-hats, and adds black-hats on the blacklist while granting red-hats a normal access.
Example 13.2. Using acl in conjunction with options
acl black-hats {
  10.0.2.0/24;
  192.168.0.0/24;
  1234:5678::9abc/24;
};
acl red-hats {
  10.0.1.0/24;
};
options {
  blackhole { black-hats; };
  allow-query { red-hats; };
  allow-query-cache { red-hats; };
};

include
The include statement allows you to include files in the /etc/named.conf, so that potentially sensitive data can be placed in a separate file with restricted permissions. It takes the following form:
include "file-name"
The file-name statement name is an absolute path to a file.
Example 13.3. Including a file to /etc/named.conf
include "/etc/named.rfc1912.zones";

options
The options statement allows you to define global server configuration options as well as to set defaults for other statements. It can be used to specify the location of the named working directory, the types of queries allowed, and much more. It takes the following form:
options {
  option;
  ...
};
For a list of frequently used option directives, see Table 13.3, “Commonly used options” below.
Table 13.3. Commonly used options
Option Description
allow-query Specifies which hosts are allowed to query the nameserver for authoritative resource records. It accepts an access control lists, a collection of IP addresses, or networks in the CIDR notation. All hosts are allowed by default.
allow-query-cache Specifies which hosts are allowed to query the nameserver for non-authoritative data such as recursive queries. Only localhost and localnets are allowed by default.
blackhole Specifies which hosts are not allowed to query the nameserver. This option should be used when particular host or network floods the server with requests. The default option is none.
directory Specifies a working directory for the named service. The default option is /var/named/.
dnssec-enable Specifies whether to return DNSSEC related resource records. The default option is yes.
dnssec-validation Specifies whether to prove that resource records are authentic via DNSSEC. The default option is yes.
forwarders Specifies a list of valid IP addresses for nameservers to which the requests should be forwarded for resolution.
forward
Specifies the behavior of the forwarders directive. It accepts the following options:
  • first — The server will query the nameservers listed in the forwarders directive before attempting to resolve the name on its own.
  • only — When unable to query the nameservers listed in the forwarders directive, the server will not attempt to resolve the name on its own.
listen-on Specifies the IPv4 network interface on which to listen for queries. On a DNS server that also acts as a gateway, you can use this option to answer queries originating from a single network only. All IPv4 interfaces are used by default.
listen-on-v6 Specifies the IPv6 network interface on which to listen for queries. On a DNS server that also acts as a gateway, you can use this option to answer queries originating from a single network only. All IPv6 interfaces are used by default.
max-cache-size Specifies the maximum amount of memory to be used for server caches. When the limit is reached, the server causes records to expire prematurely so that the limit is not exceeded. In a server with multiple views, the limit applies separately to the cache of each view. The default option is 32M.
notify
Specifies whether to notify the secondary nameservers when a zone is updated. It accepts the following options:
  • yes — The server will notify all secondary nameservers.
  • no — The server will not notify any secondary nameserver.
  • master-only — The server will notify primary server for the zone only.
  • explicit — The server will notify only the secondary servers that are specified in the also-notify list within a zone statement.
pid-file Specifies the location of the process ID file created by the named service.
recursion Specifies whether to act as a recursive server. The default option is yes.
statistics-file Specifies an alternate location for statistics files. The /var/named/named.stats file is used by default.

Restrict recursive servers to selected clients only

To prevent distributed denial of service (DDoS) attacks, it is recommended that you use the allow-query-cache option to restrict recursive DNS services for a particular subset of clients only.
Refer to the BIND 9 Administrator Reference Manual referenced in Section 13.2.7.1, “Installed Documentation”, and the named.conf manual page for a complete list of available options.
Example 13.4. Using the options statement
options {
  allow-query       { localhost; };
  listen-on port    53 { 127.0.0.1; };
  listen-on-v6 port 53 { ::1; };
  max-cache-size    256M;
  directory         "/var/named";
  statistics-file   "/var/named/data/named_stats.txt";

  recursion         yes;
  dnssec-enable     yes;
  dnssec-validation yes;
};

zone
The zone statement allows you to define the characteristics of a zone, such as the location of its configuration file and zone-specific options, and can be used to override the global options statements. It takes the following form:
zone zone-name [zone-class] {
  option;
  ...
};
The zone-name attribute is the name of the zone, zone-class is the optional class of the zone, and option is a zone statement option as described in Table 13.4, “Commonly used options”.
The zone-name attribute is particularly important, as it is the default value assigned for the $ORIGIN directive used within the corresponding zone file located in the /var/named/ directory. The named daemon appends the name of the zone to any non-fully qualified domain name listed in the zone file. For example, if a zone statement defines the namespace for example.com, use example.com as the zone-name so that it is placed at the end of hostnames within the example.com zone file.
For more information about zone files, refer to Section 13.2.2, “Editing Zone Files”.
Table 13.4. Commonly used options
Option Description
allow-query Specifies which clients are allowed to request information about this zone. This option overrides global allow-query option. All query requests are allowed by default.
allow-transfer Specifies which secondary servers are allowed to request a transfer of the zone's information. All transfer requests are allowed by default.
allow-update
Specifies which hosts are allowed to dynamically update information in their zone. The default option is to deny all dynamic update requests.
Note that you should be careful when allowing hosts to update information about their zone. Do not set IP addresses in this option unless the server is in the trusted network. Instead, use TSIG key as described in Section 13.2.5.3, “Transaction SIGnatures (TSIG)”.
file Specifies the name of the file in the named working directory that contains the zone's configuration data.
masters Specifies from which IP addresses to request authoritative zone information. This option is used only if the zone is defined as type slave.
notify
Specifies whether to notify the secondary nameservers when a zone is updated. It accepts the following options:
  • yes — The server will notify all secondary nameservers.
  • no — The server will not notify any secondary nameserver.
  • master-only — The server will notify primary server for the zone only.
  • explicit — The server will notify only the secondary servers that are specified in the also-notify list within a zone statement.
type
Specifies the zone type. It accepts the following options:
  • delegation-only — Enforces the delegation status of infrastructure zones such as COM, NET, or ORG. Any answer that is received without an explicit or implicit delegation is treated as NXDOMAIN. This option is only applicable in TLDs or root zone files used in recursive or caching implementations.
  • forward — Forwards all requests for information about this zone to other nameservers.
  • hint — A special type of zone used to point to the root nameservers which resolve queries when a zone is not otherwise known. No configuration beyond the default is necessary with a hint zone.
  • master — Designates the nameserver as authoritative for this zone. A zone should be set as the master if the zone's configuration files reside on the system.
  • slave — Designates the nameserver as a slave server for this zone. Master server is specified in masters directive.

Most changes to the /etc/named.conf file of a primary or secondary nameserver involve adding, modifying, or deleting zone statements, and only a small subset of zone statement options is usually needed for a nameserver to work efficiently.
In Example 13.5, “A zone statement for a primary nameserver”, the zone is identified as example.com, the type is set to master, and the named service is instructed to read the /var/named/example.com.zone file. It also allows only a secondary nameserver (192.168.0.2) to transfer the zone.
Example 13.5. A zone statement for a primary nameserver
zone "example.com" IN {
  type master;
  file "example.com.zone";
  allow-transfer { 192.168.0.2; };
};

A secondary server's zone statement is slightly different. The type is set to slave, and the masters directive is telling named the IP address of the master server.
In Example 13.6, “A zone statement for a secondary nameserver”, the named service is configured to query the primary server at the 192.168.0.1 IP address for information about the example.com zone. The received information is then saved to the /var/named/slaves/example.com.zone file. Note that you have to put all slave zones to /var/named/slaves directory, otherwise the service will fail to transfer the zone.
Example 13.6. A zone statement for a secondary nameserver
zone "example.com" {
  type slave;
  file "slaves/example.com.zone";
  masters { 192.168.0.1; };
};

13.2.1.2. Other Statement Types

The following types of statements are less commonly used in /etc/named.conf:
controls
The controls statement allows you to configure various security requirements necessary to use the rndc command to administer the named service.
Refer to Section 13.2.3, “Using the rndc Utility” for more information on the rndc utility and its usage.
key
The key statement allows you to define a particular key by name. Keys are used to authenticate various actions, such as secure updates or the use of the rndc command. Two options are used with key:
  • algorithm algorithm-name — The type of algorithm to be used (for example, hmac-md5).
  • secret "key-value" — The encrypted key.
Refer to Section 13.2.3, “Using the rndc Utility” for more information on the rndc utility and its usage.
logging
The logging statement allows you to use multiple types of logs, so called channels. By using the channel option within the statement, you can construct a customized type of log with its own file name (file), size limit (size), versioning (version), and level of importance (severity). Once a customized channel is defined, a category option is used to categorize the channel and begin logging when the named service is restarted.
By default, named sends standard messages to the rsyslog daemon, which places them in /var/log/messages. Several standard channels are built into BIND with various severity levels, such as default_syslog (which handles informational logging messages) and default_debug (which specifically handles debugging messages). A default category, called default, uses the built-in channels to do normal logging without any special configuration.
Customizing the logging process can be a very detailed process and is beyond the scope of this chapter. For information on creating custom BIND logs, refer to the BIND 9 Administrator Reference Manual referenced in Section 13.2.7.1, “Installed Documentation”.
server
The server statement allows you to specify options that affect how the named service should respond to remote nameservers, especially with regard to notifications and zone transfers.
The transfer-format option controls the number of resource records that are sent with each message. It can be either one-answer (only one resource record), or many-answers (multiple resource records). Note that while the many-answers option is more efficient, it is not supported by older versions of BIND.
trusted-keys
The trusted-keys statement allows you to specify assorted public keys used for secure DNS (DNSSEC). Refer to Section 13.2.5.4, “DNS Security Extensions (DNSSEC)” for more information on this topic.
view
The view statement allows you to create special views depending upon which network the host querying the nameserver is on. This allows some hosts to receive one answer regarding a zone while other hosts receive totally different information. Alternatively, certain zones may only be made available to particular trusted hosts while non-trusted hosts can only make queries for other zones.
Multiple views can be used as long as their names are unique. The match-clients option allows you to specify the IP addresses that apply to a particular view. If the options statement is used within a view, it overrides the already configured global options. Finally, most view statements contain multiple zone statements that apply to the match-clients list.
Note that the order in which the view statements are listed is important, as the first statement that matches a particular client's IP address is used. For more information on this topic, refer to Section 13.2.5.1, “Multiple Views”.

13.2.1.3. Comment Tags

Additionally to statements, the /etc/named.conf file can also contain comments. Comments are ignored by the named service, but can prove useful when providing additional information to a user. The following are valid comment tags:
//
Any text after the // characters to the end of the line is considered a comment. For example:
notify yes;  // notify all secondary nameservers
#
Any text after the # character to the end of the line is considered a comment. For example:
notify yes;  # notify all secondary nameservers
/* and */
Any block of text enclosed in /* and */ is considered a comment. For example:
notify yes;  /* notify all secondary nameservers */

13.2.2. Editing Zone Files

As outlined in Section 13.1.1, “Nameserver Zones”, zone files contain information about a namespace. They are stored in the named working directory located in /var/named/ by default, and each zone file is named according to the file option in the zone statement, usually in a way that relates to the domain in question and identifies the file as containing zone data, such as example.com.zone.
Table 13.5. The named service zone files
Path Description
/var/named/ The working directory for the named service. The nameserver is not allowed to write to this directory.
/var/named/slaves/ The directory for secondary zones. This directory is writable by the named service.
/var/named/dynamic/ The directory for other files, such as dynamic DNS (DDNS) zones or managed DNSSEC keys. This directory is writable by the named service.
/var/named/data/ The directory for various statistics and debugging files. This directory is writable by the named service.

A zone file consists of directives and resource records. Directives tell the nameserver to perform tasks or apply special settings to the zone, resource records define the parameters of the zone and assign identities to individual hosts. While the directives are optional, the resource records are required in order to provide name service to a zone.
All directives and resource records should be entered on individual lines.

13.2.2.1. Common Directives

Directives begin with the dollar sign character (that is, $) followed by the name of the directive, and usually appear at the top of the file. The following directives are commonly used in zone files:
$INCLUDE
The $INCLUDE directive allows you to include another file at the place where it appears, so that other zone settings can be stored in a separate zone file.
Example 13.7. Using the $INCLUDE directive
$INCLUDE /var/named/penguin.example.com

$ORIGIN
The $ORIGIN directive allows you to append the domain name to unqualified records, such as those with the hostname only. Note that the use of this directive is not necessary if the zone is specified in /etc/named.conf, since the zone name is used by default.
In Example 13.8, “Using the $ORIGIN directive”, any names used in resource records that do not end in a trailing period (that is, the . character) are appended with example.com.
Example 13.8. Using the $ORIGIN directive
$ORIGIN example.com.

$TTL
The $TTL directive allows you to set the default Time to Live (TTL) value for the zone, that is, how long is a zone record valid. Each resource record can contain its own TTL value, which overrides this directive.
Increasing this value allows remote nameservers to cache the zone information for a longer period of time, reducing the number of queries for the zone and lengthening the amount of time required to proliferate resource record changes.
Example 13.9. Using the $TTL directive
$TTL 1D

13.2.2.2. Common Resource Records

The following resource records are commonly used in zone files:
A
The Address record specifies an IP address to be assigned to a name. It takes the following form:
hostname IN A IP-address
If the hostname value is omitted, the record will point to the last specified hostname.
In Example 13.10, “Using the A resource record”, the requests for server1.example.com are pointed to 10.0.1.3 or 10.0.1.5.
Example 13.10. Using the A resource record
server1  IN  A  10.0.1.3
         IN  A  10.0.1.5

CNAME
The Canonical Name record maps one name to another. Because of this, this type of record is sometimes referred to as an alias record. It takes the following form:
alias-name IN CNAME real-name
CNAME records are most commonly used to point to services that use a common naming scheme, such as www for Web servers. However, there are multiple restrictions for their usage:
  • CNAME records should not point to other CNAME records. This is mainly to avoid possible infinite loops.
  • CNAME records should not contain other resource record types (such as A, NS, MX, etc.). The only exception are DNSSEC related records (that is, RRSIG, NSEC, etc.) when the zone is signed.
  • Other resource record that point to the fully qualified domain name (FQDN) of a host (that is, NS, MX, PTR) should not point to a CNAME record.
In Example 13.11, “Using the CNAME resource record”, the A record binds a hostname to an IP address, while the CNAME record points the commonly used www hostname to it.
Example 13.11. Using the CNAME resource record
server1  IN  A      10.0.1.5
www      IN  CNAME  server1

MX
The Mail Exchange record specifies where the mail sent to a particular namespace controlled by this zone should go. It takes the following form:
IN MX preference-value email-server-name
The email-server-name is a fully qualified domain name (FQDN). The preference-value allows numerical ranking of the email servers for a namespace, giving preference to some email systems over others. The MX resource record with the lowest preference-value is preferred over the others. However, multiple email servers can possess the same value to distribute email traffic evenly among them.
In Example 13.12, “Using the MX resource record”, the first mail.example.com email server is preferred to the mail2.example.com email server when receiving email destined for the example.com domain.
Example 13.12. Using the MX resource record
example.com.  IN  MX  10  mail.example.com.
              IN  MX  20  mail2.example.com.

NS
The Nameserver record announces authoritative nameservers for a particular zone. It takes the following form:
IN NS nameserver-name
The nameserver-name should be a fully qualified domain name (FQDN). Note that when two nameservers are listed as authoritative for the domain, it is not important whether these nameservers are secondary nameservers, or if one of them is a primary server. They are both still considered authoritative.
Example 13.13. Using the NS resource record
IN  NS  dns1.example.com.
IN  NS  dns2.example.com.

PTR
The Pointer record points to another part of the namespace. It takes the following form:
last-IP-digit IN PTR FQDN-of-system
The last-IP-digit directive is the last number in an IP address, and the FQDN-of-system is a fully qualified domain name (FQDN).
PTR records are primarily used for reverse name resolution, as they point IP addresses back to a particular name. Refer to Section 13.2.2.4.2, “A Reverse Name Resolution Zone File” for more examples of PTR records in use.
SOA
The Start of Authority record announces important authoritative information about a namespace to the nameserver. Located after the directives, it is the first resource record in a zone file. It takes the following form:
@  IN  SOA  primary-name-server hostmaster-email (
       serial-number
       time-to-refresh
       time-to-retry
       time-to-expire
       minimum-TTL )
The directives are as follows:
  • The @ symbol places the $ORIGIN directive (or the zone's name if the $ORIGIN directive is not set) as the namespace being defined by this SOA resource record.
  • The primary-name-server directive is the hostname of the primary nameserver that is authoritative for this domain.
  • The hostmaster-email directive is the email of the person to contact about the namespace.
  • The serial-number directive is a numerical value incremented every time the zone file is altered to indicate it is time for the named service to reload the zone.
  • The time-to-refresh directive is the numerical value secondary nameservers use to determine how long to wait before asking the primary nameserver if any changes have been made to the zone.
  • The time-to-retry directive is a numerical value used by secondary nameservers to determine the length of time to wait before issuing a refresh request in the event that the primary nameserver is not answering. If the primary server has not replied to a refresh request before the amount of time specified in the time-to-expire directive elapses, the secondary servers stop responding as an authority for requests concerning that namespace.
  • In BIND 4 and 8, the minimum-TTL directive is the amount of time other nameservers cache the zone's information. In BIND 9, it defines how long negative answers are cached for. Caching of negative answers can be set to a maximum of 3 hours (that is, 3H).
When configuring BIND, all times are specified in seconds. However, it is possible to use abbreviations when specifying units of time other than seconds, such as minutes (M), hours (H), days (D), and weeks (W). Table 13.6, “Seconds compared to other time units” shows an amount of time in seconds and the equivalent time in another format.
Table 13.6. Seconds compared to other time units
Seconds Other Time Units
60 1M
1800 30M
3600 1H
10800 3H
21600 6H
43200 12H
86400 1D
259200 3D
604800 1W
31536000 365D

Example 13.14. Using the SOA resource record
@  IN  SOA  dns1.example.com.  hostmaster.example.com. (
       2001062501  ; serial
       21600       ; refresh after 6 hours
       3600        ; retry after 1 hour
       604800      ; expire after 1 week
       86400 )     ; minimum TTL of 1 day

13.2.2.3. Comment Tags

Additionally to resource records and directives, a zone file can also contain comments. Comments are ignored by the named service, but can prove useful when providing additional information to the user. Any text after the semicolon character (that is, ;) to the end of the line is considered a comment. For example:
   604800  ; expire after 1 week

13.2.2.4. Example Usage

The following examples show the basic usage of zone files.
13.2.2.4.1. A Simple Zone File
Example 13.15, “A simple zone file” demonstrates the use of standard directives and SOA values.
Example 13.15. A simple zone file
$ORIGIN example.com.
$TTL 86400
@         IN  SOA  dns1.example.com.  hostmaster.example.com. (
              2001062501  ; serial
              21600       ; refresh after 6 hours
              3600        ; retry after 1 hour
              604800      ; expire after 1 week
              86400 )     ; minimum TTL of 1 day
;
;
          IN  NS     dns1.example.com.
          IN  NS     dns2.example.com.
dns1      IN  A      10.0.1.1
          IN  AAAA   aaaa:bbbb::1
dns2      IN  A      10.0.1.2
          IN  AAAA   aaaa:bbbb::2
;
;
@         IN  MX     10  mail.example.com.
          IN  MX     20  mail2.example.com.
mail      IN  A      10.0.1.5
          IN  AAAA   aaaa:bbbb::5
mail2     IN  A      10.0.1.6
          IN  AAAA   aaaa:bbbb::6
;
;
; This sample zone file illustrates sharing the same IP addresses
; for multiple services:
;
services  IN  A      10.0.1.10
          IN  AAAA   aaaa:bbbb::10
          IN  A      10.0.1.11
          IN  AAAA   aaaa:bbbb::11

ftp       IN  CNAME  services.example.com.
www       IN  CNAME  services.example.com.
;
;

In this example, the authoritative nameservers are set as dns1.example.com and dns2.example.com, and are tied to the 10.0.1.1 and 10.0.1.2 IP addresses respectively using the A record.
The email servers configured with the MX records point to mail and mail2 via A records. Since these names do not end in a trailing period (that is, the . character), the $ORIGIN domain is placed after them, expanding them to mail.example.com and mail2.example.com.
Services available at the standard names, such as www.example.com (WWW), are pointed at the appropriate servers using the CNAME record.
This zone file would be called into service with a zone statement in the /etc/named.conf similar to the following:
zone "example.com" IN {
  type master;
  file "example.com.zone";
  allow-update { none; };
};
13.2.2.4.2. A Reverse Name Resolution Zone File
A reverse name resolution zone file is used to translate an IP address in a particular namespace into an fully qualified domain name (FQDN). It looks very similar to a standard zone file, except that the PTR resource records are used to link the IP addresses to a fully qualified domain name as shown in Example 13.16, “A reverse name resolution zone file”.
Example 13.16. A reverse name resolution zone file
$ORIGIN 1.0.10.in-addr.arpa.
$TTL 86400
@  IN  SOA  dns1.example.com.  hostmaster.example.com. (
       2001062501  ; serial
       21600       ; refresh after 6 hours
       3600        ; retry after 1 hour
       604800      ; expire after 1 week
       86400 )     ; minimum TTL of 1 day
;
@  IN  NS   dns1.example.com.
;
1  IN  PTR  dns1.example.com.
2  IN  PTR  dns2.example.com.
;
5  IN  PTR  server1.example.com.
6  IN  PTR  server2.example.com.
;
3  IN  PTR  ftp.example.com.
4  IN  PTR  ftp.example.com.

In this example, IP addresses 10.0.1.1 through 10.0.1.6 are pointed to the corresponding fully qualified domain name.
This zone file would be called into service with a zone statement in the /etc/named.conf file similar to the following:
zone "1.0.10.in-addr.arpa" IN {
  type master;
  file "example.com.rr.zone";
  allow-update { none; };
};
There is very little difference between this example and a standard zone statement, except for the zone name. Note that a reverse name resolution zone requires the first three blocks of the IP address reversed followed by .in-addr.arpa. This allows the single block of IP numbers used in the reverse name resolution zone file to be associated with the zone.

13.2.3. Using the rndc Utility

The rndc utility is a command line tool that allows you to administer the named service, both locally and from a remote machine. Its usage is as follows:
rndc [option...] command [command-option]

13.2.3.1. Configuring the Utility

To prevent unauthorized access to the service, named must be configured to listen on the selected port (that is, 953 by default), and an identical key must be used by both the service and the rndc utility.
Table 13.7. Relevant files
Path Description
/etc/named.conf The default configuration file for the named service.
/etc/rndc.conf The default configuration file for the rndc utility.
/etc/rndc.key The default key location.

The rndc configuration is located in /etc/rndc.conf. If the file does not exist, the utility will use the key located in /etc/rndc.key, which was generated automatically during the installation process using the rndc-confgen -a command.
The named service is configured using the controls statement in the /etc/named.conf configuration file as described in Section 13.2.1.2, “Other Statement Types”. Unless this statement is present, only the connections from the loopback address (that is, 127.0.0.1) will be allowed, and the key located in /etc/rndc.key will be used.
For more information on this topic, refer to manual pages and the BIND 9 Administrator Reference Manual listed in Section 13.2.7, “Additional Resources”.

Set the correct permissions

To prevent unprivileged users from sending control commands to the service, make sure only root is allowed to read the /etc/rndc.key file:
~]# chmod o-rwx /etc/rndc.key

13.2.3.2. Checking the Service Status

To check the current status of the named service, use the following command:
~]# rndc status
version: 9.7.0-P2-RedHat-9.7.0-5.P2.el6
CPUs found: 1
worker threads: 1
number of zones: 16
debug level: 0
xfers running: 0
xfers deferred: 0
soa queries in progress: 0
query logging is OFF
recursive clients: 0/0/1000
tcp clients: 0/100
server is up and running

13.2.3.3. Reloading the Configuration and Zones

To reload both the configuration file and zones, type the following at a shell prompt:
~]# rndc reload
server reload successful
This will reload the zones while keeping all previously cached responses, so that you can make changes to the zone files without losing all stored name resolutions.
To reload a single zone, specify its name after the reload command, for example:
~]# rndc reload localhost
zone reload up-to-date
Finally, to reload the configuration file and newly added zones only, type:
~]# rndc reconfig

Modifying zones with dynamic DNS

If you intend to manually modify a zone that uses Dynamic DNS (DDNS), make sure you run the freeze command first:
~]# rndc freeze localhost
Once you are finished, run the thaw command to allow the DDNS again and reload the zone:
~]# rndc thaw localhost
The zone reload and thaw was successful.

13.2.3.4. Updating Zone Keys

To update the DNSSEC keys and sign the zone, use the sign command. For example:
~]# rndc sign localhost
Note that to sign a zone with the above command, the auto-dnssec option has to be set to maintain in the zone statement. For instance:
zone "localhost" IN {
  type master;
  file "named.localhost";
  allow-update { none; };
  auto-dnssec maintain;
};

13.2.3.5. Enabling the DNSSEC Validation

To enable the DNSSEC validation, type the following at a shell prompt:
~]# rndc validation on
Similarly, to disable this option, type:
~]# rndc validation off
Refer to the options statement described in Section 13.2.1.1, “Common Statement Types” for information on how configure this option in /etc/named.conf.

13.2.3.6. Enabling the Query Logging

To enable (or disable in case it is currently enabled) the query logging, run the following command:
~]# rndc querylog
To check the current setting, use the status command as described in Section 13.2.3.2, “Checking the Service Status”.

13.2.4. Using the dig Utility

The dig utility is a command line tool that allows you to perform DNS lookups and debug a nameserver configuration. Its typical usage is as follows:
dig [@server] [option...] name type
Refer to Section 13.2.2.2, “Common Resource Records” for a list of common types.

13.2.4.1. Looking Up a Nameserver

To look up a nameserver for a particular domain, use the command in the following form:
dig name NS
In Example 13.17, “A sample nameserver lookup”, the dig utility is used to display nameservers for example.com.
Example 13.17. A sample nameserver lookup
~]$ dig example.com NS

; <<>> DiG 9.7.1-P2-RedHat-9.7.1-2.P2.fc13 <<>> example.com NS
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 57883
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;example.com.                   IN      NS

;; ANSWER SECTION:
example.com.            99374   IN      NS      a.iana-servers.net.
example.com.            99374   IN      NS      b.iana-servers.net.

;; Query time: 1 msec
;; SERVER: 10.34.255.7#53(10.34.255.7)
;; WHEN: Wed Aug 18 18:04:06 2010
;; MSG SIZE  rcvd: 77

13.2.4.2. Looking Up an IP Address

To look up an IP address assigned to a particular domain, use the command in the following form:
dig name A
In Example 13.18, “A sample IP address lookup”, the dig utility is used to display the IP address of example.com.
Example 13.18. A sample IP address lookup
~]$ dig example.com A

; <<>> DiG 9.7.1-P2-RedHat-9.7.1-2.P2.fc13 <<>> example.com A
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 4849
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 2, ADDITIONAL: 0

;; QUESTION SECTION:
;example.com.                   IN      A

;; ANSWER SECTION:
example.com.            155606  IN      A       192.0.32.10

;; AUTHORITY SECTION:
example.com.            99175   IN      NS      a.iana-servers.net.
example.com.            99175   IN      NS      b.iana-servers.net.

;; Query time: 1 msec
;; SERVER: 10.34.255.7#53(10.34.255.7)
;; WHEN: Wed Aug 18 18:07:25 2010
;; MSG SIZE  rcvd: 93

13.2.4.3. Looking Up a Hostname

To look up a hostname for a particular IP address, use the command in the following form:
dig -x address
In Example 13.19, “A sample hostname lookup”, the dig utility is used to display the hostname assigned to 192.0.32.10.
Example 13.19. A sample hostname lookup
~]$ dig -x 192.0.32.10

; <<>> DiG 9.7.1-P2-RedHat-9.7.1-2.P2.fc13 <<>> -x 192.0.32.10
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 29683
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 5, ADDITIONAL: 6

;; QUESTION SECTION:
;10.32.0.192.in-