Home > Store

Real World Linux Security, 2nd Edition

Register your product to gain access to bonus material or receive a coupon.

Real World Linux Security, 2nd Edition

  • By
  • Published Nov 13, 2002 by Pearson.


  • Sorry, this book is no longer in print.
Not for Sale


  • Copyright 2003
  • Dimensions: 7" x 9-1/4"
  • Pages: 848
  • Edition: 2nd
  • Book
  • ISBN-10: 0-13-046456-2
  • ISBN-13: 978-0-13-046456-9

It's not a question of "if" but "when." Will you be ready to protect your system when a cracker comes? Real World Linux Security goes beyond the books that merely detail system vulnerabilities by offering system administrators practical solutions for safeguarding Linux systems and actively responding to break-in attempts. Veteran Bob Toxen shows you how to know your enemies and stop them at the front gate, before they can damage your system. The book is organized into four sections: securing your system, preparing for an intrusion, detecting an intrusion, and recovering from an intrusion. Toxen even provides at-a-glance icons and tables rating the severity and likelihood of each type of attack. Along the way, you'll learn how to configure systems so they alter themselves to lock out a cracker -- and notify the sysadmin immediately -- at the first sign of attack. You'll discover virtually cracker-proof techniques for protecting credit card databases, even if your web server and network are compromised. Toxen also presents techniques for ensuring that, if a break-in does occur, damage will be minimal and a full recovery can happen fast. This fully updated Second Edition now covers IP tables, home, mobile, and wireless issues, and protecting your network from users as well as crackers.


CD Contents

Untitled Document This file contains the CD Contents from the book Real World Linux Security.

Sample Content

Online Sample Chapter

Quick and Easy Linux Hacking and How to Avoid It

Table of Contents

List of Figures.

List of Tables.



About the Author.

1. Introduction.

Introduction to the Second Edition. Who Should Read This Book? How This Book Is Organized. What Are You Protecting? Who Are Your Enemies? What They Hope to Accomplish. Costs: Protection versus Break-Ins. Protecting Hardware. Protecting Network and Modem Access. Protecting System Access. Protecting Files. Preparing for and Detecting an Intrusion. Recovering from an Intrusion.


2. Quick Fixes for Common Problems.

Understanding Linux Security. The Seven Most Deadly Sins. Passwords: A Key Point for Good Security. Advanced Password Techniques. Protecting the System from User Mistakes. Forgiveness Is Better than Permission. Dangers and Countermeasures During Initial System Setup. Limiting Unreasonable Access. Firewalls and the Corporate Moat. Turn Off Unneeded Services. High Security Requires Minimum Services. Replace These Weak Doors with Brick. New Lamps for Old. United We Fall, Divided We Stand.

3. Quick and Easy Hacking and How to Avoid It.

X Marks the Hole. Law of the Jungle—Physical Security. Physical Actions. Selected Short Subjects. Terminal Device Attacks. Disk Sniffing.

4. Common Hacking by Subsystem.

NFS, mountd, and portmap. Sendmail. Telnet. FTP. The rsh, rcp, rexec, and rlogin Services. DNS (named, a.k.a. BIND). POP and IMAP Servers. Doing the Samba. Stop Squid from Inking Out Their Trail. The syslogd Service. The print Service (lpd). The ident Service. INND and News. Protecting Your DNS Registration.

5. Common Hacker Attacks.

Rootkit Attacks (Script Kiddies). Packet Spoofing Explained. SYN Flood Attack Explained. Defeating SYN Flood Attacks. Defeating TCP Sequence Spoofing. Packet Storms, Smurf Attacks, and Fraggles. Buffer Overflows or Stamping on Memory with gets(). Spoofing Techniques. Man-in-the-Middle Attack.

6. Advanced Security Issues.

Configuring Netscape for Higher Security. Stopping Access to I/O Devices. Scouting Out Apache (httpd) Problems. Special Techniques for Web Servers. One-Way Credit Card Data Path for Top Security. Hardening for Very High Security. Restricting Login Location and Times. Obscure but Deadly Problems. Defeating Login Simulators. Stopping Buffer Overflows with Libsafe.

7. Establishing Security Policies.

General Policy. Personal Use Policy. Accounts Policy. E-Mail Policy. Instant Messenger (IM) Policy. Web Server Policy. File Server and Database Policy. Firewall Policy. Desktop Policy. Laptop Policy. Disposal Policy. Network Topology Policy. Problem Reporting Policy. Ownership Policy. Policy Policy.

8. Trusting Other Computers.

Secure Systems and Insecure Systems. Trust No One—The Highest Security. Linux and UNIX Systems Within Your Control. Mainframes Within Your Control. A Window Is Worth a Thousand Cannons. Firewall Vulnerabilities. Virtual Private Networks. Viruses and Linux.

9. Gutsy Break-Ins.

Mission Impossible Techniques. Spies. Fanatics and Suicide Attacks.

10. Case Studies.

Confessions of a Berkeley System Mole. Knights of the Realm (Forensics). Ken Thompson Cracks the Navy. The Virtual Machine Trojan. AOL's DNS Change Fiasco. I'm Innocent, I Tell Ya! Cracking with a Laptop and a Pay Phone. Take a Few Cents off the Top. Nonprofit Organization Runs Out of Luck. Persistence with Recalcitrant SysAdmins Pays Off. Net Shipped with Nimda.

11. Recent Break-Ins.

Fragmentation Attacks. IP Masquerading Fails for ICMP. The Ping of Death Sinks Dutch Shipping Company. Captain, We're Being Scanned! (Stealth Scans). Cable Modems: A Cracker's Dream. Using Sendmail to Block E-Mail Attacks. Sendmail Account Guessing. The Mysterious Ingreslock. You're Being Tracked. Distributed Denial of Service (Coordinated) Attacks. Stealth Trojan Horses. Linuxconf via TCP Port 98. Evil HTML Tags and Script. Format Problems with syslog().


12. Hardening Your System.

Protecting User Sessions with SSH. Virtual Private Networks (VPNs). Pretty Good Privacy (PGP). Using GPG to Encrypt Files the Easy Way. Firewalls with IP Tables and DMZ. Firewalls with IP Chains and DMZ.

13. Preparing Your Hardware.

Timing Is Everything. Advanced Preparation. Switch to Auxiliary Control (Hot Backups).

14. Preparing Your Configuration.

TCP Wrappers. Adaptive Firewalls: Raising the Drawbridge with the Cracker Trap. Ending Cracker Servers with a Kernel Mod. Fire Drills. Break into Your Own System with Tiger Teams.

15. Scanning Your Own System.

The Nessus Security Scanner. The SARA and SAINT Security Auditors. The nmap Network Mapper. The Snort Attack Detector. Scanning and Analyzing with SHADOW. John the Ripper. Store the RPM Database Checksums.


16. Monitoring Activity.

Log Files. Log Files: Measures and Countermeasures. Using Logcheck to Check Log Files You Never Check. Using PortSentry to Lock Out Hackers. HostSentry. Paging the SysAdmin: Cracking in Progress! An Example for Automatic Paging. Building on Your Example for Automatic Paging. Paging telnet and rsh Usage. Using Arpwatch to Catch ARP and MAC Attacks. Monitoring Port Usage. Monitoring Attacks with Ethereal. Using tcpdump to Monitor Your LAN. Monitoring the Scanners with Deception Tool Kit (DTK). Monitoring Processes. Cron: Watching the Crackers. Caller ID.

17. Scanning Your System for Anomalies.

Finding Suspicious Files. Tripwire. Detecting Deleted Executables. Detecting Promiscuous Network Interface Cards. Finding Promiscuous Processes. Detecting Defaced Web Pages Automatically.


18. Regaining Control of Your System.

Finding the Cracker's Running Processes. Handling Running Cracker Processes. Drop the Modems, Network, Printers, and System.

19. Finding and Repairing the Damage.

Check Your /var/log Logs. The syslogd and klogd Daemons. Remote Logging. Interpreting Log File Entries. Check Other Logs. Check TCP Wrapper Responses. How the File System Can Be Damaged. Planting False Data. Altered Monitoring Programs. Stuck in the House of Mirrors. Getting Back in Control. Finding Cracker-Altered Files. Sealing the Crack. Finding set-UID Programs. Finding the mstream Trojan.

20. Finding the Attacker's System.

Tracing a Numeric IP Address with nslookup. Tracing a Numeric IP Address with dig. Who's a Commie: Finding .com Owners. Finding Entities Directly from the IP Address. Finding a G-Man: Looking Up .gov Systems. Using ping. Using traceroute. Neighboring Systems' Results. A Recent International Tracking of a Cracker. Be Sure You Found the Attacker. Other SysAdmins: Do They Care?

21. Having the Cracker Crack Rocks.

Police: Dragnet or Keystone Kops? Prosecution. Liability of ISPs Allowing Illegal Activity. Counteroffenses.

Appendix A. Internet Resources for the Latest Intrusions and Defenses.

Mailing Lists: The Mandatory Ones. Mailing Lists: The Optional Ones. News Groups. URLs for Security Sites. URLs for Security Tools. URLs for Documentation. URLs for General Tools. URLs for Specifications and Definitions. Vendor Software and Updates. Other Software Updates.

Appendix B. Books, CD-ROMs, and Videos.

Linux System Security. Building Linux and OpenBSD Firewalls. Samba: Integrating UNIX and Windows. Linux Sendmail Administration. Secrets and Lies: Digital Security in a Networked World. The Cuckoo's Egg. Hackers. UNIX Complete. The Computer Contradictionary. U.S. Department of Defense DISA Resource. Internetworking with TCP/IP Vols. I, II, and III Linux Application Development. Consultants: The Good, the Bad, and the Slick.

Appendix C. Network Services and Ports.
Appendix D. Danger Levels.
Appendix E.
Appendix F. Abbreviations.



Linux is a solid operating system. It is easy to use and install, has very powerful capabilities, runs fast on almost any hardware, and rarely crashes. It has few bugs and its widespread support from a cast of thousands ensures that any remaining bugs get fixed as soon as they are discovered. It is highly versatile and can be made as secure as any UNIX system.

Unfortunately, UNIX and Linux machines are broken into every day, not because they are inherently insecure, but because the steps required to expose a system to the real world safely—the modern Internet—are not always so obvious. The single goal of this book is to teach any Linux or UNIX system administrator how to secure his systems, keep them secure, and feel confident that all necessary steps have been taken.

Introduction to the Second Edition

Much has happened in the two years since the first edition of Real World Linux Security was published and much that was anticipated has not come to pass. Rather than the anticipated upward-compatible version of IP Chains with additional features and security, we have IP Tables. Transitioning to IP Tables requires a major rewrite of any firewall script, and some features present in IP Chains under the Linux 2.2 kernel are absent from both IP Tables and IP Chains in the 2.4 kernel. IP Tables is addressed in this book in great detail, and I include some fascinating original research and firewall tips and techniques (see ""Firewalls with IP Tables and DMZ" on page 446). You will not find this information elsewhere.

The Internet has become a much more dangerous place. Two years ago an unhardened system stood a reasonable chance of not being compromised for months or even years. Now, an unsecured system probably will be broken into within a week or two, and a complete compromise within one day of being placed on the Web is common. With the popularity of always-on DSL and cable connections, the exposure to possible compromise is increased by a factor of 10, too. It is guaranteed that each system on the Internet gets scanned for various vulnerabilities on a daily basis now.

The cyber warfare of science fiction is now a fact! There is credible evidence that the Al Qaeda is preparing to commit damaging attacks against U.S. businesses and government. A number of countries' governments or individuals have staged massive cyber attacks against their enemies. With almost every Internet-connected computer handling credit card data, and crackers (sometimes called hackers) getting more vicious and more interested in financially profiting from their attacks, there is far more at risk.

In 2000 and later, there was much talk about the U.S. Federal Bureau of Investigation (FBI) getting more involved in solving computer crime, and there was much talk worldwide about more laws to reduce computer crime. In 2000, Microsoft promised to make great improvements in Windows security and again promised this in early 2002. I have seen none of this come to pass. While the big Linux vendors have made good on their promises to improve on security, they still have made big goofs in the security of even their latest offerings and even the "rock solid" Apache has not been immune from recent major vulnerabilities.

It is my opinion that even the viruses that have caused billions of dollars in damage due to lost files and wasted time are mild compared to what is possible. Viruses that can attack both Windows and Linux and viruses that can attack Linux and several flavors of UNIX have been demonstrated. As I write this, there are major security vulnerabilities in the current versions of Apache on Linux, UNIX, and Windows (the first in five years), as well as in Internet Explorer and Internet Information Services (IIS) running on most systems. It would not be especially difficult for a hacker to create a virus that attacks all of these platforms, sniffs these systems for credit card, bank account, and investment account numbers, and drains the accounts of money before anyone discovers it.

Real World Linux Security has undergone a major revision in the second edition. Problems that people did not worry about two years ago are now big concerns and have been addressed here. New technologies, such as wireless networks and IP Tables, have been addressed in depth. Hackers now are using more subtle attacks that were rare two years ago. These include attacking at the address resolution protocol (ARP) level. Even the lowly network switch now is being compromised with regularity. All of these situations are addressed.

Better methods for monitoring your network and instantly locking out attackers in this more vicious world are explained in step-by-step detail. Arpwatch, Logcheck, Portsentry, the newest versions of Samba and the GNU Privacy Guard (the GNU answer to Pretty Good Privacy PGP), the 2.4 kernel, Red Hat 7.3 and SuSE 8.0, VPNs, and greatly improved Adaptive Firewall techniques all are covered in depth in this book. About 150 pages of new material have been added, while appendices containing listings of programs on the CD-ROM and obsolete material have been removed or revised.

Who Should Read This Book?

This book will aid Linux and UNIX System Administrators (SysAdmins) in making their systems and networks as secure as possible from intruders and improper action of the users. It covers both quick and simple solutions, and some more involved solutions to eliminate every possible vulnerability.

It is organized to allow the busy SysAdmin to increase the security of the systems one piece at a time. It is recognized that one cannot take a system down for a week and work exclusively on its security for that week. In the real world, a SysAdmin's time is divided up by many tasks that cannot wait and systems are too critical to stay down for long.

In the real world, some systems will be broken into despite the best efforts of talented SysAdmins. This book devotes over 60,000 words to dealing with a possible break-in. It deals with how to prepare for it, how to detect it, and how to recover from it quickly and completely with minimal loss of confidential data and money, with minimal inconvenience to one's customers and employees, and with minimal publicity. This is considered one of the unique features of this book.

On March 30, 2000, 350 "hackers" from around the world gathered in Israel for a conference. Organizers there said that they were able to break into 28 percent of Israeli computers that they tried and that this percentage was typical worldwide. This was with the permission of the computers' owners, who were convinced that their computers were invulnerable. The quoted statistics were not broken down by operating system type. Both John Draper ("Captain Crunch") and Kevin Mitnick were there.

The book is designed to be used by the veteran of many years of Linux and UNIX experience, as well as the new SysAdmin. It does assume that the reader is somewhat knowledgeable in system administration; Prentice Hall has other fine books to help people hone their SysAdmin skills. There are many useful details here, both for the person with a single Linux box at home and for those supporting multinational corporations and large government agencies with very large networks comprised of multiple types of operating systems.


Submit Errata

More Information

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information

To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.


Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.


If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information

Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.


This site is not directed to children under the age of 13.


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information

If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information

Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents

California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure

Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact

Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice

We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020